diff --git a/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp b/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp index c0f512ffd..1beed664a 100644 --- a/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp +++ b/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp @@ -115,6 +115,12 @@ namespace boost { namespace accumulators { } + droppable_accumulator_base(droppable_accumulator_base const &that) + : Accumulator(*static_cast(&that)) + , ref_count_(that.ref_count_) + { + } + template void operator ()(Args const &args) { @@ -162,6 +168,11 @@ namespace boost { namespace accumulators : droppable_accumulator::base(args) { } + + droppable_accumulator(droppable_accumulator const &that) + : droppable_accumulator::base(*static_cast(&that)) + { + } }; ////////////////////////////////////////////////////////////////////////// diff --git a/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp b/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp index 76087b091..c32897294 100644 --- a/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp +++ b/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -26,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -94,15 +97,49 @@ namespace boost { namespace accumulators template struct is_dependent_on : is_base_and_derived< - typename undroppable::type + typename feature_of::type>::type , typename undroppable::type > {}; + template + struct dependencies_of + { + typedef typename Feature::dependencies type; + }; + + // Should use mpl::insert_range, but doesn't seem to work with mpl sets + template + struct set_insert_range + : mpl::fold< + Range + , Set + , mpl::insert + > + {}; + + template + struct collect_abstract_features + : mpl::fold< + Features + , mpl::set0<> + , set_insert_range< + mpl::insert > + , collect_abstract_features > + > + > + {}; + template struct depends_on_base : mpl::inherit_linearly< - typename mpl::sort >::type + typename mpl::sort< + typename mpl::copy< + typename collect_abstract_features::type + , mpl::back_inserter > + >::type + , is_dependent_on + >::type // Don't inherit multiply from a feature , mpl::if_< is_dependent_on @@ -319,7 +356,7 @@ namespace boost { namespace accumulators type; }; - // BUGBUG work around a MPL bug wrt map insertion + // BUGBUG work around an MPL bug wrt map insertion template struct insert_feature : mpl::eval_if< diff --git a/project/jni/boost/include/boost/accumulators/statistics.hpp b/project/jni/boost/include/boost/accumulators/statistics.hpp index 1d136e58e..01786079a 100644 --- a/project/jni/boost/include/boost/accumulators/statistics.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/accumulators/statistics/density.hpp b/project/jni/boost/include/boost/accumulators/statistics/density.hpp index 8835f47b6..63ce6d6dd 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/density.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/density.hpp @@ -95,7 +95,7 @@ namespace impl } // Once cache_size samples have been accumulated, create num_bins bins of same size between - // the minimum and maximum of the cached samples as well as an under- and and an overflow bin. + // the minimum and maximum of the cached samples as well as under and overflow bins. // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). if (cnt == this->cache_size) { diff --git a/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp b/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp index b6c008d71..09ffef296 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/accumulators/statistics/median.hpp b/project/jni/boost/include/boost/accumulators/statistics/median.hpp index 13ebb2862..919cf69e4 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/median.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/median.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace boost { namespace accumulators { diff --git a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp new file mode 100644 index 000000000..b9e24f676 --- /dev/null +++ b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp @@ -0,0 +1,260 @@ +/////////////////////////////////////////////////////////////////////////////// +// p_square_cumulative_distribution.hpp +// +// Copyright 2005 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 +#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace accumulators +{ +/////////////////////////////////////////////////////////////////////////////// +// num_cells named parameter +// +BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) + +namespace impl +{ + /////////////////////////////////////////////////////////////////////////////// + // p_square_cumulative_distribution_impl + // cumulative_distribution calculation (as histogram) + /** + @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm + + A histogram of the sample cumulative distribution is computed dynamically without storing samples + based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells) + equiprobable (and not equal-sized) cells. + + For further details, see + + R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + histograms without storing observations, Communications of the ACM, + Volume 28 (October), Number 10, 1985, p. 1076-1085. + + @param p_square_cumulative_distribution_num_cells. + */ + template + struct p_square_cumulative_distribution_impl + : accumulator_base + { + typedef typename numeric::functional::average::result_type float_type; + typedef std::vector array_type; + typedef std::vector > histogram_type; + // for boost::result_of + typedef iterator_range result_type; + + template + p_square_cumulative_distribution_impl(Args const &args) + : num_cells(args[p_square_cumulative_distribution_num_cells]) + , heights(num_cells + 1) + , actual_positions(num_cells + 1) + , desired_positions(num_cells + 1) + , positions_increments(num_cells + 1) + , histogram(num_cells + 1) + , is_dirty(true) + { + std::size_t b = this->num_cells; + + for (std::size_t i = 0; i < b + 1; ++i) + { + this->actual_positions[i] = i + 1.; + this->desired_positions[i] = i + 1.; + this->positions_increments[i] = numeric::average(i, b); + } + } + + template + void operator ()(Args const &args) + { + this->is_dirty = true; + + std::size_t cnt = count(args); + std::size_t sample_cell = 1; // k + std::size_t b = this->num_cells; + + // accumulate num_cells + 1 first samples + if (cnt <= b + 1) + { + this->heights[cnt - 1] = args[sample]; + + // complete the initialization of heights by sorting + if (cnt == b + 1) + { + std::sort(this->heights.begin(), this->heights.end()); + } + } + else + { + // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values + if (args[sample] < this->heights[0]) + { + this->heights[0] = args[sample]; + sample_cell = 1; + } + else if (this->heights[b] <= args[sample]) + { + this->heights[b] = args[sample]; + sample_cell = b; + } + else + { + typename array_type::iterator it; + it = std::upper_bound( + this->heights.begin() + , this->heights.end() + , args[sample] + ); + + sample_cell = std::distance(this->heights.begin(), it); + } + + // increment positions of markers above sample_cell + for (std::size_t i = sample_cell; i < b + 1; ++i) + { + ++this->actual_positions[i]; + } + + // update desired position of markers 2 to num_cells + 1 + // (desired position of first marker is always 1) + for (std::size_t i = 1; i < b + 1; ++i) + { + this->desired_positions[i] += this->positions_increments[i]; + } + + // adjust heights of markers 2 to num_cells if necessary + for (std::size_t i = 1; i < b; ++i) + { + // offset to desire position + float_type d = this->desired_positions[i] - this->actual_positions[i]; + + // offset to next position + float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; + + // offset to previous position + float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; + + // height ds + float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; + float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; + + if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) + { + short sign_d = static_cast(d / std::abs(d)); + + // try adjusting heights[i] using p-squared formula + float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); + + if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) + { + this->heights[i] = h; + } + else + { + // use linear formula + if (d>0) + { + this->heights[i] += hp; + } + if (d<0) + { + this->heights[i] -= hm; + } + } + this->actual_positions[i] += sign_d; + } + } + } + } + + template + result_type result(Args const &args) const + { + if (this->is_dirty) + { + this->is_dirty = false; + + // creates a vector of std::pair where each pair i holds + // the values heights[i] (x-axis of histogram) and + // actual_positions[i] / cnt (y-axis of histogram) + + std::size_t cnt = count(args); + + for (std::size_t i = 0; i < this->histogram.size(); ++i) + { + this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], cnt)); + } + } + //return histogram; + return make_iterator_range(this->histogram); + } + + private: + std::size_t num_cells; // number of cells b + array_type heights; // q_i + array_type actual_positions; // n_i + array_type desired_positions; // n'_i + array_type positions_increments; // dn'_i + mutable histogram_type histogram; // histogram + mutable bool is_dirty; + }; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// tag::p_square_cumulative_distribution +// +namespace tag +{ + struct p_square_cumulative_distribution + : depends_on + , p_square_cumulative_distribution_num_cells + { + /// INTERNAL ONLY + /// + typedef accumulators::impl::p_square_cumulative_distribution_impl impl; + }; +} + +/////////////////////////////////////////////////////////////////////////////// +// extract::p_square_cumulative_distribution +// +namespace extract +{ + extractor const p_square_cumulative_distribution = {}; + + BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution) +} + +using extract::p_square_cumulative_distribution; + +// So that p_square_cumulative_distribution can be automatically substituted with +// weighted_p_square_cumulative_distribution when the weight parameter is non-void +template<> +struct as_weighted_feature +{ + typedef tag::weighted_p_square_cumulative_distribution type; +}; + +template<> +struct feature_of + : feature_of +{ +}; + +}} // namespace boost::accumulators + +#endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp index 437469c65..5e08b5129 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp @@ -1,260 +1,19 @@ /////////////////////////////////////////////////////////////////////////////// // p_square_cumulative_distribution.hpp // -// Copyright 2005 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Copyright 2012 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 +#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 +#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp" +#endif -namespace boost { namespace accumulators -{ -/////////////////////////////////////////////////////////////////////////////// -// num_cells named parameter -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // p_square_cumulative_distribution_impl - // cumulative_distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells) - equiprobable (and not equal-sized) cells. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells. - */ - template - struct p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::average::result_type float_type; - typedef std::vector array_type; - typedef std::vector > histogram_type; - // for boost::result_of - typedef iterator_range result_type; - - template - p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , positions_increments(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - std::size_t b = this->num_cells; - - for (std::size_t i = 0; i < b + 1; ++i) - { - this->actual_positions[i] = i + 1.; - this->desired_positions[i] = i + 1.; - this->positions_increments[i] = numeric::average(i, b); - } - } - - template - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - std::sort(this->heights.begin(), this->heights.end()); - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - ++this->actual_positions[i]; - } - - // update desired position of markers 2 to num_cells + 1 - // (desired position of first marker is always 1) - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] += this->positions_increments[i]; - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / cnt (y-axis of histogram) - - std::size_t cnt = count(args); - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], cnt)); - } - } - //return histogram; - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - array_type positions_increments; // dn'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::p_square_cumulative_distribution -// -namespace tag -{ - struct p_square_cumulative_distribution - : depends_on - , p_square_cumulative_distribution_num_cells - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::p_square_cumulative_distribution_impl impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::p_square_cumulative_distribution -// -namespace extract -{ - extractor const p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution) -} - -using extract::p_square_cumulative_distribution; - -// So that p_square_cumulative_distribution can be automatically substituted with -// weighted_p_square_cumulative_distribution when the weight parameter is non-void -template<> -struct as_weighted_feature -{ - typedef tag::weighted_p_square_cumulative_distribution type; -}; - -template<> -struct feature_of - : feature_of -{ -}; - -}} // namespace boost::accumulators +#include #endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp index 46880c88d..b8b94f9f9 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace boost { namespace accumulators { diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp new file mode 100644 index 000000000..832e23141 --- /dev/null +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp @@ -0,0 +1,262 @@ +/////////////////////////////////////////////////////////////////////////////// +// weighted_p_square_cumul_dist.hpp +// +// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 +#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for named parameter p_square_cumulative_distribution_num_cells + +namespace boost { namespace accumulators +{ + +namespace impl +{ + /////////////////////////////////////////////////////////////////////////////// + // weighted_p_square_cumulative_distribution_impl + // cumulative distribution calculation (as histogram) + /** + @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm for weighted samples + + A histogram of the sample cumulative distribution is computed dynamically without storing samples + based on the \f$ P^2 \f$ algorithm for weighted samples. The returned histogram has a specifiable + amount (num_cells) equiprobable (and not equal-sized) cells. + + Note that applying importance sampling results in regions to be more and other regions to be less + accurately estimated than without importance sampling, i.e., with unweighted samples. + + For further details, see + + R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + histograms without storing observations, Communications of the ACM, + Volume 28 (October), Number 10, 1985, p. 1076-1085. + + @param p_square_cumulative_distribution_num_cells + */ + template + struct weighted_p_square_cumulative_distribution_impl + : accumulator_base + { + typedef typename numeric::functional::multiplies::result_type weighted_sample; + typedef typename numeric::functional::average::result_type float_type; + typedef std::vector > histogram_type; + typedef std::vector array_type; + // for boost::result_of + typedef iterator_range result_type; + + template + weighted_p_square_cumulative_distribution_impl(Args const &args) + : num_cells(args[p_square_cumulative_distribution_num_cells]) + , heights(num_cells + 1) + , actual_positions(num_cells + 1) + , desired_positions(num_cells + 1) + , histogram(num_cells + 1) + , is_dirty(true) + { + } + + template + void operator ()(Args const &args) + { + this->is_dirty = true; + + std::size_t cnt = count(args); + std::size_t sample_cell = 1; // k + std::size_t b = this->num_cells; + + // accumulate num_cells + 1 first samples + if (cnt <= b + 1) + { + this->heights[cnt - 1] = args[sample]; + this->actual_positions[cnt - 1] = args[weight]; + + // complete the initialization of heights by sorting + if (cnt == b + 1) + { + //std::sort(this->heights.begin(), this->heights.end()); + + // TODO: we need to sort the initial samples (in heights) in ascending order and + // sort their weights (in actual_positions) the same way. The following lines do + // it, but there must be a better and more efficient way of doing this. + typename array_type::iterator it_begin, it_end, it_min; + + it_begin = this->heights.begin(); + it_end = this->heights.end(); + + std::size_t pos = 0; + + while (it_begin != it_end) + { + it_min = std::min_element(it_begin, it_end); + std::size_t d = std::distance(it_begin, it_min); + std::swap(*it_begin, *it_min); + std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); + ++it_begin; + ++pos; + } + + // calculate correct initial actual positions + for (std::size_t i = 1; i < b; ++i) + { + this->actual_positions[i] += this->actual_positions[i - 1]; + } + } + } + else + { + // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values + if (args[sample] < this->heights[0]) + { + this->heights[0] = args[sample]; + this->actual_positions[0] = args[weight]; + sample_cell = 1; + } + else if (this->heights[b] <= args[sample]) + { + this->heights[b] = args[sample]; + sample_cell = b; + } + else + { + typename array_type::iterator it; + it = std::upper_bound( + this->heights.begin() + , this->heights.end() + , args[sample] + ); + + sample_cell = std::distance(this->heights.begin(), it); + } + + // increment positions of markers above sample_cell + for (std::size_t i = sample_cell; i < b + 1; ++i) + { + this->actual_positions[i] += args[weight]; + } + + // determine desired marker positions + for (std::size_t i = 1; i < b + 1; ++i) + { + this->desired_positions[i] = this->actual_positions[0] + + numeric::average((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); + } + + // adjust heights of markers 2 to num_cells if necessary + for (std::size_t i = 1; i < b; ++i) + { + // offset to desire position + float_type d = this->desired_positions[i] - this->actual_positions[i]; + + // offset to next position + float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; + + // offset to previous position + float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; + + // height ds + float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; + float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; + + if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) + { + short sign_d = static_cast(d / std::abs(d)); + + // try adjusting heights[i] using p-squared formula + float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); + + if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) + { + this->heights[i] = h; + } + else + { + // use linear formula + if (d>0) + { + this->heights[i] += hp; + } + if (d<0) + { + this->heights[i] -= hm; + } + } + this->actual_positions[i] += sign_d; + } + } + } + } + + template + result_type result(Args const &args) const + { + if (this->is_dirty) + { + this->is_dirty = false; + + // creates a vector of std::pair where each pair i holds + // the values heights[i] (x-axis of histogram) and + // actual_positions[i] / sum_of_weights (y-axis of histogram) + + for (std::size_t i = 0; i < this->histogram.size(); ++i) + { + this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], sum_of_weights(args))); + } + } + + return make_iterator_range(this->histogram); + } + + private: + std::size_t num_cells; // number of cells b + array_type heights; // q_i + array_type actual_positions; // n_i + array_type desired_positions; // n'_i + mutable histogram_type histogram; // histogram + mutable bool is_dirty; + }; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// tag::weighted_p_square_cumulative_distribution +// +namespace tag +{ + struct weighted_p_square_cumulative_distribution + : depends_on + , p_square_cumulative_distribution_num_cells + { + typedef accumulators::impl::weighted_p_square_cumulative_distribution_impl impl; + }; +} + +/////////////////////////////////////////////////////////////////////////////// +// extract::weighted_p_square_cumulative_distribution +// +namespace extract +{ + extractor const weighted_p_square_cumulative_distribution = {}; + + BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_cumulative_distribution) +} + +using extract::weighted_p_square_cumulative_distribution; + +}} // namespace boost::accumulators + +#endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp index 290f090fe..918970e8d 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp @@ -1,262 +1,19 @@ /////////////////////////////////////////////////////////////////////////////// // weighted_p_square_cumulative_distribution.hpp // -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Copyright 2012 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 +#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 +#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for named parameter p_square_cumulative_distribution_num_cells +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp" +#endif -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_p_square_cumulative_distribution_impl - // cumulative distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm for weighted samples - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm for weighted samples. The returned histogram has a specifiable - amount (num_cells) equiprobable (and not equal-sized) cells. - - Note that applying importance sampling results in regions to be more and other regions to be less - accurately estimated than without importance sampling, i.e., with unweighted samples. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells - */ - template - struct weighted_p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; - typedef std::vector > histogram_type; - typedef std::vector array_type; - // for boost::result_of - typedef iterator_range result_type; - - template - weighted_p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - } - - template - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - this->actual_positions[cnt - 1] = args[weight]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - //std::sort(this->heights.begin(), this->heights.end()); - - // TODO: we need to sort the initial samples (in heights) in ascending order and - // sort their weights (in actual_positions) the same way. The following lines do - // it, but there must be a better and more efficient way of doing this. - typename array_type::iterator it_begin, it_end, it_min; - - it_begin = this->heights.begin(); - it_end = this->heights.end(); - - std::size_t pos = 0; - - while (it_begin != it_end) - { - it_min = std::min_element(it_begin, it_end); - std::size_t d = std::distance(it_begin, it_min); - std::swap(*it_begin, *it_min); - std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); - ++it_begin; - ++pos; - } - - // calculate correct initial actual positions - for (std::size_t i = 1; i < b; ++i) - { - this->actual_positions[i] += this->actual_positions[i - 1]; - } - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - this->actual_positions[0] = args[weight]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - this->actual_positions[i] += args[weight]; - } - - // determine desired marker positions - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] = this->actual_positions[0] - + numeric::average((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / sum_of_weights (y-axis of histogram) - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], sum_of_weights(args))); - } - } - - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_p_square_cumulative_distribution -// -namespace tag -{ - struct weighted_p_square_cumulative_distribution - : depends_on - , p_square_cumulative_distribution_num_cells - { - typedef accumulators::impl::weighted_p_square_cumulative_distribution_impl impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_p_square_cumulative_distribution -// -namespace extract -{ - extractor const weighted_p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_cumulative_distribution) -} - -using extract::weighted_p_square_cumulative_distribution; - -}} // namespace boost::accumulators +#include #endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp index 6d3017b3e..8ee2c5600 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/algorithm/clamp.hpp b/project/jni/boost/include/boost/algorithm/clamp.hpp new file mode 100644 index 000000000..ae98d15d2 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/clamp.hpp @@ -0,0 +1,175 @@ +/* + Copyright (c) Marshall Clow 2008-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) + + Revision history: + 27 June 2009 mtc First version + 23 Oct 2010 mtc Added predicate version + +*/ + +/// \file clamp.hpp +/// \brief Clamp algorithm +/// \author Marshall Clow +/// +/// Suggested by olafvdspek in https://svn.boost.org/trac/boost/ticket/3215 + +#ifndef BOOST_ALGORITHM_CLAMP_HPP +#define BOOST_ALGORITHM_CLAMP_HPP + +#include // For std::less +#include // For std::iterator_traits +#include + +#include +#include +#include // for identity +#include // for boost::disable_if + +namespace boost { namespace algorithm { + +/// \fn clamp ( T const& val, +/// typename boost::mpl::identity::type const& lo, +/// typename boost::mpl::identity::type const& hi, Pred p ) +/// \return the value "val" brought into the range [ lo, hi ] +/// using the comparison predicate p. +/// If p ( val, lo ) return lo. +/// If p ( hi, val ) return hi. +/// Otherwise, return the original value. +/// +/// \param val The value to be clamped +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +/// + template + T const & clamp ( T const& val, + typename boost::mpl::identity::type const & lo, + typename boost::mpl::identity::type const & hi, Pred p ) + { +// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal + return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val; + } + + +/// \fn clamp ( T const& val, +/// typename boost::mpl::identity::type const& lo, +/// typename boost::mpl::identity::type const& hi ) +/// \return the value "val" brought into the range [ lo, hi ]. +/// If the value is less than lo, return lo. +/// If the value is greater than "hi", return hi. +/// Otherwise, return the original value. +/// +/// \param val The value to be clamped +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + T const& clamp ( const T& val, + typename boost::mpl::identity::type const & lo, + typename boost::mpl::identity::type const & hi ) + { + return (clamp) ( val, lo, hi, std::less()); + } + +/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out, +/// std::iterator_traits::value_type lo, +/// std::iterator_traits::value_type hi ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// +/// \param first The start of the range of values +/// \param last One past the end of the range of input values +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi ) + { + // this could also be written with bind and std::transform + while ( first != last ) + *out++ = clamp ( *first++, lo, hi ); + return out; + } + +/// \fn clamp_range ( const Range &r, OutputIterator out, +/// typename std::iterator_traits::type>::value_type lo, +/// typename std::iterator_traits::type>::value_type hi ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// +/// \param r The range of values to be clamped +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + typename boost::disable_if_c::value, OutputIterator>::type + clamp_range ( const Range &r, OutputIterator out, + typename std::iterator_traits::type>::value_type lo, + typename std::iterator_traits::type>::value_type hi ) + { + return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi ); + } + + +/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out, +/// std::iterator_traits::value_type lo, +/// std::iterator_traits::value_type hi, Pred p ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// using the comparison predicate p. +/// +/// \param first The start of the range of values +/// \param last One past the end of the range of input values +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. + +/// + template + OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi, Pred p ) + { + // this could also be written with bind and std::transform + while ( first != last ) + *out++ = clamp ( *first++, lo, hi, p ); + return out; + } + +/// \fn clamp_range ( const Range &r, OutputIterator out, +/// typename std::iterator_traits::type>::value_type lo, +/// typename std::iterator_traits::type>::value_type hi, +/// Pred p ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// using the comparison predicate p. +/// +/// \param r The range of values to be clamped +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +// +// Disable this template if the first two parameters are the same type; +// In that case, the user will get the two iterator version. + template + typename boost::disable_if_c::value, OutputIterator>::type + clamp_range ( const Range &r, OutputIterator out, + typename std::iterator_traits::type>::value_type lo, + typename std::iterator_traits::type>::value_type hi, + Pred p ) + { + return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi, p ); + } + + +}} + +#endif // BOOST_ALGORITHM_CLAMP_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp new file mode 100644 index 000000000..b76cb3f01 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp @@ -0,0 +1,91 @@ +/* + Copyright (c) Marshall Clow 2008-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) +*/ + +/// \file all_of.hpp +/// \brief Test ranges to see if all elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ALL_OF_HPP +#define BOOST_ALGORITHM_ALL_OF_HPP + +#include // for std::all_of, if available +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of all_of if it is available +using std::all_of; // Section 25.2.1 +#else +/// \fn all_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if all elements in [first, last) satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +bool all_of ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( !p(*first)) + return false; + return true; +} +#endif + +/// \fn all_of ( const Range &r, Predicate p ) +/// \return true if all elements in the range satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool all_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); +} + +/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val ) +/// \return true if all elements in [first, last) are equal to 'val' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) +{ + for ( ; first != last; ++first ) + if ( val != *first ) + return false; + return true; +} + +/// \fn all_of_equal ( const Range &r, const T &val ) +/// \return true if all elements in the range are equal to 'val' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool all_of_equal ( const Range &r, const T &val ) +{ + return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ALL_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp new file mode 100644 index 000000000..c3ab3ce59 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp @@ -0,0 +1,90 @@ +/* + Copyright (c) Marshall Clow 2008-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) + + For more information, see http://www.boost.org +*/ + +/// \file +/// \brief Test ranges to see if any elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ANY_OF_HPP +#define BOOST_ALGORITHM_ANY_OF_HPP + +#include // for std::any_of, if available +#include +#include + +namespace boost { namespace algorithm { + +// Use the C++11 versions of any_of if it is available +#if __cplusplus >= 201103L +using std::any_of; // Section 25.2.2 +#else +/// \fn any_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if any of the elements in [first, last) satisfy the predicate +/// \note returns false on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool any_of ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( p(*first)) + return true; + return false; +} +#endif + +/// \fn any_of ( const Range &r, Predicate p ) +/// \return true if any elements in the range satisfy the predicate 'p' +/// \note returns false on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool any_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::any_of (boost::begin (r), boost::end (r), p); +} + +/// \fn any_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if any of the elements in [first, last) are equal to 'val' +/// \note returns false on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + for ( ; first != last; ++first ) + if ( val == *first ) + return true; + return false; +} + +/// \fn any_of_equal ( const Range &r, const V &val ) +/// \return true if any of the elements in the range are equal to 'val' +/// \note returns false on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool any_of_equal ( const Range &r, const V &val ) +{ + return boost::algorithm::any_of_equal (boost::begin (r), boost::end (r), val); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ANY_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp b/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp new file mode 100644 index 000000000..8591cb54d --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp @@ -0,0 +1,133 @@ +/* + Copyright (c) Marshall Clow 2008-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) +*/ + +/// \file copy_if.hpp +/// \brief Copy a subset of a sequence to a new sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_COPY_IF_HPP +#define BOOST_ALGORITHM_COPY_IF_HPP + +#include // for std::copy_if, if available +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of copy_if if it is available +using std::copy_if; // Section 25.3.1 +#else +/// \fn copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements from the input range that satisfy the +/// predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +{ + for ( ; first != last; ++first ) + if (p(*first)) + *result++ = *first; + return result; +} +#endif + +/// \fn copy_if ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements from the input range that satisfy the +/// predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_if (boost::begin (r), boost::end(r), result, p); +} + + +/// \fn copy_while ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_while ( InputIterator first, InputIterator last, + OutputIterator result, Predicate p ) +{ + for ( ; first != last && p(*first); ++first ) + *result++ = *first; + return result; +} + +/// \fn copy_while ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_while ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_while (boost::begin (r), boost::end(r), result, p); +} + + +/// \fn copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that do not +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +{ + for ( ; first != last && !p(*first); ++first ) + *result++ = *first; + return result; +} + +/// \fn copy_until ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that do not +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_until ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_COPY_IF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp b/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp new file mode 100644 index 000000000..0ea53bd23 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp @@ -0,0 +1,44 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file copy_n.hpp +/// \brief Copy n items from one sequence to another +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_COPY_N_HPP +#define BOOST_ALGORITHM_COPY_N_HPP + +#include // for std::copy_n, if available + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of copy_n if it is available +using std::copy_n; // Section 25.3.1 +#else +/// \fn copy_n ( InputIterator first, Size n, OutputIterator result ) +/// \brief Copies exactly n (n > 0) elements from the range starting at first to +/// the range starting at result. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param n The number of elements to copy +/// \param result An output iterator to write the results into +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result ) +{ + for ( ; n > 0; --n, ++first, ++result ) + *result = *first; + return result; +} +#endif +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_COPY_IF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp b/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp new file mode 100644 index 000000000..4beed0008 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp @@ -0,0 +1,60 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file find_if_not.hpp +/// \brief Find the first element in a sequence that does not satisfy a predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP +#define BOOST_ALGORITHM_FIND_IF_NOT_HPP + +#include // for std::find_if_not, if it exists + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of find_if_not if it is available +using std::find_if_not; // Section 25.2.5 +#else +/// \fn find_if_not(InputIterator first, InputIterator last, Predicate p) +/// \brief Finds the first element in the sequence that does not satisfy the predicate. +/// \return The iterator pointing to the desired element. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the range +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( !p(*first)) + break; + return first; +} +#endif + +/// \fn find_if_not ( const Range &r, Predicate p ) +/// \brief Finds the first element in the sequence that does not satisfy the predicate. +/// \return The iterator pointing to the desired element. +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +typename boost::range_iterator::type find_if_not ( const Range &r, Predicate p ) +{ + return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p); +} + +}} +#endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp b/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp new file mode 100644 index 000000000..b4f0dafa6 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp @@ -0,0 +1,74 @@ +/* + Copyright (c) Marshall Clow 2008-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) +*/ + +/// \file iota.hpp +/// \brief Generate an increasing series +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IOTA_HPP +#define BOOST_ALGORITHM_IOTA_HPP + +#include + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of iota if it is available +using std::iota; // Section 26.7.6 +#else +/// \fn iota ( ForwardIterator first, ForwardIterator last, T value ) +/// \brief Generates an increasing sequence of values, and stores them in [first, last) +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param value The initial value of the sequence to be generated +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +void iota ( ForwardIterator first, ForwardIterator last, T value ) +{ + for ( ; first != last; ++first, ++value ) + *first = value; +} +#endif + +/// \fn iota ( Range &r, T value ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param r The input range +/// \param value The initial value of the sequence to be generated +/// +template +void iota ( Range &r, T value ) +{ + boost::algorithm::iota (boost::begin(r), boost::end(r), value); +} + + +/// \fn iota_n ( OutputIterator out, T value, std::size_t n ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param out An output iterator to write the results into +/// \param value The initial value of the sequence to be generated +/// \param n The number of items to write +/// +template +OutputIterator iota_n ( OutputIterator out, T value, std::size_t n ) +{ + while ( n-- > 0 ) + *out++ = value++; + + return out; +} + +}} + +#endif // BOOST_ALGORITHM_IOTA_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp new file mode 100644 index 000000000..e939e0560 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp @@ -0,0 +1,65 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file is_partitioned.hpp +/// \brief Tell if a sequence is partitioned +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP +#define BOOST_ALGORITHM_IS_PARTITIONED_HPP + +#include // for std::is_partitioned, if available + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_partitioned if it is available +using std::is_partitioned; // Section 25.3.13 +#else +/// \fn is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) +/// \brief Tests to see if a sequence is partitioned according to a predicate +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p The predicate to test the values with +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) +{ +// Run through the part that satisfy the predicate + for ( ; first != last; ++first ) + if ( !p (*first)) + break; +// Now the part that does not satisfy the predicate + for ( ; first != last; ++first ) + if ( p (*first)) + return false; + return true; +} +#endif + +/// \fn is_partitioned ( const Range &r, UnaryPredicate p ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param r The input range +/// \param p The predicate to test the values with +/// +template +bool is_partitioned ( const Range &r, UnaryPredicate p ) +{ + return boost::algorithm::is_partitioned (boost::begin(r), boost::end(r), p); +} + + +}} + +#endif // BOOST_ALGORITHM_IS_PARTITIONED_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp new file mode 100644 index 000000000..526ca2e47 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp @@ -0,0 +1,139 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file is_permutation.hpp +/// \brief Is a sequence a permutation of another sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IS_PERMUTATION_HPP +#define BOOST_ALGORITHM_IS_PERMUTATION_HPP + +#include // for std::less, tie, mismatch and is_permutation (if available) +#include // for std::make_pair +#include // for std::equal_to +#include + +#include +#include +#include +#include +#include // for tie + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_permutation if it is available +using std::is_permutation; // Section 25.2.12 +#else +/// \cond DOXYGEN_HIDE +namespace detail { + template + struct value_predicate { + value_predicate ( Predicate p, Iterator it ) : p_ ( p ), it_ ( it ) {} + + template + bool operator () ( const T1 &t1 ) const { return p_ ( *it_, t1 ); } + private: + Predicate &p_; + Iterator it_; + }; +} +/// \endcond + + +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2, BinaryPredicate p ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \param p The predicate to compare elements with +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate > +bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, BinaryPredicate p ) +{ +// Skip the common prefix (if any) +// std::tie (first1, first2) = std::mismatch (first1, last1, first2, p); + std::pair eq = std::mismatch (first1, last1, first2, p); + first1 = eq.first; + first2 = eq.second; + if ( first1 != last1 ) { + // Create last2 + ForwardIterator2 last2 = first2; + std::advance ( last2, std::distance (first1, last1)); + + // for each unique value in the sequence [first1,last1), count how many times + // it occurs, and make sure it occurs the same number of times in [first2, last2) + for ( ForwardIterator1 iter = first1; iter != last1; ++iter ) { + detail::value_predicate pred ( p, iter ); + + /* For each value we haven't seen yet... */ + if ( std::find_if ( first1, iter, pred ) == iter ) { + std::size_t dest_count = std::count_if ( first2, last2, pred ); + if ( dest_count == 0 || dest_count != (std::size_t) std::count_if ( iter, last1, pred )) + return false; + } + } + } + + return true; +} + +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template< class ForwardIterator1, class ForwardIterator2 > +bool is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 ) +{ +// How should I deal with the idea that ForwardIterator1::value_type +// and ForwardIterator2::value_type could be different? Define my own comparison predicate? + return boost::algorithm::is_permutation ( first, last, first2, + std::equal_to::value_type> ()); +} + +#endif + +/// \fn is_permutation ( const Range &r, ForwardIterator first2 ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param r The input range +/// \param first2 The start of the second sequence +template +bool is_permutation ( const Range &r, ForwardIterator first2 ) +{ + return boost::algorithm::is_permutation (boost::begin (r), boost::end (r), first2 ); +} + +/// \fn is_permutation ( const Range &r, ForwardIterator first2, BinaryPredicate pred ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param r The input range +/// \param first2 The start of the second sequence +/// \param pred The predicate to compare elements with +/// +// Disable this template when the first two parameters are the same type +// That way the non-range version will be chosen. +template +typename boost::disable_if_c::value, bool>::type +is_permutation ( const Range &r, ForwardIterator first2, BinaryPredicate pred ) +{ + return boost::algorithm::is_permutation (boost::begin (r), boost::end (r), first2, pred ); +} + +}} + +#endif // BOOST_ALGORITHM_IS_PERMUTATION_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp new file mode 100644 index 000000000..c9bc65fbe --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp @@ -0,0 +1,287 @@ +// Copyright (c) 2010 Nuovation System Designs, LLC +// Grant Erickson +// +// Reworked somewhat by Marshall Clow; August 2010 +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/ for latest version. +// + +#ifndef BOOST_ALGORITHM_ORDERED_HPP +#define BOOST_ALGORITHM_ORDERED_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_sorted/is_sorted_until if they are available +using std::is_sorted_until; // Section 25.4.1.5 +using std::is_sorted; // Section 25.4.1.5 +#else +/// \fn is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) +/// \return the point in the sequence [first, last) where the elements are unordered +/// (according to the comparison predicate 'p'). +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) + { + if ( first == last ) return last; // the empty sequence is ordered + ForwardIterator next = first; + while ( ++next != last ) + { + if ( p ( *next, *first )) + return next; + first = next; + } + return last; + } + +/// \fn is_sorted_until ( ForwardIterator first, ForwardIterator last ) +/// \return the point in the sequence [first, last) where the elements are unordered +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// + template + ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted_until ( first, last, std::less()); + } + + +/// \fn is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) +/// \return whether or not the entire sequence is sorted +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) + { + return boost::algorithm::is_sorted_until (first, last, p) == last; + } + +/// \fn is_sorted ( ForwardIterator first, ForwardIterator last ) +/// \return whether or not the entire sequence is sorted +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// + template + bool is_sorted ( ForwardIterator first, ForwardIterator last ) + { + return boost::algorithm::is_sorted_until (first, last) == last; + } +#endif + +/// +/// -- Range based versions of the C++11 functions +/// + +/// \fn is_sorted_until ( const R &range, Pred p ) +/// \return the point in the range R where the elements are unordered +/// (according to the comparison predicate 'p'). +/// +/// \param range The range to be tested. +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + typename boost::lazy_disable_if_c< + boost::is_same::value, + typename boost::range_iterator + >::type is_sorted_until ( const R &range, Pred p ) + { + return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range ), p ); + } + + +/// \fn is_sorted_until ( const R &range ) +/// \return the point in the range R where the elements are unordered +/// +/// \param range The range to be tested. +/// + template + typename boost::range_iterator::type is_sorted_until ( const R &range ) + { + return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range )); + } + +/// \fn is_sorted ( const R &range, Pred p ) +/// \return whether or not the entire range R is sorted +/// (according to the comparison predicate 'p'). +/// +/// \param range The range to be tested. +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + typename boost::lazy_disable_if_c< boost::is_same::value, boost::mpl::identity >::type + is_sorted ( const R &range, Pred p ) + { + return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p ); + } + + +/// \fn is_sorted ( const R &range ) +/// \return whether or not the entire range R is sorted +/// +/// \param range The range to be tested. +/// + template + bool is_sorted ( const R &range ) + { + return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range )); + } + + +/// +/// -- Range based versions of the C++11 functions +/// + +/// \fn is_increasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is increasing; i.e, each item is greater than or +/// equal to the previous one. +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_increasing instead. + template + bool is_increasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::less()); + } + + +/// \fn is_increasing ( const R &range ) +/// \return true if the entire sequence is increasing; i.e, each item is greater than or +/// equal to the previous one. +/// +/// \param range The range to be tested. +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_increasing instead. + template + bool is_increasing ( const R &range ) + { + return is_increasing ( boost::begin ( range ), boost::end ( range )); + } + + + +/// \fn is_decreasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is decreasing; i.e, each item is less than +/// or equal to the previous one. +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_decreasing instead. + template + bool is_decreasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::greater()); + } + +/// \fn is_decreasing ( const R &range ) +/// \return true if the entire sequence is decreasing; i.e, each item is less than +/// or equal to the previous one. +/// +/// \param range The range to be tested. +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_decreasing instead. + template + bool is_decreasing ( const R &range ) + { + return is_decreasing ( boost::begin ( range ), boost::end ( range )); + } + + + +/// \fn is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is strictly increasing; i.e, each item is greater +/// than the previous one +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_increasing instead. + template + bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::less_equal()); + } + +/// \fn is_strictly_increasing ( const R &range ) +/// \return true if the entire sequence is strictly increasing; i.e, each item is greater +/// than the previous one +/// +/// \param range The range to be tested. +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_increasing instead. + template + bool is_strictly_increasing ( const R &range ) + { + return is_strictly_increasing ( boost::begin ( range ), boost::end ( range )); + } + + +/// \fn is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is strictly decreasing; i.e, each item is less than +/// the previous one +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_decreasing instead. + template + bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::greater_equal()); + } + +/// \fn is_strictly_decreasing ( const R &range ) +/// \return true if the entire sequence is strictly decreasing; i.e, each item is less than +/// the previous one +/// +/// \param range The range to be tested. +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_decreasing instead. + template + bool is_strictly_decreasing ( const R &range ) + { + return is_strictly_decreasing ( boost::begin ( range ), boost::end ( range )); + } + +}} // namespace boost + +#endif // BOOST_ALGORITHM_ORDERED_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp new file mode 100644 index 000000000..feae9919f --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp @@ -0,0 +1,88 @@ +/* + Copyright (c) Marshall Clow 2008-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) +*/ + +/// \file none_of.hpp +/// \brief Test ranges to see if no elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_NONE_OF_HPP +#define BOOST_ALGORITHM_NONE_OF_HPP + +#include // for std::none_of, if available +#include +#include + +namespace boost { namespace algorithm { + +// Use the C++11 versions of the none_of if it is available +#if __cplusplus >= 201103L +using std::none_of; // Section 25.2.3 +#else +/// \fn none_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if none of the elements in [first, last) satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool none_of ( InputIterator first, InputIterator last, Predicate p ) +{ +for ( ; first != last; ++first ) + if ( p(*first)) + return false; + return true; +} +#endif + +/// \fn none_of ( const Range &r, Predicate p ) +/// \return true if none of the elements in the range satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool none_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::none_of (boost::begin (r), boost::end (r), p ); +} + +/// \fn none_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if none of the elements in [first, last) are equal to 'val' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + for ( ; first != last; ++first ) + if ( val == *first ) + return false; + return true; +} + +/// \fn none_of_equal ( const Range &r, const V &val ) +/// \return true if none of the elements in the range are equal to 'val' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool none_of_equal ( const Range &r, const V & val ) +{ + return boost::algorithm::none_of_equal (boost::begin (r), boost::end (r), val); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_NONE_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp new file mode 100644 index 000000000..b6e8c7719 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp @@ -0,0 +1,82 @@ +/* + Copyright (c) Marshall Clow 2008-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) +*/ + +/// \file one_of.hpp +/// \brief Test ranges to see if only one element matches a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ONE_OF_HPP +#define BOOST_ALGORITHM_ONE_OF_HPP + +#include // for std::find and std::find_if +#include + +#include +#include + +namespace boost { namespace algorithm { + +/// \fn one_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if the predicate 'p' is true for exactly one item in [first, last). +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool one_of ( InputIterator first, InputIterator last, Predicate p ) +{ + InputIterator i = std::find_if (first, last, p); + if (i == last) + return false; // Didn't occur at all + return boost::algorithm::none_of (++i, last, p); +} + +/// \fn one_of ( const Range &r, Predicate p ) +/// \return true if the predicate 'p' is true for exactly one item in the range. +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool one_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::one_of ( boost::begin (r), boost::end (r), p ); +} + + +/// \fn one_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if the value 'val' exists only once in [first, last). +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool one_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + InputIterator i = std::find (first, last, val); // find first occurrence of 'val' + if (i == last) + return false; // Didn't occur at all + return boost::algorithm::none_of_equal (++i, last, val); +} + +/// \fn one_of_equal ( const Range &r, const V &val ) +/// \return true if the value 'val' exists only once in the range. +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool one_of_equal ( const Range &r, const V &val ) +{ + return boost::algorithm::one_of_equal ( boost::begin (r), boost::end (r), val ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ALL_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp b/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp new file mode 100644 index 000000000..15c4dd68a --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp @@ -0,0 +1,78 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file partition_copy.hpp +/// \brief Copy a subset of a sequence to a new sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP +#define BOOST_ALGORITHM_PARTITION_COPY_HPP + +#include // for std::partition_copy, if available +#include // for make_pair + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of partition_copy if it is available +using std::partition_copy; // Section 25.3.13 +#else +/// \fn partition_copy ( InputIterator first, InputIterator last, +/// OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +/// \brief Copies the elements that satisfy the predicate p from the range [first, last) +/// to the range beginning at d_first_true, and +/// copies the elements that do not satisfy p to the range beginning at d_first_false. +/// +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out_true An output iterator to write the elements that satisfy the predicate into +/// \param out_false An output iterator to write the elements that do not satisfy the predicate into +/// \param p A predicate for dividing the elements of the input sequence. +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +std::pair +partition_copy ( InputIterator first, InputIterator last, + OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +{ + for ( ; first != last; ++first ) + if ( p (*first)) + *out_true++ = *first; + else + *out_false++ = *first; + return std::pair ( out_true, out_false ); +} +#endif + +/// \fn partition_copy ( const Range &r, +/// OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +/// +/// \param r The input range +/// \param out_true An output iterator to write the elements that satisfy the predicate into +/// \param out_false An output iterator to write the elements that do not satisfy the predicate into +/// \param p A predicate for dividing the elements of the input sequence. +/// +template +std::pair +partition_copy ( const Range &r, OutputIterator1 out_true, OutputIterator2 out_false, + UnaryPredicate p ) +{ + return boost::algorithm::partition_copy + (boost::begin(r), boost::end(r), out_true, out_false, p ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_PARTITION_COPY_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp b/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp new file mode 100644 index 000000000..36d8384b5 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp @@ -0,0 +1,72 @@ +/* + Copyright (c) Marshall Clow 2011-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) +*/ + +/// \file partition_point.hpp +/// \brief Find the partition point in a sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_PARTITION_POINT_HPP +#define BOOST_ALGORITHM_PARTITION_POINT_HPP + +#include // for std::partition_point, if available + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of partition_point if it is available +using std::partition_point; // Section 25.3.13 +#else +/// \fn partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) +/// \brief Given a partitioned range, returns the partition point, i.e, the first element +/// that does not satisfy p +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p The predicate to test the values with +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) +{ + std::size_t dist = std::distance ( first, last ); + while ( first != last ) { + std::size_t d2 = dist / 2; + ForwardIterator ret_val = first; + std::advance (ret_val, d2); + if (p (*ret_val)) { + first = ++ret_val; + dist -= d2 + 1; + } + else { + last = ret_val; + dist = d2; + } + } + return first; +} +#endif + +/// \fn partition_point ( Range &r, Predicate p ) +/// \brief Given a partitioned range, returns the partition point +/// +/// \param r The input range +/// \param p The predicate to test the values with +/// +template +typename boost::range_iterator partition_point ( Range &r, Predicate p ) +{ + return boost::algorithm::partition_point (boost::begin(r), boost::end(r), p); +} + + +}} + +#endif // BOOST_ALGORITHM_PARTITION_POINT_HPP diff --git a/project/jni/boost/include/boost/algorithm/hex.hpp b/project/jni/boost/include/boost/algorithm/hex.hpp new file mode 100644 index 000000000..439ec46b9 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/hex.hpp @@ -0,0 +1,269 @@ +/* + Copyright (c) Marshall Clow 2011-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) + + Thanks to Nevin for his comments/help. +*/ + +/* + General problem - turn a sequence of integral types into a sequence of hexadecimal characters. + - and back. + +TO DO: + 1. these should really only work on integral types. (see the >> and << operations) + -- this is done, I think. + 2. The 'value_type_or_char' struct is really a hack. + -- but it's a better hack now that it works with back_insert_iterators +*/ + +/// \file hex.hpp +/// \brief Convert sequence of integral types into a sequence of hexadecimal +/// characters and back. Based on the MySQL functions HEX and UNHEX +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_HEXHPP +#define BOOST_ALGORITHM_HEXHPP + +#include // for std::iterator_traits +#include + +#include +#include +#include + +#include +#include + + +namespace boost { namespace algorithm { + +/*! + \struct hex_decode_error + \brief Base exception class for all hex decoding errors + + \struct non_hex_input + \brief Thrown when a non-hex value (0-9, A-F) encountered when decoding. + Contains the offending character + + \struct not_enough_input + \brief Thrown when the input sequence unexpectedly ends + +*/ +struct hex_decode_error : virtual boost::exception, virtual std::exception {}; +struct not_enough_input : virtual hex_decode_error {}; +struct non_hex_input : virtual hex_decode_error {}; +typedef boost::error_info bad_char; + +namespace detail { +/// \cond DOXYGEN_HIDE + + template + OutputIterator encode_one ( T val, OutputIterator out ) { + const std::size_t num_hex_digits = 2 * sizeof ( T ); + char res [ num_hex_digits ]; + char *p = res + num_hex_digits; + for ( std::size_t i = 0; i < num_hex_digits; ++i, val >>= 4 ) + *--p = "0123456789ABCDEF" [ val & 0x0F ]; + return std::copy ( res, res + num_hex_digits, out ); + } + +// this needs to be in an un-named namespace because it is not a template +// and might get included in several compilation units. This could cause +// multiple definition errors at link time. + namespace { + unsigned hex_char_to_int ( char c ) { + if ( c >= '0' && c <= '9' ) return c - '0'; + if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10; + if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10; + BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c)); + return 0; // keep dumb compilers happy + } + } + +// My own iterator_traits class. +// It is here so that I can "reach inside" some kinds of output iterators +// and get the type to write. + template + struct hex_iterator_traits { + typedef typename std::iterator_traits::value_type value_type; + }; + + template + struct hex_iterator_traits< std::back_insert_iterator > { + typedef typename Container::value_type value_type; + }; + + template + struct hex_iterator_traits< std::front_insert_iterator > { + typedef typename Container::value_type value_type; + }; + + template + struct hex_iterator_traits< std::insert_iterator > { + typedef typename Container::value_type value_type; + }; + +// ostream_iterators have three template parameters. +// The first one is the output type, the second one is the character type of +// the underlying stream, the third is the character traits. +// We only care about the first one. + template + struct hex_iterator_traits< std::ostream_iterator > { + typedef T value_type; + }; + + template + bool iter_end ( Iterator current, Iterator last ) { return current == last; } + + template + bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; } + +// What can we assume here about the inputs? +// is std::iterator_traits::value_type always 'char' ? +// Could it be wchar_t, say? Does it matter? +// We are assuming ASCII for the values - but what about the storage? + template + typename boost::enable_if::value_type>, OutputIterator>::type + decode_one ( InputIterator &first, InputIterator last, OutputIterator out, EndPred pred ) { + typedef typename hex_iterator_traits::value_type T; + T res (0); + + // Need to make sure that we get can read that many chars here. + for ( std::size_t i = 0; i < 2 * sizeof ( T ); ++i, ++first ) { + if ( pred ( first, last )) + BOOST_THROW_EXCEPTION (not_enough_input ()); + res = ( 16 * res ) + hex_char_to_int (static_cast (*first)); + } + + *out = res; + return ++out; + } +/// \endcond + } + + +/// \fn hex ( InputIterator first, InputIterator last, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex ( InputIterator first, InputIterator last, OutputIterator out ) { + for ( ; first != last; ++first ) + out = detail::encode_one ( *first, out ); + return out; + } + + +/// \fn hex ( const T *ptr, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param ptr A pointer to a 0-terminated sequence of data. +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if, OutputIterator>::type +hex ( const T *ptr, OutputIterator out ) { + while ( *ptr ) + out = detail::encode_one ( *ptr++, out ); + return out; + } + +/// \fn hex ( const Range &r, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param r The input range +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex ( const Range &r, OutputIterator out ) { + return hex (boost::begin(r), boost::end(r), out); +} + + +/// \fn unhex ( InputIterator first, InputIterator last, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( InputIterator first, InputIterator last, OutputIterator out ) { + while ( first != last ) + out = detail::decode_one ( first, last, out, detail::iter_end ); + return out; + } + + +/// \fn unhex ( const T *ptr, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param ptr A pointer to a null-terminated input sequence. +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( const T *ptr, OutputIterator out ) { + typedef typename detail::hex_iterator_traits::value_type OutputType; +// If we run into the terminator while decoding, we will throw a +// malformed input exception. It would be nicer to throw a 'Not enough input' +// exception - but how much extra work would that require? + while ( *ptr ) + out = detail::decode_one ( ptr, (const T *) NULL, out, detail::ptr_end ); + return out; + } + + +/// \fn OutputIterator unhex ( const Range &r, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param r The input range +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( const Range &r, OutputIterator out ) { + return unhex (boost::begin(r), boost::end(r), out); + } + + +/// \fn String hex ( const String &input ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param input A container to be converted +/// \return A container with the encoded text +template +String hex ( const String &input ) { + String output; + output.reserve (input.size () * (2 * sizeof (typename String::value_type))); + (void) hex (input, std::back_inserter (output)); + return output; + } + +/// \fn String unhex ( const String &input ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of characters. +/// +/// \param input A container to be converted +/// \return A container with the decoded text +template +String unhex ( const String &input ) { + String output; + output.reserve (input.size () / (2 * sizeof (typename String::value_type))); + (void) unhex (input, std::back_inserter (output)); + return output; + } + +}} + +#endif // BOOST_ALGORITHM_HEXHPP diff --git a/project/jni/boost/include/boost/algorithm/minmax_element.hpp b/project/jni/boost/include/boost/algorithm/minmax_element.hpp index 0d2efd8cd..752f6cbdb 100644 --- a/project/jni/boost/include/boost/algorithm/minmax_element.hpp +++ b/project/jni/boost/include/boost/algorithm/minmax_element.hpp @@ -99,8 +99,10 @@ namespace boost { // if odd number of elements, treat last element if (first != last) { // odd number of elements - if (comp(first, min_result)) - min_result = first, potential_min_result = last; + if (comp(first, min_result)) { + min_result = first; + potential_min_result = last; + } else if (comp(max_result, first)) max_result = first; } diff --git a/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp b/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp new file mode 100644 index 000000000..c5fe9fa25 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp @@ -0,0 +1,268 @@ +/* + Copyright (c) Marshall Clow 2010-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) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP +#define BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP + +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +namespace boost { namespace algorithm { + +/* + A templated version of the boyer-moore searching algorithm. + +References: + http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/ + http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf + +Explanations: + http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm + http://www.movsd.com/bm.htm + http://www.cs.ucdavis.edu/~gusfield/cs224f09/bnotes.pdf + +The Boyer-Moore search algorithm uses two tables, a "bad character" table +to tell how far to skip ahead when it hits a character that is not in the pattern, +and a "good character" table to tell how far to skip ahead when it hits a +mismatch on a character that _is_ in the pattern. + +Requirements: + * Random access iterators + * The two iterator types (patIter and corpusIter) must + "point to" the same underlying type and be comparable. + * Additional requirements may be imposed but the skip table, such as: + ** Numeric type (array-based skip table) + ** Hashable type (map-based skip table) +*/ + + template > + class boyer_moore { + typedef typename std::iterator_traits::difference_type difference_type; + public: + boyer_moore ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length, -1 ), + suffix_ ( k_pattern_length + 1 ) + { + this->build_skip_table ( first, last ); + this->build_suffix_table ( first, last ); + } + + ~boyer_moore () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + // Do the search + return this->do_search ( corpus_first, corpus_last ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + typename traits::skip_table_t skip_; + std::vector suffix_; + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + /* ---- Do the matching ---- */ + corpusIter curPos = corpus_first; + const corpusIter lastPos = corpus_last - k_pattern_length; + difference_type j, k, m; + + while ( curPos <= lastPos ) { + /* while ( std::distance ( curPos, corpus_last ) >= k_pattern_length ) { */ + // Do we match right where we are? + j = k_pattern_length; + while ( pat_first [j-1] == curPos [j-1] ) { + j--; + // We matched - we're done! + if ( j == 0 ) + return curPos; + } + + // Since we didn't match, figure out how far to skip forward + k = skip_ [ curPos [ j - 1 ]]; + m = j - k - 1; + if ( k < j && m > suffix_ [ j ] ) + curPos += m; + else + curPos += suffix_ [ j ]; + } + + return corpus_last; // We didn't find anything + } + + + void build_skip_table ( patIter first, patIter last ) { + for ( std::size_t i = 0; first != last; ++first, ++i ) + skip_.insert ( *first, i ); + } + + + template + void compute_bm_prefix ( Iter pat_first, Iter pat_last, Container &prefix ) { + const std::size_t count = std::distance ( pat_first, pat_last ); + BOOST_ASSERT ( count > 0 ); + BOOST_ASSERT ( prefix.size () == count ); + + prefix[0] = 0; + std::size_t k = 0; + for ( std::size_t i = 1; i < count; ++i ) { + BOOST_ASSERT ( k < count ); + while ( k > 0 && ( pat_first[k] != pat_first[i] )) { + BOOST_ASSERT ( k < count ); + k = prefix [ k - 1 ]; + } + + if ( pat_first[k] == pat_first[i] ) + k++; + prefix [ i ] = k; + } + } + + void build_suffix_table ( patIter pat_first, patIter pat_last ) { + const std::size_t count = (std::size_t) std::distance ( pat_first, pat_last ); + + if ( count > 0 ) { // empty pattern + std::vector::value_type> reversed(count); + (void) std::reverse_copy ( pat_first, pat_last, reversed.begin ()); + + std::vector prefix (count); + compute_bm_prefix ( pat_first, pat_last, prefix ); + + std::vector prefix_reversed (count); + compute_bm_prefix ( reversed.begin (), reversed.end (), prefix_reversed ); + + for ( std::size_t i = 0; i <= count; i++ ) + suffix_[i] = count - prefix [count-1]; + + for ( std::size_t i = 0; i < count; i++ ) { + const std::size_t j = count - prefix_reversed[i]; + const difference_type k = i - prefix_reversed[i] + 1; + + if (suffix_[j] > k) + suffix_[j] = k; + } + } + } +/// \endcond + }; + + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn boyer_moore_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter boyer_moore_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + boyer_moore bm ( pat_first, pat_last ); + return bm ( corpus_first, corpus_last ); + } + + template + corpusIter boyer_moore_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore bm ( boost::begin(pattern), boost::end (pattern)); + return bm ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + boyer_moore_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + boyer_moore bm ( pat_first, pat_last ); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + boyer_moore_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore bm ( boost::begin(pattern), boost::end (pattern)); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::boyer_moore::type> + make_boyer_moore ( const Range &r ) { + return boost::algorithm::boyer_moore + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::boyer_moore::type> + make_boyer_moore ( Range &r ) { + return boost::algorithm::boyer_moore + ::type> (boost::begin(r), boost::end(r)); + } + +}} + +#endif // BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp b/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp new file mode 100644 index 000000000..758ded206 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp @@ -0,0 +1,199 @@ +/* + Copyright (c) Marshall Clow 2010-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) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP +#define BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP + +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +// #define BOOST_ALGORITHM_BOYER_MOORE_HORSPOOL_DEBUG_HPP + +namespace boost { namespace algorithm { + +/* + A templated version of the boyer-moore-horspool searching algorithm. + + Requirements: + * Random access iterators + * The two iterator types (patIter and corpusIter) must + "point to" the same underlying type. + * Additional requirements may be imposed buy the skip table, such as: + ** Numeric type (array-based skip table) + ** Hashable type (map-based skip table) + +http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html + +*/ + + template > + class boyer_moore_horspool { + typedef typename std::iterator_traits::difference_type difference_type; + public: + boyer_moore_horspool ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length, k_pattern_length ) { + + // Build the skip table + std::size_t i = 0; + if ( first != last ) // empty pattern? + for ( patIter iter = first; iter != last-1; ++iter, ++i ) + skip_.insert ( *iter, k_pattern_length - 1 - i ); +#ifdef BOOST_ALGORITHM_BOYER_MOORE_HORSPOOL_DEBUG_HPP + skip_.PrintSkipTable (); +#endif + } + + ~boyer_moore_horspool () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + // Do the search + return this->do_search ( corpus_first, corpus_last ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + typename traits::skip_table_t skip_; + + /// \fn do_search ( corpusIter corpus_first, corpusIter corpus_last ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param k_corpus_length The length of the corpus to search + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + corpusIter curPos = corpus_first; + const corpusIter lastPos = corpus_last - k_pattern_length; + while ( curPos <= lastPos ) { + // Do we match right where we are? + std::size_t j = k_pattern_length - 1; + while ( pat_first [j] == curPos [j] ) { + // We matched - we're done! + if ( j == 0 ) + return curPos; + j--; + } + + curPos += skip_ [ curPos [ k_pattern_length - 1 ]]; + } + + return corpus_last; + } +// \endcond + }; + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn boyer_moore_horspool_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter boyer_moore_horspool_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + boyer_moore_horspool bmh ( pat_first, pat_last ); + return bmh ( corpus_first, corpus_last ); + } + + template + corpusIter boyer_moore_horspool_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore_horspool bmh ( boost::begin(pattern), boost::end (pattern)); + return bmh ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + boyer_moore_horspool_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + boyer_moore_horspool bmh ( pat_first, pat_last ); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + boyer_moore_horspool_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore_horspool bmh ( boost::begin(pattern), boost::end (pattern)); + return bmh (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::boyer_moore_horspool::type> + make_boyer_moore_horspool ( const Range &r ) { + return boost::algorithm::boyer_moore_horspool + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::boyer_moore_horspool::type> + make_boyer_moore_horspool ( Range &r ) { + return boost::algorithm::boyer_moore_horspool + ::type> (boost::begin(r), boost::end(r)); + } + +}} + +#endif // BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp b/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp new file mode 100644 index 000000000..ea150c302 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp @@ -0,0 +1,105 @@ +/* + Copyright (c) Marshall Clow 2010-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) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP +#define BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP + +#include // for CHAR_BIT +#include +#include // for std::iterator_traits + +#include +#include +#include +#include + +#include +#include + +#include + +namespace boost { namespace algorithm { namespace detail { + +// +// Default implementations of the skip tables for B-M and B-M-H +// + template class skip_table; + +// General case for data searching other than bytes; use a map + template + class skip_table { + private: + typedef std::tr1::unordered_map skip_map; + const value_type k_default_value; + skip_map skip_; + + public: + skip_table ( std::size_t patSize, value_type default_value ) + : k_default_value ( default_value ), skip_ ( patSize ) {} + + void insert ( key_type key, value_type val ) { + skip_ [ key ] = val; // Would skip_.insert (val) be better here? + } + + value_type operator [] ( key_type key ) const { + typename skip_map::const_iterator it = skip_.find ( key ); + return it == skip_.end () ? k_default_value : it->second; + } + + void PrintSkipTable () const { + std::cout << "BM(H) Skip Table :" << std::endl; + for ( typename skip_map::const_iterator it = skip_.begin (); it != skip_.end (); ++it ) + if ( it->second != k_default_value ) + std::cout << " " << it->first << ": " << it->second << std::endl; + std::cout << std::endl; + } + }; + + +// Special case small numeric values; use an array + template + class skip_table { + private: + typedef typename boost::make_unsigned::type unsigned_key_type; + typedef boost::array skip_map; + skip_map skip_; + const value_type k_default_value; + public: + skip_table ( std::size_t patSize, value_type default_value ) : k_default_value ( default_value ) { + std::fill_n ( skip_.begin(), skip_.size(), default_value ); + } + + void insert ( key_type key, value_type val ) { + skip_ [ static_cast ( key ) ] = val; + } + + value_type operator [] ( key_type key ) const { + return skip_ [ static_cast ( key ) ]; + } + + void PrintSkipTable () const { + std::cout << "BM(H) Skip Table :" << std::endl; + for ( typename skip_map::const_iterator it = skip_.begin (); it != skip_.end (); ++it ) + if ( *it != k_default_value ) + std::cout << " " << std::distance (skip_.begin (), it) << ": " << *it << std::endl; + std::cout << std::endl; + } + }; + + template + struct BM_traits { + typedef typename std::iterator_traits::difference_type value_type; + typedef typename std::iterator_traits::value_type key_type; + typedef boost::algorithm::detail::skip_table::value && (sizeof(key_type)==1)> skip_table_t; + }; + +}}} // namespaces + +#endif // BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp b/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp new file mode 100644 index 000000000..3996e0f50 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp @@ -0,0 +1,30 @@ +/* + Copyright (c) Marshall Clow 2010-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) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP +#define BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP + +#include +/// \cond DOXYGEN_HIDE + +namespace boost { namespace algorithm { namespace detail { + +// Debugging support + template + void PrintTable ( Iter first, Iter last ) { + std::cout << std::distance ( first, last ) << ": { "; + for ( Iter iter = first; iter != last; ++iter ) + std::cout << *iter << " "; + std::cout << "}" << std::endl; + } + +}}} +/// \endcond + +#endif // BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp b/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp new file mode 100644 index 000000000..aaeeb51cc --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp @@ -0,0 +1,258 @@ +/* + Copyright (c) Marshall Clow 2010-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) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP +#define BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP + +#include +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include + +// #define BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_DEBUG + +namespace boost { namespace algorithm { + +// #define NEW_KMP + +/* + A templated version of the Knuth-Morris-Pratt searching algorithm. + + Requirements: + * Random-access iterators + * The two iterator types (I1 and I2) must "point to" the same underlying type. + + http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm + http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm +*/ + + template + class knuth_morris_pratt { + typedef typename std::iterator_traits::difference_type difference_type; + public: + knuth_morris_pratt ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length + 1 ) { +#ifdef NEW_KMP + preKmp ( pat_first, pat_last ); +#else + init_skip_table ( pat_first, pat_last ); +#endif +#ifdef BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_DEBUG + detail::PrintTable ( skip_.begin (), skip_.end ()); +#endif + } + + ~knuth_morris_pratt () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + return do_search ( corpus_first, corpus_last, k_corpus_length ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + std::vector skip_; + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last, + difference_type k_corpus_length ) const { + difference_type match_start = 0; // position in the corpus that we're matching + +#ifdef NEW_KMP + int patternIdx = 0; + while ( match_start < k_corpus_length ) { + while ( patternIdx > -1 && pat_first[patternIdx] != corpus_first [match_start] ) + patternIdx = skip_ [patternIdx]; //<--- Shifting the pattern on mismatch + + patternIdx++; + match_start++; //<--- corpus is always increased by 1 + + if ( patternIdx >= (int) k_pattern_length ) + return corpus_first + match_start - patternIdx; + } + +#else +// At this point, we know: +// k_pattern_length <= k_corpus_length +// for all elements of skip, it holds -1 .. k_pattern_length +// +// In the loop, we have the following invariants +// idx is in the range 0 .. k_pattern_length +// match_start is in the range 0 .. k_corpus_length - k_pattern_length + 1 + + const difference_type last_match = k_corpus_length - k_pattern_length; + difference_type idx = 0; // position in the pattern we're comparing + + while ( match_start <= last_match ) { + while ( pat_first [ idx ] == corpus_first [ match_start + idx ] ) { + if ( ++idx == k_pattern_length ) + return corpus_first + match_start; + } + // Figure out where to start searching again + // assert ( idx - skip_ [ idx ] > 0 ); // we're always moving forward + match_start += idx - skip_ [ idx ]; + idx = skip_ [ idx ] >= 0 ? skip_ [ idx ] : 0; + // assert ( idx >= 0 && idx < k_pattern_length ); + } +#endif + + // We didn't find anything + return corpus_last; + } + + + void preKmp ( patIter first, patIter last ) { + const /*std::size_t*/ int count = std::distance ( first, last ); + + int i, j; + + i = 0; + j = skip_[0] = -1; + while (i < count) { + while (j > -1 && first[i] != first[j]) + j = skip_[j]; + i++; + j++; + if (first[i] == first[j]) + skip_[i] = skip_[j]; + else + skip_[i] = j; + } + } + + + void init_skip_table ( patIter first, patIter last ) { + const difference_type count = std::distance ( first, last ); + + int j; + skip_ [ 0 ] = -1; + for ( int i = 1; i <= count; ++i ) { + j = skip_ [ i - 1 ]; + while ( j >= 0 ) { + if ( first [ j ] == first [ i - 1 ] ) + break; + j = skip_ [ j ]; + } + skip_ [ i ] = j + 1; + } + } +// \endcond + }; + + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn knuth_morris_pratt_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter knuth_morris_pratt_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + knuth_morris_pratt kmp ( pat_first, pat_last ); + return kmp ( corpus_first, corpus_last ); + } + + template + corpusIter knuth_morris_pratt_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + knuth_morris_pratt kmp ( boost::begin(pattern), boost::end (pattern)); + return kmp ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + knuth_morris_pratt_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + knuth_morris_pratt kmp ( pat_first, pat_last ); + return kmp (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + knuth_morris_pratt_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + knuth_morris_pratt kmp ( boost::begin(pattern), boost::end (pattern)); + return kmp (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::knuth_morris_pratt::type> + make_knuth_morris_pratt ( const Range &r ) { + return boost::algorithm::knuth_morris_pratt + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::knuth_morris_pratt::type> + make_knuth_morris_pratt ( Range &r ) { + return boost::algorithm::knuth_morris_pratt + ::type> (boost::begin(r), boost::end(r)); + } +}} + +#endif // BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp b/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp index 8b9ad4276..1612b9378 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp @@ -56,7 +56,7 @@ namespace boost { // Copy the beginning of the sequence Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output ); // Format find result - // Copy formated result + // Copy formatted result Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output ); // Copy the rest of the sequence Output = std::copy( M.end(), ::boost::end(Input), Output ); @@ -118,11 +118,11 @@ namespace boost { InputT Output; // Copy the beginning of the sequence - insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() ); - // Copy formated result - insert( Output, ::boost::end(Output), M.format_result() ); + boost::algorithm::detail::insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() ); + // Copy formatted result + boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() ); // 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; } diff --git a/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp b/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp index 978710c95..51ad56678 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp @@ -58,7 +58,7 @@ namespace boost { { // Copy the beginning of the sequence 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 ); // Proceed to the next match @@ -134,9 +134,9 @@ namespace boost { while( M ) { // Copy the beginning of the sequence - insert( Output, ::boost::end(Output), LastMatch, M.begin() ); - // Copy formated result - insert( Output, ::boost::end(Output), M.format_result() ); + boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, M.begin() ); + // Copy formatted result + boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() ); // Proceed to the next match LastMatch=M.end(); @@ -218,7 +218,7 @@ namespace boost { // Adjust search iterator 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() ); // Find range for a next match diff --git a/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp b/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp index 45bcb7d3d..93310d053 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp @@ -92,7 +92,7 @@ namespace boost { // 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 marking the subsequence in the sequence. If the find fails, returns diff --git a/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp b/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp index 673d93a53..01bf5a082 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp @@ -60,14 +60,14 @@ namespace boost { return *this; } - // Match result retrival + // Match result retrieval const match_results_type& match_results() const { return m_MatchResults; } private: - // Saved matchresult + // Saved match result match_results_type m_MatchResults; }; diff --git a/project/jni/boost/include/boost/algorithm/string/find.hpp b/project/jni/boost/include/boost/algorithm/string/find.hpp index 304646d09..da1cb616b 100644 --- a/project/jni/boost/include/boost/algorithm/string/find.hpp +++ b/project/jni/boost/include/boost/algorithm/string/find.hpp @@ -86,7 +86,7 @@ namespace boost { //! 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. \param Input A string which will be searched. @@ -228,13 +228,13 @@ namespace boost { //! Find head algorithm /*! Get the head of the input. Head is a prefix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the head. \param Input An input string \param N Length of the head For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -258,13 +258,13 @@ namespace boost { //! Find tail algorithm /*! Get the tail of the input. Tail is a suffix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the tail. \param Input An input string \param N Length of the tail. For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c RangeT::iterator or @@ -293,7 +293,7 @@ namespace boost { If the "token compress mode" is enabled, adjacent tokens are considered to be one match. \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 \return An \c iterator_range delimiting the match. diff --git a/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp b/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp index b72ba7c78..07a909e16 100644 --- a/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp +++ b/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp @@ -132,7 +132,10 @@ namespace boost { // 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 diff --git a/project/jni/boost/include/boost/algorithm/string/formatter.hpp b/project/jni/boost/include/boost/algorithm/string/formatter.hpp index ab5921e73..c2c13eb2e 100644 --- a/project/jni/boost/include/boost/algorithm/string/formatter.hpp +++ b/project/jni/boost/include/boost/algorithm/string/formatter.hpp @@ -39,7 +39,7 @@ namespace boost { Constructs a \c const_formatter. Const formatter always returns 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. */ template @@ -95,7 +95,7 @@ namespace boost { to extract a portion of the formatted sequence. The first finder's match is returned 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. */ template diff --git a/project/jni/boost/include/boost/algorithm/string/iter_find.hpp b/project/jni/boost/include/boost/algorithm/string/iter_find.hpp index 9e0245f1a..e10652834 100644 --- a/project/jni/boost/include/boost/algorithm/string/iter_find.hpp +++ b/project/jni/boost/include/boost/algorithm/string/iter_find.hpp @@ -60,7 +60,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A Finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ @@ -122,7 +122,7 @@ namespace boost { Each match is used as a separator of segments. These segments are then returned in the result. - \param Result A 'container container' to container the result of search. + \param Result A 'container container' to contain the result of search. Both outer and inner container must have constructor taking a pair of iterators as an argument. Typical type of the result is @@ -131,7 +131,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ diff --git a/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp b/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp index c8319f7ee..a9753fc2a 100644 --- a/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp +++ b/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp @@ -15,7 +15,7 @@ /* \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 composition operators. */ diff --git a/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp b/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp index f698004a3..409afc2ba 100644 --- a/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp +++ b/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp @@ -32,7 +32,7 @@ namespace boost { Construct the \c regex_finder. Finder uses the regex engine to search for a match. 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. \param Rx A regular expression diff --git a/project/jni/boost/include/boost/algorithm/string/trim.hpp b/project/jni/boost/include/boost/algorithm/string/trim.hpp index eb408a35e..be57cd92f 100644 --- a/project/jni/boost/include/boost/algorithm/string/trim.hpp +++ b/project/jni/boost/include/boost/algorithm/string/trim.hpp @@ -50,7 +50,7 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -118,7 +118,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template 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 Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -228,7 +228,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template 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 Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -352,7 +352,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_if(SequenceT& Input, PredicateT IsSpace) diff --git a/project/jni/boost/include/boost/algorithm/string/trim_all.hpp b/project/jni/boost/include/boost/algorithm/string/trim_all.hpp index 70fd0412e..a616f7f33 100644 --- a/project/jni/boost/include/boost/algorithm/string/trim_all.hpp +++ b/project/jni/boost/include/boost/algorithm/string/trim_all.hpp @@ -49,7 +49,7 @@ namespace boost { The result is a trimmed copy of the input \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return A trimmed copy of the input */ template @@ -70,7 +70,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_all_if(SequenceT& Input, PredicateT IsSpace) @@ -126,7 +126,7 @@ namespace boost { \param Input An input sequence \param Fill A string used to fill the inner spaces - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return A trimmed copy of the input */ template @@ -149,7 +149,7 @@ namespace boost { \param Input An input sequence \param Fill A string used to fill the inner spaces - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_fill_if(SequenceT& Input, const RangeT& Fill, PredicateT IsSpace) diff --git a/project/jni/boost/include/boost/algorithm/string_regex.hpp b/project/jni/boost/include/boost/algorithm/string_regex.hpp index 6fd8ad9fa..791aa1848 100644 --- a/project/jni/boost/include/boost/algorithm/string_regex.hpp +++ b/project/jni/boost/include/boost/algorithm/string_regex.hpp @@ -13,7 +13,7 @@ /*! \file 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 diff --git a/project/jni/boost/include/boost/archive/archive_exception.hpp b/project/jni/boost/include/boost/archive/archive_exception.hpp index b5f33f685..e27807bc2 100644 --- a/project/jni/boost/include/boost/archive/archive_exception.hpp +++ b/project/jni/boost/include/boost/archive/archive_exception.hpp @@ -43,6 +43,8 @@ namespace archive { class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : public virtual std::exception { +protected: + char m_buffer[128]; public: typedef enum { no_exception, // initialized without code @@ -74,8 +76,6 @@ public: // type has been instantiated in more than one module. output_stream_error // error on input stream } exception_code; -protected: - std::string m_msg; public: exception_code code; archive_exception( @@ -83,9 +83,11 @@ public: const char * e1 = NULL, const char * e2 = NULL ); - ~archive_exception() throw (); - virtual const char *what( ) const throw(); + virtual ~archive_exception() throw(); + virtual const char *what() const throw(); protected: + unsigned int + append(unsigned int l, const char * a); archive_exception(); }; diff --git a/project/jni/boost/include/boost/archive/basic_archive.hpp b/project/jni/boost/include/boost/archive/basic_archive.hpp index d40848520..c5ac8808e 100644 --- a/project/jni/boost/include/boost/archive/basic_archive.hpp +++ b/project/jni/boost/include/boost/archive/basic_archive.hpp @@ -150,7 +150,8 @@ private: base_type t; public: object_id_type(): t(0) {}; - explicit object_id_type(const unsigned int & t_) : t(t_){ + // note: presumes that size_t >= unsigned int. + explicit object_id_type(const std::size_t & t_) : t(t_){ BOOST_ASSERT(t_ <= boost::integer_traits::const_max); } object_id_type(const object_id_type & t_) : diff --git a/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp b/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp index 19defcb5b..a991ea1dc 100644 --- a/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp +++ b/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include // must be the last header diff --git a/project/jni/boost/include/boost/archive/detail/iserializer.hpp b/project/jni/boost/include/boost/archive/detail/iserializer.hpp index 46033fddf..53765af31 100644 --- a/project/jni/boost/include/boost/archive/detail/iserializer.hpp +++ b/project/jni/boost/include/boost/archive/detail/iserializer.hpp @@ -61,7 +61,7 @@ namespace std{ #define DONT_USE_HAS_NEW_OPERATOR ( \ defined(__BORLANDC__) \ - || defined(__IBMCPP__) \ + || BOOST_WORKAROUND(__IBMCPP__, < 1210) \ || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \ || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ ) diff --git a/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp b/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp index ad6a6d58d..16378b843 100644 --- a/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp +++ b/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp @@ -86,23 +86,21 @@ basic_text_iprimitive::load_binary( ,CharType > binary; - - binary ti_begin = binary( + + binary i = binary( BOOST_MAKE_PFTO_WRAPPER( iterators::istream_iterator(is) ) ); - + char * caddr = static_cast(address); // take care that we don't increment anymore than necessary - while(--count > 0){ - *caddr++ = static_cast(*ti_begin); - ++ti_begin; + while(count-- > 0){ + *caddr++ = static_cast(*i++); } - *caddr++ = static_cast(*ti_begin); - - iterators::istream_iterator i; + + // skip over any excess input for(;;){ BOOST_DEDUCED_TYPENAME IStream::int_type r; r = is.get(); @@ -112,7 +110,7 @@ basic_text_iprimitive::load_binary( break; } } - + template BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_iprimitive::basic_text_iprimitive( diff --git a/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp b/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp index cacab617c..7e4315c0d 100644 --- a/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp +++ b/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp @@ -51,7 +51,7 @@ basic_text_oprimitive::save_binary( 8 > > - ,72 + ,76 ,const char // cwpro8 needs this > base64_text; diff --git a/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp b/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp index 60f23f397..2fe8292f1 100644 --- a/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp +++ b/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp @@ -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,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, 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, diff --git a/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp b/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp index 7d39a35da..2fdd475e1 100644 --- a/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp +++ b/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp @@ -42,8 +42,8 @@ private: > super_t; typedef head_iterator this_t; - typedef BOOST_DEDUCED_TYPENAME super_t::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + typedef super_t::value_type value_type; + typedef super_t::reference reference_type; reference_type dereference_impl(){ if(! m_end){ diff --git a/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp b/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp index 1df612dc8..478f112ff 100644 --- a/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp +++ b/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp @@ -49,16 +49,17 @@ class istream_iterator : > super_t; typedef BOOST_DEDUCED_TYPENAME std::basic_istream istream_type; - //Access the value referred to - Elem dereference() const { - return m_current_value; - } - bool equal(const this_t & rhs) const { // note: only works for comparison against end of stream return m_istream == rhs.m_istream; } +/* + //Access the value referred to + Elem dereference() const { + return m_current_value; + } + void increment(){ if(NULL != m_istream){ m_current_value = static_cast(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; Elem m_current_value; @@ -74,7 +86,7 @@ public: istream_iterator(istream_type & is) : m_istream(& is) { - increment(); + //increment(); } istream_iterator() : diff --git a/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp b/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp index a8e109298..a01049faf 100644 --- a/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp +++ b/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp @@ -24,6 +24,7 @@ #include #include +#include //#include //#if ! BOOST_WORKAROUND(BOOST_MSVC, <=1300) @@ -140,13 +141,19 @@ public: template class remove_whitespace : public filter_iterator< - remove_whitespace_predicate, + remove_whitespace_predicate< + BOOST_DEDUCED_TYPENAME boost::iterator_value::type + //BOOST_DEDUCED_TYPENAME Base::value_type + >, Base > { friend class boost::iterator_core_access; typedef filter_iterator< - remove_whitespace_predicate, + remove_whitespace_predicate< + BOOST_DEDUCED_TYPENAME boost::iterator_value::type + //BOOST_DEDUCED_TYPENAME Base::value_type + >, Base > super_t; public: diff --git a/project/jni/boost/include/boost/archive/iterators/transform_width.hpp b/project/jni/boost/include/boost/archive/iterators/transform_width.hpp index 6e2c52663..5a5c7b757 100644 --- a/project/jni/boost/include/boost/archive/iterators/transform_width.hpp +++ b/project/jni/boost/include/boost/archive/iterators/transform_width.hpp @@ -24,8 +24,6 @@ // character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters // or 3 8 bit characters -#include - #include // for BOOST_DEDUCED_TYPENAME & PTFO #include @@ -66,101 +64,105 @@ class transform_width : typedef transform_width this_t; typedef BOOST_DEDUCED_TYPENAME iterator_value::type base_value_type; - CharType fill(); - - CharType dereference_impl(){ - if(! m_full){ - m_current_value = fill(); - m_full = true; - } - return m_current_value; - } + void fill(); CharType dereference() const { - return const_cast(this)->dereference_impl(); + if(!m_buffer_out_full) + const_cast(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 { - return - this->base_reference() == rhs.base_reference(); - ; + return const_cast(this)->equal_impl(rhs); } void increment(){ - m_displacement += BitsOut; - - 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; + m_buffer_out_full = false; } - CharType m_current_value; - // number of bits left in current input character buffer - unsigned int m_displacement; - base_value_type m_buffer; - // flag to current output character is ready - just used to save time - bool m_full; - // flag to indicate that m_buffer has data - bool m_bufferfull; + bool m_buffer_out_full; + CharType m_buffer_out; + + // last read element from input + base_value_type m_buffer_in; + + // number of bits to left in the input buffer. + unsigned int m_remaining_bits; + + // flag to indicate we've reached end of data. + bool m_end_of_sequence; public: // make composible buy using templated constructor template transform_width(BOOST_PFTO_WRAPPER(T) start) : super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), - m_displacement(0), - m_full(false), - m_bufferfull(false) + m_buffer_out_full(false), + m_remaining_bits(0), + m_end_of_sequence(false) {} // intel 7.1 doesn't like default copy constructor transform_width(const transform_width & rhs) : super_t(rhs.base_reference()), - m_current_value(rhs.m_current_value), - m_displacement(rhs.m_displacement), - m_buffer(rhs.m_buffer), - m_full(rhs.m_full), - m_bufferfull(rhs.m_bufferfull) + m_buffer_out_full(rhs.m_buffer_out_full), + m_remaining_bits(rhs.m_remaining_bits), + m_buffer_in(rhs.m_buffer_in), + m_end_of_sequence(false) {} }; -template -CharType transform_width::fill(){ - CharType retval = 0; +template< + class Base, + int BitsOut, + int BitsIn, + class CharType +> +void transform_width::fill() { unsigned int missing_bits = BitsOut; - for(;;){ - unsigned int bcount; - if(! m_bufferfull){ - m_buffer = * this->base_reference(); - m_bufferfull = true; - bcount = BitsIn; + m_buffer_out = 0; + do{ + if(0 == m_remaining_bits){ + if(m_end_of_sequence){ + m_buffer_in = 0; + m_remaining_bits = missing_bits; + } + else{ + m_buffer_in = * this->base_reference()++; + m_remaining_bits = BitsIn; + } } - else - bcount = BitsIn - m_displacement; - unsigned int i = (std::min)(bcount, missing_bits); + + // append these bits to the next output + // up to the size of the output + unsigned int i = std::min(missing_bits, m_remaining_bits); // shift interesting bits to least significant position - unsigned int j = m_buffer >> (bcount - i); - // strip off uninteresting bits - // (note presumption of two's complement arithmetic) - j &= ~(-(1 << i)); + base_value_type j = m_buffer_in >> (m_remaining_bits - i); + // and mask off the un interesting higher bits + // note presumption of twos complement notation + j &= (1 << i) - 1; // append then interesting bits to the output value - retval <<= i; - retval |= j; + m_buffer_out <<= i; + m_buffer_out |= j; + + // and update counters missing_bits -= i; - if(0 == missing_bits) - break; - // note: suspect that this is not invoked for borland 5.51 - ++(this->base_reference()); - m_bufferfull = false; - } - return retval; + m_remaining_bits -= i; + }while(0 < missing_bits); + m_buffer_out_full = true; } } // namespace iterators diff --git a/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp b/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp index 0e5f4f26b..39e6eb82c 100644 --- a/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp +++ b/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp @@ -127,7 +127,7 @@ public: template struct non_polymorphic { static const boost::serialization::extended_type_info * - get_object_identifier(T & t){ + get_object_identifier(T &){ return & boost::serialization::singleton< BOOST_DEDUCED_TYPENAME boost::serialization::type_info_implementation< T >::type diff --git a/project/jni/boost/include/boost/array.hpp b/project/jni/boost/include/boost/array.hpp index ffb504bdb..fa06fa9a5 100644 --- a/project/jni/boost/include/boost/array.hpp +++ b/project/jni/boost/include/boost/array.hpp @@ -13,6 +13,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * + * 14 Apr 2012 - (mtc) Added support for boost::hash * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. * See or Trac issue #3168 @@ -46,6 +47,7 @@ // Handles broken standard libraries better than #include #include +#include #include // FIXES for broken compilers @@ -118,13 +120,13 @@ namespace boost { // operator[] reference operator[](size_type i) { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } const_reference operator[](size_type i) const { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } @@ -427,6 +429,13 @@ namespace boost { } #endif + + template + std::size_t hash_value(const array& arr) + { + return boost::hash_range(arr.begin(), arr.end()); + } + } /* namespace boost */ diff --git a/project/jni/boost/include/boost/asio/basic_socket.hpp b/project/jni/boost/include/boost/asio/basic_socket.hpp index c9e2045bf..d4c3476b0 100644 --- a/project/jni/boost/include/boost/asio/basic_socket.hpp +++ b/project/jni/boost/include/boost/asio/basic_socket.hpp @@ -843,7 +843,7 @@ public: * ... * boost::asio::ip::tcp::socket::keep_alive option; * socket.get_option(option); - * bool is_set = option.get(); + * bool is_set = option.value(); * @endcode */ template @@ -891,7 +891,7 @@ public: * { * // An error occurred. * } - * bool is_set = option.get(); + * bool is_set = option.value(); * @endcode */ template diff --git a/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp b/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp index 93d1fcd17..6fae0854b 100644 --- a/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp +++ b/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp @@ -53,7 +53,7 @@ basic_socket_streambuf >::member) \ { \ - tie(this); \ + this->setf(std::ios_base::unitbuf); \ if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ @@ -112,7 +112,7 @@ public: basic_socket_streambuf >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); } #if defined(GENERATING_DOCUMENTATION) @@ -131,7 +131,7 @@ public: basic_socket_streambuf >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } diff --git a/project/jni/boost/include/boost/asio/buffered_write_stream.hpp b/project/jni/boost/include/boost/asio/buffered_write_stream.hpp index 9159c237f..11cb87255 100644 --- a/project/jni/boost/include/boost/asio/buffered_write_stream.hpp +++ b/project/jni/boost/include/boost/asio/buffered_write_stream.hpp @@ -232,7 +232,7 @@ public: ? bytes_avail : space_avail; storage_.resize(orig_size + length); std::size_t bytes_copied = boost::asio::buffer_copy( - storage_.data(), buffers_, length); + storage_.data() + orig_size, buffers_, length); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } diff --git a/project/jni/boost/include/boost/asio/buffers_iterator.hpp b/project/jni/boost/include/boost/asio/buffers_iterator.hpp index 66b8cf604..c11e1469d 100644 --- a/project/jni/boost/include/boost/asio/buffers_iterator.hpp +++ b/project/jni/boost/include/boost/asio/buffers_iterator.hpp @@ -128,7 +128,7 @@ public: /// Construct an iterator representing the beginning of the buffers' data. static buffers_iterator begin(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -148,7 +148,7 @@ public: /// Construct an iterator representing the end of the buffers' data. static buffers_iterator end(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; diff --git a/project/jni/boost/include/boost/asio/detail/atomic_count.hpp b/project/jni/boost/include/boost/asio/detail/atomic_count.hpp index 9324fffa6..5e0051a22 100644 --- a/project/jni/boost/include/boost/asio/detail/atomic_count.hpp +++ b/project/jni/boost/include/boost/asio/detail/atomic_count.hpp @@ -31,10 +31,13 @@ namespace detail { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) typedef long atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } #elif defined(BOOST_ASIO_HAS_STD_ATOMIC) typedef std::atomic atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } #else // defined(BOOST_ASIO_HAS_STD_ATOMIC) typedef boost::detail::atomic_count atomic_count; +inline void increment(atomic_count& a, long b) { while (b > 0) ++a, --b; } #endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) } // namespace detail diff --git a/project/jni/boost/include/boost/asio/detail/call_stack.hpp b/project/jni/boost/include/boost/asio/detail/call_stack.hpp index db4cd1ed6..ac5322923 100644 --- a/project/jni/boost/include/boost/asio/detail/call_stack.hpp +++ b/project/jni/boost/include/boost/asio/detail/call_stack.hpp @@ -102,6 +102,13 @@ public: return 0; } + // Obtain the value at the top of the stack. + static Value* top() + { + context* elem = top_; + return elem ? elem->value_ : 0; + } + private: // The top of the stack of calls for the current thread. static tss_ptr top_; diff --git a/project/jni/boost/include/boost/asio/detail/config.hpp b/project/jni/boost/include/boost/asio/detail/config.hpp index 3f2314db9..40f770caf 100644 --- a/project/jni/boost/include/boost/asio/detail/config.hpp +++ b/project/jni/boost/include/boost/asio/detail/config.hpp @@ -112,6 +112,22 @@ # endif // defined(__GNUC__) #endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) +// Compliant C++11 compilers put noexcept specifiers on error_category members. +#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# if (BOOST_VERSION >= 105300) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT +# endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +#endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) + // Standard library support for arrays. #if !defined(BOOST_ASIO_DISABLE_STD_ARRAY) # if defined(__GNUC__) @@ -163,7 +179,9 @@ # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) # if defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_ASIO_HAS_STD_CHRONO -# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) # endif // defined(__GXX_EXPERIMENTAL_CXX0X__) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) # endif // defined(__GNUC__) @@ -355,4 +373,28 @@ # endif // !defined(UNDER_CE) #endif // !defined(BOOST_ASIO_DISABLE_SIGNAL) +// Support for the __thread keyword extension. +#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +# if defined(__linux__) +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# if !defined(__INTEL_COMPILER) && !defined(__ICL) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# endif // defined(__linux__) +#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) + +// Support for POSIX ssize_t typedef. +#if !defined(BOOST_ASIO_DISABLE_SSIZE_T) +# if defined(__linux__) \ + || (defined(__MACH__) && defined(__APPLE__)) +# define BOOST_ASIO_HAS_SSIZE_T 1 +# endif // defined(__linux__) + // || (defined(__MACH__) && defined(__APPLE__)) +#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T) + #endif // BOOST_ASIO_DETAIL_CONFIG_HPP diff --git a/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp b/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp index 72ea6e2f2..425cfc4f3 100644 --- a/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp +++ b/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp @@ -88,9 +88,9 @@ BOOST_ASIO_DECL bool non_blocking_write(int d, BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd, ioctl_arg_type* arg, boost::system::error_code& ec); -BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec); +BOOST_ASIO_DECL int fcntl(int d, int cmd, boost::system::error_code& ec); -BOOST_ASIO_DECL int fcntl(int d, long cmd, +BOOST_ASIO_DECL int fcntl(int d, int cmd, long arg, boost::system::error_code& ec); BOOST_ASIO_DECL int poll_read(int d, diff --git a/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp b/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp index 2d26644ca..8f66f74b1 100644 --- a/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp +++ b/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_EPOLL) +#include #include #include #include @@ -59,6 +60,7 @@ public: mutex mutex_; epoll_reactor* reactor_; int descriptor_; + boost::uint32_t registered_events_; op_queue op_queue_[max_ops]; bool shutdown_; diff --git a/project/jni/boost/include/boost/asio/detail/fenced_block.hpp b/project/jni/boost/include/boost/asio/detail/fenced_block.hpp index 36e288481..d9e8a04e8 100644 --- a/project/jni/boost/include/boost/asio/detail/fenced_block.hpp +++ b/project/jni/boost/include/boost/asio/detail/fenced_block.hpp @@ -25,7 +25,8 @@ # include #elif defined(__sun) # include -#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) # include #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) # include @@ -34,8 +35,7 @@ #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ - && !defined(ANDROID) && !defined(__ANDROID__) + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) # include #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) # include @@ -55,7 +55,8 @@ typedef null_fenced_block fenced_block; typedef macos_fenced_block fenced_block; #elif defined(__sun) typedef solaris_fenced_block fenced_block; -#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) typedef gcc_arm_fenced_block fenced_block; #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) typedef gcc_hppa_fenced_block fenced_block; @@ -64,8 +65,7 @@ typedef gcc_x86_fenced_block fenced_block; #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ - && !defined(ANDROID) && !defined(__ANDROID__) + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) typedef gcc_sync_fenced_block fenced_block; #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) typedef win_fenced_block fenced_block; diff --git a/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp b/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp index b416b50d5..973165ab1 100644 --- a/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp @@ -40,17 +40,17 @@ public: // Constructor for a full fenced block. explicit gcc_x86_fenced_block(full_t) { - barrier1(); + lbarrier(); } // Destructor. ~gcc_x86_fenced_block() { - barrier2(); + sbarrier(); } private: - static int barrier1() + static int barrier() { int r = 0, m = 1; __asm__ __volatile__ ( @@ -61,12 +61,21 @@ private: return r; } - static void barrier2() + static void lbarrier() { #if defined(__SSE2__) - __asm__ __volatile__ ("mfence" ::: "memory"); + __asm__ __volatile__ ("lfence" ::: "memory"); #else // defined(__SSE2__) - barrier1(); + barrier(); +#endif // defined(__SSE2__) + } + + static void sbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("sfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); #endif // defined(__SSE2__) } }; diff --git a/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp b/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp index 6c3528f30..9d41cde38 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp @@ -183,7 +183,8 @@ std::size_t sync_read(int d, state_type state, buf* bufs, { // Try to complete the operation without blocking. errno = 0; - int bytes = error_wrapper(::readv(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::readv( + d, bufs, static_cast(count)), ec); // Check if operation succeeded. if (bytes > 0) @@ -215,7 +216,8 @@ bool non_blocking_read(int d, buf* bufs, std::size_t count, { // Read some data. errno = 0; - int bytes = error_wrapper(::readv(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::readv( + d, bufs, static_cast(count)), ec); // Check for end of stream. if (bytes == 0) @@ -267,7 +269,8 @@ std::size_t sync_write(int d, state_type state, const buf* bufs, { // Try to complete the operation without blocking. errno = 0; - int bytes = error_wrapper(::writev(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::writev( + d, bufs, static_cast(count)), ec); // Check if operation succeeded. if (bytes > 0) @@ -292,7 +295,8 @@ bool non_blocking_write(int d, const buf* bufs, std::size_t count, { // Write some data. errno = 0; - int bytes = error_wrapper(::writev(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::writev( + d, bufs, static_cast(count)), ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -357,7 +361,7 @@ int ioctl(int d, state_type& state, long cmd, return result; } -int fcntl(int d, long cmd, boost::system::error_code& ec) +int fcntl(int d, int cmd, boost::system::error_code& ec) { if (d == -1) { @@ -372,7 +376,7 @@ int fcntl(int d, long cmd, boost::system::error_code& ec) return result; } -int fcntl(int d, long cmd, long arg, boost::system::error_code& ec) +int fcntl(int d, int cmd, long arg, boost::system::error_code& ec) { if (d == -1) { diff --git a/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp b/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp index 771edea67..073bd0882 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp @@ -127,7 +127,7 @@ void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) for (descriptor_state* state = registered_descriptors_.first(); state != 0; state = state->next_) { - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = state->registered_events_; ev.data.ptr = state; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); if (result != 0) @@ -159,7 +159,8 @@ int epoll_reactor::register_descriptor(socket_type descriptor, } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -184,7 +185,8 @@ int epoll_reactor::register_internal_descriptor( } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -222,23 +224,47 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, if (descriptor_data->op_queue_[op_type].empty()) { - if (allow_speculative) + if (allow_speculative + && (op_type != read_op + || descriptor_data->op_queue_[except_op].empty())) { - if (op_type != read_op || descriptor_data->op_queue_[except_op].empty()) + if (op->perform()) { - if (op->perform()) + descriptor_lock.unlock(); + io_service_.post_immediate_completion(op); + return; + } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) { - descriptor_lock.unlock(); - io_service_.post_immediate_completion(op); - return; + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op); + return; + } } } } else { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP - | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = descriptor_data->registered_events_; ev.data.ptr = descriptor_data; epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); } @@ -440,7 +466,7 @@ int epoll_reactor::do_epoll_create() errno = EINVAL; #endif // defined(EPOLL_CLOEXEC) - if (fd == -1 && errno == EINVAL) + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) { fd = epoll_create(epoll_size); if (fd != -1) diff --git a/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp b/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp index a819eb9b7..30dd0aa7a 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp @@ -367,7 +367,7 @@ void kqueue_reactor::run(bool block, op_queue& ops) // Dispatch the waiting events. for (int i = 0; i < num_events; ++i) { - int descriptor = events[i].ident; + int descriptor = static_cast(events[i].ident); void* ptr = reinterpret_cast(events[i].udata); if (ptr == &interrupter_) { @@ -397,7 +397,8 @@ void kqueue_reactor::run(bool block, op_queue& ops) { if (events[i].flags & EV_ERROR) { - op->ec_ = boost::system::error_code(events[i].data, + op->ec_ = boost::system::error_code( + static_cast(events[i].data), boost::asio::error::get_system_category()); descriptor_data->op_queue_[j].pop(); ops.push(op); diff --git a/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp b/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp index 75a8d16a4..7b02236e0 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -90,7 +91,7 @@ void pipe_select_interrupter::recreate() void pipe_select_interrupter::interrupt() { char byte = 0; - int result = ::write(write_descriptor_, &byte, 1); + signed_size_type result = ::write(write_descriptor_, &byte, 1); (void)result; } @@ -99,7 +100,7 @@ bool pipe_select_interrupter::reset() for (;;) { char data[1024]; - int bytes_read = ::read(read_descriptor_, data, sizeof(data)); + signed_size_type bytes_read = ::read(read_descriptor_, data, sizeof(data)); if (bytes_read < 0 && errno == EINTR) continue; bool was_interrupted = (bytes_read > 0); diff --git a/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp b/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp index 08eae05c8..6500b85a7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp @@ -21,6 +21,7 @@ #include #include +#include #include diff --git a/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp index 0b57007a9..b317b862b 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp @@ -64,7 +64,7 @@ void asio_signal_handler(int signal_number) #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) int saved_errno = errno; signal_state* state = get_signal_state(); - int result = ::write(state->write_descriptor_, + signed_size_type result = ::write(state->write_descriptor_, &signal_number, sizeof(signal_number)); (void)result; errno = saved_errno; diff --git a/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp b/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp index 24d2d66ad..cda0bf0b6 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -669,8 +670,8 @@ inline void init_msghdr_msg_name(T& name, const socket_addr_type* addr) name = reinterpret_cast(const_cast(addr)); } -int recv(socket_type s, buf* bufs, size_t count, int flags, - boost::system::error_code& ec) +signed_size_type recv(socket_type s, buf* bufs, size_t count, + int flags, boost::system::error_code& ec) { clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) @@ -691,8 +692,8 @@ int recv(socket_type s, buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -719,7 +720,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recv(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec); // Check if operation succeeded. if (bytes > 0) @@ -781,7 +782,7 @@ bool non_blocking_recv(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recv(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec); // Check for end of stream. if (is_stream && bytes == 0) @@ -814,8 +815,8 @@ bool non_blocking_recv(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int recvfrom(socket_type s, buf* bufs, size_t count, int flags, - socket_addr_type* addr, std::size_t* addrlen, +signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, + int flags, socket_addr_type* addr, std::size_t* addrlen, boost::system::error_code& ec) { clear_last_error(); @@ -839,10 +840,10 @@ int recvfrom(socket_type s, buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); init_msghdr_msg_name(msg.msg_name, addr); - msg.msg_namelen = *addrlen; + msg.msg_namelen = static_cast(*addrlen); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec); *addrlen = msg.msg_namelen; if (result >= 0) ec = boost::system::error_code(); @@ -864,7 +865,8 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recvfrom(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::recvfrom( + s, bufs, count, flags, addr, addrlen, ec); // Check if operation succeeded. if (bytes >= 0) @@ -912,7 +914,8 @@ bool non_blocking_recvfrom(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recvfrom(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::recvfrom( + s, bufs, count, flags, addr, addrlen, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -938,7 +941,7 @@ bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int recvmsg(socket_type s, buf* bufs, size_t count, +signed_size_type recvmsg(socket_type s, buf* bufs, size_t count, int in_flags, int& out_flags, boost::system::error_code& ec) { clear_last_error(); @@ -948,8 +951,8 @@ int recvmsg(socket_type s, buf* bufs, size_t count, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); if (result >= 0) { ec = boost::system::error_code(); @@ -975,7 +978,8 @@ size_t sync_recvmsg(socket_type s, state_type state, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + signed_size_type bytes = socket_ops::recvmsg( + s, bufs, count, in_flags, out_flags, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1022,7 +1026,8 @@ bool non_blocking_recvmsg(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + signed_size_type bytes = socket_ops::recvmsg( + s, bufs, count, in_flags, out_flags, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1048,8 +1053,8 @@ bool non_blocking_recvmsg(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int send(socket_type s, const buf* bufs, size_t count, int flags, - boost::system::error_code& ec) +signed_size_type send(socket_type s, const buf* bufs, size_t count, + int flags, boost::system::error_code& ec) { clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) @@ -1070,11 +1075,11 @@ int send(socket_type s, const buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = const_cast(bufs); - msg.msg_iovlen = count; + msg.msg_iovlen = static_cast(count); #if defined(__linux__) flags |= MSG_NOSIGNAL; #endif // defined(__linux__) - int result = error_wrapper(::sendmsg(s, &msg, flags), ec); + signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -1101,7 +1106,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::send(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::send(s, bufs, count, flags, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1148,7 +1153,7 @@ bool non_blocking_send(socket_type s, for (;;) { // Write some data. - int bytes = socket_ops::send(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::send(s, bufs, count, flags, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1174,8 +1179,8 @@ bool non_blocking_send(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int sendto(socket_type s, const buf* bufs, size_t count, int flags, - const socket_addr_type* addr, std::size_t addrlen, +signed_size_type sendto(socket_type s, const buf* bufs, size_t count, + int flags, const socket_addr_type* addr, std::size_t addrlen, boost::system::error_code& ec) { clear_last_error(); @@ -1197,13 +1202,13 @@ int sendto(socket_type s, const buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); init_msghdr_msg_name(msg.msg_name, addr); - msg.msg_namelen = addrlen; + msg.msg_namelen = static_cast(addrlen); msg.msg_iov = const_cast(bufs); - msg.msg_iovlen = count; + msg.msg_iovlen = static_cast(count); #if defined(__linux__) flags |= MSG_NOSIGNAL; #endif // defined(__linux__) - int result = error_wrapper(::sendmsg(s, &msg, flags), ec); + signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -1224,7 +1229,8 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::sendto(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::sendto( + s, bufs, count, flags, addr, addrlen, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1252,7 +1258,8 @@ bool non_blocking_sendto(socket_type s, for (;;) { // Write some data. - int bytes = socket_ops::sendto(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::sendto( + s, bufs, count, flags, addr, addrlen, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1867,7 +1874,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, return result == socket_error_retval ? 0 : dest; #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - const char* result = error_wrapper(::inet_ntop(af, src, dest, length), ec); + const char* result = error_wrapper(::inet_ntop( + af, src, dest, static_cast(length)), ec); if (result == 0 && !ec) ec = boost::asio::error::invalid_argument; if (result != 0 && af == AF_INET6 && scope_id != 0) @@ -1877,7 +1885,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, const in6_addr_type* ipv6_address = static_cast(src); bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); - if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) + if (!is_link_local + || if_indextoname(static_cast(scope_id), if_name + 1) == 0) sprintf(if_name + 1, "%lu", scope_id); strcat(dest, if_name); } diff --git a/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp index 1d98d9905..7581852ff 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp @@ -50,11 +50,6 @@ struct strand_service::on_dispatch_exit } }; -inline void strand_service::destroy(strand_service::implementation_type& impl) -{ - impl = 0; -} - template void strand_service::dispatch(strand_service::implementation_type& impl, Handler handler) diff --git a/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp index 64e4cc00c..1912d80f7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp @@ -38,7 +38,7 @@ struct strand_service::on_do_complete_exit impl_->mutex_.unlock(); if (more_handlers) - owner_->post_immediate_completion(impl_); + owner_->post_private_immediate_completion(impl_); } }; diff --git a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp index 7cd7449e6..2cc7b7eea 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp @@ -45,7 +45,7 @@ void task_io_service::dispatch(Handler handler) BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); - post_immediate_completion(p.p); + post_non_private_immediate_completion(p.p); p.v = p.p = 0; } } diff --git a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp index 3d679c2dc..cb7311634 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -34,44 +35,55 @@ struct task_io_service::task_cleanup { ~task_cleanup() { + if (this_thread_->private_outstanding_work > 0) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work); + } + this_thread_->private_outstanding_work = 0; + // Enqueue the completed operations and reinsert the task at the end of // the operation queue. lock_->lock(); task_io_service_->task_interrupted_ = true; - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); task_io_service_->op_queue_.push(&task_io_service_->task_operation_); } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue* ops_; + thread_info* this_thread_; }; struct task_io_service::work_cleanup { ~work_cleanup() { - task_io_service_->work_finished(); + if (this_thread_->private_outstanding_work > 1) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work - 1); + } + else if (this_thread_->private_outstanding_work < 1) + { + task_io_service_->work_finished(); + } + this_thread_->private_outstanding_work = 0; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - if (!ops_->empty()) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (!this_thread_->private_op_queue.empty()) { lock_->lock(); - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue* ops_; -}; - -struct task_io_service::thread_info -{ - event* wakeup_event; - op_queue* private_op_queue; - thread_info* next; + thread_info* this_thread_; }; task_io_service::task_io_service( @@ -131,19 +143,14 @@ std::size_t task_io_service::run(boost::system::error_code& ec) thread_info this_thread; event wakeup_event; this_thread.wakeup_event = &wakeup_event; - op_queue private_op_queue; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = one_thread_ == 1 ? &private_op_queue : 0; -#else // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = 0; -#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); std::size_t n = 0; - for (; do_run_one(lock, this_thread, private_op_queue, ec); lock.lock()) + for (; do_run_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits::max)()) ++n; return n; @@ -161,14 +168,13 @@ std::size_t task_io_service::run_one(boost::system::error_code& ec) thread_info this_thread; event wakeup_event; this_thread.wakeup_event = &wakeup_event; - op_queue private_op_queue; - this_thread.private_op_queue = 0; + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_run_one(lock, this_thread, private_op_queue, ec); + return do_run_one(lock, this_thread, ec); } std::size_t task_io_service::poll(boost::system::error_code& ec) @@ -182,29 +188,23 @@ std::size_t task_io_service::poll(boost::system::error_code& ec) thread_info this_thread; this_thread.wakeup_event = 0; - op_queue private_op_queue; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = one_thread_ == 1 ? &private_op_queue : 0; -#else // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = 0; -#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) // We want to support nested calls to poll() and poll_one(), so any handlers // that are already on a thread-private queue need to be put on to the main // queue now. if (one_thread_) if (thread_info* outer_thread_info = ctx.next_by_key()) - if (outer_thread_info->private_op_queue) - op_queue_.push(*outer_thread_info->private_op_queue); + op_queue_.push(outer_thread_info->private_op_queue); #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) std::size_t n = 0; - for (; do_poll_one(lock, private_op_queue, ec); lock.lock()) + for (; do_poll_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits::max)()) ++n; return n; @@ -221,24 +221,22 @@ std::size_t task_io_service::poll_one(boost::system::error_code& ec) thread_info this_thread; this_thread.wakeup_event = 0; - op_queue private_op_queue; - this_thread.private_op_queue = 0; + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) // We want to support nested calls to poll() and poll_one(), so any handlers // that are already on a thread-private queue need to be put on to the main // queue now. if (one_thread_) if (thread_info* outer_thread_info = ctx.next_by_key()) - if (outer_thread_info->private_op_queue) - op_queue_.push(*outer_thread_info->private_op_queue); + op_queue_.push(outer_thread_info->private_op_queue); #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - return do_poll_one(lock, private_op_queue, ec); + return do_poll_one(lock, this_thread, ec); } void task_io_service::stop() @@ -261,22 +259,33 @@ void task_io_service::reset() void task_io_service::post_immediate_completion(task_io_service::operation* op) { - work_started(); - post_deferred_completion(op); -} - -void task_io_service::post_deferred_completion(task_io_service::operation* op) -{ -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) if (one_thread_) { if (thread_info* this_thread = thread_call_stack::contains(this)) { - if (this_thread->private_op_queue) - { - this_thread->private_op_queue->push(op); - return; - } + ++this_thread->private_outstanding_work; + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + work_started(); + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_deferred_completion(task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; } } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) @@ -291,16 +300,13 @@ void task_io_service::post_deferred_completions( { if (!ops.empty()) { -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) if (one_thread_) { if (thread_info* this_thread = thread_call_stack::contains(this)) { - if (this_thread->private_op_queue) - { - this_thread->private_op_queue->push(ops); - return; - } + this_thread->private_op_queue.push(ops); + return; } } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) @@ -311,6 +317,44 @@ void task_io_service::post_deferred_completions( } } +void task_io_service::post_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_private_deferred_completion(op); +} + +void task_io_service::post_private_deferred_completion( + task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_non_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_non_private_deferred_completion(op); +} + +void task_io_service::post_non_private_deferred_completion( + task_io_service::operation* op) +{ + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + void task_io_service::abandon_operations( op_queue& ops) { @@ -320,7 +364,7 @@ void task_io_service::abandon_operations( std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, task_io_service::thread_info& this_thread, - op_queue& private_op_queue, const boost::system::error_code& ec) + const boost::system::error_code& ec) { while (!stopped_) { @@ -343,14 +387,13 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, else lock.unlock(); - op_queue completed_ops; - task_cleanup on_exit = { this, &lock, &completed_ops }; + task_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(!more_handlers, completed_ops); + task_->run(!more_handlers, this_thread.private_op_queue); } else { @@ -362,7 +405,7 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_cleanup on_exit = { this, &lock, &private_op_queue }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Complete the operation. May throw an exception. Deletes the object. @@ -385,7 +428,8 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, } std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, - op_queue& private_op_queue, const boost::system::error_code& ec) + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) { if (stopped_) return 0; @@ -397,14 +441,13 @@ std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, lock.unlock(); { - op_queue completed_ops; - task_cleanup c = { this, &lock, &completed_ops }; + task_cleanup c = { this, &lock, &this_thread }; (void)c; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(false, completed_ops); + task_->run(false, this_thread.private_op_queue); } o = op_queue_.front(); @@ -426,7 +469,7 @@ std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_cleanup on_exit = { this, &lock, &private_op_queue }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Complete the operation. May throw an exception. Deletes the object. diff --git a/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp b/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp deleted file mode 100644 index c4d9ea34a..000000000 --- a/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp +++ /dev/null @@ -1,87 +0,0 @@ -// -// detail/impl/timer_queue.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP -#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include - -#if !defined(BOOST_ASIO_HEADER_ONLY) - -#include - -#include - -namespace boost { -namespace asio { -namespace detail { - -timer_queue >::timer_queue() -{ -} - -timer_queue >::~timer_queue() -{ -} - -bool timer_queue >::enqueue_timer( - const time_type& time, per_timer_data& timer, timer_op* op) -{ - return impl_.enqueue_timer(time, timer, op); -} - -bool timer_queue >::empty() const -{ - return impl_.empty(); -} - -long timer_queue >::wait_duration_msec( - long max_duration) const -{ - return impl_.wait_duration_msec(max_duration); -} - -long timer_queue >::wait_duration_usec( - long max_duration) const -{ - return impl_.wait_duration_usec(max_duration); -} - -void timer_queue >::get_ready_timers( - op_queue& ops) -{ - impl_.get_ready_timers(ops); -} - -void timer_queue >::get_all_timers( - op_queue& ops) -{ - impl_.get_all_timers(ops); -} - -std::size_t timer_queue >::cancel_timer( - per_timer_data& timer, op_queue& ops, std::size_t max_cancelled) -{ - return impl_.cancel_timer(timer, ops, max_cancelled); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include - -#endif // !defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp index 871f6fa2e..5a522356a 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp @@ -33,7 +33,7 @@ namespace detail { template void win_iocp_io_service::dispatch(Handler handler) { - if (call_stack::contains(this)) + if (thread_call_stack::contains(this)) { fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp index 72f4af752..72adb40e1 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -68,6 +68,7 @@ win_iocp_io_service::win_iocp_io_service( iocp_(), outstanding_work_(0), stopped_(0), + stop_event_posted_(0), shutdown_(0), dispatch_required_(0) { @@ -148,12 +149,13 @@ size_t win_iocp_io_service::run(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); size_t n = 0; while (do_one(true, ec)) @@ -166,12 +168,13 @@ size_t win_iocp_io_service::run_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); return do_one(true, ec); } @@ -180,12 +183,13 @@ size_t win_iocp_io_service::poll(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); size_t n = 0; while (do_one(false, ec)) @@ -198,12 +202,13 @@ size_t win_iocp_io_service::poll_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); return do_one(false, ec); } @@ -212,12 +217,15 @@ void win_iocp_io_service::stop() { if (::InterlockedExchange(&stopped_, 1) == 0) { - if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + if (::InterlockedExchange(&stop_event_posted_, 1) == 0) { - DWORD last_error = ::GetLastError(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - boost::asio::detail::throw_error(ec, "pqcs"); + if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "pqcs"); + } } } } @@ -421,17 +429,23 @@ size_t win_iocp_io_service::do_one(bool block, boost::system::error_code& ec) } else { + // Indicate that there is no longer an in-flight stop event. + ::InterlockedExchange(&stop_event_posted_, 0); + // The stopped_ flag is always checked to ensure that any leftover - // interrupts from a previous run invocation are ignored. + // stop events from a previous run invocation are ignored. if (::InterlockedExchangeAdd(&stopped_, 0) != 0) { // Wake up next thread that is blocked on GetQueuedCompletionStatus. - if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + if (::InterlockedExchange(&stop_event_posted_, 1) == 0) { - last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return 0; + if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + { + last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + return 0; + } } ec = boost::system::error_code(); diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp b/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp index 3ec104da2..dcd61a0d7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp @@ -43,11 +43,11 @@ int win_static_mutex::do_init() using namespace std; // For sprintf. wchar_t mutex_name[128]; #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - swprintf_s(mutex_name, 128, + swprintf_s( #else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - swprintf(mutex_name, + _snwprintf( #endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", + mutex_name, 128, L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", static_cast(::GetCurrentProcessId()), this); HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); diff --git a/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp b/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp new file mode 100644 index 000000000..10dd01a1f --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp @@ -0,0 +1,72 @@ +// +// detail/keyword_tss_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP +#define BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +template +class keyword_tss_ptr + : private noncopyable +{ +public: + // Constructor. + keyword_tss_ptr() + { + } + + // Destructor. + ~keyword_tss_ptr() + { + } + + // Get the value. + operator T*() const + { + return value_; + } + + // Set the value. + void operator=(T* value) + { + value_ = value; + } + +private: + static __thread T* value_; +}; + +template +__thread T* keyword_tss_ptr::value_; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#endif // BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP diff --git a/project/jni/boost/include/boost/asio/detail/socket_ops.hpp b/project/jni/boost/include/boost/asio/detail/socket_ops.hpp index b353316fe..92af9fbe2 100644 --- a/project/jni/boost/include/boost/asio/detail/socket_ops.hpp +++ b/project/jni/boost/include/boost/asio/detail/socket_ops.hpp @@ -129,8 +129,8 @@ BOOST_ASIO_DECL void init_buf(buf& b, void* data, size_t size); BOOST_ASIO_DECL void init_buf(buf& b, const void* data, size_t size); -BOOST_ASIO_DECL int recv(socket_type s, buf* bufs, size_t count, int flags, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recv(socket_type s, buf* bufs, + size_t count, int flags, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recv(socket_type s, state_type state, buf* bufs, size_t count, int flags, bool all_empty, boost::system::error_code& ec); @@ -149,9 +149,9 @@ BOOST_ASIO_DECL bool non_blocking_recv(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int recvfrom(socket_type s, buf* bufs, size_t count, int flags, - socket_addr_type* addr, std::size_t* addrlen, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recvfrom(socket_type s, buf* bufs, + size_t count, int flags, socket_addr_type* addr, + std::size_t* addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, size_t count, int flags, socket_addr_type* addr, @@ -172,8 +172,9 @@ BOOST_ASIO_DECL bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int recvmsg(socket_type s, buf* bufs, size_t count, - int in_flags, int& out_flags, boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recvmsg(socket_type s, buf* bufs, + size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recvmsg(socket_type s, state_type state, buf* bufs, size_t count, int in_flags, int& out_flags, @@ -193,7 +194,7 @@ BOOST_ASIO_DECL bool non_blocking_recvmsg(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int send(socket_type s, const buf* bufs, +BOOST_ASIO_DECL signed_size_type send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_send(socket_type s, state_type state, @@ -214,9 +215,9 @@ BOOST_ASIO_DECL bool non_blocking_send(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int sendto(socket_type s, const buf* bufs, size_t count, - int flags, const socket_addr_type* addr, std::size_t addrlen, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type sendto(socket_type s, const buf* bufs, + size_t count, int flags, const socket_addr_type* addr, + std::size_t addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_sendto(socket_type s, state_type state, const buf* bufs, size_t count, int flags, const socket_addr_type* addr, diff --git a/project/jni/boost/include/boost/asio/detail/socket_types.hpp b/project/jni/boost/include/boost/asio/detail/socket_types.hpp index af758f512..7285daa7b 100644 --- a/project/jni/boost/include/boost/asio/detail/socket_types.hpp +++ b/project/jni/boost/include/boost/asio/detail/socket_types.hpp @@ -107,6 +107,7 @@ typedef addrinfo addrinfo_type; typedef unsigned long ioctl_arg_type; typedef u_long u_long_type; typedef u_short u_short_type; +typedef int signed_size_type; const int shutdown_receive = SD_RECEIVE; const int shutdown_send = SD_SEND; const int shutdown_both = SD_BOTH; @@ -156,6 +157,11 @@ typedef addrinfo addrinfo_type; typedef int ioctl_arg_type; typedef uint32_t u_long_type; typedef uint16_t u_short_type; +#if defined(BOOST_ASIO_HAS_SSIZE_T) +typedef ssize_t signed_size_type; +#else // defined(BOOST_ASIO_HAS_SSIZE_T) +typedef int signed_size_type; +#endif // defined(BOOST_ASIO_HAS_SSIZE_T) const int shutdown_receive = SHUT_RD; const int shutdown_send = SHUT_WR; const int shutdown_both = SHUT_RDWR; diff --git a/project/jni/boost/include/boost/asio/detail/strand_service.hpp b/project/jni/boost/include/boost/asio/detail/strand_service.hpp index 420634658..3a271b50d 100644 --- a/project/jni/boost/include/boost/asio/detail/strand_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/strand_service.hpp @@ -84,9 +84,6 @@ public: // Construct a new strand implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); - // Destroy a strand implementation. - void destroy(implementation_type& impl); - // Request the io_service to invoke the given handler. template void dispatch(implementation_type& impl, Handler handler); diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service.hpp index 7a0bcc570..72abc9428 100644 --- a/project/jni/boost/include/boost/asio/detail/task_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/task_io_service.hpp @@ -112,23 +112,41 @@ public: // that work_started() was previously called for each operation. BOOST_ASIO_DECL void post_deferred_completions(op_queue& ops); + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // has not yet been called for the operation. + BOOST_ASIO_DECL void post_private_immediate_completion(operation* op); + + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // was previously called for the operation. + BOOST_ASIO_DECL void post_private_deferred_completion(operation* op); + // Process unfinished operations as part of a shutdown_service operation. // Assumes that work_started() was previously called for the operations. BOOST_ASIO_DECL void abandon_operations(op_queue& ops); private: // Structure containing information about an idle thread. - struct thread_info; + typedef task_io_service_thread_info thread_info; - // Run at most one operation. Blocks only if this_idle_thread is non-null. + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() has not yet + // been called for the operation. + BOOST_ASIO_DECL void post_non_private_immediate_completion(operation* op); + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() was previously + // called for the operation. + BOOST_ASIO_DECL void post_non_private_deferred_completion(operation* op); + + // Run at most one operation. May block. BOOST_ASIO_DECL std::size_t do_run_one(mutex::scoped_lock& lock, - thread_info& this_thread, op_queue& private_op_queue, - const boost::system::error_code& ec); + thread_info& this_thread, const boost::system::error_code& ec); // Poll for at most one operation. BOOST_ASIO_DECL std::size_t do_poll_one(mutex::scoped_lock& lock, - op_queue& private_op_queue, - const boost::system::error_code& ec); + thread_info& this_thread, const boost::system::error_code& ec); // Stop the task and all idle threads. BOOST_ASIO_DECL void stop_all_threads(mutex::scoped_lock& lock); diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp index 4aa0ec364..dbc5f2cb7 100644 --- a/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp +++ b/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp @@ -20,6 +20,8 @@ namespace asio { namespace detail { class task_io_service; +class task_io_service_operation; +struct task_io_service_thread_info; } // namespace detail } // namespace asio diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp new file mode 100644 index 000000000..12775f194 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp @@ -0,0 +1,43 @@ +// +// detail/task_io_service_thread_info.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP +#define BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +struct task_io_service_thread_info : public thread_info_base +{ + event* wakeup_event; + op_queue private_op_queue; + long private_outstanding_work; + task_io_service_thread_info* next; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP diff --git a/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp b/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp new file mode 100644 index 000000000..c93bce3b5 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp @@ -0,0 +1,93 @@ +// +// detail/thread_info_base.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP +#define BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +class thread_info_base + : private noncopyable +{ +public: + thread_info_base() + : reusable_memory_(0) + { + } + + ~thread_info_base() + { + if (reusable_memory_) + ::operator delete(reusable_memory_); + } + + static void* allocate(thread_info_base* this_thread, std::size_t size) + { + if (this_thread && this_thread->reusable_memory_) + { + void* const pointer = this_thread->reusable_memory_; + this_thread->reusable_memory_ = 0; + + unsigned char* const mem = static_cast(pointer); + if (static_cast(mem[0]) >= size) + { + mem[size] = mem[0]; + return pointer; + } + + ::operator delete(pointer); + } + + void* const pointer = ::operator new(size + 1); + unsigned char* const mem = static_cast(pointer); + mem[size] = (size <= UCHAR_MAX) ? static_cast(size) : 0; + return pointer; + } + + static void deallocate(thread_info_base* this_thread, + void* pointer, std::size_t size) + { + if (size <= UCHAR_MAX) + { + if (this_thread && this_thread->reusable_memory_ == 0) + { + unsigned char* const mem = static_cast(pointer); + mem[0] = mem[size]; + this_thread->reusable_memory_ = pointer; + return; + } + } + + ::operator delete(pointer); + } + +private: + void* reusable_memory_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP diff --git a/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp b/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp index cdb09e71b..d14a95944 100644 --- a/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp +++ b/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp @@ -19,6 +19,8 @@ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) # include +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) +# include #elif defined(BOOST_WINDOWS) # include #elif defined(BOOST_HAS_PTHREADS) @@ -37,6 +39,8 @@ template class tss_ptr #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) : public null_tss_ptr +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + : public keyword_tss_ptr #elif defined(BOOST_WINDOWS) : public win_tss_ptr #elif defined(BOOST_HAS_PTHREADS) @@ -48,6 +52,8 @@ public: { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) null_tss_ptr::operator=(value); +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + keyword_tss_ptr::operator=(value); #elif defined(BOOST_WINDOWS) win_tss_ptr::operator=(value); #elif defined(BOOST_HAS_PTHREADS) diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp index c6ebf63e9..924b37806 100644 --- a/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -107,7 +108,7 @@ public: // Return whether a handler can be dispatched immediately. bool can_dispatch() { - return call_stack::contains(this) != 0; + return thread_call_stack::contains(this) != 0; } // Request invocation of the given handler. @@ -135,6 +136,22 @@ public: BOOST_ASIO_DECL void post_deferred_completions( op_queue& ops); + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() has not yet been + // called for the operation. + void post_private_immediate_completion(win_iocp_operation* op) + { + post_immediate_completion(op); + } + + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() was previously called + // for the operation. + void post_private_deferred_completion(win_iocp_operation* op) + { + post_deferred_completion(op); + } + // Process unfinished operations as part of a shutdown_service operation. // Assumes that work_started() was previously called for the operations. BOOST_ASIO_DECL void abandon_operations(op_queue& ops); @@ -221,6 +238,11 @@ private: // Flag to indicate whether the event loop has been stopped. mutable long stopped_; + // Flag to indicate whether there is an in-flight stop event. Every event + // posted using PostQueuedCompletionStatus consumes non-paged pool, so to + // avoid exhausting this resouce we limit the number of outstanding events. + long stop_event_posted_; + // Flag to indicate whether the service has been shut down. long shutdown_; @@ -269,6 +291,10 @@ private: // The operations that are ready to dispatch. op_queue completed_ops_; + + // Per-thread call stack to track the state of each thread in the io_service. + typedef call_stack thread_call_stack; }; } // namespace detail diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp index 79580def1..4c1683fa3 100644 --- a/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp @@ -446,7 +446,7 @@ protected: bool peer_is_open, socket_holder& new_socket, int family, int type, int protocol, void* output_buffer, DWORD address_length, operation* op); - // Start an asynchronous read or write operation using the the reactor. + // Start an asynchronous read or write operation using the reactor. BOOST_ASIO_DECL void start_reactor_op(base_implementation_type& impl, int op_type, reactor_op* op); diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp new file mode 100644 index 000000000..e9af13330 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp @@ -0,0 +1,36 @@ +// +// detail/win_iocp_thread_info.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP +#define BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +struct win_iocp_thread_info : public thread_info_base +{ +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP diff --git a/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp b/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp index 6bef15188..bef5f61b4 100644 --- a/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp +++ b/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp @@ -32,10 +32,8 @@ namespace asio { * Implement asio_handler_allocate and asio_handler_deallocate for your own * handlers to provide custom allocation for these temporary objects. * - * This default implementation is simply: - * @code - * return ::operator new(size); - * @endcode + * The default implementation of these allocation hooks uses ::operator + * new and ::operator delete. * * @note All temporary objects associated with a handler will be deallocated * before the upcall to the handler is performed. This allows the same memory to @@ -57,32 +55,29 @@ namespace asio { * } * @endcode */ -inline void* asio_handler_allocate(std::size_t size, ...) -{ - return ::operator new(size); -} +BOOST_ASIO_DECL void* asio_handler_allocate( + std::size_t size, ...); /// Default deallocation function for handlers. /** * Implement asio_handler_allocate and asio_handler_deallocate for your own * handlers to provide custom allocation for the associated temporary objects. * - * This default implementation is simply: - * @code - * ::operator delete(pointer); - * @endcode + * The default implementation of these allocation hooks uses ::operator + * new and ::operator delete. * * @sa asio_handler_allocate. */ -inline void asio_handler_deallocate(void* pointer, std::size_t size, ...) -{ - (void)(size); - ::operator delete(pointer); -} +BOOST_ASIO_DECL void asio_handler_deallocate( + void* pointer, std::size_t size, ...); } // namespace asio } // namespace boost #include +#if defined(BOOST_ASIO_HEADER_ONLY) +# include +#endif // defined(BOOST_ASIO_HEADER_ONLY) + #endif // BOOST_ASIO_HANDLER_ALLOC_HOOK_HPP diff --git a/project/jni/boost/include/boost/asio/impl/error.ipp b/project/jni/boost/include/boost/asio/impl/error.ipp index cfb7a997e..e96ee9878 100644 --- a/project/jni/boost/include/boost/asio/impl/error.ipp +++ b/project/jni/boost/include/boost/asio/impl/error.ipp @@ -31,7 +31,7 @@ namespace detail { class netdb_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.netdb"; } @@ -63,7 +63,7 @@ namespace detail { class addrinfo_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.addrinfo"; } @@ -93,7 +93,7 @@ namespace detail { class misc_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.misc"; } diff --git a/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp b/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp new file mode 100644 index 000000000..d30e0f17a --- /dev/null +++ b/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp @@ -0,0 +1,76 @@ +// +// impl/handler_alloc_hook.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP +#define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include + +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) +# include +# include +# else // defined(BOOST_ASIO_HAS_IOCP) +# include +# endif // defined(BOOST_ASIO_HAS_IOCP) +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + +#include + +namespace boost { +namespace asio { + +void* asio_handler_allocate(std::size_t size, ...) +{ +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_io_service io_service_impl; + typedef detail::win_iocp_thread_info thread_info; +# else // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::task_io_service io_service_impl; + typedef detail::task_io_service_thread_info thread_info; +# endif // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::call_stack call_stack; + return thread_info::allocate(call_stack::top(), size); +#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + return ::operator new(size); +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +} + +void asio_handler_deallocate(void* pointer, std::size_t size, ...) +{ +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_io_service io_service_impl; + typedef detail::win_iocp_thread_info thread_info; +# else // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::task_io_service io_service_impl; + typedef detail::task_io_service_thread_info thread_info; +# endif // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::call_stack call_stack; + thread_info::deallocate(call_stack::top(), pointer, size); +#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + (void)size; + ::operator delete(pointer); +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +} + +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP diff --git a/project/jni/boost/include/boost/asio/impl/src.hpp b/project/jni/boost/include/boost/asio/impl/src.hpp index e5a0fafde..c44e070f2 100644 --- a/project/jni/boost/include/boost/asio/impl/src.hpp +++ b/project/jni/boost/include/boost/asio/impl/src.hpp @@ -20,6 +20,7 @@ #endif #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp b/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp index 24bfce293..857591102 100644 --- a/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp +++ b/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp @@ -81,7 +81,8 @@ endpoint::endpoint(const boost::asio::ip::address& addr, boost::asio::detail::socket_ops::host_to_network_short(port_num); data_.v4.sin_addr.s_addr = boost::asio::detail::socket_ops::host_to_network_long( - addr.to_v4().to_ulong()); + static_cast( + addr.to_v4().to_ulong())); } else { @@ -92,7 +93,9 @@ endpoint::endpoint(const boost::asio::ip::address& addr, boost::asio::ip::address_v6 v6_addr = addr.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = v6_addr.to_bytes(); memcpy(data_.v6.sin6_addr.s6_addr, bytes.data(), 16); - data_.v6.sin6_scope_id = v6_addr.scope_id(); + data_.v6.sin6_scope_id = + static_cast( + v6_addr.scope_id()); } } diff --git a/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp b/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp index 31f6e27d5..369d32467 100644 --- a/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp +++ b/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp @@ -55,7 +55,8 @@ address_v4::address_v4(unsigned long addr) } #endif // ULONG_MAX > 0xFFFFFFFF - addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long(addr); + addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long( + static_cast(addr)); } address_v4::bytes_type address_v4::to_bytes() const diff --git a/project/jni/boost/include/boost/asio/ssl/context_base.hpp b/project/jni/boost/include/boost/asio/ssl/context_base.hpp index 3c0b59d65..3d39053d0 100644 --- a/project/jni/boost/include/boost/asio/ssl/context_base.hpp +++ b/project/jni/boost/include/boost/asio/ssl/context_base.hpp @@ -71,29 +71,29 @@ public: }; /// Bitmask type for SSL options. - typedef int options; + typedef long options; #if defined(GENERATING_DOCUMENTATION) /// Implement various bug workarounds. - static const int default_workarounds = implementation_defined; + static const long default_workarounds = implementation_defined; /// Always create a new key when using tmp_dh parameters. - static const int single_dh_use = implementation_defined; + static const long single_dh_use = implementation_defined; /// Disable SSL v2. - static const int no_sslv2 = implementation_defined; + static const long no_sslv2 = implementation_defined; /// Disable SSL v3. - static const int no_sslv3 = implementation_defined; + static const long no_sslv3 = implementation_defined; /// Disable TLS v1. - static const int no_tlsv1 = implementation_defined; + static const long no_tlsv1 = implementation_defined; #else - BOOST_STATIC_CONSTANT(int, default_workarounds = SSL_OP_ALL); - BOOST_STATIC_CONSTANT(int, single_dh_use = SSL_OP_SINGLE_DH_USE); - BOOST_STATIC_CONSTANT(int, no_sslv2 = SSL_OP_NO_SSLv2); - BOOST_STATIC_CONSTANT(int, no_sslv3 = SSL_OP_NO_SSLv3); - BOOST_STATIC_CONSTANT(int, no_tlsv1 = SSL_OP_NO_TLSv1); + BOOST_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL); + BOOST_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE); + BOOST_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2); + BOOST_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3); + BOOST_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1); #endif /// File format types. diff --git a/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp b/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp index 72f1c3568..39d412a5d 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp +++ b/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp @@ -18,7 +18,10 @@ #include #if !defined(BOOST_ASIO_ENABLE_OLD_SSL) +# include +# include # include +# include # include #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) @@ -34,6 +37,14 @@ namespace detail { engine::engine(SSL_CTX* context) : ssl_(::SSL_new(context)) { + if (!ssl_) + { + boost::system::error_code ec( + static_cast(::ERR_get_error()), + boost::asio::error::get_ssl_category()); + boost::asio::detail::throw_error(ec, "engine"); + } + accept_mutex().init(); ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE); @@ -156,7 +167,7 @@ boost::asio::mutable_buffers_1 engine::get_output( { int length = ::BIO_read(ext_bio_, boost::asio::buffer_cast(data), - boost::asio::buffer_size(data)); + static_cast(boost::asio::buffer_size(data))); return boost::asio::buffer(data, length > 0 ? static_cast(length) : 0); @@ -167,7 +178,7 @@ boost::asio::const_buffer engine::put_input( { int length = ::BIO_write(ext_bio_, boost::asio::buffer_cast(data), - boost::asio::buffer_size(data)); + static_cast(boost::asio::buffer_size(data))); return boost::asio::buffer(data + (length > 0 ? static_cast(length) : 0)); @@ -218,7 +229,7 @@ engine::want engine::perform(int (engine::* op)(void*, std::size_t), std::size_t pending_output_before = ::BIO_ctrl_pending(ext_bio_); int result = (this->*op)(data, length); int ssl_error = ::SSL_get_error(ssl_, result); - int sys_error = ::ERR_get_error(); + int sys_error = static_cast(::ERR_get_error()); std::size_t pending_output_after = ::BIO_ctrl_pending(ext_bio_); if (ssl_error == SSL_ERROR_SSL) @@ -286,12 +297,14 @@ int engine::do_shutdown(void*, std::size_t) int engine::do_read(void* data, std::size_t length) { - return ::SSL_read(ssl_, data, length < INT_MAX ? length : INT_MAX); + return ::SSL_read(ssl_, data, + length < INT_MAX ? static_cast(length) : INT_MAX); } int engine::do_write(void* data, std::size_t length) { - return ::SSL_write(ssl_, data, length < INT_MAX ? length : INT_MAX); + return ::SSL_write(ssl_, data, + length < INT_MAX ? static_cast(length) : INT_MAX); } #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) diff --git a/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp b/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp index af33f6e03..fe62e6eab 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp +++ b/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp @@ -56,7 +56,9 @@ public: ::EVP_cleanup(); ::CRYPTO_cleanup_all_ex_data(); ::CONF_modules_unload(1); +#if !defined(OPENSSL_NO_ENGINE) ::ENGINE_cleanup(); +#endif // !defined(OPENSSL_NO_ENGINE) } private: diff --git a/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp b/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp index 752fe587d..a3c372933 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp +++ b/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp @@ -18,7 +18,9 @@ #include #include #include -#include +#if !defined(OPENSSL_NO_ENGINE) +# include +#endif // !defined(OPENSSL_NO_ENGINE) #include #include #include diff --git a/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp b/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp index b8f0afa4a..666069130 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp +++ b/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp @@ -34,7 +34,7 @@ namespace detail { struct stream_core { - // According to the OpenSSL documentation, this is the buffer size that is is + // According to the OpenSSL documentation, this is the buffer size that is // sufficient to hold the largest possible TLS record. enum { max_tls_record_size = 17 * 1024 }; diff --git a/project/jni/boost/include/boost/asio/ssl/impl/context.ipp b/project/jni/boost/include/boost/asio/ssl/impl/context.ipp index 54f4fd15d..f730e830d 100644 --- a/project/jni/boost/include/boost/asio/ssl/impl/context.ipp +++ b/project/jni/boost/include/boost/asio/ssl/impl/context.ipp @@ -91,7 +91,8 @@ context::context(context::method m) if (handle_ == 0) { - boost::system::error_code ec(::ERR_get_error(), + boost::system::error_code ec( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); boost::asio::detail::throw_error(ec, "context"); } @@ -201,7 +202,8 @@ boost::system::error_code context::load_verify_file( { if (::SSL_CTX_load_verify_locations(handle_, filename.c_str(), 0) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -222,7 +224,8 @@ boost::system::error_code context::set_default_verify_paths( { if (::SSL_CTX_set_default_verify_paths(handle_) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -243,7 +246,8 @@ boost::system::error_code context::add_verify_path( { if (::SSL_CTX_load_verify_locations(handle_, 0, path.c_str()) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -282,7 +286,8 @@ boost::system::error_code context::use_certificate_file( if (::SSL_CTX_use_certificate_file(handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -303,7 +308,8 @@ boost::system::error_code context::use_certificate_chain_file( { if (::SSL_CTX_use_certificate_chain_file(handle_, filename.c_str()) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -342,7 +348,8 @@ boost::system::error_code context::use_private_key_file( if (::SSL_CTX_use_PrivateKey_file(handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -382,7 +389,8 @@ boost::system::error_code context::use_rsa_private_key_file( if (::SSL_CTX_use_RSAPrivateKey_file( handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -417,11 +425,12 @@ boost::system::error_code context::use_tmp_dh_file( } ::BIO_free(bio); - int result = ::SSL_CTX_set_tmp_dh(handle_, dh); + long result = ::SSL_CTX_set_tmp_dh(handle_, dh); ::DH_free(dh); if (result != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -510,7 +519,7 @@ int context::password_callback_function( strncat(buf, passwd.c_str(), size); #endif - return strlen(buf); + return static_cast(strlen(buf)); } return 0; diff --git a/project/jni/boost/include/boost/asio/ssl/impl/error.ipp b/project/jni/boost/include/boost/asio/ssl/impl/error.ipp index 6d462352a..cef57f725 100644 --- a/project/jni/boost/include/boost/asio/ssl/impl/error.ipp +++ b/project/jni/boost/include/boost/asio/ssl/impl/error.ipp @@ -30,7 +30,7 @@ namespace detail { class ssl_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.ssl"; } diff --git a/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp b/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp index c4a8feea6..4d2ab131d 100644 --- a/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp +++ b/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp @@ -154,7 +154,7 @@ public: // For connect/accept/shutdown, the operation // is done, when return code is 1 // for write, it is done, when is retcode > 0 - // for read, is is done when retcode > 0 + // for read, it is done when retcode > 0 int error_code = !is_operation_done ? ::SSL_get_error( session_, rc ) : diff --git a/project/jni/boost/include/boost/asio/strand.hpp b/project/jni/boost/include/boost/asio/strand.hpp index ba82e602a..6a1033f37 100644 --- a/project/jni/boost/include/boost/asio/strand.hpp +++ b/project/jni/boost/include/boost/asio/strand.hpp @@ -105,7 +105,6 @@ public: */ ~strand() { - service_.destroy(impl_); } /// Get the io_service associated with the strand. diff --git a/project/jni/boost/include/boost/asio/version.hpp b/project/jni/boost/include/boost/asio/version.hpp index 21eeb5124..612887957 100644 --- a/project/jni/boost/include/boost/asio/version.hpp +++ b/project/jni/boost/include/boost/asio/version.hpp @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 100800 // 1.8.0 +#define BOOST_ASIO_VERSION 100803 // 1.8.3 #endif // BOOST_ASIO_VERSION_HPP diff --git a/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp b/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp index 161bb512f..a94bb57e2 100644 --- a/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp +++ b/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp @@ -125,7 +125,7 @@ public: void wait() { boost::system::error_code ec; - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); boost::asio::detail::throw_error(ec, "wait"); } @@ -139,7 +139,7 @@ public: */ void wait(boost::system::error_code& ec) { - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); } /// Start an asynchronous wait on the object handle. @@ -161,7 +161,7 @@ public: template void async_wait(WaitHandler handler) { - this->service.async_wait(this->implementation, handler); + this->get_service().async_wait(this->get_implementation(), handler); } }; diff --git a/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp b/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp index 0d5714188..3529c9c3f 100644 --- a/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp +++ b/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp @@ -58,7 +58,7 @@ public: /// Construct a basic_random_access_handle without opening it. /** * This constructor creates a random-access handle without opening it. The - * handle needs to be opened before data can be written to or or read from it. + * handle needs to be opened before data can be written to or read from it. * * @param io_service The io_service object that the random-access handle will * use to dispatch handlers for any asynchronous operations performed on the diff --git a/project/jni/boost/include/boost/atomic.hpp b/project/jni/boost/include/boost/atomic.hpp new file mode 100644 index 000000000..0f5883c38 --- /dev/null +++ b/project/jni/boost/include/boost/atomic.hpp @@ -0,0 +1,18 @@ +#ifndef BOOST_ATOMIC_HPP +#define BOOST_ATOMIC_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This header includes all Boost.Atomic public headers + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#endif diff --git a/project/jni/boost/include/boost/atomic/atomic.hpp b/project/jni/boost/include/boost/atomic/atomic.hpp new file mode 100644 index 000000000..f47bdb16d --- /dev/null +++ b/project/jni/boost/include/boost/atomic/atomic.hpp @@ -0,0 +1,205 @@ +#ifndef BOOST_ATOMIC_ATOMIC_HPP +#define BOOST_ATOMIC_ATOMIC_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#include + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { + +#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE +#define BOOST_ATOMIC_CHAR_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE +#define BOOST_ATOMIC_SHORT_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_INT_LOCK_FREE +#define BOOST_ATOMIC_INT_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_LONG_LOCK_FREE +#define BOOST_ATOMIC_LONG_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE +#define BOOST_ATOMIC_POINTER_LOCK_FREE 0 +#endif + +#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE + +#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE +#define BOOST_ATOMIC_BOOL_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_THREAD_FENCE +#define BOOST_ATOMIC_THREAD_FENCE 0 +inline void atomic_thread_fence(memory_order) +{ +} +#endif + +#ifndef BOOST_ATOMIC_SIGNAL_FENCE +#define BOOST_ATOMIC_SIGNAL_FENCE 0 +inline void atomic_signal_fence(memory_order order) +{ + atomic_thread_fence(order); +} +#endif + +template +class atomic : + public atomics::detail::base_atomic::type, atomics::detail::storage_size_of::value, boost::is_signed::value > +{ +private: + typedef T value_type; + typedef atomics::detail::base_atomic::type, atomics::detail::storage_size_of::value, boost::is_signed::value > super; +public: + atomic(void) : super() {} + explicit atomic(const value_type & v) : super(v) {} + + atomic & operator=(value_type v) volatile + { + super::operator=(v); + return *const_cast(this); + } +private: + atomic(const atomic &) /* =delete */ ; + atomic & operator=(const atomic &) /* =delete */ ; +}; + +typedef atomic atomic_char; +typedef atomic atomic_uchar; +typedef atomic atomic_schar; +typedef atomic atomic_uint8_t; +typedef atomic atomic_int8_t; +typedef atomic atomic_ushort; +typedef atomic atomic_short; +typedef atomic atomic_uint16_t; +typedef atomic atomic_int16_t; +typedef atomic atomic_uint; +typedef atomic atomic_int; +typedef atomic atomic_uint32_t; +typedef atomic atomic_int32_t; +typedef atomic atomic_ulong; +typedef atomic atomic_long; +typedef atomic atomic_uint64_t; +typedef atomic atomic_int64_t; +#ifdef BOOST_HAS_LONG_LONG +typedef atomic atomic_ullong; +typedef atomic atomic_llong; +#endif +typedef atomic atomic_address; +typedef atomic atomic_bool; +typedef atomic atomic_wchar_t; +#if !defined(BOOST_NO_CXX11_CHAR16_T) +typedef atomic atomic_char16_t; +#endif +#if !defined(BOOST_NO_CXX11_CHAR32_T) +typedef atomic atomic_char32_t; +#endif + +typedef atomic atomic_int_least8_t; +typedef atomic atomic_uint_least8_t; +typedef atomic atomic_int_least16_t; +typedef atomic atomic_uint_least16_t; +typedef atomic atomic_int_least32_t; +typedef atomic atomic_uint_least32_t; +typedef atomic atomic_int_least64_t; +typedef atomic atomic_uint_least64_t; +typedef atomic atomic_int_fast8_t; +typedef atomic atomic_uint_fast8_t; +typedef atomic atomic_int_fast16_t; +typedef atomic atomic_uint_fast16_t; +typedef atomic atomic_int_fast32_t; +typedef atomic atomic_uint_fast32_t; +typedef atomic atomic_int_fast64_t; +typedef atomic atomic_uint_fast64_t; +typedef atomic atomic_intmax_t; +typedef atomic atomic_uintmax_t; + +typedef atomic atomic_size_t; +typedef atomic atomic_ptrdiff_t; + +// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config. +#if !defined(__PGIC__) + +#if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \ + || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0)) \ + || defined(__CYGWIN__) \ + || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \ + || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +typedef atomic atomic_intptr_t; +typedef atomic atomic_uintptr_t; +#elif defined(__GNUC__) || defined(__clang__) +#if defined(__INTPTR_TYPE__) +typedef atomic< __INTPTR_TYPE__ > atomic_intptr_t; +#endif +#if defined(__UINTPTR_TYPE__) +typedef atomic< __UINTPTR_TYPE__ > atomic_uintptr_t; +#endif +#endif + +#endif + +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE +#define BOOST_ATOMIC_FLAG_LOCK_FREE 0 +class atomic_flag +{ +public: + atomic_flag(void) : v_(false) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) + { + return v_.exchange(true, order); + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + v_.store(false, order); + } +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + atomic v_; +}; +#endif + +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/base.hpp b/project/jni/boost/include/boost/atomic/detail/base.hpp new file mode 100644 index 000000000..b03545435 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/base.hpp @@ -0,0 +1,519 @@ +#ifndef BOOST_ATOMIC_DETAIL_BASE_HPP +#define BOOST_ATOMIC_DETAIL_BASE_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// 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) + +// Base class definition and fallback implementation. +// To be overridden (through partial specialization) by +// platform implementations. + +#include + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + operator value_type(void) volatile const \ + { \ + return load(memory_order_seq_cst); \ + } \ + \ + this_type & \ + operator=(value_type v) volatile \ + { \ + store(v, memory_order_seq_cst); \ + return *const_cast(this); \ + } \ + \ + bool \ + compare_exchange_strong( \ + value_type & expected, \ + value_type desired, \ + memory_order order = memory_order_seq_cst) volatile \ + { \ + return compare_exchange_strong(expected, desired, order, calculate_failure_order(order)); \ + } \ + \ + bool \ + compare_exchange_weak( \ + value_type & expected, \ + value_type desired, \ + memory_order order = memory_order_seq_cst) volatile \ + { \ + return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \ + } \ + \ + +#define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + value_type \ + operator++(int) volatile \ + { \ + return fetch_add(1); \ + } \ + \ + value_type \ + operator++(void) volatile \ + { \ + return fetch_add(1) + 1; \ + } \ + \ + value_type \ + operator--(int) volatile \ + { \ + return fetch_sub(1); \ + } \ + \ + value_type \ + operator--(void) volatile \ + { \ + return fetch_sub(1) - 1; \ + } \ + \ + value_type \ + operator+=(difference_type v) volatile \ + { \ + return fetch_add(v) + v; \ + } \ + \ + value_type \ + operator-=(difference_type v) volatile \ + { \ + return fetch_sub(v) - v; \ + } \ + +#define BOOST_ATOMIC_DECLARE_BIT_OPERATORS \ + value_type \ + operator&=(difference_type v) volatile \ + { \ + return fetch_and(v) & v; \ + } \ + \ + value_type \ + operator|=(difference_type v) volatile \ + { \ + return fetch_or(v) | v; \ + } \ + \ + value_type \ + operator^=(difference_type v) volatile \ + { \ + return fetch_xor(v) ^ v; \ + } \ + +#define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS \ + BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + +#define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS \ + BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + BOOST_ATOMIC_DECLARE_BIT_OPERATORS \ + +namespace boost { +namespace atomics { +namespace detail { + +inline memory_order +calculate_failure_order(memory_order order) +{ + switch(order) { + case memory_order_acq_rel: + return memory_order_acquire; + case memory_order_release: + return memory_order_relaxed; + default: + return order; + } +} + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T value_type; + typedef lockpool::scoped_lock guard_type; +public: + base_atomic(void) {} + + explicit base_atomic(const value_type & v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + + void + store(value_type const& v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(v_)); + + memcpy(const_cast(v_), &v, sizeof(value_type)); + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) volatile const + { + guard_type guard(const_cast(v_)); + + value_type v; + memcpy(&v, const_cast(v_), sizeof(value_type)); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(v_)); + + if (memcmp(const_cast(v_), &expected, sizeof(value_type)) == 0) { + memcpy(const_cast(v_), &desired, sizeof(value_type)); + return true; + } else { + memcpy(&expected, const_cast(v_), sizeof(value_type)); + return false; + } + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + exchange(value_type const& v, memory_order /*order*/=memory_order_seq_cst) volatile + { + guard_type guard(const_cast(v_)); + + value_type tmp; + memcpy(&tmp, const_cast(v_), sizeof(value_type)); + + memcpy(const_cast(v_), &v, sizeof(value_type)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + + char v_[sizeof(value_type)]; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ += v; + return old; + } + + value_type + fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ -= v; + return old; + } + + value_type + fetch_and(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ &= v; + return old; + } + + value_type + fetch_or(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ |= v; + return old; + } + + value_type + fetch_xor(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ ^= v; + return old; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ += v; + return old; + } + + value_type fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ -= v; + return old; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef void * value_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp b/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp new file mode 100644 index 000000000..2cbfaab85 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp @@ -0,0 +1,872 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP +#define BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +// Build 8-, 16- and 32-bit atomic operations from +// a platform_cmpxchg32_strong primitive. + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp b/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp new file mode 100644 index 000000000..f4d9f7f24 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp @@ -0,0 +1,916 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS32WEAK_HPP +#define BOOST_ATOMIC_DETAIL_CAS32WEAK_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp b/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp new file mode 100644 index 000000000..ca7f41f3f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp @@ -0,0 +1,438 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP +#define BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +// Build 64-bit atomic operation from platform_cmpxchg64_strong +// primitive. It is assumed that 64-bit loads/stores are not +// atomic, so they are funnelled through cmpxchg as well. + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& value, memory_order order = memory_order_seq_cst) volatile + { + storage_type value_s = 0; + memcpy(&value_s, &value, sizeof(value_s)); + platform_fence_before_store(order); + platform_store64(value_s, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type value_s = platform_load64(&v_); + platform_fence_after_load(order); + value_type value; + memcpy(&value, &value_s, sizeof(value_s)); + return value; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg64_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/config.hpp b/project/jni/boost/include/boost/atomic/detail/config.hpp new file mode 100644 index 000000000..979bdd8f9 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/config.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP +#define BOOST_ATOMIC_DETAIL_CONFIG_HPP + +// Copyright (c) 2012 Hartmut Kaiser +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__GNUC__) || defined(BOOST_CLANG) || defined(BOOST_INTEL) || defined(__COMO__) || defined(__DMC__) +#define BOOST_ATOMIC_HAS_PRAGMA_ONCE +#endif + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Set up dll import/export options +#if (defined(BOOST_ATOMIC_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \ + !defined(BOOST_ATOMIC_STATIC_LINK) + +#if defined(BOOST_ATOMIC_SOURCE) +#define BOOST_ATOMIC_DECL BOOST_SYMBOL_EXPORT +#define BOOST_ATOMIC_BUILD_DLL +#else +#define BOOST_ATOMIC_DECL BOOST_SYMBOL_IMPORT +#endif + +#endif // building a shared library + +#ifndef BOOST_ATOMIC_DECL +#define BOOST_ATOMIC_DECL +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Auto library naming +#if !defined(BOOST_ATOMIC_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_ATOMIC_NO_LIB) + +#define BOOST_LIB_NAME boost_atomic + +// tell the auto-link code to select a dll when required: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ATOMIC_DYN_LINK) +#define BOOST_DYN_LINK +#endif + +#include + +#endif // auto-linking disabled + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp new file mode 100644 index 000000000..0748fc381 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp @@ -0,0 +1,359 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP +#define BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* + Refer to http://h71000.www7.hp.com/doc/82final/5601/5601pro_004.html + (HP OpenVMS systems documentation) and the alpha reference manual. + */ + +/* + NB: The most natural thing would be to write the increment/decrement + operators along the following lines: + + __asm__ __volatile__( + "1: ldl_l %0,%1 \n" + "addl %0,1,%0 \n" + "stl_c %0,%1 \n" + "beq %0,1b\n" + : "=&b" (tmp) + : "m" (value) + : "cc" + ); + + However according to the comments on the HP website and matching + comments in the Linux kernel sources this defies branch prediction, + as the cpu assumes that backward branches are always taken; so + instead copy the trick from the Linux kernel, introduce a forward + branch and back again. + + I have, however, had a hard time measuring the difference between + the two versions in microbenchmarks -- I am leaving it in nevertheless + as it apparently does not hurt either. +*/ + +namespace boost { +namespace atomics { +namespace detail { + +inline void fence_before(memory_order order) +{ + switch(order) { + case memory_order_consume: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +inline void fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +template<> +inline void platform_atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_consume: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +template +class atomic_alpha_32 { +public: + typedef T integral_type; + explicit atomic_alpha_32(T v) : i(v) {} + atomic_alpha_32() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T v=*reinterpret_cast(&i); + fence_after(order); + return v; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + fence_before(order); + *reinterpret_cast(&i)=(int)v; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + fence_before(success_order); + int current, success; + __asm__ __volatile__( + "1: ldl_l %2, %4\n" + "cmpeq %2, %0, %3\n" + "mov %2, %0\n" + "beq %3, 3f\n" + "stl_c %1, %4\n" + "2:\n" + + ".subsection 2\n" + "3: mov %3, %1\n" + "br 2b\n" + ".previous\n" + + : "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success) + : "m" (i) + : + ); + if (desired) fence_after(success_order); + else fence_after(failure_order); + return desired; + } + + bool is_lock_free(void) const volatile {return true;} +protected: + inline T fetch_add_var(T c, memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "addl %0, %3, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i), "r" (c) + : + ); + fence_after(order); + return original; + } + inline T fetch_inc(memory_order order) volatile + { + fence_before(order); + int original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "addl %0, 1, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } + inline T fetch_dec(memory_order order) volatile + { + fence_before(order); + int original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "subl %0, 1, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } +private: + T i; +}; + +template +class atomic_alpha_64 { +public: + typedef T integral_type; + explicit atomic_alpha_64(T v) : i(v) {} + atomic_alpha_64() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T v=*reinterpret_cast(&i); + fence_after(order); + return v; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + fence_before(order); + *reinterpret_cast(&i)=v; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + fence_before(success_order); + int current, success; + __asm__ __volatile__( + "1: ldq_l %2, %4\n" + "cmpeq %2, %0, %3\n" + "mov %2, %0\n" + "beq %3, 3f\n" + "stq_c %1, %4\n" + "2:\n" + + ".subsection 2\n" + "3: mov %3, %1\n" + "br 2b\n" + ".previous\n" + + : "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success) + : "m" (i) + : + ); + if (desired) fence_after(success_order); + else fence_after(failure_order); + return desired; + } + + bool is_lock_free(void) const volatile {return true;} +protected: + inline T fetch_add_var(T c, memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "addq %0, %3, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i), "r" (c) + : + ); + fence_after(order); + return original; + } + inline T fetch_inc(memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "addq %0, 1, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } + inline T fetch_dec(memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "subq %0, 1, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } +private: + T i; +}; + +template +class platform_atomic_integral : public build_atomic_from_typical > > { +public: + typedef build_atomic_from_typical > > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral : public build_atomic_from_typical > > { +public: + typedef build_atomic_from_typical > > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp new file mode 100644 index 000000000..5d02cde88 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp @@ -0,0 +1,250 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP +#define BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2009 Phil Endecott +// ARM Code by Phil Endecott, based on other architectures. + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +// From the ARM Architecture Reference Manual for architecture v6: +// +// LDREX{} , [] +// Specifies the destination register for the memory word addressed by +// Specifies the register containing the address. +// +// STREX{} , , [] +// Specifies the destination register for the returned status value. +// 0 if the operation updates memory +// 1 if the operation fails to update memory +// Specifies the register containing the word to be stored to memory. +// Specifies the register containing the address. +// Rd must not be the same register as Rm or Rn. +// +// ARM v7 is like ARM v6 plus: +// There are half-word and byte versions of the LDREX and STREX instructions, +// LDREXH, LDREXB, STREXH and STREXB. +// There are also double-word versions, LDREXD and STREXD. +// (Actually it looks like these are available from version 6k onwards.) +// FIXME these are not yet used; should be mostly a matter of copy-and-paste. +// I think you can supply an immediate offset to the address. +// +// A memory barrier is effected using a "co-processor 15" instruction, +// though a separate assembler mnemonic is available for it in v7. + +namespace boost { +namespace atomics { +namespace detail { + +// "Thumb 1" is a subset of the ARM instruction set that uses a 16-bit encoding. It +// doesn't include all instructions and in particular it doesn't include the co-processor +// instruction used for the memory barrier or the load-locked/store-conditional +// instructions. So, if we're compiling in "Thumb 1" mode, we need to wrap all of our +// asm blocks with code to temporarily change to ARM mode. +// +// You can only change between ARM and Thumb modes when branching using the bx instruction. +// bx takes an address specified in a register. The least significant bit of the address +// indicates the mode, so 1 is added to indicate that the destination code is Thumb. +// A temporary register is needed for the address and is passed as an argument to these +// macros. It must be one of the "low" registers accessible to Thumb code, specified +// using the "l" attribute in the asm statement. +// +// Architecture v7 introduces "Thumb 2", which does include (almost?) all of the ARM +// instruction set. So in v7 we don't need to change to ARM mode; we can write "universal +// assembler" which will assemble to Thumb 2 or ARM code as appropriate. The only thing +// we need to do to make this "universal" assembler mode work is to insert "IT" instructions +// to annotate the conditional instructions. These are ignored in other modes (e.g. v6), +// so they can always be present. + +#if defined(__thumb__) && !defined(__ARM_ARCH_7A__) +// FIXME also other v7 variants. +#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) "adr " #TMPREG ", 1f\n" "bx " #TMPREG "\n" ".arm\n" ".align 4\n" "1: " +#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) "adr " #TMPREG ", 1f + 1\n" "bx " #TMPREG "\n" ".thumb\n" ".align 2\n" "1: " + +#else +// The tmpreg is wasted in this case, which is non-optimal. +#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) +#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) +#endif + +#if defined(__ARM_ARCH_7A__) +// FIXME ditto. +#define BOOST_ATOMIC_ARM_DMB "dmb\n" +#else +#define BOOST_ATOMIC_ARM_DMB "mcr\tp15, 0, r0, c7, c10, 5\n" +#endif + +inline void +arm_barrier(void) +{ + int brtmp; + __asm__ __volatile__ ( + BOOST_ATOMIC_ARM_ASM_START(%0) + BOOST_ATOMIC_ARM_DMB + BOOST_ATOMIC_ARM_ASM_END(%0) + : "=&l" (brtmp) :: "memory" + ); +} + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + case memory_order_consume: + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + platform_fence_before(order); +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + arm_barrier(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +template +inline bool +platform_cmpxchg32(T & expected, T desired, volatile T * ptr) +{ + int success; + int tmp; + __asm__ ( + BOOST_ATOMIC_ARM_ASM_START(%2) + "mov %1, #0\n" // success = 0 + "ldrex %0, %3\n" // expected' = *(&i) + "teq %0, %4\n" // flags = expected'==expected + "ittt eq\n" + "strexeq %2, %5, %3\n" // if (flags.equal) *(&i) = desired, tmp = !OK + "teqeq %2, #0\n" // if (flags.equal) flags = tmp==0 + "moveq %1, #1\n" // if (flags.equal) success = 1 + BOOST_ATOMIC_ARM_ASM_END(%2) + : "=&r" (expected), // %0 + "=&r" (success), // %1 + "=&l" (tmp), // %2 + "+Q" (*ptr) // %3 + : "r" (expected), // %4 + "r" (desired) // %5 + : "cc" + ); + return success; +} + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + atomics::detail::arm_barrier(); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} + +#undef BOOST_ATOMIC_ARM_ASM_START +#undef BOOST_ATOMIC_ARM_ASM_END + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif + diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp new file mode 100644 index 000000000..781e935f1 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp @@ -0,0 +1,155 @@ +// Copyright (c) 2011 Helge Bahmann +// +// 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) + +// Use the gnu builtin __sync_val_compare_and_swap to build +// atomic operations for 32 bit and smaller. + +#ifndef BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP +#define BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + break; + case memory_order_release: + case memory_order_consume: + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +namespace atomics { +namespace detail { + +inline void +platform_fence_before(memory_order) +{ + /* empty, as compare_and_swap is synchronizing already */ +} + +inline void +platform_fence_after(memory_order) +{ + /* empty, as compare_and_swap is synchronizing already */ +} + +inline void +platform_fence_before_store(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + __sync_synchronize(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_consume: + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +template +inline bool +platform_cmpxchg32_strong(T & expected, T desired, volatile T * ptr) +{ + T found = __sync_val_compare_and_swap(ptr, expected, desired); + bool success = (found == expected); + expected = found; + return success; +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} +} +} + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE (sizeof(long) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_LLONG_LOCK_FREE (sizeof(long long) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_POINTER_LOCK_FREE (sizeof(void *) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp new file mode 100644 index 000000000..dd58aaf31 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp @@ -0,0 +1,2757 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_PPC_HPP +#define BOOST_ATOMIC_DETAIL_GCC_PPC_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* + Refer to: Motorola: "Programming Environments Manual for 32-Bit + Implementations of the PowerPC Architecture", Appendix E: + "Synchronization Programming Examples" for an explanation of what is + going on here (can be found on the web at various places by the + name "MPCFPE32B.pdf", Google is your friend...) + + Most of the atomic operations map to instructions in a relatively + straight-forward fashion, but "load"s may at first glance appear + a bit strange as they map to: + + lwz %rX, addr + cmpw %rX, %rX + bne- 1f + 1: + + That is, the CPU is forced to perform a branch that "formally" depends + on the value retrieved from memory. This scheme has an overhead of + about 1-2 clock cycles per load, but it allows to map "acquire" to + the "isync" instruction instead of "sync" uniformly and for all type + of atomic operations. Since "isync" has a cost of about 15 clock + cycles, while "sync" hast a cost of about 50 clock cycles, the small + penalty to atomic loads more than compensates for this. + + Byte- and halfword-sized atomic values are realized by encoding the + value to be represented into a word, performing sign/zero extension + as appropriate. This means that after add/sub operations the value + needs fixing up to accurately preserve the wrap-around semantic of + the smaller type. (Nothing special needs to be done for the bit-wise + and the "exchange type" operators as the compiler already sees to + it that values carried in registers are extended appropriately and + everything falls into place naturally). + + The register constraint "b" instructs gcc to use any register + except r0; this is sometimes required because the encoding for + r0 is used to signify "constant zero" in a number of instructions, + making r0 unusable in this place. For simplicity this constraint + is used everywhere since I am to lazy to look this up on a + per-instruction basis, and ppc has enough registers for this not + to pose a problem. +*/ + +namespace boost { +namespace atomics { +namespace detail { + +inline void +ppc_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: +#if defined(__powerpc64__) + __asm__ __volatile__ ("lwsync" ::: "memory"); + break; +#endif + case memory_order_seq_cst: + __asm__ __volatile__ ("sync" ::: "memory"); + default:; + } +} + +inline void +ppc_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("isync"); + case memory_order_consume: + __asm__ __volatile__ ("" ::: "memory"); + default:; + } +} + +inline void +ppc_fence_after_store(memory_order order) +{ + switch(order) { + case memory_order_seq_cst: + __asm__ __volatile__ ("sync"); + default:; + } +} + +} +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::ppc_fence_before(order); + const_cast(v_) = 0; + atomics::detail::ppc_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + uint32_t original; + atomics::detail::ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (1) + : "cr0" + ); + atomics::detail::ppc_fence_after(order); + return original; + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#if defined(__powerpc64__) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +/* Would like to move the slow-path of failed compare_exchange +(that clears the "success" bit) out-of-line. gcc can in +principle do that using ".subsection"/".previous", but Apple's +binutils seemingly does not understand that. Therefore wrap +the "clear" of the flag in a macro and let it remain +in-line for Apple +*/ + +#if !defined(__APPLE__) + +#define BOOST_ATOMIC_ASM_SLOWPATH_CLEAR \ + "9:\n" \ + ".subsection 2\n" \ + "2: addi %1,0,0\n" \ + "b 9b\n" \ + ".previous\n" \ + +#else + +#define BOOST_ATOMIC_ASM_SLOWPATH_CLEAR \ + "b 9f\n" \ + "2: addi %1,0,0\n" \ + "9:\n" \ + +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef int32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "extsb %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "extsb %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef int32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "extsh %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "extsh %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xffff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xffff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + const_cast(v_) = v; + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + __asm__ __volatile__ ( + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "+b"(v) + : + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#if defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + const_cast(v_) = v; + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + __asm__ __volatile__ ( + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "+b"(v) + : + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "add %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "sub %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "and %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "or %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "xor %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* pointer types */ + +#if !defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#else + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "add %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "sub %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* generic */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; +#endif + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + __asm__ __volatile__ ("isync" ::: "memory"); + break; + case memory_order_release: +#if defined(__powerpc64__) + __asm__ __volatile__ ("lwsync" ::: "memory"); + break; +#endif + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("sync" ::: "memory"); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + break; + default:; + } +} + +} + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp new file mode 100644 index 000000000..ae256d133 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp @@ -0,0 +1,1229 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_SPARC_HPP +#define BOOST_ATOMIC_DETAIL_GCC_SPARC_HPP + +// Copyright (c) 2010 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + /* seq */ + break; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + switch(order) { + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + default:; + } +} + + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +} +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t tmp = 1; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (tmp) + : "r" (&v_), "r" (0) + : "memory" + ); + atomics::detail::platform_fence_after(order); + return tmp; + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + break; + case memory_order_release: + __asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory"); + break; + case memory_order_acquire: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory"); + break; + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore | #StoreStore" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + break; + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef int32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef int32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp new file mode 100644 index 000000000..0b06e47b6 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp @@ -0,0 +1,1651 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_X86_HPP +#define BOOST_ATOMIC_DETAIL_GCC_X86_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Tim Blechmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(__x86_64__) || defined(__SSE2__) +# define BOOST_ATOMIC_X86_FENCE_INSTR "mfence\n" +#else +# define BOOST_ATOMIC_X86_FENCE_INSTR "lock ; addl $0, (%%esp)\n" +#endif + +#define BOOST_ATOMIC_X86_PAUSE() __asm__ __volatile__ ("pause\n") + +inline void +platform_fence_before(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_load(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + break; + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +} +} + +class atomic_flag +{ +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(0) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + uint32_t v = 1; + atomics::detail::platform_fence_before(order); + __asm__ __volatile__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + atomics::detail::platform_fence_after(order); + return v; + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + if (order == memory_order_seq_cst) { + uint32_t v = 0; + __asm__ __volatile__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + } else { + atomics::detail::platform_fence_before(order); + v_ = 0; + } + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 + +#if defined(__x86_64__) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 1 +#endif + +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + break; + case memory_order_release: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_acquire: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ (BOOST_ATOMIC_X86_FENCE_INSTR ::: "memory"); + break; + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +namespace atomics { +namespace detail { + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddb %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgb %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgb %2, %1" + : "+a" (previous), "+m" (v_) + : "q" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for(; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddw %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgw %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgw %2, %1" + : "+a" (previous), "+m" (v_) + : "q" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#if defined(__x86_64__) +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* pointers */ + +#if !defined(__x86_64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + __asm__ ( + "lock ; xaddl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return reinterpret_cast(v); + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#else + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + __asm__ ( + "lock ; xaddq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return reinterpret_cast(v); + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint8_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgb %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgb %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint16_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgw %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgw %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(__x86_64__) +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; +#endif + +#if !defined(__x86_64__) && (defined(__i686__) || defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) + +template +inline bool +platform_cmpxchg64_strong(T & expected, T desired, volatile T * ptr) +{ +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 + const T oldval = __sync_val_compare_and_swap(ptr, expected, desired); + const bool result = (oldval == expected); + expected = oldval; + return result; +#else + int scratch; + T prev = expected; + /* Make sure ebx is saved and restored properly in case + this object is compiled as "position independent". Since + programmers on x86 tend to forget specifying -DPIC or + similar, always assume PIC. + + To make this work uniformly even in the non-PIC case, + setup register constraints such that ebx can not be + used by accident e.g. as base address for the variable + to be modified. Accessing "scratch" should always be okay, + as it can only be placed on the stack (and therefore + accessed through ebp or esp only). + + In theory, could push/pop ebx onto/off the stack, but movs + to a prepared stack slot turn out to be faster. */ + __asm__ __volatile__ ( + "movl %%ebx, %1\n" + "movl %2, %%ebx\n" + "lock; cmpxchg8b 0(%4)\n" + "movl %1, %%ebx\n" + : "=A" (prev), "=m" (scratch) + : "D" ((int)desired), "c" ((int)(desired >> 32)), "S" (ptr), "0" (prev) + : "memory"); + bool success = (prev == expected); + expected = prev; + return success; +#endif +} + +template +inline void +platform_store64(T value, volatile T * ptr) +{ + T expected = *ptr; + for (; !platform_cmpxchg64_strong(expected, value, ptr);) + { + BOOST_ATOMIC_X86_PAUSE(); + } +} + +template +inline T +platform_load64(const volatile T * ptr) +{ + T expected = *ptr; + for (; !platform_cmpxchg64_strong(expected, expected, const_cast(ptr));) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return expected; +} + +#endif + +} +} +} + +/* pull in 64-bit atomic type using cmpxchg8b above */ +#if !defined(__x86_64__) && (defined(__i686__) || defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) +#include +#endif + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp b/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp new file mode 100644 index 000000000..d87c87d71 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp @@ -0,0 +1,199 @@ +#ifndef BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP +#define BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* fallback implementation for various compilation targets; +this is *not* efficient, particularly because all operations +are fully fenced (full memory barriers before and after +each operation) */ + +#if defined(__GNUC__) + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(volatile int32_t *ptr, int32_t expected, int32_t desired) + { + return __sync_val_compare_and_swap_4(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + + #if defined(__amd64__) || defined(__i686__) + inline int64_t + fenced_compare_exchange_strong_64(int64_t *ptr, int64_t expected, int64_t desired) + { + return __sync_val_compare_and_swap_8(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif defined(__ICL) || defined(_MSC_VER) + + #if defined(_MSC_VER) + #include + #include + #endif + + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong(int32_t *ptr, int32_t expected, int32_t desired) + { + return _InterlockedCompareExchange(reinterpret_cast(ptr), desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + #if defined(_WIN64) + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return _InterlockedCompareExchange64(ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif (defined(__ICC) || defined(__ECC)) + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(int32_t *ptr, int32_t expected, int32_t desired) + { + return _InterlockedCompareExchange((void*)ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + #if defined(__x86_64) + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return cas64(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #elif defined(__ECC) //IA-64 version + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return _InterlockedCompareExchange64((void*)ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif (defined(__SUNPRO_CC) && defined(__sparc)) + #include + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(int32_t *ptr, int32_t expected, int32_t desired) + { + return atomic_cas_32((volatile unsigned int*)ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + + /* FIXME: check for 64 bit mode */ + inline int64_t + fenced_compare_exchange_strong_64(int64_t *ptr, int64_t expected, int64_t desired) + { + return atomic_cas_64((volatile unsigned long long*)ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + }}} +#endif + + +namespace boost { +namespace atomics { +namespace detail { + +#ifdef BOOST_ATOMIC_HAVE_CAS32 +template +class atomic_generic_cas32 { +private: + typedef atomic_generic_cas32 this_type; +public: + explicit atomic_generic_cas32(T v) : i((int32_t)v) {} + atomic_generic_cas32() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T expected=(T)i; + do { } while(!const_cast(this)->compare_exchange_weak(expected, expected, order, memory_order_relaxed)); + return expected; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + exchange(v); + } + bool compare_exchange_strong( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + T found; + found=(T)fenced_compare_exchange_strong_32(&i, (int32_t)expected, (int32_t)desired); + bool success=(found==expected); + expected=found; + return success; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + T exchange(T r, memory_order order=memory_order_seq_cst) volatile + { + T expected=(T)i; + do { } while(!compare_exchange_weak(expected, r, order, memory_order_relaxed)); + return expected; + } + + bool is_lock_free(void) const volatile {return true;} + typedef T integral_type; +private: + mutable int32_t i; +}; + +template +class platform_atomic_integral : public build_atomic_from_exchange > { +public: + typedef build_atomic_from_exchange > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; +#endif + +} } } + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/interlocked.hpp b/project/jni/boost/include/boost/atomic/detail/interlocked.hpp new file mode 100644 index 000000000..84a71316f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/interlocked.hpp @@ -0,0 +1,206 @@ +#ifndef BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP +#define BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(_WIN32_WCE) + +#include + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest), exchange, compare) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) BOOST_INTERLOCKED_EXCHANGE((long*)(dest), newval) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) BOOST_INTERLOCKED_EXCHANGE_ADD((long*)(dest), addend) +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) BOOST_INTERLOCKED_EXCHANGE_POINTER(dest, newval) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset)) + +#elif defined(_MSC_VER) + +#include + +#pragma intrinsic(_InterlockedCompareExchange) +#pragma intrinsic(_InterlockedExchangeAdd) +#pragma intrinsic(_InterlockedExchange) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval)) + +#if _MSC_VER >= 1400 + +#pragma intrinsic(_InterlockedAnd) +#pragma intrinsic(_InterlockedOr) +#pragma intrinsic(_InterlockedXor) + +#define BOOST_ATOMIC_INTERLOCKED_AND(dest, arg) _InterlockedAnd((long*)(dest), (long)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR(dest, arg) _InterlockedOr((long*)(dest), (long)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR(dest, arg) _InterlockedXor((long*)(dest), (long)(arg)) + +#endif // _MSC_VER >= 1400 + +#if _MSC_VER >= 1600 + +// MSVC 2010 and later provide intrinsics for 8 and 16 bit integers. +// Note that for each bit count these macros must be either all defined or all not defined. +// Otherwise atomic<> operations will be implemented inconsistently. + +#pragma intrinsic(_InterlockedCompareExchange8) +#pragma intrinsic(_InterlockedExchangeAdd8) +#pragma intrinsic(_InterlockedExchange8) +#pragma intrinsic(_InterlockedAnd8) +#pragma intrinsic(_InterlockedOr8) +#pragma intrinsic(_InterlockedXor8) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(dest, exchange, compare) _InterlockedCompareExchange8((char*)(dest), (char)(exchange), (char)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(dest, addend) _InterlockedExchangeAdd8((char*)(dest), (char)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(dest, newval) _InterlockedExchange8((char*)(dest), (char)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND8(dest, arg) _InterlockedAnd8((char*)(dest), (char)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR8(dest, arg) _InterlockedOr8((char*)(dest), (char)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR8(dest, arg) _InterlockedXor8((char*)(dest), (char)(arg)) + +#pragma intrinsic(_InterlockedCompareExchange16) +#pragma intrinsic(_InterlockedExchangeAdd16) +#pragma intrinsic(_InterlockedExchange16) +#pragma intrinsic(_InterlockedAnd16) +#pragma intrinsic(_InterlockedOr16) +#pragma intrinsic(_InterlockedXor16) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(dest, exchange, compare) _InterlockedCompareExchange16((short*)(dest), (short)(exchange), (short)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(dest, addend) _InterlockedExchangeAdd16((short*)(dest), (short)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(dest, newval) _InterlockedExchange16((short*)(dest), (short)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND16(dest, arg) _InterlockedAnd16((short*)(dest), (short)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR16(dest, arg) _InterlockedOr16((short*)(dest), (short)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR16(dest, arg) _InterlockedXor16((short*)(dest), (short)(arg)) + +#endif // _MSC_VER >= 1600 + +#if defined(_M_AMD64) || defined(_M_IA64) + +#pragma intrinsic(_InterlockedCompareExchange64) +#pragma intrinsic(_InterlockedExchangeAdd64) +#pragma intrinsic(_InterlockedExchange64) +#pragma intrinsic(_InterlockedAnd64) +#pragma intrinsic(_InterlockedOr64) +#pragma intrinsic(_InterlockedXor64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) _InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) _InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) _InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND64(dest, arg) _InterlockedAnd64((__int64*)(dest), (__int64)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR64(dest, arg) _InterlockedOr64((__int64*)(dest), (__int64)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR64(dest, arg) _InterlockedXor64((__int64*)(dest), (__int64)(arg)) + +#pragma intrinsic(_InterlockedCompareExchangePointer) +#pragma intrinsic(_InterlockedExchangePointer) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) _InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) _InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64((long*)(dest), byte_offset)) + +#else // defined(_M_AMD64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)_InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)_InterlockedExchange((long*)(dest), (long)(newval))) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset)) + +#endif // defined(_M_AMD64) + +#else // defined(_MSC_VER) + +#if defined(BOOST_USE_WINDOWS_H) + +#include + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) InterlockedExchange((long*)(dest), (long)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) InterlockedExchangeAdd((long*)(dest), (long)(addend)) + +#if defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset)) + +#else // defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset)) + +#endif // defined(_WIN64) + +#else // defined(BOOST_USE_WINDOWS_H) + +#if defined(__MINGW64__) +#define BOOST_ATOMIC_INTERLOCKED_IMPORT +#else +#define BOOST_ATOMIC_INTERLOCKED_IMPORT __declspec(dllimport) +#endif + +namespace boost { +namespace atomics { +namespace detail { + +extern "C" { + +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange(long volatile*, long, long); +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchange(long volatile*, long); +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd(long volatile*, long); + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) boost::atomics::detail::InterlockedExchange((long*)(dest), (long)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) boost::atomics::detail::InterlockedExchangeAdd((long*)(dest), (long)(addend)) + +#if defined(_WIN64) + +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedCompareExchange64(__int64 volatile*, __int64, __int64); +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchange64(__int64 volatile*, __int64); +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchangeAdd64(__int64 volatile*, __int64); + +BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer(void* volatile *, void*, void*); +BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer(void* volatile *, void*); + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) boost::atomics::detail::InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) boost::atomics::detail::InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) boost::atomics::detail::InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset)) + +#else // defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset)) + +#endif // defined(_WIN64) + +} // extern "C" + +} // namespace detail +} // namespace atomics +} // namespace boost + +#undef BOOST_ATOMIC_INTERLOCKED_IMPORT + +#endif // defined(BOOST_USE_WINDOWS_H) + +#endif // defined(_MSC_VER) + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp b/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp new file mode 100644 index 000000000..9831d81e8 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp @@ -0,0 +1,187 @@ +#ifndef BOOST_ATOMIC_DETAIL_LINUX_ARM_HPP +#define BOOST_ATOMIC_DETAIL_LINUX_ARM_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2009, 2011 Helge Bahmann +// Copyright (c) 2009 Phil Endecott +// Linux-specific code by Phil Endecott + +// Different ARM processors have different atomic instructions. In particular, +// architecture versions before v6 (which are still in widespread use, e.g. the +// Intel/Marvell XScale chips like the one in the NSLU2) have only atomic swap. +// On Linux the kernel provides some support that lets us abstract away from +// these differences: it provides emulated CAS and barrier functions at special +// addresses that are guaranteed not to be interrupted by the kernel. Using +// this facility is slightly slower than inline assembler would be, but much +// faster than a system call. +// +// While this emulated CAS is "strong" in the sense that it does not fail +// "spuriously" (i.e.: it never fails to perform the exchange when the value +// found equals the value expected), it does not return the found value on +// failure. To satisfy the atomic API, compare_exchange_{weak|strong} must +// return the found value on failure, and we have to manually load this value +// after the emulated CAS reports failure. This in turn introduces a race +// between the CAS failing (due to the "wrong" value being found) and subsequently +// loading (which might turn up the "right" value). From an application's +// point of view this looks like "spurious failure", and therefore the +// emulated CAS is only good enough to provide compare_exchange_weak +// semantics. + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +inline void +arm_barrier(void) +{ + void (*kernel_dmb)(void) = (void (*)(void)) 0xffff0fa0; + kernel_dmb(); +} + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + case memory_order_consume: + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + platform_fence_before(order); +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + arm_barrier(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +template +inline bool +platform_cmpxchg32(T & expected, T desired, volatile T * ptr) +{ + typedef T (*kernel_cmpxchg32_t)(T oldval, T newval, volatile T * ptr); + + if (((kernel_cmpxchg32_t) 0xffff0fc0)(expected, desired, ptr) == 0) { + return true; + } else { + expected = *ptr; + return false; + } +} + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + atomics::detail::arm_barrier(); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/lockpool.hpp b/project/jni/boost/include/boost/atomic/detail/lockpool.hpp new file mode 100644 index 000000000..ea96cd299 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/lockpool.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP +#define BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE +#include +#endif + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE + +class lockpool +{ +public: + typedef mutex lock_type; + class scoped_lock + { + private: + lock_type& mtx_; + + scoped_lock(scoped_lock const&) /* = delete */; + scoped_lock& operator=(scoped_lock const&) /* = delete */; + + public: + explicit + scoped_lock(const volatile void * addr) : mtx_(get_lock_for(addr)) + { + mtx_.lock(); + } + ~scoped_lock() + { + mtx_.unlock(); + } + }; + +private: + static BOOST_ATOMIC_DECL lock_type& get_lock_for(const volatile void * addr); +}; + +#else + +class lockpool +{ +public: + typedef atomic_flag lock_type; + + class scoped_lock + { + private: + atomic_flag& flag_; + + scoped_lock(const scoped_lock &) /* = delete */; + scoped_lock& operator=(const scoped_lock &) /* = delete */; + + public: + explicit + scoped_lock(const volatile void * addr) : flag_(get_lock_for(addr)) + { + for (; flag_.test_and_set(memory_order_acquire);) + { +#if defined(BOOST_ATOMIC_X86_PAUSE) + BOOST_ATOMIC_X86_PAUSE(); +#endif + } + } + + ~scoped_lock(void) + { + flag_.clear(memory_order_release); + } + }; + +private: + static BOOST_ATOMIC_DECL lock_type& get_lock_for(const volatile void * addr); +}; + +#endif + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/platform.hpp b/project/jni/boost/include/boost/atomic/detail/platform.hpp new file mode 100644 index 000000000..a31ececad --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/platform.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_ATOMIC_DETAIL_PLATFORM_HPP +#define BOOST_ATOMIC_DETAIL_PLATFORM_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// 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) + +// Platform selection file + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + + #include + +#elif 0 && defined(__GNUC__) && defined(__alpha__) /* currently does not work correctly */ + + #include + #include + +#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__)) + + #include + +// This list of ARM architecture versions comes from Apple's arm/arch.h header. +// I don't know how complete it is. +#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_7A__)) + + #include + +#elif defined(__linux__) && defined(__arm__) + + #include + +#elif defined(__GNUC__) && defined(__sparc_v9__) + + #include + +#elif defined(BOOST_WINDOWS) || defined(_WIN32_CE) + + #include + +#elif 0 && defined(__GNUC__) /* currently does not work correctly */ + + #include + #include + +#else + +#include + +#endif + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/type-classification.hpp b/project/jni/boost/include/boost/atomic/detail/type-classification.hpp new file mode 100644 index 000000000..f7c2f8bf8 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/type-classification.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ATOMIC_DETAIL_TYPE_CLASSIFICATION_HPP +#define BOOST_ATOMIC_DETAIL_TYPE_CLASSIFICATION_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +template::value> +struct classify +{ + typedef void type; +}; + +template +struct classify {typedef int type;}; + +template +struct classify {typedef void* type;}; + +template +struct storage_size_of +{ + enum _ + { + size = sizeof(T), + value = (size == 3 ? 4 : (size == 5 || size == 6 || size == 7 ? 8 : size)) + }; +}; + +}}} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/windows.hpp b/project/jni/boost/include/boost/atomic/detail/windows.hpp new file mode 100644 index 000000000..4c401ae6f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/windows.hpp @@ -0,0 +1,1441 @@ +#ifndef BOOST_ATOMIC_DETAIL_WINDOWS_HPP +#define BOOST_ATOMIC_DETAIL_WINDOWS_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#ifdef _MSC_VER +#pragma warning(push) +// 'order' : unreferenced formal parameter +#pragma warning(disable: 4100) +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) +extern "C" void _mm_pause(void); +#pragma intrinsic(_mm_pause) +#define BOOST_ATOMIC_X86_PAUSE() _mm_pause() +#else +#define BOOST_ATOMIC_X86_PAUSE() +#endif + +// Define hardware barriers +#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +extern "C" void _mm_mfence(void); +#pragma intrinsic(_mm_mfence) +#endif + +BOOST_FORCEINLINE void hardware_full_fence(void) +{ +#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) + // Use mfence only if SSE2 is available + _mm_mfence(); +#else + long tmp; + BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&tmp, 0); +#endif +} + +// Define compiler barriers +#if defined(_MSC_VER) && _MSC_VER >= 1310 && !defined(_WIN32_WCE) +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic(_ReadWriteBarrier) +#define BOOST_ATOMIC_READ_WRITE_BARRIER() _ReadWriteBarrier() +#endif + +#ifndef BOOST_ATOMIC_READ_WRITE_BARRIER +#define BOOST_ATOMIC_READ_WRITE_BARRIER() +#endif + +BOOST_FORCEINLINE void +platform_fence_before(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_before_store(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after_store(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after_load(memory_order order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); + + // On x86 and x86_64 there is no need for a hardware barrier, + // even if seq_cst memory order is requested, because all + // seq_cst writes are implemented with lock-prefixed operations + // or xchg which has implied lock prefix. Therefore normal loads + // are already ordered with seq_cst stores on these architectures. + +#if !(defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))) + if (order == memory_order_seq_cst) + hardware_full_fence(); +#endif +} + +} // namespace detail +} // namespace atomics + +#define BOOST_ATOMIC_THREAD_FENCE 2 +BOOST_FORCEINLINE void +atomic_thread_fence(memory_order order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); + if (order == memory_order_seq_cst) + atomics::detail::hardware_full_fence(); +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +BOOST_FORCEINLINE void +atomic_signal_fence(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +#undef BOOST_ATOMIC_READ_WRITE_BARRIER + +class atomic_flag +{ +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(0) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + const uint32_t old = (uint32_t)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, 1); + atomics::detail::platform_fence_after(order); + return old != 0; + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, 0); + atomics::detail::platform_fence_after_store(order); + } +}; + +} // namespace boost + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(_MSC_VER) +#pragma warning(push) +// 'char' : forcing value to bool 'true' or 'false' (performance warning) +#pragma warning(disable: 4800) +#endif + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + typedef value_type storage_type; +#else + typedef uint32_t storage_type; +#endif + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE8 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&v_, desired, previous)); +#else + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); +#endif + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_AND8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_OR8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_XOR8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + typedef value_type storage_type; +#else + typedef uint32_t storage_type; +#endif + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE16 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&v_, desired, previous)); +#else + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); +#endif + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_AND16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_OR16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_XOR16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef value_type storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for(; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef value_type storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(&v_, v)); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&v_, v)); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&v_, desired, previous)); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_AND64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_OR64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_XOR64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif // defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +// MSVC 2012 fails to recognize sizeof(T) as a constant expression in template specializations +enum msvc_sizeof_pointer_workaround { sizeof_pointer = sizeof(void*) }; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef void* value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(&v_, v); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = (value_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&v_, desired, previous); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T* value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(&v_, v); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = (value_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&v_, desired, previous); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + value_type res = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(&v_, v); + platform_fence_after(order); + return res; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + typedef uint8_t storage_type; +#else + typedef uint32_t storage_type; +#endif +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE8 + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&v_, tmp)); +#else + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); +#endif + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&v_, desired_s, expected_s)); +#else + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); +#endif + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + typedef uint16_t storage_type; +#else + typedef uint32_t storage_type; +#endif +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE16 + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&v_, tmp)); +#else + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); +#endif + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&v_, desired_s, expected_s)); +#else + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); +#endif + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&v_, tmp)); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&v_, desired_s, expected_s)); + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif // defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +} // namespace detail +} // namespace atomics +} // namespace boost + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif diff --git a/project/jni/boost/include/boost/bimap/bimap.hpp b/project/jni/boost/include/boost/bimap/bimap.hpp index 3021b04ff..2929ce58e 100644 --- a/project/jni/boost/include/boost/bimap/bimap.hpp +++ b/project/jni/boost/include/boost/bimap/bimap.hpp @@ -166,28 +166,37 @@ class bimap /* // The rest is computed in the core, because it is quite difficult to // expose a nice interface with so many metaprogramming stuff. - // Here it is the complete metadat list. - + // Map by {side} metadata typedef -unspecified- {side}_tag; typedef -unspecified- {side}_data_type; typedef -unspecified- {side}_value_type; typedef -unspecified- {side}_key_type; - typedef -unspecified- {side}_iterator; - typedef -unspecified- {side}_const_iterator; - + + // There are other typedefs for definitions of different map views + ------------------------------------------------------------------*/ typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail:: left_map_view_type::type left_map; typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail:: right_map_view_type::type right_map; + + typedef BOOST_DEDUCED_TYPENAME + left_map::iterator left_iterator; + typedef BOOST_DEDUCED_TYPENAME + left_map::const_iterator left_const_iterator; typedef BOOST_DEDUCED_TYPENAME - left_map::reference left_reference; + right_map::iterator right_iterator; typedef BOOST_DEDUCED_TYPENAME - left_map::const_reference left_const_reference; + right_map::const_iterator right_const_iterator; + + typedef BOOST_DEDUCED_TYPENAME + left_map::reference left_reference; + typedef BOOST_DEDUCED_TYPENAME + left_map::const_reference left_const_reference; typedef BOOST_DEDUCED_TYPENAME right_map::reference right_reference; @@ -239,16 +248,19 @@ class bimap const allocator_type& al = allocator_type()) : base_::relation_set( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core) ), core(first,last,ctor_args_list(),al), left ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core) ), right ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core) ) {} @@ -256,16 +268,19 @@ class bimap bimap(const bimap& x) : base_::relation_set( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core) ), core(x.core), left ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core) ), right ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core) ) {} @@ -279,32 +294,28 @@ class bimap // Projection of iterators template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::left_iterator - project_left(IteratorType iter) + left_iterator project_left(IteratorType iter) { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::left_const_iterator - project_left(IteratorType iter) const + left_const_iterator project_left(IteratorType iter) const { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::right_iterator - project_right(IteratorType iter) + right_iterator project_right(IteratorType iter) { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::right_const_iterator - project_right(IteratorType iter) const + right_const_iterator project_right(IteratorType iter) const { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base()); @@ -382,7 +393,7 @@ class bimap friend class boost::serialization::access; template - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & serialization::make_nvp("mi_core",core); } diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp index ff7a5407a..e4fd52df7 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp @@ -134,6 +134,7 @@ class list_map_adaptor : typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type key_type; typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; protected: diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp index f1a6f64d2..3df1a03cb 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp @@ -82,6 +82,7 @@ class map_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp index ad5edf2bb..f39899ea0 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp @@ -81,6 +81,7 @@ class multimap_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp index 762a643c2..fd233e8e2 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp @@ -82,6 +82,7 @@ class unordered_map_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp index be28b3adf..104d19796 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp @@ -81,6 +81,7 @@ class unordered_multimap_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp index de6e391c9..87d41726e 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp @@ -109,25 +109,33 @@ class vector_adaptor : BOOST_DEDUCED_TYPENAME base_::const_reference operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const { - return this->base().operator[](n); + return this->template functor()( + this->base().operator[](n) + ); } BOOST_DEDUCED_TYPENAME base_::const_reference at(BOOST_DEDUCED_TYPENAME base_::size_type n) const { - return this->base().at(n); + return this->template functor()( + this->base().at(n) + ); } BOOST_DEDUCED_TYPENAME base_::reference operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) { - return this->base().operator[](n); + return this->template functor()( + this->base().operator[](n) + ); } BOOST_DEDUCED_TYPENAME base_::reference at(BOOST_DEDUCED_TYPENAME base_::size_type n) { - return this->base().at(n); + return this->template functor()( + this->base().at(n) + ); } }; diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp index 9b0b9d3df..1d49ac7c6 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp @@ -77,6 +77,7 @@ class vector_map_adaptor : typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type key_type; typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp b/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp index f37d96810..28a91a463 100644 --- a/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp +++ b/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp @@ -425,50 +425,6 @@ class bimap_core typedef BOOST_DEDUCED_TYPENAME right_index::iterator right_core_iterator; typedef BOOST_DEDUCED_TYPENAME right_index::const_iterator right_core_const_iterator; - // Map by {side} iterator metadata - // -------------------------------------------------------------------- - public: - - //@{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - left_tag, - relation, - left_core_iterator - - > left_iterator; - - typedef ::boost::bimaps::detail::map_view_iterator - < - right_tag, - relation, - right_core_iterator - - > right_iterator; - - //@} - - //@{ - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - left_tag, - relation, - left_core_const_iterator - - > left_const_iterator; - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - right_tag, - relation, - right_core_const_iterator - - > right_const_iterator; - - //@} - // Relation set view typedef BOOST_DEDUCED_TYPENAME ::boost::multi_index::index @@ -513,6 +469,7 @@ struct right_map_view_type >::type type; }; + } // namespace detail } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp b/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp index 7900901bf..51059c38c 100644 --- a/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp +++ b/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp @@ -31,12 +31,13 @@ #include #include #include -#include +//#include #include #include #include #include #include +#include namespace boost { namespace bimaps { @@ -47,27 +48,20 @@ namespace detail { // The next macro can be converted in a metafunctor to gain code robustness. /*===========================================================================*/ #define BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( \ - CONTAINER_ADAPTOR, TAG,BIMAP, OTHER_ITER, CONST_OTHER_ITER \ + CONTAINER_ADAPTOR, TAG, BIMAP, OTHER_ITER, CONST_OTHER_ITER \ ) \ ::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \ < \ BOOST_DEDUCED_TYPENAME BIMAP::core_type:: \ BOOST_NESTED_TEMPLATE index::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - OTHER_ITER::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - CONST_OTHER_ITER::type, \ + ::boost::bimaps::detail:: map_view_iterator, \ + ::boost::bimaps::detail::const_map_view_iterator, \ + ::boost::bimaps::detail:: OTHER_ITER, \ + ::boost::bimaps::detail::CONST_OTHER_ITER, \ ::boost::bimaps::container_adaptor::support::iterator_facade_to_base \ < \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by::type \ - \ + ::boost::bimaps::detail:: map_view_iterator, \ + ::boost::bimaps::detail::const_map_view_iterator \ >, \ ::boost::mpl::na, \ ::boost::mpl::na, \ @@ -102,13 +96,8 @@ class map_view_base { typedef ::boost::bimaps::container_adaptor::support:: iterator_facade_to_base< - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type - + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail::const_map_view_iterator > iterator_to_base_; typedef ::boost::bimaps::relation::detail:: @@ -125,8 +114,8 @@ class map_view_base pair_type_by::type value_type_; - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator_; + typedef + ::boost::bimaps::detail::map_view_iterator iterator_; public: @@ -144,7 +133,8 @@ class map_view_base return derived().base().replace( derived().template functor()(position), derived().template functor()( - value_type_(k,position->second) + ::boost::bimaps::relation::detail:: + copy_with_first_replaced(*position,k) ) ); } @@ -155,7 +145,8 @@ class map_view_base return derived().base().replace( derived().template functor()(position), derived().template functor()( - value_type_(position->first,d) + ::boost::bimaps::relation::detail:: + copy_with_second_replaced(*position,d) ) ); } @@ -263,8 +254,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & at(const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator iterator; iterator iter = derived().find(k); if( iter == derived().end() ) @@ -279,8 +270,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -295,8 +286,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & operator[](const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator iterator; typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: value_type_by::type value_type; @@ -341,8 +332,8 @@ class non_mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -355,7 +346,7 @@ class non_mutable_data_unique_map_view_access } template< class CompatibleKey > - data_type_ & operator[](const CompatibleKey& k) + data_type_ & operator[](const CompatibleKey&) { BOOST_BIMAP_STATIC_ERROR( OPERATOR_BRACKET_IS_NOT_SUPPORTED, (Derived)); } @@ -493,7 +484,7 @@ void assign(BOOST_DEDUCED_TYPENAME BASE::size_type n, \ const BOOST_DEDUCED_TYPENAME BASE::value_type& v) \ { \ this->clear(); \ - for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++n) \ + for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++i) \ { \ this->push_back(v); \ } \ diff --git a/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp b/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp index adc8d7c86..c796a7015 100644 --- a/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp +++ b/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp @@ -19,55 +19,110 @@ #include // Boost -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION + #include #include #include +// check +#include +#include + namespace boost { namespace bimaps { namespace detail { +/** \brief Map View Iterator adaptors from multi index to bimap. + +These classes are based on transform iterators from Boost.Iterator. + **/ + +template< class Tag, class BimapCore > struct map_view_iterator ; +template< class Tag, class BimapCore > struct const_map_view_iterator ; + +template< class Tag, class BimapCore > struct reverse_map_view_iterator ; +template< class Tag, class BimapCore > struct const_reverse_map_view_iterator ; + +template< class Tag, class BimapCore > struct local_map_view_iterator ; +template< class Tag, class BimapCore > struct const_local_map_view_iterator ; + + #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES -template< class Tag, class Relation, class CoreIterator > struct map_view_iterator; +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION +/*===========================================================================*/ +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT \ + BOOST_SERIALIZATION_SPLIT_MEMBER() \ + \ + friend class ::boost::serialization::access; \ + \ + template< class Archive > \ + void save(Archive & ar, const unsigned int) const \ + { \ + ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); \ + } \ + \ + template< class Archive > \ + void load(Archive & ar, const unsigned int) \ + { \ + BOOST_DEDUCED_TYPENAME base_::base_type iter; \ + ar >> ::boost::serialization::make_nvp("mi_iterator",iter); \ + this->base_reference() = iter; \ + } +/*===========================================================================*/ +#else +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT // None +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator_base -{ - typedef iterator_adaptor - < - map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by::type +/*===========================================================================*/ +#define BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( METANAME, ITERATOR ) \ +BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( METANAME, BimapCore, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index \ + ::type::ITERATOR type, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index \ + ::type::ITERATOR type \ +) +/*===========================================================================*/ + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( core_iterator_type_by + , iterator ) + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( reverse_core_iterator_type_by + , reverse_iterator ) + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( local_core_iterator_type_by + , local_iterator ) + + +// map_view_iterator + +template< class Tag, class BimapCore > +struct map_view_iterator_adaptor { + typedef iterator_adaptor< + map_view_iterator, + BOOST_DEDUCED_TYPENAME core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type > type; }; - -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - -/** \brief Map View Iterator adaptor from multi index to bimap. - -This is class is based on transform iterator from Boost.Iterator that is -modified to allow serialization. It has been specialized for this -library, and EBO optimization was applied to the functor. - - **/ - -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator : public map_view_iterator_base::type +template< class Tag, class BimapCore > +struct map_view_iterator : + public map_view_iterator_adaptor::type { - typedef BOOST_DEDUCED_TYPENAME - map_view_iterator_base::type base_; - + typedef BOOST_DEDUCED_TYPENAME + map_view_iterator_adaptor::type base_; public: map_view_iterator() {} - - map_view_iterator(CoreIterator const& iter) + map_view_iterator(BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - map_view_iterator(map_view_iterator const & iter) : base_(iter.base()) {} @@ -79,118 +134,204 @@ struct map_view_iterator : public map_view_iterator_base - void save(Archive & ar, const unsigned int version) const - { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); - } - - template< class Archive > - void load(Archive & ar, const unsigned int version) - { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; - } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; -#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - -template< class Tag, class Relation, class CoreIterator > struct const_map_view_iterator; - -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator_base -{ - typedef iterator_adaptor - < - const_map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by::type - +template< class Tag, class BimapCore > +struct const_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_map_view_iterator, + BOOST_DEDUCED_TYPENAME core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type > type; }; - -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - - -/** \brief Const Map View Iterator adaptor from multi index to bimap. - -See also map_view_iterator. - **/ - -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator : - - public const_map_view_iterator_base::type +template< class Tag, class BimapCore > +struct const_map_view_iterator : + public const_map_view_iterator_adaptor::type { - typedef BOOST_DEDUCED_TYPENAME - const_map_view_iterator_base::type base_; - + typedef BOOST_DEDUCED_TYPENAME + const_map_view_iterator_adaptor::type base_; public: const_map_view_iterator() {} - - const_map_view_iterator(CoreIterator const& iter) + const_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - const_map_view_iterator(const_map_view_iterator const & iter) : base_(iter.base()) {} - - const_map_view_iterator(map_view_iterator i) + const_map_view_iterator(map_view_iterator i) : base_(i.base()) {} BOOST_DEDUCED_TYPENAME base_::reference dereference() const { return ::boost::bimaps::relation::support::pair_by(*this->base()); } - private: - friend class iterator_core_access; - - #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION - - // Serialization support - - BOOST_SERIALIZATION_SPLIT_MEMBER() - - friend class ::boost::serialization::access; - - template< class Archive > - void save(Archive & ar, const unsigned int version) const - { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); - } - - template< class Archive > - void load(Archive & ar, const unsigned int version) - { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; - } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; +// reverse_map_view_iterator + +template< class Tag, class BimapCore > +struct reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + reverse_map_view_iterator, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct reverse_map_view_iterator : + public reverse_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + reverse_map_view_iterator_adaptor::type base_; + public: + + reverse_map_view_iterator() {} + reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + reverse_map_view_iterator(reverse_map_view_iterator const & iter) + : base_(iter.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by( + *const_cast( + &(*this->base()) + ) + ); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_reverse_map_view_iterator, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator : + public const_reverse_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_reverse_map_view_iterator_adaptor::type base_; + + public: + + const_reverse_map_view_iterator() {} + const_reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_reverse_map_view_iterator(const_reverse_map_view_iterator const & iter) + : base_(iter.base()) {} + const_reverse_map_view_iterator(reverse_map_view_iterator i) + : base_(i.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by(*this->base()); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + + +// local_map_view_iterator + +template< class Tag, class BimapCore > +struct local_map_view_iterator_adaptor { + typedef iterator_adaptor< + local_map_view_iterator, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct local_map_view_iterator : + public local_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + local_map_view_iterator_adaptor::type base_; + public: + + local_map_view_iterator() {} + local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + local_map_view_iterator(local_map_view_iterator const & iter) + : base_(iter.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by( + *const_cast( + &(*this->base()) + ) + ); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +template< class Tag, class BimapCore > +struct const_local_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_local_map_view_iterator, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct const_local_map_view_iterator : + public const_local_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_local_map_view_iterator_adaptor::type base_; + public: + + const_local_map_view_iterator() {} + const_local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_local_map_view_iterator(const_local_map_view_iterator const & iter) + : base_(iter.base()) {} + const_local_map_view_iterator(local_map_view_iterator i) + : base_(i.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by(*this->base()); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES + } // namespace detail } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp b/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp index 7c7f0d0a6..45305f039 100644 --- a/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp +++ b/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp @@ -199,7 +199,7 @@ class set_view_base { return derived().base().replace( derived().template functor()(position), - value_type_(l,position->right) + ::boost::bimaps::relation::detail::copy_with_left_replaced(*position,l) ); } @@ -209,7 +209,7 @@ class set_view_base { return derived().base().replace( derived().template functor()(position), - value_type_(position->left,r) + ::boost::bimaps::relation::detail::copy_with_right_replaced(*position,r) ); } diff --git a/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp b/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp index 57e6ae3c8..08d7a42b7 100644 --- a/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp +++ b/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp @@ -19,7 +19,11 @@ #include // Boost -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION + #include #include #include @@ -91,13 +95,13 @@ struct set_view_iterator : public set_view_iterator_base::type friend class ::boost::serialization::access; template< class Archive > - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); @@ -167,13 +171,13 @@ struct const_set_view_iterator : public const_set_view_iterator_base - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); diff --git a/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp b/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp index 62b3843bb..8a2ffdeba 100644 --- a/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp +++ b/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp @@ -21,9 +21,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp b/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp index c46ab790a..60294a3b6 100644 --- a/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp +++ b/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp @@ -21,7 +21,10 @@ #include #include #include -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION #include @@ -139,7 +142,7 @@ class relation_info_hook : public #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION template< class Archive > - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & ::boost::serialization::make_nvp("left" , base_::left ); ar & ::boost::serialization::make_nvp("right", base_::right); @@ -185,7 +188,7 @@ class relation_info_hook : #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION template< class Archive > - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & ::boost::serialization::make_nvp("left" , base_::left ); ar & ::boost::serialization::make_nvp("right", base_::right); @@ -343,7 +346,7 @@ class mutant_relation : public { return ::boost::bimaps::relation::support::get(*this); } - + #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION private: @@ -419,6 +422,50 @@ bool operator>=(const detail::relation_storage & a, (( a.left == b.left ) && ( a.right >= b.right ))); } +namespace detail { + +template< class TA, class TB, class Info, bool force_mutable> +mutant_relation + copy_with_left_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::left_value_type> + ::param_type l) +{ + return mutant_relation(l,rel.right,rel.info); +} + +template< class TA, class TB, bool force_mutable> +mutant_relation + copy_with_left_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::left_value_type> + ::param_type l) +{ + return mutant_relation(l,rel.right); +} + +template< class TA, class TB, class Info, bool force_mutable> +mutant_relation + copy_with_right_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::right_value_type> + ::param_type r) +{ + return mutant_relation(rel.left,r,rel.info); +} + +template< class TA, class TB, bool force_mutable> +mutant_relation + copy_with_right_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::right_value_type> + ::param_type r) +{ + return mutant_relation(rel.left,r); +} + +} // namespace detail + } // namespace relation } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp b/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp index 2325b3d32..53a0b300b 100644 --- a/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp +++ b/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp @@ -499,6 +499,50 @@ bool operator>=(const std::pair & a, } +namespace detail { + +template< class FirstType, class SecondType, class Info, class Layout> +structured_pair + copy_with_first_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::first_type> + ::param_type f) +{ + return structured_pair(f,p.second,p.info); +} + +template< class FirstType, class SecondType, class Layout> +structured_pair + copy_with_first_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::first_type> + ::param_type f) +{ + return structured_pair(f,p.second); +} + +template< class FirstType, class SecondType, class Info, class Layout> +structured_pair + copy_with_second_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::second_type> + ::param_type s) +{ + return structured_pair(p.first,s,p.info); +} + +template< class FirstType, class SecondType, class Layout> +structured_pair + copy_with_second_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::second_type> + ::param_type s) +{ + return structured_pair(p.first,s); +} + +} // namespace detail + } // namespace relation } // namespace bimaps diff --git a/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp b/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp index 6d1cff3ff..714183504 100644 --- a/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp +++ b/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp @@ -21,14 +21,11 @@ #include #include -#include - -#include - /** \struct boost::bimaps::support::iterator_type_by \brief Metafunction to obtain the iterator type of the map view by one of the sides. - +These metafunctions can be used outside the bimap framework for other bimap +signature compatible classes. \code template< class Tag, class Bimap > @@ -79,7 +76,6 @@ namespace boost { namespace bimaps { namespace support { - // Implementation of iterator type by metafunction BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER @@ -101,123 +97,41 @@ BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER // Implementation of reverse iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_reverse_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::reverse_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::reverse_iterator type + reverse_iterator_type_by, + left_reverse_iterator, + right_reverse_iterator ) -template< class Tag, class BimapCore > -struct reverse_iterator_type_by -{ - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_reverse_iterator_type_by::type - - > type; -}; - // Implementation of const reverse iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_const_reverse_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_reverse_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_reverse_iterator type + const_reverse_iterator_type_by, + left_const_reverse_iterator, + right_const_reverse_iterator ) -template< class Tag, class BimapCore > -struct const_reverse_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_const_reverse_iterator_type_by::type - - > type; -}; - // Implementation of local iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_local_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::local_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::local_iterator type + local_iterator_type_by, + left_local_iterator, + right_local_iterator ) - -template< class Tag, class BimapCore > -struct local_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_local_iterator_type_by::type - - > type; -}; - - // Implementation of const local iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_const_local_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_local_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_local_iterator type + const_local_iterator_type_by, + left_const_local_iterator, + right_const_local_iterator ) -template< class Tag, class BimapCore > -struct const_local_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_const_local_iterator_type_by::type - - > type; -}; - - } // namespace support } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/views/list_map_view.hpp b/project/jni/boost/include/boost/bimap/views/list_map_view.hpp index 2a7d2b1f6..1014fed84 100644 --- a/project/jni/boost/include/boost/bimap/views/list_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/list_map_view.hpp @@ -36,22 +36,17 @@ struct list_map_view_base { typedef ::boost::bimaps::container_adaptor::list_map_adaptor < - BOOST_DEDUCED_TYPENAME BimapType::core_type::BOOST_NESTED_TEMPLATE index::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - reverse_iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_reverse_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME BimapType::core_type:: + BOOST_NESTED_TEMPLATE index::type, + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail:: const_map_view_iterator, + ::boost::bimaps::detail:: reverse_map_view_iterator, + ::boost::bimaps::detail::const_reverse_map_view_iterator, ::boost::bimaps::container_adaptor::support::iterator_facade_to_base < - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type - + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail::const_map_view_iterator + >, ::boost::mpl::na, ::boost::mpl::na, @@ -64,7 +59,7 @@ struct list_map_view_base < Tag, BOOST_DEDUCED_TYPENAME BimapType::relation - + >::type > type; diff --git a/project/jni/boost/include/boost/bimap/views/map_view.hpp b/project/jni/boost/include/boost/bimap/views/map_view.hpp index 245b5d6fe..b8c2e01af 100644 --- a/project/jni/boost/include/boost/bimap/views/map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/map_view.hpp @@ -40,7 +40,7 @@ class map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( map_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: map_view_base< map_view,Tag,BimapType >, @@ -50,7 +50,7 @@ class map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( map_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/multimap_view.hpp b/project/jni/boost/include/boost/bimap/views/multimap_view.hpp index 41769496c..08022e7c3 100644 --- a/project/jni/boost/include/boost/bimap/views/multimap_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/multimap_view.hpp @@ -42,7 +42,7 @@ class multimap_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( multimap_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: map_view_base< multimap_view,Tag,BimapType > @@ -51,7 +51,7 @@ class multimap_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( multimap_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp b/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp index da9b4b47a..b78a80ef1 100644 --- a/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp @@ -29,8 +29,10 @@ class unconstrained_map_view { public: template< class T > - unconstrained_map_view(const T & t) {} + unconstrained_map_view(const T &) {} + typedef void iterator; + typedef void const_iterator; typedef void reference; typedef void const_reference; typedef void info_type; diff --git a/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp b/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp index 6b4a6e220..e4ada9d08 100644 --- a/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp @@ -29,7 +29,7 @@ class unconstrained_set_view { public: template< class T > - unconstrained_set_view(const T & t) {} + unconstrained_set_view(const T &) {} typedef void iterator; typedef void const_iterator; diff --git a/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp b/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp index 14813e2fc..90eeb1e71 100644 --- a/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp @@ -43,7 +43,7 @@ class unordered_map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_map_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ), public ::boost::bimaps::detail::map_view_base< @@ -56,7 +56,7 @@ class unordered_map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_map_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp b/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp index db222056e..ac4579cf9 100644 --- a/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp @@ -44,7 +44,7 @@ class unordered_multimap_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_multimap_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ), public ::boost::bimaps::detail::map_view_base< @@ -54,7 +54,7 @@ class unordered_multimap_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_multimap_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp b/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp index 1837c2797..d8fdd8d82 100644 --- a/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp @@ -41,7 +41,7 @@ class vector_map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( vector_map_adaptor, Tag,BimapType, - reverse_iterator_type_by, const_reverse_iterator_type_by + reverse_map_view_iterator, const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: @@ -50,7 +50,7 @@ class vector_map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( vector_map_adaptor, Tag,BimapType, - reverse_iterator_type_by, const_reverse_iterator_type_by + reverse_map_view_iterator, const_reverse_map_view_iterator ) base_; @@ -75,7 +75,41 @@ class vector_map_view this->base() = v.base(); return *this; } + + BOOST_DEDUCED_TYPENAME base_::const_reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().operator[](n) + ); + } + BOOST_DEDUCED_TYPENAME base_::const_reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().at(n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().operator[](n) + )); + } + + BOOST_DEDUCED_TYPENAME base_::reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().at(n) + )); + } + BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_) BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_) @@ -273,7 +307,7 @@ typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \ /*===========================================================================*/ #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \ BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \ - BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \ + BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) /*===========================================================================*/ namespace detail { diff --git a/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp b/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp index 58e347af2..890ffd02a 100644 --- a/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp @@ -68,6 +68,40 @@ class vector_set_view return *this; } + BOOST_DEDUCED_TYPENAME base_::const_reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().operator[](n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::const_reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().at(n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().operator[](n) + )); + } + + BOOST_DEDUCED_TYPENAME base_::reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().at(n) + )); + } + BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_) BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_) diff --git a/project/jni/boost/include/boost/chrono/chrono_io.hpp b/project/jni/boost/include/boost/chrono/chrono_io.hpp index 29a8d3493..ebd18a3da 100644 --- a/project/jni/boost/include/boost/chrono/chrono_io.hpp +++ b/project/jni/boost/include/boost/chrono/chrono_io.hpp @@ -14,6 +14,21 @@ #define BOOST_CHRONO_CHRONO_IO_HPP #include + +//#if BOOST_CHRONO_VERSION == 2 +//#include +//#include +//#elif BOOST_CHRONO_VERSION == 1 +//#include +//#endif + +#if defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#include +#include +#else #include +#endif + +#include #endif // BOOST_CHRONO_CHRONO_IO_HPP diff --git a/project/jni/boost/include/boost/chrono/config.hpp b/project/jni/boost/include/boost/chrono/config.hpp index a852b103a..d892ec834 100644 --- a/project/jni/boost/include/boost/chrono/config.hpp +++ b/project/jni/boost/include/boost/chrono/config.hpp @@ -13,10 +13,25 @@ #include +#if !defined BOOST_CHRONO_VERSION +#define BOOST_CHRONO_VERSION 1 +#else +#if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 +#error "BOOST_CHRONO_VERSION must be 1 or 2" +#endif +#endif + #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) #define BOOST_USE_WINDOWS_H #endif +#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +# define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +#endif + // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API // can be defined by the user to specify which API should be used @@ -62,12 +77,8 @@ # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME -# if defined(CLOCK_REALTIME) -# if defined(CLOCK_MONOTONIC) -# define BOOST_CHRONO_HAS_CLOCK_STEADY -# endif -# else -# error does not supply CLOCK_REALTIME +# if defined(CLOCK_MONOTONIC) +# define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK @@ -81,6 +92,13 @@ # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif +# if defined(__HP_aCC) && defined(__hpux) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# if defined(__VXWORKS__) +# undef BOOST_CHRONO_HAS_PROCESS_CLOCKS +# endif # endif #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) @@ -88,23 +106,63 @@ #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY #endif +//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS // unicode support ------------------------------// -#if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T) +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT #else #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 #endif #if ! defined BOOST_NOEXCEPT -#if defined(BOOST_NO_NOEXCEPT) +#if defined(BOOST_NO_CXX11_NOEXCEPT) #define BOOST_NOEXCEPT #else #define BOOST_NOEXCEPT noexcept #endif #endif +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +#define BOOST_CHRONO_LIB_CONSTEXPR +#else +#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +#ifdef BOOST_NO_CXX11_NOEXCEPT +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept +#endif +#endif + + +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" +#endif + +#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" +#endif + +#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING +#endif + +#if (BOOST_CHRONO_VERSION == 2) +#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#endif +#endif + #ifdef BOOST_CHRONO_HEADER_ONLY #define BOOST_CHRONO_INLINE inline #define BOOST_CHRONO_STATIC inline @@ -135,7 +193,6 @@ #endif -//#define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING // enable automatic library variant selection ------------------------------// diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp index d76d9356c..5d5c4f480 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp @@ -32,8 +32,8 @@ namespace chrono_detail factor = -1; else { - BOOST_ASSERT( factor <= 1000000l ); // doesn't handle large ticks - factor = 1000000l / factor; // compute factor + BOOST_ASSERT( factor <= 1000000000l ); // doesn't handle large ticks + factor = 1000000000l / factor; // compute factor if ( !factor ) factor = -1; } } @@ -54,7 +54,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { @@ -66,9 +66,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING process_real_cpu_clock::time_point process_real_cpu_clock::now( - system::error_code & ec) + system::error_code & ec) { - + tms tm; clock_t c = ::times( &tm ); if ( c == clock_t(-1) ) // error @@ -76,9 +76,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -91,21 +91,21 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -131,7 +131,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { @@ -152,9 +152,9 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -167,21 +167,21 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -208,11 +208,12 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXC if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return time_point(); } } } @@ -248,7 +249,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now( ec.clear(); } return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { @@ -297,8 +298,8 @@ process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -process_cpu_clock::time_point process_cpu_clock::now( - system::error_code & ec ) +process_cpu_clock::time_point process_cpu_clock::now( + system::error_code & ec ) { tms tm; clock_t c = ::times( &tm ); @@ -307,9 +308,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -333,9 +334,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -345,7 +346,7 @@ process_cpu_clock::time_point process_cpu_clock::now( } } } - + } #endif diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp index 5ad41f84e..42a544a0d 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp @@ -15,6 +15,7 @@ #include # include +# include # include namespace boost { namespace chrono { @@ -45,7 +46,7 @@ namespace boost { namespace chrono { } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING - thread_clock::time_point thread_clock::now( system::error_code & ec ) + thread_clock::time_point thread_clock::now( system::error_code & ec ) { struct timespec ts; #if defined CLOCK_THREAD_CPUTIME_ID @@ -64,9 +65,9 @@ namespace boost { namespace chrono { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::thread_clock" )); } else @@ -75,7 +76,7 @@ namespace boost { namespace chrono { return time_point(); } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp index d953fe4bb..17dae964c 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp @@ -42,6 +42,7 @@ namespace chrono_detail (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return steady_clock::time_point(); } return steady_clock::time_point(steady_clock::duration( @@ -97,8 +98,12 @@ namespace chrono_detail #else boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails #endif - return system_clock::time_point(system_clock::duration( - (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + return system_clock::time_point( + system_clock::duration( + ((static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime) + -116444736000000000LL + ) + ); } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING @@ -128,12 +133,6 @@ namespace chrono_detail { __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; return static_cast( temp ); } @@ -144,12 +143,6 @@ namespace chrono_detail __int64 temp = t; temp *= 10000000; - # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 - temp += 116444736000000000LL; - # else - temp += 116444736000000000; - # endif - return time_point(duration(temp)); } diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp index 6453aa600..1b7e67a12 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp @@ -34,8 +34,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); } + typedef ratio_divide >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast(c)*R::num/R::den) ); } @@ -56,8 +57,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { ec.clear(); } + typedef ratio_divide >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast(c)*R::num/R::den) ); } #endif diff --git a/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp b/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp index 78a0ce13e..94936c8ba 100644 --- a/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp +++ b/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp @@ -19,6 +19,10 @@ #if defined(__GNUC__) && (__GNUC__ >= 4) #pragma GCC system_header +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) #endif namespace boost { @@ -41,4 +45,10 @@ namespace detail { } // namespace detail } // namespace chrono -#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP +#if defined __SUNPRO_CC +#pragma enable_warn +#elif defined _MSC_VER +#pragma warning(pop) +#endif + +#endif // BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP diff --git a/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp b/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp index 13ad0ca8c..7c3ba6e2a 100644 --- a/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp +++ b/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp @@ -23,10 +23,11 @@ #include #include #include +#include namespace boost { using interprocess::unique_ptr; - + namespace chrono { namespace chrono_detail { @@ -65,13 +66,13 @@ scan_keyword(InputIterator& b, InputIterator e, unsigned char statbuf[100]; unsigned char* status = statbuf; // Change free by free_aux to avoid - // Error: Could not find a match for boost::interprocess::unique_ptr::unique_ptr(int, extern "C" void(void*)) + // Error: Could not find a match for boost::interprocess::unique_ptr::unique_ptr(int, extern "C" void(void*)) unique_ptr stat_hold(0, free_aux); if (nkw > sizeof(statbuf)) { status = (unsigned char*)malloc(nkw); if (status == 0) - throw std::bad_alloc(); + throw_exception(std::bad_alloc()); stat_hold.reset(status); } size_t n_might_match = nkw; // At this point, any keyword might match diff --git a/project/jni/boost/include/boost/chrono/detail/static_assert.hpp b/project/jni/boost/include/boost/chrono/detail/static_assert.hpp index 1ad21a56b..861519475 100644 --- a/project/jni/boost/include/boost/chrono/detail/static_assert.hpp +++ b/project/jni/boost/include/boost/chrono/detail/static_assert.hpp @@ -11,7 +11,7 @@ #include -#ifndef BOOST_NO_STATIC_ASSERT +#ifndef BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) #elif defined(BOOST_CHRONO_USES_STATIC_ASSERT) #include diff --git a/project/jni/boost/include/boost/chrono/detail/system.hpp b/project/jni/boost/include/boost/chrono/detail/system.hpp index f8a40f12a..0dcffe852 100644 --- a/project/jni/boost/include/boost/chrono/detail/system.hpp +++ b/project/jni/boost/include/boost/chrono/detail/system.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHRONO_DETAIL_SYSTEM_HPP #define BOOST_CHRONO_DETAIL_SYSTEM_HPP +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + #include #include @@ -15,7 +17,7 @@ #define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category() #endif -#ifdef BOOST_SYSTEM_NO_DEPRECATED +#ifdef BOOST_SYSTEM_NO_DEPRECATED #define BOOST_CHRONO_THROWS boost::throws() #define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::throws()) #else @@ -24,3 +26,4 @@ #endif #endif +#endif diff --git a/project/jni/boost/include/boost/chrono/duration.hpp b/project/jni/boost/include/boost/chrono/duration.hpp index 323474014..f39346c06 100644 --- a/project/jni/boost/include/boost/chrono/duration.hpp +++ b/project/jni/boost/include/boost/chrono/duration.hpp @@ -51,13 +51,17 @@ time2_demo contained this comment: #include #include -#if !defined(BOOST_NO_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) #define BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION "A duration representation can not be a duration" #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO "Second template parameter of duration must be a boost::ratio" #define BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE "duration period must be positive" #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION "Second template parameter of time_point must be a boost::chrono::duration" #endif +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -336,17 +340,17 @@ namespace detail namespace detail { template ::value> struct chrono_numeric_limits { - static T lowest() throw() {return (std::numeric_limits::min) ();} + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits::min) ();} }; template struct chrono_numeric_limits { - static T lowest() throw() {return (std::numeric_limits::min) ();} + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits::min) ();} }; template <> struct chrono_numeric_limits { - static float lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max) (); } @@ -354,7 +358,7 @@ namespace detail { template <> struct chrono_numeric_limits { - static double lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max) (); } @@ -362,7 +366,7 @@ namespace detail { template <> struct chrono_numeric_limits { - static long double lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max)(); } @@ -377,12 +381,12 @@ template struct duration_values { static BOOST_CONSTEXPR Rep zero() {return Rep(0);} - static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () { return (std::numeric_limits::max)(); } - static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () { return detail::numeric_limits::lowest(); } @@ -413,7 +417,7 @@ struct common_type, namespace chrono { template - class duration + class BOOST_SYMBOL_VISIBLE duration { //BOOST_CHRONO_STATIC_ASSERT(boost::is_integral::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ()); BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration::value, @@ -432,7 +436,7 @@ namespace chrono { BOOST_CONSTEXPR duration() : rep_(duration_values::zero()) { } template - BOOST_CONSTEXPR + BOOST_SYMBOL_VISIBLE inline BOOST_CONSTEXPR explicit duration(const Rep2& r , typename boost::enable_if < mpl::and_ < @@ -447,9 +451,8 @@ namespace chrono { > >::type* = 0 ) : rep_(r) { } - ~duration() {} //= default; - BOOST_CONSTEXPR - duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; + //~duration() {} //= default; +// BOOST_CONSTEXPR duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; duration& operator=(const duration& rhs) // = default; { if (&rhs != this) rep_= rhs.rep_; @@ -480,7 +483,7 @@ namespace chrono { // arithmetic BOOST_CONSTEXPR - duration operator+() const {return *this;} + duration operator+() const {return duration(rep_);;} BOOST_CONSTEXPR duration operator-() const {return duration(-rep_);} duration& operator++() {++rep_; return *this;} @@ -510,11 +513,11 @@ namespace chrono { { return duration(duration_values::zero()); } - static BOOST_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () { return duration((duration_values::min)()); } - static BOOST_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () { return duration((duration_values::max)()); } @@ -660,7 +663,7 @@ namespace detail template struct duration_eq { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type::type CD; return CD(lhs).count() == CD(rhs).count(); @@ -670,7 +673,7 @@ namespace detail template struct duration_eq { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() == rhs.count(); } @@ -679,7 +682,7 @@ namespace detail template struct duration_lt { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type::type CD; return CD(lhs).count() < CD(rhs).count(); @@ -689,7 +692,7 @@ namespace detail template struct duration_lt { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() < rhs.count(); } @@ -757,7 +760,7 @@ namespace detail // Duration >= template - inline + inline BOOST_CONSTEXPR bool operator>=(const duration& lhs, const duration& rhs) @@ -783,4 +786,9 @@ namespace detail } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_DURATION_HPP diff --git a/project/jni/boost/include/boost/chrono/io/duration_get.hpp b/project/jni/boost/include/boost/chrono/io/duration_get.hpp new file mode 100644 index 000000000..601460334 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_get.hpp @@ -0,0 +1,542 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_DURATION_GET_HPP +#define BOOST_CHRONO_IO_DURATION_GET_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/** + * Duration formatting facet for input. + */ +namespace boost +{ + namespace chrono + { + + namespace detail + { + template ::value> + struct duration_io_intermediate + { + typedef Rep type; + }; + + template + struct duration_io_intermediate + { + typedef typename mpl::if_c::value, long double, typename mpl::if_c< + is_signed::value, long long, unsigned long long>::type>::type type; + }; + + template + typename enable_if , bool>::type reduce(intermediate_type& r, + unsigned long long& den, std::ios_base::iostate& err) + { + typedef typename common_type::type common_type_t; + + // Reduce r * num / den + common_type_t t = math::gcd(common_type_t(r), common_type_t(den)); + r /= t; + den /= t; + if (den != 1) + { + // Conversion to Period is integral and not exact + err |= std::ios_base::failbit; + return false; + } + return true; + } + template + typename disable_if , bool>::type reduce(intermediate_type&, unsigned long long&, + std::ios_base::iostate&) + { + return true; + } + + } + + /** + * @c duration_get is used to parse a character sequence, extracting + * components of a duration into a class duration. + * Each get member parses a format as produced by a corresponding format specifier to time_put<>::put. + * If the sequence being parsed matches the correct format, the + * corresponding member of the class duration argument are set to the + * value used to produce the sequence; + * otherwise either an error is reported or unspecified values are assigned. + * In other words, user confirmation is required for reliable parsing of + * user-entered durations, but machine-generated formats can be parsed + * reliably. This allows parsers to be aggressive about interpreting user + * variations on standard formats. + * + * If the end iterator is reached during parsing of the get() member + * function, the member sets std::ios_base::eofbit in err. + */ + template > + class duration_get: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to scan the character buffer. + */ + typedef InputIterator iter_type; + + /** + * Construct a @c duration_get facet. + * @param refs + * @Effects Construct a @c duration_get facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + + explicit duration_get(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * Requires: [pattern,pat_end) shall be a valid range. + * + * Effects: The function starts by evaluating err = std::ios_base::goodbit. + * It then enters a loop, reading zero or more characters from s at + * each iteration. Unless otherwise specified below, the loop + * terminates when the first of the following conditions holds: + * - The expression pattern == pat_end evaluates to true. + * - The expression err == std::ios_base::goodbit evaluates to false. + * - The expression s == end evaluates to true, in which case the + * function evaluates err = std::ios_base::eofbit | std::ios_base::failbit. + * - The next element of pattern is equal to '%', followed by a conversion + * specifier character, format. + * If the number of elements in the range [pattern,pat_end) is not + * sufficient to unambiguously determine whether the conversion + * specification is complete and valid, the function evaluates + * err = std::ios_base::failbit. Otherwise, the function evaluates + * s = get_value(s, end, ios, err, r) when the conversion specification is 'v' and + * s = get_value(s, end, ios, err, rt) when the conversion specification is 'u'. + * If err == std::ios_base::goodbit holds after + * the evaluation of the expression, the function increments pattern to + * point just past the end of the conversion specification and continues + * looping. + * - The expression isspace(*pattern, ios.getloc()) evaluates to true, in + * which case the function first increments pattern until + * pattern == pat_end || !isspace(*pattern, ios.getloc()) evaluates to true, + * then advances s until s == end || !isspace(*s, ios.getloc()) is true, + * and finally resumes looping. + * - The next character read from s matches the element pointed to by + * pattern in a case-insensitive comparison, in which case the function + * evaluates ++pattern, ++s and continues looping. Otherwise, the function + * evaluates err = std::ios_base::failbit. + * + * Once r and rt are retrieved, + * Returns: s + */ + template + iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, + duration &d, const char_type *pattern, const char_type *pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >(ios.getloc()); + return get(facet, s, end, ios, err, d, pattern, pat_end); + } + else + { + duration_units_default facet; + return get(facet, s, end, ios, err, d, pattern, pat_end); + } + } + + template + iter_type get(duration_units const&facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, duration &d, const char_type *pattern, const char_type *pat_end) const + { + + typedef typename detail::duration_io_intermediate::type intermediate_type; + intermediate_type r; + rt_ratio rt; + bool value_found = false, unit_found = false; + + const std::ctype& ct = std::use_facet >(ios.getloc()); + while (pattern != pat_end && err == std::ios_base::goodbit) + { + if (s == end) + { + err |= std::ios_base::eofbit; + break; + } + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + err |= std::ios_base::failbit; + return s; + } + char cmd = ct.narrow(*pattern, 0); + switch (cmd) + { + case 'v': + { + if (value_found) + { + err |= std::ios_base::failbit; + return s; + } + value_found = true; + s = get_value(s, end, ios, err, r); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + case 'u': + { + if (unit_found) + { + err |= std::ios_base::failbit; + return s; + } + unit_found = true; + s = get_unit(facet, s, end, ios, err, rt); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + + ++pattern; + } + else if (ct.is(std::ctype_base::space, *pattern)) + { + for (++pattern; pattern != pat_end && ct.is(std::ctype_base::space, *pattern); ++pattern) + ; + for (; s != end && ct.is(std::ctype_base::space, *s); ++s) + ; + } + else if (ct.toupper(*s) == ct.toupper(*pattern)) + { + ++s; + ++pattern; + } + else + { + err |= std::ios_base::failbit; + return s; + } + + } + + unsigned long long num = rt.num; + unsigned long long den = rt.den; + + // r should be multiplied by (num/den) / Period + // Reduce (num/den) / Period to lowest terms + unsigned long long gcd_n1_n2 = math::gcd(num, Period::num); + unsigned long long gcd_d1_d2 = math::gcd(den, Period::den); + num /= gcd_n1_n2; + den /= gcd_d1_d2; + unsigned long long n2 = Period::num / gcd_n1_n2; + unsigned long long d2 = Period::den / gcd_d1_d2; + if (num > (std::numeric_limits::max)() / d2 || den + > (std::numeric_limits::max)() / n2) + { + // (num/den) / Period overflows + err |= std::ios_base::failbit; + return s; + } + num *= d2; + den *= n2; + + typedef typename common_type::type common_type_t; + + // num / den is now factor to multiply by r + if (!detail::reduce(r, den, err)) return s; + + if (chrono::detail::gt(r, ( (duration_values::max)() / num))) + { + // Conversion to Period overflowed + err |= std::ios_base::failbit; + return s; + } + common_type_t t = r * num; + t /= den; + if (t > 0) + { + Rep pt = t; + if ( (duration_values::max)() < pt) + { + // Conversion to Period overflowed + err |= std::ios_base::failbit; + return s; + } + } + // Success! Store it. + r = Rep(t); + d = duration (r); + + return s; + } + + /** + * + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return get(s, end, ios, err, ios, d, str.data(), str.data() + str.size()); + * @codeend + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, + duration & d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >(ios.getloc()); + std::basic_string str = facet.get_pattern(); + return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size()); + } + else + { + duration_units_default facet; + std::basic_string str = facet.get_pattern(); + return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size()); + } + } + + /** + * + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param r a reference to the duration representation. + * @Effects As if + * @code + * return std::use_facet >(ios.getloc()).get(s, end, ios, err, r); + * @endcode + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get_value(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, Rep& r) const + { + return std::use_facet >(ios.getloc()).get(s, end, ios, err, r); + } + + /** + * + * @param s start input stream iterator + * @param e end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param rt a reference to the duration run-time ratio. + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + iter_type get_unit(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, rt_ratio &rt) const + { + if (std::has_facet >(is.getloc())) + { + return get_unit(std::use_facet >(is.getloc()), i, e, is, err, rt); + } + else + { + duration_units_default facet; + return get_unit(facet, i, e, is, err, rt); + } + } + + + iter_type get_unit(duration_units const &facet, iter_type i, iter_type e, std::ios_base& is, + std::ios_base::iostate& err, rt_ratio &rt) const + { + + if (*i == '[') + { + // parse [N/D]s or [N/D]second or [N/D]seconds format + ++i; + i = std::use_facet >(is.getloc()).get(i, e, is, err, rt.num); + if ( (err & std::ios_base::failbit) != 0) + { + return i; + } + + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + CharT x = *i++; + if (x != '/') + { + err |= std::ios_base::failbit; + return i; + } + i = std::use_facet >(is.getloc()).get(i, e, is, err, rt.den); + if ( (err & std::ios_base::failbit) != 0) + { + return i; + } + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + if (*i != ']') + { + err |= std::ios_base::failbit; + return i; + } + ++i; + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + // parse s or second or seconds + return do_get_n_d_valid_unit(facet, i, e, is, err); + } + else + { + return do_get_valid_unit(facet, i, e, is, err, rt); + } + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~duration_get() + { + } + + protected: + + /** + * Extracts the run-time ratio associated to the duration when it is given in prefix form. + * + * This is an extension point of this facet so that we can take in account other periods that can have a useful + * translation in other contexts, as e.g. days and weeks. + * + * @param facet the duration_units facet + * @param s start input stream iterator. + * @param e end input stream iterator. + * @param ios a reference to a ios_base. + * @param err the ios_base state. + * @return @c s + */ + iter_type do_get_n_d_valid_unit(duration_units const &facet, iter_type i, iter_type e, + std::ios_base&, std::ios_base::iostate& err) const + { + // parse SI name, short or long + + const string_type* units = facet.get_n_d_valid_units_start(); + const string_type* units_end = facet.get_n_d_valid_units_end(); + + const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end, + //~ std::use_facet >(loc), + err); + if (!facet.match_n_d_valid_unit(k)) + { + err |= std::ios_base::failbit; + } + + return i; + } + + /** + * Extracts the run-time ratio associated to the duration when it is given in prefix form. + * + * This is an extension point of this facet so that we can take in account other periods that can have a useful + * translation in other contexts, as e.g. days and weeks. + * + * @param facet the duration_units facet + * @param s start input stream iterator. + * @param e end input stream iterator. + * @param ios a reference to a ios_base. + * @param err the ios_base state. + * @param rt a reference to the duration run-time ratio. + * @Effects + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name. + */ + iter_type do_get_valid_unit(duration_units const &facet, iter_type i, iter_type e, + std::ios_base&, std::ios_base::iostate& err, rt_ratio &rt) const + { + // parse SI name, short or long + + const string_type* units = facet.get_valid_units_start(); + const string_type* units_end = facet.get_valid_units_end(); + + err = std::ios_base::goodbit; + const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end, + //~ std::use_facet >(loc), + err); + + if (!facet.match_valid_unit(k, rt)) + { + err |= std::ios_base::failbit; + } + return i; + + } + }; + + /** + * Unique identifier for this type of facet. + */ + template + std::locale::id duration_get::id; + + } // chrono +} +// boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_io.hpp b/project/jni/boost/include/boost/chrono/io/duration_io.hpp new file mode 100644 index 000000000..438f7696d --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_io.hpp @@ -0,0 +1,225 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_DURATION_IO_HPP +#define BOOST_CHRONO_IO_DURATION_IO_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * duration parameterized manipulator. + */ + + class duration_fmt: public manip + { + duration_style style_; + public: + + /** + * explicit manipulator constructor from a @c duration_style + */ + explicit duration_fmt(duration_style style)BOOST_NOEXCEPT + : style_(style) + {} + + /** + * Change the duration_style ios state; + */ + void operator()(std::ios_base &ios) const + + { + set_duration_style(ios, style_); + } + }; + + /** + * duration_style i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + struct duration_style_io_saver + { + + //! the type of the state to restore + typedef std::ios_base state_type; + //! the type of aspect to save + typedef duration_style aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c duration_style. + */ + explicit duration_style_io_saver(state_type &s) : + s_save_(s) + { + a_save_ = get_duration_style(s_save_); + } + + /** + * Construction from an i/o stream and a @c duration_style to restore. + * + * Stores a reference to the i/o stream and the value @c duration_style to restore given as parameter. + */ + duration_style_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the duration_style to be restored. + */ + ~duration_style_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the duration_style to be restored. + */ + void restore() + { + set_duration_style(s_save_, a_save_); + } + + private: + duration_style_io_saver& operator=(duration_style_io_saver const& rhs) ; + + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * duration stream inserter + * @param os the output stream + * @param d to value to insert + * @return @c os + */ + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const duration& d) + { + bool failed = false; + BOOST_TRY + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + typename std::basic_ostream::sentry opfx(os); + if (bool(opfx)) + { + if (!std::has_facet >(os.getloc())) + { + if (duration_put ().put(os, os, os.fill(), d) .failed()) + { + err = std::ios_base::badbit; + } + } + else if (std::use_facet >(os.getloc()) .put(os, os, os.fill(), d) .failed()) + { + err = std::ios_base::badbit; + } + os.width(0); + } + } + BOOST_CATCH(...) + { + bool flag = false; + BOOST_TRY + { + os.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) os.setstate(err); + return os; + } + BOOST_CATCH(...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) os.setstate(std::ios_base::failbit | std::ios_base::badbit); + return os; + } + + /** + * + * @param is the input stream + * @param d the duration + * @return @c is + */ + template + std::basic_istream& + operator>>(std::basic_istream& is, duration& d) + { + std::ios_base::iostate err = std::ios_base::goodbit; + + BOOST_TRY + { + typename std::basic_istream::sentry ipfx(is); + if (bool(ipfx)) + { + if (!std::has_facet >(is.getloc())) + { + duration_get ().get(is, std::istreambuf_iterator(), is, err, d); + } + else + { + std::use_facet >(is.getloc()) .get(is, std::istreambuf_iterator(), is, + err, d); + } + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + is.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) { BOOST_RETHROW } + } + BOOST_CATCH_END + if (err) is.setstate(err); + return is; + } + + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_put.hpp b/project/jni/boost/include/boost/chrono/io/duration_put.hpp new file mode 100644 index 000000000..7bd0cd7db --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_put.hpp @@ -0,0 +1,264 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +/** + * Duration formatting facet for output. + */ +#ifndef BOOST_CHRONO_IO_DURATION_PUT_HPP +#define BOOST_CHRONO_IO_DURATION_PUT_HPP + +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @tparam ChatT a character type + * @tparam OutputIterator a model of @c OutputIterator + * + * The @c duration_put facet provides facilities for formatted output of duration values. + * The member function of @c duration_put take a duration and format it into character string representation. + * + */ + template > + class duration_put: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to write in the character buffer. + */ + typedef OutputIterator iter_type; + + /** + * Construct a duration_put facet. + * @param refs + * @Effects Construct a duration_put facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_put(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Steps through the sequence from @c pattern to @c pat_end, + * identifying characters that are part of a pattern sequence. Each character + * that is not part of a pattern sequence is written to @c s immediately, and + * each pattern sequence, as it is identified, results in a call to + * @c put_value or @c put_unit; + * thus, pattern elements and other characters are interleaved in the output + * in the order in which they appear in the pattern. Pattern sequences are + * identified by converting each character @c c to a @c char value as if by + * @c ct.narrow(c,0), where @c ct is a reference to @c ctype obtained from + * @c ios.getloc(). The first character of each sequence is equal to @c '%', + * followed by a pattern specifier character @c spec, which can be @c 'v' for + * the duration value or @c 'u' for the duration unit. . + * For each valid pattern sequence identified, calls + * put_value(s, ios, fill, d) or put_unit(s, ios, fill, d). + * + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration const& d, const CharT* pattern, + const CharT* pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + return put(facet, s, ios, fill, d, pattern, pat_end); + } + else + { + duration_units_default facet; + return put(facet, s, ios, fill, d, pattern, pat_end); + } + } + + template + iter_type put(duration_units const& units_facet, iter_type s, std::ios_base& ios, char_type fill, + duration const& d, const CharT* pattern, const CharT* pat_end) const + { + + const std::ctype& ct = std::use_facet >(ios.getloc()); + for (; pattern != pat_end; ++pattern) + { + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + *s++ = pattern[-1]; + break; + } + char fmt = ct.narrow(*pattern, 0); + switch (fmt) + { + case 'v': + { + s = put_value(s, ios, fill, d); + break; + } + case 'u': + { + s = put_unit(units_facet, s, ios, fill, d); + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + } + else + *s++ = *pattern; + } + return s; + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects imbue in @c ios the @c duration_units_default facet if not already present. + * Retrieves Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return put(s, ios, d, str.data(), str.data() + str.size()); + * @endcode + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + std::basic_string str = facet.get_pattern(); + return put(facet, s, ios, fill, d, str.data(), str.data() + str.size()); + } + else + { + duration_units_default facet; + std::basic_string str = facet.get_pattern(); + return put(facet, s, ios, fill, d, str.data(), str.data() + str.size()); + } + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects As if s=std::use_facet >(ios.getloc()).put(s, ios, fill, static_cast (d.count())). + * @Returns s, iterator pointing immediately after the last character produced. + */ + template + iter_type put_value(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + return std::use_facet >(ios.getloc()).put(s, ios, fill, + static_cast (d.count())); + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects Let facet be the duration_units facet associated to ios. If the associated unit is named, + * as if + * @code + string_type str = facet.get_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + * @endcode + * Otherwise, format the unit as "[Period::num/Period::den]" followed by the unit associated to [N/D] obtained using facet.get_n_d_unit(get_duration_style(ios), d) + * @Returns s, iterator pointing immediately after the last character produced. + */ + template + iter_type put_unit(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + return put_unit(facet, s, ios, fill, d); + } + else + { + duration_units_default facet; + return put_unit(facet, s, ios, fill, d); + } + } + + template + iter_type put_unit(duration_units const& facet, iter_type s, std::ios_base& ios, char_type fill, + duration const& d) const + { + if (facet.template is_named_unit()) { + string_type str = facet.get_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + } else { + *s++ = CharT('['); + std::use_facet >(ios.getloc()).put(s, ios, fill, Period::num); + *s++ = CharT('/'); + std::use_facet >(ios.getloc()).put(s, ios, fill, Period::den); + *s++ = CharT(']'); + string_type str = facet.get_n_d_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + } + return s; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~duration_put() + { + } + + }; + + template + std::locale::id duration_put::id; + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_style.hpp b/project/jni/boost/include/boost/chrono/io/duration_style.hpp new file mode 100644 index 000000000..65b76a902 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_style.hpp @@ -0,0 +1,35 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_DURATION_STYLE_HPP +#define BOOST_CHRONO_IO_DURATION_STYLE_HPP + +#include + +namespace boost +{ + namespace chrono + { + /** + * Scoped enumeration emulation stating whether the duration I/O style is long or short. + * prefix means duration::rep with whatever stream/locale settings are set for it followed by a long name representing the unit + * symbol means duration::rep with whatever stream/locale settings are set for it followed by a SI unit abbreviation + */ + BOOST_SCOPED_ENUM_DECLARE_BEGIN(duration_style) + { + prefix, symbol + } + BOOST_SCOPED_ENUM_DECLARE_END(duration_style) + + + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_units.hpp b/project/jni/boost/include/boost/chrono/io/duration_units.hpp new file mode 100644 index 000000000..e2f1ba090 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_units.hpp @@ -0,0 +1,992 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_DURATION_UNITS_HPP +#define BOOST_CHRONO_IO_DURATION_UNITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + class rt_ratio + { + public: + template + rt_ratio(Period const&) : + num(Period::type::num), den(Period::type::den) + { + } + + rt_ratio(intmax_t n = 0, intmax_t d = 0) : + num(n), den(d) + { + } + + intmax_t num; + intmax_t den; + }; + + /** + * @c duration_units facet gives useful information about the duration units, + * as the number of plural forms, the plural form associated to a duration, + * the text associated to a plural form and a duration's period, + */ + template + class duration_units: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * Construct a @c duration_units facet. + * @param refs + * @Effects Construct a @c duration_units facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_units(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @return pointer to the start of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_start() const =0; + /** + * @effect calls the do_... + * @return pointer to the end of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_end() const=0; + + /** + * @return pointer to the start of valid units, symbol or prefix with its different plural forms. + */ + virtual const string_type* get_valid_units_start() const=0; + /** + * @return pointer to the end of valid units. + */ + virtual const string_type* get_valid_units_end() const=0; + + /** + * @param k the found pointer to the [N/D] unit. + * @return true if @c k matches a valid unit. + */ + virtual bool match_n_d_valid_unit(const string_type* k) const = 0; + /** + * @param k the found pointer to the unit. + * @Effects @c rt is set to the valid Period when the @c k matches a valid unit. + * @return true if @c k matches a valid unit. + */ + virtual bool match_valid_unit(const string_type* k, rt_ratio& rt) const = 0; + + /** + * @effect calls the do_... + * @return the pattern to be used by default. + */ + virtual string_type get_pattern() const=0; + + /** + * @effect calls the do_... + * @return the unit associated to this duration. + */ + template + string_type get_unit(duration_style style, duration const& d) const + { + return do_get_unit(style, rt_ratio(Period()), static_cast(d.count())); + } + /** + * @effect calls the do_... + * @return the [N/D] suffix unit associated to this duration. + */ + template + string_type get_n_d_unit(duration_style style, duration const& d) const + { + return do_get_n_d_unit(style, rt_ratio(Period()), static_cast(d.count())); + } + + /** + * @effect calls the do_... + * @return true if the unit associated to the given Period is named, false otherwise. + */ + template + bool is_named_unit() const + { + return do_is_named_unit(rt_ratio(Period())); + } + + + protected: + + /** + * @Effects Destroys the facet + */ + virtual ~duration_units() + { + } + /** + * @return the [N/D] suffix unit associated to this duration. + */ + virtual string_type do_get_n_d_unit(duration_style style, rt_ratio rt, intmax_t v) const = 0; + /** + * @return the unit associated to this duration. + */ + virtual string_type do_get_unit(duration_style style,rt_ratio rt, intmax_t v) const = 0; + /** + * @return true if the unit associated to the given Period is named, false otherwise. + */ + virtual bool do_is_named_unit(rt_ratio rt) const =0; + + }; + + template + std::locale::id duration_units::id; + + namespace detail + { + template + struct duration_units_default_holder + { + typedef std::basic_string string_type; + static string_type* n_d_valid_units_; + static string_type* valid_units_; + static bool initialized_; + }; + template + typename duration_units_default_holder::string_type* duration_units_default_holder::n_d_valid_units_=0; + template + typename duration_units_default_holder::string_type* duration_units_default_holder::valid_units_=0; + template + bool duration_units_default_holder::initialized_ = false; + } + + /** + * This class is used to define the strings for the default English + */ + template + class duration_units_default: public duration_units + { + protected: + static const std::size_t pfs_ = 2; + + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + + /** + * Construct a @c duration_units_default facet. + * @param refs + * @Effects Construct a @c duration_units_default facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_units_default(size_t refs = 0) : + duration_units (refs) + { + } + + /** + * Destroys the facet. + */ + ~duration_units_default() + { + } + + public: + + /** + * @param k the found pointer to the [N/D] unit. + * @return true if @c k matches a valid unit. + */ + bool match_n_d_valid_unit(const string_type* k) const + { + std::size_t index = (k - get_n_d_valid_units_start()) / (pfs_ + 1); + switch (index) + { + case 0: + break; + default: + return false; + } + return true; + } + /** + * @param k the found pointer to the unit. + * @Effects @c rt is set to the valid Period when the @c k matches a valid unit. + * @return true if @c k matches a valid unit. + */ + bool match_valid_unit(const string_type* k, rt_ratio& rt) const + { + std::size_t index = (k - get_valid_units_start()) / (pfs_ + 1); + switch (index) + { + case 0: + rt = rt_ratio(atto()); + break; + case 1: + rt = rt_ratio(femto()); + break; + case 2: + rt = rt_ratio(pico()); + break; + case 3: + rt = rt_ratio(nano()); + break; + case 4: + rt = rt_ratio(micro()); + break; + case 5: + rt = rt_ratio(milli()); + break; + case 6: + rt = rt_ratio(centi()); + break; + case 7: + rt = rt_ratio(deci()); + break; + case 8: + rt = rt_ratio(deca()); + break; + case 9: + rt = rt_ratio(hecto()); + break; + case 10: + rt = rt_ratio(kilo()); + break; + case 11: + rt = rt_ratio(mega()); + break; + case 12: + rt = rt_ratio(giga()); + break; + case 13: + rt = rt_ratio(tera()); + break; + case 14: + rt = rt_ratio(peta()); + break; + case 15: + rt = rt_ratio(exa()); + break; + case 16: + rt = rt_ratio(ratio<1> ()); + break; + case 17: + rt = rt_ratio(ratio<60> ()); + break; + case 18: + rt = rt_ratio(ratio<3600> ()); + break; + default: + return false; + } + return true; + } + + /** + * @return pointer to the start of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_start()const + { + return detail::duration_units_default_holder::n_d_valid_units_; + } + /** + * @return pointer to the end of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_end()const + { + return detail::duration_units_default_holder::n_d_valid_units_ + (pfs_ + 1); + } + + /** + * @return pointer to the start of valid units. + */ + virtual string_type* get_valid_units_start() const + { + return detail::duration_units_default_holder::valid_units_; + } + /** + * @return pointer to the end of valid units. + */ + virtual string_type* get_valid_units_end() const + { + return detail::duration_units_default_holder::valid_units_ + 19 * (pfs_ + 1); + } + + string_type get_pattern() const + { + static const CharT t[] = + { '%', 'v', ' ', '%', 'u' }; + static const string_type pattern(t, t + sizeof (t) / sizeof (t[0])); + + return pattern; + } + + protected: + /** + * + * This facet names the units associated to the following periods: + * atto,femto,pico,nano,micro,milli,centi,deci,ratio<1>,deca,hecto,kilo,mega,giga,tera,peta,exa,ratio<60> and ratio<3600>. + * @return true if the unit associated to the given Period is named, false otherwise. + */ + bool do_is_named_unit(rt_ratio rt) const + { + if (rt.num==1) { + switch (rt.den) + { + case BOOST_RATIO_INTMAX_C(1): + case BOOST_RATIO_INTMAX_C(10): + case BOOST_RATIO_INTMAX_C(100): + case BOOST_RATIO_INTMAX_C(1000): + case BOOST_RATIO_INTMAX_C(1000000): + case BOOST_RATIO_INTMAX_C(1000000000): + case BOOST_RATIO_INTMAX_C(1000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return true; + default: + return false; + } + } else if (rt.den==1) { + switch (rt.num) + { + case BOOST_RATIO_INTMAX_C(10): + case BOOST_RATIO_INTMAX_C(60): + case BOOST_RATIO_INTMAX_C(100): + case BOOST_RATIO_INTMAX_C(1000): + case BOOST_RATIO_INTMAX_C(3600): + case BOOST_RATIO_INTMAX_C(1000000): + case BOOST_RATIO_INTMAX_C(1000000000): + case BOOST_RATIO_INTMAX_C(1000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return true; + default: + return false; + } + } + return false; + + } + + /** + * In English the suffix used after [N/D] is the one associated to the period ratio<1>. + * @return the [N/D] suffix unit associated to this duration. + */ + string_type do_get_n_d_unit(duration_style style, rt_ratio, intmax_t v) const + { + return do_get_unit(style, ratio<1>(), do_get_plural_form(v)); + } + + /** + * @return the unit associated to this duration if it is named, "" otherwise. + */ + string_type do_get_unit(duration_style style, rt_ratio rt, intmax_t v) const + { + if (rt.num==1) { + switch (rt.den) + { + case BOOST_RATIO_INTMAX_C(1): + return do_get_unit(style, ratio<1>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(10): + return do_get_unit(style, deci(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(100): + return do_get_unit(style, centi(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000): + return do_get_unit(style, milli(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000): + return do_get_unit(style, micro(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000): + return do_get_unit(style, nano(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000): + return do_get_unit(style, pico(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000): + return do_get_unit(style, femto(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return do_get_unit(style, atto(), do_get_plural_form(v)); + default: + ; + } + } else if (rt.den==1) { + switch (rt.num) + { + case BOOST_RATIO_INTMAX_C(10): + return do_get_unit(style, deca(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(60): + return do_get_unit(style, ratio<60>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(100): + return do_get_unit(style, hecto(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000): + return do_get_unit(style, kilo(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(3600): + return do_get_unit(style, ratio<3600>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000): + return do_get_unit(style, mega(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000): + return do_get_unit(style, giga(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000): + return do_get_unit(style, tera(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000): + return do_get_unit(style, peta(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return do_get_unit(style, exa(), do_get_plural_form(v)); + default: + ; + } + } + BOOST_ASSERT(false&&"ratio parameter can not be translated"); + //throw "exception"; + return string_type(); + } + + protected: + /** + * @return the number of associated plural forms this facet manages. + */ + virtual std::size_t do_get_plural_forms() const + { + return static_get_plural_forms(); + } + static std::size_t static_get_plural_forms() + { + return pfs_; + } + /** + * Gets the associated plural form. + * @param value the duration representation + * @return the plural form associated to the @c value parameter. In English there are 2 plural forms + * 0 singular (-1 or 1) + * 1 plural for all others + */ + virtual std::size_t do_get_plural_form(int_least64_t value) const + { + return static_get_plural_form(value); + } + static std::size_t static_get_plural_form(int_least64_t value) + { + return (value == -1 || value == 1) ? 0 : 1; + } + + /** + * @param style the duration style. + * @param period the period associated to the duration seconds. + * @param pf the requested plural form. + * @return if style is symbol returns "s", otherwise if pf is 0 return "second", if pf is 1 "seconds" + */ + virtual string_type do_get_unit(duration_style style, ratio<1> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<1> , std::size_t pf) + { + static const CharT t[] = + { 's' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + static const CharT u[] = + { 's', 'e', 'c', 'o', 'n', 'd' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 's', 'e', 'c', 'o', 'n', 'd', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) + { + return symbol; + } + if (pf == 0) + { + return singular; + } + if (pf == 1) + { + return plural; + } + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + } + + /** + * @param style the duration style. + * @param period the period associated to the duration minutes. + * @param pf the requested plural form. + * @return if style is symbol returns "min", otherwise if pf is 0 return "minute", if pf is 1 "minutes" + */ + virtual string_type do_get_unit(duration_style style, ratio<60> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<60> , std::size_t pf) + { + static const CharT t[] = + { 'm', 'i', 'n' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + + static const CharT u[] = + { 'm', 'i', 'n', 'u', 't', 'e' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 'm', 'i', 'n', 'u', 't', 'e', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) return symbol; + if (pf == 0) return singular; + if (pf == 1) return plural; + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + + } + + /** + * @param style the duration style. + * @param period the period associated to the duration hours. + * @param pf the requested plural form. + * @return if style is symbol returns "h", otherwise if pf is 0 return "hour", if pf is 1 "hours" + */ + virtual string_type do_get_unit(duration_style style, ratio<3600> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<3600> , std::size_t pf) + { + static const CharT t[] = + { 'h' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + static const CharT u[] = + { 'h', 'o', 'u', 'r' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 'h', 'o', 'u', 'r', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) return symbol; + if (pf == 0) return singular; + if (pf == 1) return plural; + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + + } + /** + * @param style the duration style. + * @param u the period tag atto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to @c period + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, atto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, atto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + /** + * @param style the duration style. + * @param u the period tag femto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to period @c u + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, femto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, femto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + /** + * @param style the duration style. + * @param u the period tag femto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to period @c u + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, pico u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, pico u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, nano u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, nano u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, micro u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, micro u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, milli u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, milli u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, centi u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, centi u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, deci u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, deci u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, deca u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, deca u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, hecto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, hecto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, kilo u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, kilo u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, mega u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, mega u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, giga u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, giga u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, tera u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, tera u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, peta u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, peta u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, exa u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, exa u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + + protected: + + /** + * @param style the duration style. + * @param u the period tag atto. + * @return depending on the value of @c style return the ratio_string symbol or prefix. + */ + virtual string_type do_get_ratio_prefix(duration_style style, atto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, atto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, femto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, femto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, pico u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, pico) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, nano u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, nano) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, micro u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, micro) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, milli u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, milli) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, centi u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, centi) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, deci u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, deci) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, deca u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, deca) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, hecto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, hecto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, kilo u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, kilo) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, mega u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, mega) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, giga u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, giga) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, tera u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, tera) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, peta u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, peta) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, exa u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, exa) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + + protected: + template + string_type* fill_units(string_type* it, Period) const + { + std::size_t pfs = do_get_plural_forms(); + for (std::size_t pf = 0; pf < pfs; ++pf) + { + *it++ = do_get_unit(duration_style::prefix, Period(), pf); + } + *it++ = do_get_unit(duration_style::symbol, Period(), 0); + return it; + } + public: + template + static string_type* static_fill_units(string_type* it, Period) + { + std::size_t pfs = static_get_plural_forms(); + for (std::size_t pf = 0; pf < pfs; ++pf) + { + *it++ = static_get_unit(duration_style::prefix, Period(), pf); + } + *it++ = static_get_unit(duration_style::symbol, Period(), 0); + return it; + } + static string_type* static_init_valid_units(string_type* it) + { + it = static_fill_units(it, atto()); + it = static_fill_units(it, femto()); + it = static_fill_units(it, pico()); + it = static_fill_units(it, nano()); + it = static_fill_units(it, micro()); + it = static_fill_units(it, milli()); + it = static_fill_units(it, centi()); + it = static_fill_units(it, deci()); + it = static_fill_units(it, deca()); + it = static_fill_units(it, hecto()); + it = static_fill_units(it, kilo()); + it = static_fill_units(it, mega()); + it = static_fill_units(it, giga()); + it = static_fill_units(it, tera()); + it = static_fill_units(it, peta()); + it = static_fill_units(it, exa()); + it = static_fill_units(it, ratio<1> ()); + it = static_fill_units(it, ratio<60> ()); + it = static_fill_units(it, ratio<3600> ()); + return it; + } + }; + + namespace detail + { + + template + struct duration_units_default_initializer_t + { + duration_units_default_initializer_t() + { + if (!duration_units_default_holder::initialized_) + { + typedef typename duration_units_default_holder::string_type string_type; + duration_units_default_holder::n_d_valid_units_ = new string_type[3]; + duration_units_default_holder::valid_units_ = new string_type[19 * 3]; + + string_type* it = duration_units_default_holder::n_d_valid_units_; + it = duration_units_default::static_fill_units(it, ratio<1> ()); + it = duration_units_default::static_init_valid_units(duration_units_default_holder::valid_units_); + + duration_units_default_holder::initialized_ = true; + } + } + }; + namespace /**/ + { + duration_units_default_initializer_t duration_units_default_initializer; + duration_units_default_initializer_t wduration_units_default_initializer; + } // namespace + } + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp b/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp new file mode 100644 index 000000000..6e320a567 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp @@ -0,0 +1,151 @@ +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_IOS_BASE_STATE_HPP +#define BOOST_CHRONO_IO_IOS_BASE_STATE_HPP + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + class fmt_masks : public ios_flags + { + typedef ios_flags base_type; + fmt_masks& operator=(fmt_masks const& rhs) ; + + public: + fmt_masks(std::ios_base& ios): base_type(ios) {} + enum type + { + uses_symbol = 1 << 0, + uses_local = 1 << 1 + }; + + inline duration_style get_duration_style() + { + return (flags() & uses_symbol) ? duration_style::symbol : duration_style::prefix; + } + inline void set_duration_style(duration_style style) + { + if (style == duration_style::symbol) + setf(uses_symbol); + else + unsetf(uses_symbol); + } + + inline timezone get_timezone() + { + return (flags() & uses_local) ? timezone::local : timezone::utc; + } + inline void set_timezone(timezone tz) + { + if (tz == timezone::local) + setf(uses_local); + else + unsetf(uses_local); + } + }; + namespace detail + { + namespace /**/ { + xalloc_key_initializer fmt_masks_xalloc_key_initializer; + } // namespace + } // namespace detail + + inline duration_style get_duration_style(std::ios_base & ios) + { + return fmt_masks(ios).get_duration_style(); + } + inline void set_duration_style(std::ios_base& ios, duration_style style) + { + fmt_masks(ios).set_duration_style(style); + } + inline std::ios_base& symbol_format(std::ios_base& ios) + { + fmt_masks(ios).setf(fmt_masks::uses_symbol); + return ios; + } + inline std::ios_base& name_format(std::ios_base& ios) + { + fmt_masks(ios).unsetf(fmt_masks::uses_symbol); + return ios; + } + + inline timezone get_timezone(std::ios_base & ios) + { + return fmt_masks(ios).get_timezone(); + } + inline void set_timezone(std::ios_base& ios, timezone tz) + { + fmt_masks(ios).set_timezone(tz); + } + inline std::ios_base& local_timezone(std::ios_base& ios) + { + fmt_masks(ios).setf(fmt_masks::uses_local); + return ios; + } + + inline std::ios_base& utc_timezone(std::ios_base& ios) + { + fmt_masks(ios).unsetf(fmt_masks::uses_local); + return ios; + } + + namespace detail + { + + template + struct ios_base_data_aux + { + std::basic_string time_fmt; + std::basic_string duration_fmt; + public: + + ios_base_data_aux() : + time_fmt(""), + duration_fmt("") + { + } + }; + template + struct ios_base_data {}; + namespace /**/ { + xalloc_key_initializer > ios_base_data_aux_xalloc_key_initializer; + xalloc_key_initializer > wios_base_data_aux_xalloc_key_initializer; +#if BOOST_CHRONO_HAS_UNICODE_SUPPORT + xalloc_key_initializer > u16ios_base_data_aux_xalloc_key_initializer; + xalloc_key_initializer > u32ios_base_data_aux_xalloc_key_initializer; +#endif + } // namespace + } // namespace detail + + template + inline std::basic_string get_time_fmt(std::ios_base & ios) + { + ios_state_not_null_ptr, detail::ios_base_data_aux > ptr(ios); + return ptr->time_fmt; + } + template + inline void set_time_fmt(std::ios_base& ios, std::basic_string< + CharT> const& fmt) + { + ios_state_not_null_ptr, detail::ios_base_data_aux > ptr(ios); + ptr->time_fmt = fmt; + } + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_get.hpp b/project/jni/boost/include/boost/chrono/io/time_point_get.hpp new file mode 100644 index 000000000..5e4acd39c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_get.hpp @@ -0,0 +1,330 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_TIME_POINT_GET_HPP +#define BOOST_CHRONO_IO_TIME_POINT_GET_HPP + +#include +#include +#include +#include +#include +#include +#include + +/** + * Duration formatting facet for input. + */ +namespace boost +{ + namespace chrono + { + + template > + class time_point_get: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of iterator used to scan the character buffer. + */ + typedef InputIterator iter_type; + + /** + * Construct a @c time_point_get facet. + * @param refs + * @Effects Construct a @c time_point_get facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + + explicit time_point_get(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * Requires: [pattern,pat_end) shall be a valid range. + * + * Effects: The function starts by evaluating err = std::ios_base::goodbit. + * It then enters a loop, reading zero or more characters from s at + * each iteration. Unless otherwise specified below, the loop + * terminates when the first of the following conditions holds: + * - The expression pattern == pat_end evaluates to true. + * - The expression err == std::ios_base::goodbit evaluates to false. + * - The expression s == end evaluates to true, in which case the + * function evaluates err = std::ios_base::eofbit | std::ios_base::failbit. + * - The next element of pattern is equal to '%', followed by a conversion + * specifier character, the functions @c get_duration or @c get_epoch are called depending on + * whether the format is @c 'd' or @c 'e'. + * If the number of elements in the range [pattern,pat_end) is not + * sufficient to unambiguously determine whether the conversion + * specification is complete and valid, the function evaluates + * err = std::ios_base::failbit. Otherwise, the function evaluates + * s = do_get(s, end, ios, err, d). If err == std::ios_base::goodbit holds after + * the evaluation of the expression, the function increments pattern to + * point just past the end of the conversion specification and continues + * looping. + * - The expression isspace(*pattern, ios.getloc()) evaluates to true, in + * which case the function first increments pattern until + * pattern == pat_end || !isspace(*pattern, ios.getloc()) evaluates to true, + * then advances s until s == end || !isspace(*s, ios.getloc()) is true, + * and finally resumes looping. + * - The next character read from s matches the element pointed to by + * pattern in a case-insensitive comparison, in which case the function + * evaluates ++pattern, ++s and continues looping. Otherwise, the function + * evaluates err = std::ios_base::failbit. + * + * Returns: s + */ + + template + iter_type get(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + time_point &tp, const char_type *pattern, const char_type *pat_end) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + return get(facet, i, e, is, err, tp, pattern, pat_end); + } + else + { + time_point_units_default facet; + return get(facet, i, e, is, err, tp, pattern, pat_end); + } + } + + template + iter_type get(time_point_units const &facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, time_point &tp, const char_type *pattern, + const char_type *pat_end) const + { + + Duration d; + bool duration_found = false, epoch_found = false; + + const std::ctype& ct = std::use_facet >(ios.getloc()); + err = std::ios_base::goodbit; + while (pattern != pat_end && err == std::ios_base::goodbit) + { + if (s == end) + { + err |= std::ios_base::eofbit; + break; + } + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + err |= std::ios_base::failbit; + return s; + } + char cmd = ct.narrow(*pattern, 0); + switch (cmd) + { + case 'd': + { + if (duration_found) + { + err |= std::ios_base::failbit; + return s; + } + duration_found = true; + s = get_duration(s, end, ios, err, d); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + case 'e': + { + if (epoch_found) + { + err |= std::ios_base::failbit; + return s; + } + epoch_found = true; + s = get_epoch (facet, s, end, ios, err); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + + ++pattern; + } + else if (ct.is(std::ctype_base::space, *pattern)) + { + for (++pattern; pattern != pat_end && ct.is(std::ctype_base::space, *pattern); ++pattern) + ; + for (; s != end && ct.is(std::ctype_base::space, *s); ++s) + ; + } + else if (ct.toupper(*s) == ct.toupper(*pattern)) + { + ++s; + ++pattern; + } + else + { + err |= std::ios_base::failbit; + } + } + + // Success! Store it. + tp = time_point (d); + return s; + } + + /** + * + * @param s an input stream iterator + * @param ios a reference to a ios_base + * @param d the duration + * Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return get(s, end, ios, err, ios, d, str.data(), str.data() + str.size()); + * @codeend + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + time_point &tp) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + std::basic_string str = facet.get_pattern(); + return get(facet, i, e, is, err, tp, str.data(), str.data() + str.size()); + } + else + { + time_point_units_default facet; + std::basic_string str = facet.get_pattern(); + return get(facet, i, e, is, err, tp, str.data(), str.data() + str.size()); + } + } + + /** + * As if + * @code + * return facet.get(s, end, ios, err, d); + * @endcode + * where @c facet is either the @c duration_get facet associated to the @c ios or an instance of the default @c duration_get facet. + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid duration. + */ + template + iter_type get_duration(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + duration& d) const + { + if (std::has_facet >(is.getloc())) + { + duration_get const &facet = std::use_facet >(is.getloc()); + return get_duration(facet, i, e, is, err, d); + } + else + { + duration_get facet; + return get_duration(facet, i, e, is, err, d); + } + } + + template + iter_type get_duration(duration_get const& facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, duration& d) const + { + return facet.get(s, end, ios, err, d); + } + + /** + * + * @Effects Let @c facet be the @c time_point_units facet associated to @c is or a new instance of the default @c time_point_units_default facet. + * Let @c epoch be the epoch string associated to the Clock using this facet. + * Scans @c i to match @c epoch or @c e is reached. + * + * If not match before the @c e is reached @c std::ios_base::failbit is set in @c err. + * If @c e is reached @c std::ios_base::failbit is set in @c err. + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid epoch. + */ + template + iter_type get_epoch(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + return get_epoch(facet, i, e, is, err); + } + else + { + time_point_units_default facet; + return get_epoch(facet, i, e, is, err); + } + } + + template + iter_type get_epoch(time_point_units const &facet, iter_type i, iter_type e, std::ios_base&, + std::ios_base::iostate& err) const + { + const std::basic_string epoch = facet.template get_epoch (); + std::ptrdiff_t k = chrono_detail::scan_keyword(i, e, &epoch, &epoch + 1, + //~ std::use_facet >(ios.getloc()), + err) - &epoch; + if (k == 1) + { + err |= std::ios_base::failbit; + return i; + } + return i; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~time_point_get() + { + } + }; + + /** + * Unique identifier for this type of facet. + */ + template + std::locale::id time_point_get::id; + + } // chrono +} +// boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_io.hpp b/project/jni/boost/include/boost/chrono/io/time_point_io.hpp new file mode 100644 index 000000000..c10b8364c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_io.hpp @@ -0,0 +1,1082 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). + +//===-------------------------- locale ------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost and some functions from libc++/locale to emulate the missing time_get::get() + +#ifndef BOOST_CHRONO_IO_TIME_POINT_IO_HPP +#define BOOST_CHRONO_IO_TIME_POINT_IO_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_CHRONO_INTERNAL_TIMEGM defined BOOST_WINDOWS && ! defined(__CYGWIN__) +#define BOOST_CHRONO_INTERNAL_GMTIME defined BOOST_WINDOWS && ! defined(__CYGWIN__) + +#define BOOST_CHRONO_USES_INTERNAL_TIME_GET + + +namespace boost +{ + namespace chrono + { + namespace detail + { + + template > + struct time_get + { + std::time_get const &that_; + time_get(std::time_get const& that) : that_(that) {} + + typedef std::time_get facet; + typedef typename facet::iter_type iter_type; + typedef typename facet::char_type char_type; + typedef std::basic_string string_type; + + static int + get_up_to_n_digits( + InputIterator& b, InputIterator e, + std::ios_base::iostate& err, + const std::ctype& ct, + int n) + { + // Precondition: n >= 1 + if (b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return 0; + } + // get first digit + CharT c = *b; + if (!ct.is(std::ctype_base::digit, c)) + { + err |= std::ios_base::failbit; + return 0; + } + int r = ct.narrow(c, 0) - '0'; + for (++b, --n; b != e && n > 0; ++b, --n) + { + // get next digit + c = *b; + if (!ct.is(std::ctype_base::digit, c)) + return r; + r = r * 10 + ct.narrow(c, 0) - '0'; + } + if (b == e) + err |= std::ios_base::eofbit; + return r; + } + + + void get_day( + int& d, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && 1 <= t && t <= 31) + d = t; + else + err |= std::ios_base::failbit; + } + + void get_month( + int& m, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2) - 1; + if (!(err & std::ios_base::failbit) && t <= 11) + m = t; + else + err |= std::ios_base::failbit; + } + + + void get_year4(int& y, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 4); + if (!(err & std::ios_base::failbit)) + y = t - 1900; + } + + void + get_hour(int& h, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 23) + h = t; + else + err |= std::ios_base::failbit; + } + + void + get_minute(int& m, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 59) + m = t; + else + err |= std::ios_base::failbit; + } + + void + get_second(int& s, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 60) + s = t; + else + err |= std::ios_base::failbit; + } + + + + InputIterator get( + iter_type b, iter_type e, + std::ios_base& iob, + std::ios_base::iostate& err, + std::tm* tm, + char fmt, char) const + { + err = std::ios_base::goodbit; + const std::ctype& ct = std::use_facet >(iob.getloc()); + + switch (fmt) + { +// case 'a': +// case 'A': +// that_.get_weekdayname(tm->tm_wday, b, e, err, ct); +// break; +// case 'b': +// case 'B': +// case 'h': +// that_.get_monthname(tm->tm_mon, b, e, err, ct); +// break; +// case 'c': +// { +// const string_type& fm = this->c(); +// b = that_.get(b, e, iob, err, tm, fm.data(), fm.data() + fm.size()); +// } +// break; + case 'd': + case 'e': + get_day(tm->tm_mday, b, e, err, ct); + + break; +// case 'D': +// { +// const char_type fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'F': +// { +// const char_type fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; + case 'H': + get_hour(tm->tm_hour, b, e, err, ct); + break; +// case 'I': +// that_.get_12_hour(tm->tm_hour, b, e, err, ct); +// break; +// case 'j': +// that_.get_day_year_num(tm->tm_yday, b, e, err, ct); +// break; + case 'm': + get_month(tm->tm_mon, b, e, err, ct); + break; + case 'M': + get_minute(tm->tm_min, b, e, err, ct); + break; +// case 'n': +// case 't': +// that_.get_white_space(b, e, err, ct); +// break; +// case 'p': +// that_.get_am_pm(tm->tm_hour, b, e, err, ct); +// break; +// case 'r': +// { +// const char_type fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'R': +// { +// const char_type fm[] = {'%', 'H', ':', '%', 'M'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'S': +// that_.get_second(tm->tm_sec, b, e, err, ct); +// break; +// case 'T': +// { +// const char_type fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'w': +// that_.get_weekday(tm->tm_wday, b, e, err, ct); +// break; +// case 'x': +// return that_.get_date(b, e, iob, err, tm); +// case 'X': +// { +// const string_type& fm = this->X(); +// b = that_.get(b, e, iob, err, tm, fm.data(), fm.data() + fm.size()); +// } +// break; +// case 'y': +// that_.get_year(tm->tm_year, b, e, err, ct); + break; + case 'Y': + get_year4(tm->tm_year, b, e, err, ct); + break; +// case '%': +// that_.get_percent(b, e, err, ct); +// break; + default: + err |= std::ios_base::failbit; + } + return b; + } + + + InputIterator get( + iter_type b, iter_type e, + std::ios_base& iob, + std::ios_base::iostate& err, std::tm* tm, + const char_type* fmtb, const char_type* fmte) const + { + const std::ctype& ct = std::use_facet >(iob.getloc()); + err = std::ios_base::goodbit; + while (fmtb != fmte && err == std::ios_base::goodbit) + { + if (b == e) + { + err = std::ios_base::failbit; + break; + } + if (ct.narrow(*fmtb, 0) == '%') + { + if (++fmtb == fmte) + { + err = std::ios_base::failbit; + break; + } + char cmd = ct.narrow(*fmtb, 0); + char opt = '\0'; + if (cmd == 'E' || cmd == '0') + { + if (++fmtb == fmte) + { + err = std::ios_base::failbit; + break; + } + opt = cmd; + cmd = ct.narrow(*fmtb, 0); + } + b = get(b, e, iob, err, tm, cmd, opt); + ++fmtb; + } + else if (ct.is(std::ctype_base::space, *fmtb)) + { + for (++fmtb; fmtb != fmte && ct.is(std::ctype_base::space, *fmtb); ++fmtb) + ; + for ( ; b != e && ct.is(std::ctype_base::space, *b); ++b) + ; + } + else if (ct.toupper(*b) == ct.toupper(*fmtb)) + { + ++b; + ++fmtb; + } + else + err = std::ios_base::failbit; + } + if (b == e) + err |= std::ios_base::eofbit; + return b; + } + + }; + + + template + class time_manip: public manip > + { + std::basic_string fmt_; + timezone tz_; + public: + + time_manip(timezone tz, std::basic_string fmt) + // todo move semantics + : + fmt_(fmt), tz_(tz) + { + } + + /** + * Change the timezone and time format ios state; + */ + void operator()(std::ios_base &ios) const + { + set_time_fmt (ios, fmt_); + set_timezone(ios, tz_); + } + }; + + class time_man: public manip + { + timezone tz_; + public: + + time_man(timezone tz) + // todo move semantics + : + tz_(tz) + { + } + + /** + * Change the timezone and time format ios state; + */ + void operator()(std::ios_base &ios) const + { + //set_time_fmt(ios, ""); + set_timezone(ios, tz_); + } + }; + + } + + template + inline detail::time_manip time_fmt(timezone tz, const CharT* fmt) + { + return detail::time_manip(tz, fmt); + } + + template + inline detail::time_manip time_fmt(timezone tz, std::basic_string fmt) + { + // todo move semantics + return detail::time_manip(tz, fmt); + } + + inline detail::time_man time_fmt(timezone f) + { + return detail::time_man(f); + } + + /** + * time_fmt_io_saver i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + template > + struct time_fmt_io_saver + { + + //! the type of the state to restore + typedef std::basic_ostream state_type; + //! the type of aspect to save + typedef std::basic_string aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c time format . + */ + explicit time_fmt_io_saver(state_type &s) : + s_save_(s), a_save_(get_time_fmt(s_save_)) + { + } + + /** + * Construction from an i/o stream and a @c time format to restore. + * + * Stores a reference to the i/o stream and the value @c new_value to restore given as parameter. + */ + time_fmt_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the format to be restored. + */ + ~time_fmt_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the time format to be restored. + */ + void restore() + { + set_time_fmt(a_save_, a_save_); + } + private: + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * timezone_io_saver i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + struct timezone_io_saver + { + + //! the type of the state to restore + typedef std::ios_base state_type; + //! the type of aspect to save + typedef timezone aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c timezone. + */ + explicit timezone_io_saver(state_type &s) : + s_save_(s), a_save_(get_timezone(s_save_)) + { + } + + /** + * Construction from an i/o stream and a @c timezone to restore. + * + * Stores a reference to the i/o stream and the value @c new_value to restore given as parameter. + */ + timezone_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the format to be restored. + */ + ~timezone_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the timezone to be restored. + */ + void restore() + { + set_timezone(s_save_, a_save_); + } + private: + timezone_io_saver& operator=(timezone_io_saver const& rhs) ; + + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * + * @param os + * @param tp + * @Effects Behaves as a formatted output function. After constructing a @c sentry object, if the @ sentry + * converts to true, calls to @c facet.put(os,os,os.fill(),tp) where @c facet is the @c time_point_put + * facet associated to @c os or a new created instance of the default @c time_point_put facet. + * @return @c os. + */ + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_point& tp) + { + + bool failed = false; + BOOST_TRY + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + typename std::basic_ostream::sentry opfx(os); + if (bool(opfx)) + { + if (!std::has_facet >(os.getloc())) + { + if (time_point_put ().put(os, os, os.fill(), tp) .failed()) + { + err = std::ios_base::badbit; + } + } + else + { + if (std::use_facet >(os.getloc()) .put(os, os, os.fill(), tp).failed()) + { + err = std::ios_base::badbit; + } + } + os.width(0); + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + os.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) os.setstate(err); + return os; + } + BOOST_CATCH (...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) os.setstate(std::ios_base::failbit | std::ios_base::badbit); + return os; + } + + template + std::basic_istream& + operator>>(std::basic_istream& is, time_point& tp) + { + std::ios_base::iostate err = std::ios_base::goodbit; + + BOOST_TRY + { + typename std::basic_istream::sentry ipfx(is); + if (bool(ipfx)) + { + if (!std::has_facet >(is.getloc())) + { + time_point_get ().get(is, std::istreambuf_iterator(), is, err, tp); + } + else + { + std::use_facet >(is.getloc()).get(is, std::istreambuf_iterator(), is, + err, tp); + } + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + is.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) is.setstate(err); + return is; + } + + + namespace detail + { + + inline int32_t is_leap(int32_t year) + { + if(year % 400 == 0) + return 1; + if(year % 100 == 0) + return 0; + if(year % 4 == 0) + return 1; + return 0; + } + inline int32_t days_from_0(int32_t year) + { + year--; + return 365 * year + (year / 400) - (year/100) + (year / 4); + } + inline int32_t days_from_1970(int32_t year) + { + static const int days_from_0_to_1970 = days_from_0(1970); + return days_from_0(year) - days_from_0_to_1970; + } + inline int32_t days_from_1jan(int32_t year,int32_t month,int32_t day) + { + static const int32_t days[2][12] = + { + { 0,31,59,90,120,151,181,212,243,273,304,334}, + { 0,31,60,91,121,152,182,213,244,274,305,335} + }; + return days[is_leap(year)][month-1] + day - 1; + } + + inline time_t internal_timegm(std::tm const *t) + { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if(month > 11) + { + year += month/12; + month %= 12; + } + else if(month < 0) + { + int years_diff = (-month + 11)/12; + year -= years_diff; + month+=12 * years_diff; + } + month++; + int day = t->tm_mday; + int day_of_year = days_from_1jan(year,month,day); + int days_since_epoch = days_from_1970(year) + day_of_year; + + time_t seconds_in_day = 3600 * 24; + time_t result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec; + + return result; + } + + /** + * from_ymd could be made more efficient by using a table + * day_count_table indexed by the y%400. + * This table could contain the day_count + * by*365 + by/4 - by/100 + by/400 + * + * from_ymd = (by/400)*days_by_400_years+day_count_table[by%400] + + * days_in_year_before[is_leap_table[by%400]][m-1] + d; + */ + inline unsigned days_before_years(int32_t y) + { + return y * 365 + y / 4 - y / 100 + y / 400; + } + + inline std::tm * internal_gmtime(std::time_t const* t, std::tm *tm) + { + if (t==0) return 0; + if (tm==0) return 0; + + static const unsigned char + day_of_year_month[2][366] = + { + { 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }, + + { 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 + + } }; + + static const int32_t days_in_year_before[2][13] = + { + { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }, + { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 } + }; + + const time_t seconds_in_day = 3600 * 24; + int32_t days_since_epoch = static_cast(*t / seconds_in_day); + int32_t hms = static_cast(*t - seconds_in_day*days_since_epoch); + if (hms < 0) { + days_since_epoch-=1; + hms = seconds_in_day+hms; + } + + int32_t x = days_since_epoch; + int32_t y = static_cast (static_cast (x + 2) * 400 + / 146097); + const int32_t ym1 = y - 1; + int32_t doy = x - days_before_years(y); + const int32_t doy1 = x - days_before_years(ym1); + const int32_t N = std::numeric_limits::digits - 1; + const int32_t mask1 = doy >> N; // arithmetic rshift - not portable - but nearly universal + const int32_t mask0 = ~mask1; + doy = (doy & mask0) | (doy1 & mask1); + y = (y & mask0) | (ym1 & mask1); + //y -= 32767 + 2; + y += 70; + tm->tm_year=y; + const bool leap = is_leap(y); + tm->tm_mon = day_of_year_month[leap][doy]-1; + tm->tm_mday = doy - days_in_year_before[leap][day_of_year_month[leap][doy] - 1]; + + + tm->tm_hour = hms / 3600; + const int ms = hms % 3600; + tm->tm_min = ms / 60; + tm->tm_sec = ms % 60; + + return tm; + } + + } // detail +#ifndef BOOST_CHRONO_NO_UTC_TIMEPOINT + +#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_point& tp) + { + typename std::basic_ostream::sentry ok(os); + if (bool(ok)) + { + bool failed = false; + BOOST_TRY + { + const CharT* pb = 0; //nullptr; + const CharT* pe = pb; + std::basic_string fmt = get_time_fmt (os); + pb = fmt.data(); + pe = pb + fmt.size(); + + timezone tz = get_timezone(os); + std::locale loc = os.getloc(); + time_t t = system_clock::to_time_t(time_point_cast(tp)); + std::tm tm; + if (tz == timezone::local) + { +#if defined BOOST_WINDOWS && ! defined(__CYGWIN__) + std::tm *tmp = 0; + if ((tmp=localtime(&t)) == 0) + failed = true; + else + tm =*tmp; +#else + if (localtime_r(&t, &tm) == 0) failed = true; +#endif + } + else + { +#if BOOST_CHRONO_INTERNAL_GMTIME + if (detail::internal_gmtime(&t, &tm) == 0) failed = true; + +#elif defined BOOST_WINDOWS && ! defined(__CYGWIN__) + std::tm *tmp = 0; + if((tmp = gmtime(&t)) == 0) + failed = true; + else + tm = *tmp; +#else + if (gmtime_r(&t, &tm) == 0) failed = true; +#endif + + } + if (!failed) + { + const std::time_put& tpf = std::use_facet >(loc); + if (pb == pe) + { + CharT pattern[] = + { '%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', '%', 'H', ':', '%', 'M', ':' }; + pb = pattern; + pe = pb + sizeof (pattern) / sizeof(CharT); + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + if (!failed) + { + duration d = tp - system_clock::from_time_t(t) + seconds(tm.tm_sec); + if (d.count() < 10) os << CharT('0'); + //if (! os.good()) { + // throw "exception"; + //} + std::ios::fmtflags flgs = os.flags(); + os.setf(std::ios::fixed, std::ios::floatfield); + //if (! os.good()) { + //throw "exception"; + //} + os << d.count(); + //if (! os.good()) { + //throw "exception"; + //} + os.flags(flgs); + if (tz == timezone::local) + { + CharT sub_pattern[] = + { ' ', '%', 'z' }; + pb = sub_pattern; + pe = pb + +sizeof (sub_pattern) / sizeof(CharT); + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + } + else + { + CharT sub_pattern[] = + { ' ', '+', '0', '0', '0', '0', 0 }; + os << sub_pattern; + } + } + } + else + { + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + } + } + } + BOOST_CATCH (...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) + { + os.setstate(std::ios_base::failbit | std::ios_base::badbit); + } + } + return os; + } +#endif + + namespace detail + { + + template + minutes extract_z(InputIterator& b, InputIterator e, std::ios_base::iostate& err, const std::ctype& ct) + { + int min = 0; + if (b != e) + { + char cn = ct.narrow(*b, 0); + if (cn != '+' && cn != '-') + { + err |= std::ios_base::failbit; + return minutes(0); + } + int sn = cn == '-' ? -1 : 1; + int hr = 0; + for (int i = 0; i < 2; ++i) + { + if (++b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return minutes(0); + } + cn = ct.narrow(*b, 0); + if (! ('0' <= cn && cn <= '9')) + { + err |= std::ios_base::failbit; + return minutes(0); + } + hr = hr * 10 + cn - '0'; + } + for (int i = 0; i < 2; ++i) + { + if (++b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return minutes(0); + } + cn = ct.narrow(*b, 0); + if (! ('0' <= cn && cn <= '9')) + { + err |= std::ios_base::failbit; + return minutes(0); + } + min = min * 10 + cn - '0'; + } + if (++b == e) { + err |= std::ios_base::eofbit; + } + min += hr * 60; + min *= sn; + } + else + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + } + return minutes(min); + } + + } // detail + +#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + + template + std::basic_istream& + operator>>(std::basic_istream& is, time_point& tp) + { + typename std::basic_istream::sentry ok(is); + if (bool(ok)) + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + const CharT* pb = 0; //nullptr; + const CharT* pe = pb; + std::basic_string fmt = get_time_fmt (is); + pb = fmt.data(); + pe = pb + fmt.size(); + + timezone tz = get_timezone(is); + std::locale loc = is.getloc(); + const std::time_get& tg = std::use_facet >(loc); + const std::ctype& ct = std::use_facet >(loc); + tm tm; // {0} + typedef std::istreambuf_iterator It; + if (pb == pe) + { + CharT pattern[] = + { '%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', '%', 'H', ':', '%', 'M', ':' }; + pb = pattern; + pe = pb + sizeof (pattern) / sizeof(CharT); + tm.tm_sec=0; +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, pb, pe); +#else + tg.get(is, 0, is, err, &tm, pb, pe); +#endif + if (err & std::ios_base::failbit) goto exit; + double sec; + CharT c = CharT(); + is >> sec; + if (is.fail()) + { + err |= std::ios_base::failbit; + goto exit; + } + It i(is); + It eof; + c = *i; + if (++i == eof || c != ' ') + { + err |= std::ios_base::failbit; + goto exit; + } + minutes min = detail::extract_z(i, eof, err, ct); + + if (err & std::ios_base::failbit) goto exit; + time_t t; +#if BOOST_CHRONO_INTERNAL_TIMEGM + t = detail::internal_timegm(&tm); +#else + t = timegm(&tm); +#endif + tp = time_point_cast( + system_clock::from_time_t(t) - min + round (duration (sec)) + ); + } + else + { + const CharT z[2] = + { '%', 'z' }; + const CharT* fz = std::search(pb, pe, z, z + 2); +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, pb, fz); +#else + tg.get(is, 0, is, err, &tm, pb, fz); +#endif + minutes minu(0); + if (fz != pe) + { + if (err != std::ios_base::goodbit) + { + err |= std::ios_base::failbit; + goto exit; + } + It i(is); + It eof; + minu = detail::extract_z(i, eof, err, ct); + if (err & std::ios_base::failbit) goto exit; + if (fz + 2 != pe) + { + if (err != std::ios_base::goodbit) + { + err |= std::ios_base::failbit; + goto exit; + } +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, fz + 2, pe); +#else + tg.get(is, 0, is, err, &tm, fz + 2, pe); +#endif + if (err & std::ios_base::failbit) goto exit; + } + } + tm.tm_isdst = -1; + time_t t; + if (tz == timezone::utc || fz != pe) + { +#if BOOST_CHRONO_INTERNAL_TIMEGM + t = detail::internal_timegm(&tm); +#else + t = timegm(&tm); +#endif + } + else + { + t = mktime(&tm); + } + tp = time_point_cast( + system_clock::from_time_t(t) - minu + ); + } + } + BOOST_CATCH (...) + { + err |= std::ios_base::badbit | std::ios_base::failbit; + } + BOOST_CATCH_END + exit: is.setstate(err); + } + return is; + } + +#endif +#endif //UTC + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_put.hpp b/project/jni/boost/include/boost/chrono/io/time_point_put.hpp new file mode 100644 index 000000000..9c8c7cadd --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_put.hpp @@ -0,0 +1,261 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +/** + * Duration formatting facet for output. + */ +#ifndef BOOST_CHRONO_IO_TIME_POINT_PUT_HPP +#define BOOST_CHRONO_IO_TIME_POINT_PUT_HPP + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @tparam ChatT a character type + * @tparam OutputIterator a model of @c OutputIterator + * + * The @c time_point_put facet provides facilities for formatted output of @c time_point values. + * The member function of @c time_point_put take a @c time_point and format it into character string representation. + * + */ + template > + class time_point_put: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to write in the character buffer. + */ + typedef OutputIterator iter_type; + + /** + * Construct a time_point_put facet. + * @param refs + * @Effects Construct a time_point_put facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit time_point_put(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param tp the @c time_point + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Steps through the sequence from @c pattern to @c pat_end, + * identifying characters that are part of a pattern sequence. Each character + * that is not part of a pattern sequence is written to @c s immediately, and + * each pattern sequence, as it is identified, results in a call to + * @c put_duration or @c put_epoch; + * thus, pattern elements and other characters are interleaved in the output + * in the order in which they appear in the pattern. Pattern sequences are + * identified by converting each character @c c to a @c char value as if by + * @c ct.narrow(c,0), where @c ct is a reference to @c ctype obtained from + * @c ios.getloc(). The first character of each sequence is equal to @c '%', + * followed by a pattern specifier character @c spec, which can be @c 'd' for + * the duration value or @c 'e' for the epoch. + * For each valid pattern sequence identified, calls + * put_duration(s, ios, fill, tp.time_since_epoch()) or put_epoch(s, ios). + * + * @Returns An iterator pointing immediately after the last character produced. + */ + + template + iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point const& tp, const CharT* pattern, + const CharT* pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + time_point_units const &facet = + std::use_facet >(ios.getloc()); + return put(facet, i, ios, fill, tp, pattern, pat_end); + } + else + { + time_point_units_default facet; + return put(facet, i, ios, fill, tp, pattern, pat_end); + } + } + + template + iter_type put(time_point_units const& units_facet, iter_type s, std::ios_base& ios, char_type fill, + time_point const& tp, const CharT* pattern, const CharT* pat_end) const + { + + const std::ctype& ct = std::use_facet >(ios.getloc()); + for (; pattern != pat_end; ++pattern) + { + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + *s++ = pattern[-1]; + break; + } + char fmt = ct.narrow(*pattern, 0); + switch (fmt) + { + case 'd': + { + s = put_duration(s, ios, fill, tp.time_since_epoch()); + break; + } + case 'e': + { + s = put_epoch (units_facet, s, ios); + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + } + else + *s++ = *pattern; + } + return s; + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param tp the @c time_point + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Stores the time_point pattern from the @c time_point_unit facet in let say @c str. Last as if + * @code + * return put(s, ios, dill, tp, str.data(), str.data() + str.size()); + * @endcode + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point const& tp) const + { + if (std::has_facet >(ios.getloc())) + { + time_point_units const &facet = + std::use_facet >(ios.getloc()); + std::basic_string str = facet.get_pattern(); + return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size()); + } + else + { + time_point_units_default facet; + std::basic_string str = facet.get_pattern(); + return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size()); + } + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the @c duration + * @Effects As if facet.put(s, ios, fill, d) where facet is the @c duration_put facet associated + * to the @c ios or a new instance of @c duration_put. + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put_duration(iter_type i, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_put const &facet = std::use_facet >(ios.getloc()); + return facet.put(i, ios, fill, d); + } + else + { + duration_put facet; + return facet.put(i, ios, fill, d); + } + } + + /** + * + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @Effects As if + * @code + * string_type str = facet.template get_epoch(); + * s=std::copy(str.begin(), str.end(), s); + * @endcode + * where facet is the @c time_point_units facet associated + * to the @c ios or a new instance of @c time_point_units_default. + * @Returns s, iterator pointing immediately after the last character produced. + */ + + template + iter_type put_epoch(iter_type i, std::ios_base& os) const + { + if (std::has_facet >(os.getloc())) + { + time_point_units const &facet = std::use_facet >(os.getloc()); + return put_epoch (facet, i, os); + } + else + { + time_point_units_default facet; + return put_epoch (facet, i, os); + } + } + + template + iter_type put_epoch(time_point_units const& facet, iter_type s, std::ios_base&) const + { + string_type str = facet.template get_epoch(); + s= std::copy(str.begin(), str.end(), s); + return s; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~time_point_put() + { + } + + }; + + template + std::locale::id time_point_put::id; + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_units.hpp b/project/jni/boost/include/boost/chrono/io/time_point_units.hpp new file mode 100644 index 000000000..24284a76d --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_units.hpp @@ -0,0 +1,244 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP +#define BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @c time_point_units facet gives useful information about the time_point pattern, + * the text associated to a time_point's epoch, + */ + template + class time_point_units: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string used by member functions. + */ + typedef std::basic_string string_type; + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * Construct a @c time_point_units facet. + * @param refs + * @Effects Construct a @c time_point_units facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit time_point_units(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @return the pattern to be used by default. + */ + virtual string_type get_pattern() const =0; + + /** + * @return the epoch associated to the clock @c Clock calling @c do_get_epoch(Clock()) + */ + template + string_type get_epoch() const + { + return do_get_epoch(Clock()); + } + + protected: + /** + * Destroy the facet. + */ + virtual ~time_point_units() {} + + + /** + * + * @param c a dummy instance of @c system_clock. + * @return The epoch string associated to the @c system_clock. + */ + virtual string_type do_get_epoch(system_clock) const=0; + + /** + * + * @param c a dummy instance of @c steady_clock. + * @return The epoch string associated to the @c steady_clock. + */ + virtual string_type do_get_epoch(steady_clock) const=0; + +#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS) + /** + * + * @param c a dummy instance of @c process_real_cpu_clock. + * @return The epoch string associated to the @c process_real_cpu_clock. + */ + virtual string_type do_get_epoch(process_real_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_user_cpu_clock. + * @return The epoch string associated to the @c process_user_cpu_clock. + */ + virtual string_type do_get_epoch(process_user_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_system_cpu_clock. + * @return The epoch string associated to the @c process_system_cpu_clock. + */ + virtual string_type do_get_epoch(process_system_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_cpu_clock. + * @return The epoch string associated to the @c process_cpu_clock. + */ + virtual string_type do_get_epoch(process_cpu_clock) const=0; +#endif +#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK) + /** + * + * @param c a dummy instance of @c thread_clock. + * @return The epoch string associated to the @c thread_clock. + */ + virtual string_type do_get_epoch(thread_clock) const=0; +#endif + + }; + + template + std::locale::id time_point_units::id; + + + // This class is used to define the strings for the default English + template + class time_point_units_default: public time_point_units + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string returned by member functions. + */ + typedef std::basic_string string_type; + + explicit time_point_units_default(size_t refs = 0) : + time_point_units (refs) + { + } + ~time_point_units_default() {} + + /** + * @return the default pattern "%d%e". + */ + string_type get_pattern() const + { + static const CharT t[] = + { '%', 'd', '%', 'e' }; + static const string_type pattern(t, t + sizeof (t) / sizeof (t[0])); + + return pattern; + } + + protected: + /** + * @param c a dummy instance of @c system_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(system_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c steady_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(steady_clock ) const + { + return clock_string::since(); + } + +#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS) + /** + * @param c a dummy instance of @c process_real_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_real_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_user_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_user_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_system_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_system_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_cpu_clock ) const + { + return clock_string::since(); + } + +#endif +#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK) + /** + * @param c a dummy instance of @c thread_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(thread_clock ) const + { + return clock_string::since(); + } +#endif + + }; + + + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/timezone.hpp b/project/jni/boost/include/boost/chrono/io/timezone.hpp new file mode 100644 index 000000000..67975da96 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/timezone.hpp @@ -0,0 +1,30 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_TIMEZONE_HPP +#define BOOST_CHRONO_IO_TIMEZONE_HPP +#include + +namespace boost +{ + namespace chrono + { + /** + * Scoped enumeration emulation stating whether the time_point for system_clock I/O is UTC or local. + */ + BOOST_SCOPED_ENUM_DECLARE_BEGIN(timezone) + { + utc, local + } + BOOST_SCOPED_ENUM_DECLARE_END(timezone) + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp b/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp new file mode 100644 index 000000000..865b98724 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp @@ -0,0 +1,435 @@ +// boost/chrono/utility/ios_base_pword_ptr.hpp ------------------------------------------------------------// + +// Copyright 2011 Vicente J. Botet Escriba + +// 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/chrono for documentation. + +#ifndef BOOST_CHRONO_UTILITY_IOS_BASE_STATE_PTR_HPP +#define BOOST_CHRONO_UTILITY_IOS_BASE_STATE_PTR_HPP + +#include +#include + +/** + * + + + */ +namespace boost +{ + namespace chrono + { + namespace detail + { + + /** + * xalloc key holder. + */ + template + struct xalloc_key_holder + { + static int value; //< the xalloc value associated to T. + static bool initialized; //< whether the value has been initialized or not. + }; + + template + int xalloc_key_holder::value = 0; + + template + bool xalloc_key_holder::initialized = false; + + } + + /** + * xalloc key initialiazer. + * + * Declare a static variable of this type to ensure that the xalloc_key_holder is initialized correctly. + */ + template + struct xalloc_key_initializer + { + xalloc_key_initializer() + { + if (!detail::xalloc_key_holder::initialized) + { + detail::xalloc_key_holder::value = std::ios_base::xalloc(); + detail::xalloc_key_holder::initialized = true; + } + } + }; + /** + * @c ios_state_ptr is a smart pointer to a ios_base specific state. + */ + template + class ios_state_ptr + { + ios_state_ptr& operator=(ios_state_ptr const& rhs) ; + + public: + /** + * The pointee type + */ + typedef T element_type; + /** + * Explicit constructor. + * @param ios the ios + * @Effects Constructs a @c ios_state_ptr by storing the associated @c ios. + */ + explicit ios_state_ptr(std::ios_base& ios) : + ios_(ios) + { + } + /** + * Nothing to do as xalloc index can not be removed. + */ + ~ios_state_ptr() + { + } + + /** + * @Effects Allocates the index if not already done. + * Registers the callback responsible of maintaining the state pointer coherency, if not already done. + * Retrieves the associated ios pointer + * @return the retrieved pointer statically casted to const. + */ + T const* get() const BOOST_NOEXCEPT + { + register_once(index(), ios_); + void* &pw = ios_.pword(index()); + if (pw == 0) + { + return 0; + } + return static_cast (pw); + } + /** + * @Effects Allocates the index if not already done. + * Registers the callback responsible of maintaining the state pointer coherency, if not already done. + * Retrieves the associated ios pointer + * @return the retrieved pointer. + */ + T * get() BOOST_NOEXCEPT + { + register_once(index(), ios_); + void* &pw = ios_.pword(index()); + if (pw == 0) + { + return 0; + } + return static_cast (pw); + } + /** + * @Effects as if @c return get(); + * @return the retrieved pointer. + */ + T * operator->()BOOST_NOEXCEPT + { + return get(); + } + /** + * @Effects as if @c return get(); + * @return the retrieved pointer. + */ + T const * operator->() const BOOST_NOEXCEPT + { + return get(); + } + + /** + * @Effects as if @c return *get(); + * @return a reference to the retrieved state. + * @Remark The behavior is undefined if @c get()==0. + */ + T & operator*() BOOST_NOEXCEPT + { + return *get(); + } + /** + * @Effects as if @c return *get(); + * @return a reference to the retrieved state. + * @Remark The behavior is undefined if @c get()==0. + */ + T const & operator *() const BOOST_NOEXCEPT + { + return *get(); + } + + /** + * @Effects reset the current pointer after storing in a temporary variable the pointer to the current state. + * @return the stored state pointer. + */ + T * release() BOOST_NOEXCEPT + { + T const* f = get(); + reset(); + return f; + } + + /** + * + * @param new_ptr the new pointer. + * @Effects deletes the current state and replace it with the new one. + */ + void reset(T* new_ptr = 0)BOOST_NOEXCEPT + { + register_once(index(), ios_); + void*& pw = ios_.pword(index()); + delete static_cast (pw); + pw = new_ptr; + } + +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + typedef T* (ios_state_ptr::*bool_type)(); + operator bool_type() const BOOST_NOEXCEPT + { + return (get()!=0)?&ios_state_ptr::release:0; + } + bool operator!() const BOOST_NOEXCEPT + { + return (get()==0)?&ios_state_ptr::release:0; + } +#else + /** + * Explicit conversion to bool. + */ + explicit operator bool() const BOOST_NOEXCEPT + { + return get()!=0; + } +#endif + + std::ios_base& getios()BOOST_NOEXCEPT + { + return ios_; + } + std::ios_base& getios() const BOOST_NOEXCEPT + { + return ios_; + } + /** + * Implicit conversion to the ios_base + */ + operator std::ios_base&() BOOST_NOEXCEPT + { + return ios_; + } + /** + * Implicit conversion to the ios_base const + */ + operator std::ios_base&() const BOOST_NOEXCEPT + { + return ios_; + } + private: + static inline bool is_registerd(std::ios_base& ios) + { + long iw = ios.iword(index()); + return (iw == 1); + } + static inline void set_registered(std::ios_base& ios) + { + long& iw = ios.iword(index()); + iw = 1; + } + static inline void callback(std::ios_base::event evt, std::ios_base& ios, int index) + { + switch (evt) + { + case std::ios_base::erase_event: + { + void*& pw = ios.pword(index); + if (pw != 0) + { + T* ptr = static_cast (pw); + delete ptr; + pw = 0; + } + break; + } + case std::ios_base::copyfmt_event: + { + void*& pw = ios.pword(index); + if (pw != 0) + { + pw = new T(*static_cast (pw)); + } + break; + } + default: + break; + } + } + + static inline int index() + { + return detail::xalloc_key_holder::value; + } + + static inline void register_once(int indx, std::ios_base& ios) + { + // needs a mask registered + if (!is_registerd(ios)) + { + set_registered(ios); + ios.register_callback(callback, indx); + } + } + + + protected: + std::ios_base& ios_; + //static detail::xalloc_key_initializer xalloc_key_initializer_; + + }; + //template + //detail::xalloc_key_initializer ios_state_ptr::xalloc_key_initializer_; + + + /** + * @c ios_state_not_null_ptr is a non null variant of @c ios_state_ptr. + * @tparm T + * @Requires @c T must be @c DefaultConstructible and @c HeapAllocatable + */ + template + class ios_state_not_null_ptr: public ios_state_ptr + { + typedef ios_state_ptr base_type; + public: + explicit ios_state_not_null_ptr(std::ios_base& ios) : + base_type(ios) + { + if (this->get() == 0) + { + this->base_type::reset(new T()); + } + } + ~ios_state_not_null_ptr() + { + } + + void reset(T* new_value) BOOST_NOEXCEPT + { + BOOST_ASSERT(new_value!=0); + this->base_type::reset(new_value); + } + + }; + + /** + * This class is useful to associate some flags to an std::ios_base. + */ + template + class ios_flags + { + public: + /** + * + * @param ios the associated std::ios_base. + * @Postcondition flags()==0 + */ + explicit ios_flags(std::ios_base& ios) : + ios_(ios) + { + } + ~ios_flags() + { + } + /** + * @Returns The format control information. + */ + long flags() const BOOST_NOEXCEPT + { + return value(); + } + + /** + * @param v the new bit mask. + * @Postcondition v == flags(). + * @Returns The previous value of @c flags(). + */ + long flags(long v)BOOST_NOEXCEPT + { + long tmp = flags(); + ref() = v; + return tmp; + } + + /** + * @param v the new value + * @Effects: Sets @c v in @c flags(). + * @Returns: The previous value of @c flags(). + */ + long setf(long v) + { + long tmp = value(); + ref() |= v; + return tmp; + } + + /** + * @param mask the bit mask to clear. + * @Effects: Clears @c mask in @c flags(). + */ + void unsetf(long mask) + { + ref() &= ~mask; + } + + /** + * + * @param v + * @param mask + * @Effects: Clears @c mask in @c flags(), sets v & mask in @c flags(). + * @Returns: The previous value of flags(). + */ + long setf(long v, long mask) + { + long tmp = value(); + unsetf(mask); + ref() |= v & mask; + return tmp; + } + + /** + * implicit conversion to the @c ios_base + */ + operator std::ios_base&()BOOST_NOEXCEPT + { + return ios_; + } + /** + * implicit conversion to the @c ios_base const + */ + operator std::ios_base const&() const BOOST_NOEXCEPT + { + return ios_; + } + private: + long value() const BOOST_NOEXCEPT + { + return ios_.iword(index()); + } + long& ref()BOOST_NOEXCEPT + { + return ios_.iword(index()); + } + static inline int index() + { + return detail::xalloc_key_holder::value; + } + ios_flags& operator=(ios_flags const& rhs) ; + + std::ios_base& ios_; + //static detail::xalloc_key_initializer xalloc_key_initializer_; + + }; + //template + //detail::xalloc_key_initializer ios_flags::xalloc_key_initializer_; + + } // namespace chrono +} // namespace boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp b/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp new file mode 100644 index 000000000..f4a5f562c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp @@ -0,0 +1,101 @@ +// boost/chrono/utility/manip_base.hpp ------------------------------------------------------------// + +// Copyright 2011 Vicente J. Botet Escriba + +// 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/chrono for documentation. + +#ifndef BOOST_CHRONO_UTILITY_MANIP_BASE_PTR_HPP +#define BOOST_CHRONO_UTILITY_MANIP_BASE_PTR_HPP + +#include + +/** + * + + */ + +namespace boost +{ + namespace chrono + { + + /** + * manip is a manipulator mixin class following the CRTP. + * @tparam Final the derived from manip and final type + * + * @Example + * @code + + class mendl: public manip + { + public: + explicit mendl(size_t how_many) : + count(how_many) {} + template + void operator()(out_stream &out) const + { + for (size_t line = 0; line < count; ++line) + { + out.put(out.widen('\n')); + } + out.flush(); + } + private: + size_t count; + }; + + * @codeend + */ + template + class manip + { + public: + /** + * + * @param ios the io stream or ios_base. + * @Effects calls to the manipulator final functor. + */ + //template + void operator()(std::ios_base &ios) const + { + (*static_cast (this))(ios); + } + }; + + /** + * @c manip stream inserter + * @param out the io stream or ios_base. + * @param op the manipulator instance. + * @Effects if @c out is good calls to the manipulator functor @op. + * @return @c out + */ + template + out_stream &operator<<(out_stream &out, const manip &op) + { + if (out.good()) + op(out); + return out; + } + + /** + * @c manip stream extractor + * @param in the io stream or ios_base. + * @param op the manipulator instance. + * @Effects if @c in is good calls to the manipulator functor @op. + * @return @c in + */ + template + in_stream &operator>>(in_stream &in, const manip &op) + { + if (in.good()) + op(in); + return in; + } + + } // namespace chrono +} // namespace boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp b/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp new file mode 100644 index 000000000..4717ba6ad --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp @@ -0,0 +1,50 @@ +// boost/chrono/utility/to_string.hpp +// +// Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). + +#ifndef BOOST_CHRONO_UTILITY_TO_STRING_HPP +#define BOOST_CHRONO_UTILITY_TO_STRING_HPP + +#include +#include +#include + +namespace boost +{ + namespace chrono + { + template + std::basic_string to_basic_string(T const&v) { + std::basic_stringstream sstr; + sstr << v; + return sstr.str(); + } + + template + std::string to_string(T const&v) { + return to_basic_string(v); + } +#ifndef BOOST_NO_STD_WSTRING + template + std::wstring to_wstring(T const&v) { + return to_basic_string(v); + } +#endif +#if BOOST_CHRONO_HAS_UNICODE_SUPPORT + template + std::basic_string to_u16string(T const&v) { + return to_basic_string(v); + } + template + std::basic_string to_u32string(T const&v) { + return to_basic_string(v); + } +#endif + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp b/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp index 6ca1ca2d6..daabd4922 100644 --- a/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp +++ b/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp @@ -265,59 +265,59 @@ template std::basic_istream& operator>>(std::basic_istream& is, duration& d) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; typedef duration_punct Facet; std::locale loc = is.getloc(); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (!std::has_facet(loc)) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.imbue(std::locale(loc, new Facet)); } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; loc = is.getloc(); const Facet& f = std::use_facet(loc); typedef typename chrono_detail::duration_io_intermediate::type intermediate_type; intermediate_type r; std::ios_base::iostate err = std::ios_base::goodbit; // read value into r - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is >> r; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (is.good()) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // now determine unit typedef std::istreambuf_iterator in_iterator; in_iterator i(is); in_iterator e; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (i != e && *i == ' ') // mandatory ' ' after value { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; ++i; if (i != e) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // unit is num / den (yet to be determined) unsigned long long num = 0; unsigned long long den = 0; if (*i == '[') { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // parse [N/D]s or [N/D]seconds format ++i; CharT x; is >> num >> x >> den; if (!is.good() || (x != '/')) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit); return is; } i = in_iterator(is); if (*i != ']') { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit); return is; } @@ -328,27 +328,27 @@ operator>>(std::basic_istream& is, duration& d) f.template plural >(), f.template short_name >() }; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; const std::basic_string* k = chrono_detail::scan_keyword(i, e, units, units + sizeof(units)/sizeof(units[0]), //~ std::use_facet >(loc), err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err); switch ((k - units) / 3) { case 0: - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; break; default: is.setstate(err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // parse SI name, short or long const std::basic_string units[] = { @@ -410,12 +410,12 @@ operator>>(std::basic_istream& is, duration& d) f.template plural >(), f.template short_name >() }; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; const std::basic_string* k = chrono_detail::scan_keyword(i, e, units, units + sizeof(units)/sizeof(units[0]), //~ std::use_facet >(loc), err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; switch ((k - units) / 3) { case 0: @@ -495,12 +495,12 @@ operator>>(std::basic_istream& is, duration& d) den = 1; break; default: - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // unit is num/den // r should be multiplied by (num/den) / Period // Reduce (num/den) / Period to lowest terms @@ -513,7 +513,7 @@ operator>>(std::basic_istream& is, duration& d) if (num > (std::numeric_limits::max)() / d2 || den > (std::numeric_limits::max)() / n2) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // (num/den) / Period overflows is.setstate(err|is.failbit); return is; @@ -523,68 +523,68 @@ operator>>(std::basic_istream& is, duration& d) typedef typename common_type::type common_type_t; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // num / den is now factor to multiply by r if (!chrono_detail::reduce(r, den, err)) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } //if (r > ((duration_values::max)() / num)) - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (chrono::detail::gt(r,((duration_values::max)() / num))) { // Conversion to Period overflowed - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; common_type_t t = r * num; t /= den; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (t > 0) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; Rep pt = t; if ( (duration_values::max)() < pt) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // Conversion to Period overflowed is.setstate(err|is.failbit); return is; } } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // Success! Store it. r = Rep(t); d = duration(r); is.setstate(err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit | is.eofbit); return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (i == e) is.setstate(is.failbit|is.eofbit); else is.setstate(is.failbit); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; //is.setstate(is.failbit); return is; } diff --git a/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp index 12ec2e39b..486950da4 100644 --- a/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp @@ -18,15 +18,11 @@ #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include #include -#endif #include #include #include - #ifndef BOOST_CHRONO_HEADER_ONLY #include // must be the last #include #endif diff --git a/project/jni/boost/include/boost/chrono/system_clocks.hpp b/project/jni/boost/include/boost/chrono/system_clocks.hpp index bb62610c7..df8b79e20 100644 --- a/project/jni/boost/include/boost/chrono/system_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/system_clocks.hpp @@ -31,7 +31,6 @@ time2_demo contained this comment: TODO: * Fully implement error handling, with test cases. - * Use boost::throw_exception. (Currently not used because of an issue with Intel 11.0.) * Consider issues raised by Michael Marcin: > In the past I've seen QueryPerformanceCounter give incorrect results, @@ -62,14 +61,17 @@ TODO: #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #include -#include -#endif #include #include +# if defined( BOOST_CHRONO_POSIX_API ) +# if ! defined(CLOCK_REALTIME) +# error does not supply CLOCK_REALTIME +# endif +# endif + #ifdef BOOST_CHRONO_WINDOWS_API // The system_clock tick is 100 nanoseconds # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration > @@ -77,6 +79,7 @@ TODO: # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds #endif +// this must occur after all of the includes and before any code appears: #ifndef BOOST_CHRONO_HEADER_ONLY #include // must be the last #include #endif @@ -221,6 +224,7 @@ namespace chrono { } // namespace boost #ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: #include // pops abi_prefix.hpp pragmas #else #include diff --git a/project/jni/boost/include/boost/chrono/thread_clock.hpp b/project/jni/boost/include/boost/chrono/thread_clock.hpp index 7022c61dc..207697b4c 100644 --- a/project/jni/boost/include/boost/chrono/thread_clock.hpp +++ b/project/jni/boost/include/boost/chrono/thread_clock.hpp @@ -17,10 +17,7 @@ #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include #include -#endif #include #ifndef BOOST_CHRONO_HEADER_ONLY @@ -49,7 +46,7 @@ struct clock_string static std::basic_string name() { static const CharT u[] = - { 't', 'h', 'r', 'e', 'd', '_', + { 't', 'h', 'r', 'e', 'a', 'd', '_', 'c', 'l','o', 'c', 'k'}; static const std::basic_string str(u, u + sizeof(u)/sizeof(u[0])); return str; @@ -57,7 +54,7 @@ struct clock_string static std::basic_string since() { const CharT u[] = - { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'h', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; const std::basic_string str(u, u + sizeof(u)/sizeof(u[0])); return str; } diff --git a/project/jni/boost/include/boost/chrono/time_point.hpp b/project/jni/boost/include/boost/chrono/time_point.hpp index bef49cb40..7e80b59d1 100644 --- a/project/jni/boost/include/boost/chrono/time_point.hpp +++ b/project/jni/boost/include/boost/chrono/time_point.hpp @@ -2,7 +2,7 @@ // Copyright 2008 Howard Hinnant // Copyright 2008 Beman Dawes -// Copyright 2009-2011 Vicente J. Botet Escriba +// Copyright 2009-2012 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -32,8 +32,11 @@ time2_demo contained this comment: #include #include -#include +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -160,7 +163,7 @@ namespace chrono { typedef typename duration::rep rep; typedef typename duration::period period; typedef Duration difference_type; - + private: duration d_; @@ -194,7 +197,7 @@ namespace chrono { // arithmetic -#ifdef BOOST_CHRONO_EXTENSIONS +#ifdef BOOST_CHRONO_EXTENSIONS BOOST_CONSTEXPR time_point operator+() const {return *this;} BOOST_CONSTEXPR @@ -202,24 +205,24 @@ namespace chrono { time_point& operator++() {++d_; return *this;} time_point operator++(int) {return time_point(d_++);} time_point& operator--() {--d_; return *this;} - time_point operator--(int) {return time_point(d_--);} + time_point operator--(int) {return time_point(d_--);} time_point& operator+=(const rep& r) {d_ += duration(r); return *this;} time_point& operator-=(const rep& r) {d_ -= duration(r); return *this;} #endif - + time_point& operator+=(const duration& d) {d_ += d; return *this;} time_point& operator-=(const duration& d) {d_ -= d; return *this;} // special values - static BOOST_CONSTEXPR time_point + static BOOST_CHRONO_LIB_CONSTEXPR time_point min BOOST_PREVENT_MACRO_SUBSTITUTION () { return time_point((duration::min)()); } - static BOOST_CONSTEXPR time_point + static BOOST_CHRONO_LIB_CONSTEXPR time_point max BOOST_PREVENT_MACRO_SUBSTITUTION () { return time_point((duration::max)()); @@ -368,4 +371,9 @@ namespace chrono { } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_TIME_POINT_HPP diff --git a/project/jni/boost/include/boost/concept_check.hpp b/project/jni/boost/include/boost/concept_check.hpp index 01b2f4ec2..bf5a2af78 100644 --- a/project/jni/boost/include/boost/concept_check.hpp +++ b/project/jni/boost/include/boost/concept_check.hpp @@ -1052,11 +1052,11 @@ namespace boost c.swap(c); } - void const_constraints(const C& c) { - ci = c.begin(); - ci = c.end(); - n = c.size(); - b = c.empty(); + void const_constraints(const C& cc) { + ci = cc.begin(); + ci = cc.end(); + n = cc.size(); + b = cc.empty(); } private: diff --git a/project/jni/boost/include/boost/config/auto_link.hpp b/project/jni/boost/include/boost/config/auto_link.hpp index ad021f407..e36d06a05 100644 --- a/project/jni/boost/include/boost/config/auto_link.hpp +++ b/project/jni/boost/include/boost/config/auto_link.hpp @@ -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, contains one or more of the following letters after - a hiphen: + a hyphen: s static runtime (dynamic if not present). g debug/diagnostic runtime (release if not present). y Python debug/diagnostic runtime (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. @@ -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: // #ifndef BOOST_LIB_TOOLSET -// Note: no compilers before 1200 are supported -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) +# if defined(BOOST_MSVC) && (BOOST_MSVC < 1200) + // 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 - -#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 // @@ -201,11 +202,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(_DEBUG)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # 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" # elif defined(_DEBUG) # 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" # else # 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)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # 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" # elif defined(_DEBUG) # 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" # else # 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)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # 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" # elif defined(_DEBUG) # 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" # else # 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)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # 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" # elif defined(_DEBUG) # 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" # else # 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: // #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 # ifdef _RTLDLL diff --git a/project/jni/boost/include/boost/config/compiler/borland.hpp b/project/jni/boost/include/boost/config/compiler/borland.hpp index 680e87bde..cffa8ea0e 100644 --- a/project/jni/boost/include/boost/config/compiler/borland.hpp +++ b/project/jni/boost/include/boost/config/compiler/borland.hpp @@ -47,7 +47,7 @@ # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif // Variadic macros do not exist for C++ Builder versions 5 and below -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS # endif // Version 5.51 and below: @@ -150,14 +150,14 @@ // C++0x Macros: // #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DECLTYPE -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_STATIC_ASSERT #else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T @@ -169,25 +169,27 @@ # define BOOST_HAS_STATIC_ASSERT #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/project/jni/boost/include/boost/config/compiler/clang.hpp b/project/jni/boost/include/boost/config/compiler/clang.hpp index a183f34be..18d6e5462 100644 --- a/project/jni/boost/include/boost/config/compiler/clang.hpp +++ b/project/jni/boost/include/boost/config/compiler/clang.hpp @@ -8,15 +8,18 @@ // Clang compiler setup. -#if __has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) -#else +#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif -#if !__has_feature(cxx_rtti) +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID) +# define BOOST_NO_TYPEID +#endif + #if defined(__int64) # define BOOST_HAS_MS_INT64 #endif @@ -24,89 +27,109 @@ #define BOOST_HAS_NRVO // Clang supports "long long" in all compilation modes. +#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) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T #endif #if !__has_feature(cxx_constexpr) -# define BOOST_NO_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif #if !__has_feature(cxx_decltype) -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #endif -#define BOOST_NO_DECLTYPE_N3276 +#if !__has_feature(cxx_decltype_incomplete_return_types) +# define BOOST_NO_CXX11_DECLTYPE_N3276 +#endif #if !__has_feature(cxx_defaulted_functions) -# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS #endif #if !__has_feature(cxx_deleted_functions) -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif #if !__has_feature(cxx_explicit_conversions) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS #endif #if !__has_feature(cxx_default_function_template_args) -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #endif #if !__has_feature(cxx_generalized_initializers) -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if !__has_feature(cxx_lambdas) -# define BOOST_NO_LAMBDAS +# define BOOST_NO_CXX11_LAMBDAS +#endif + +#if !__has_feature(cxx_local_type_template_args) +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS #endif #if !__has_feature(cxx_noexcept) -# define BOOST_NO_NOEXCEPT +# define BOOST_NO_CXX11_NOEXCEPT #endif #if !__has_feature(cxx_nullptr) -# define BOOST_NO_NULLPTR +# define BOOST_NO_CXX11_NULLPTR +#endif + +#if !__has_feature(cxx_range_for) +# define BOOST_NO_CXX11_RANGE_BASED_FOR #endif #if !__has_feature(cxx_raw_string_literals) -# define BOOST_NO_RAW_LITERALS +# define BOOST_NO_CXX11_RAW_LITERALS #endif #if !__has_feature(cxx_generalized_initializers) -# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #endif #if !__has_feature(cxx_rvalue_references) -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif #if !__has_feature(cxx_strong_enums) -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif #if !__has_feature(cxx_static_assert) -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif #if !__has_feature(cxx_alias_templates) -# define BOOST_NO_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_TEMPLATE_ALIASES #endif #if !__has_feature(cxx_unicode_literals) -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif #if !__has_feature(cxx_variadic_templates) -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif // Clang always supports variadic macros diff --git a/project/jni/boost/include/boost/config/compiler/codegear.hpp b/project/jni/boost/include/boost/config/compiler/codegear.hpp index f1887a0c0..1a6df3352 100644 --- a/project/jni/boost/include/boost/config/compiler/codegear.hpp +++ b/project/jni/boost/include/boost/config/compiler/codegear.hpp @@ -76,7 +76,7 @@ // C++0x macros: // #if (__CODEGEARC__ <= 0x620) -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_STATIC_ASSERT #else #define BOOST_HAS_STATIC_ASSERT #endif @@ -91,24 +91,25 @@ // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // TR1 macros: @@ -120,7 +121,7 @@ #define BOOST_HAS_MACRO_USE_FACET -#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 diff --git a/project/jni/boost/include/boost/config/compiler/common_edg.hpp b/project/jni/boost/include/boost/config/compiler/common_edg.hpp index 10333ad2d..441a055fa 100644 --- a/project/jni/boost/include/boost/config/compiler/common_edg.hpp +++ b/project/jni/boost/include/boost/config/compiler/common_edg.hpp @@ -60,39 +60,41 @@ // See above for BOOST_NO_LONG_LONG // #if (__EDG_VERSION__ < 310) -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if (__EDG_VERSION__ <= 310) // No support for initializer lists -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if (__EDG_VERSION__ < 400) -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #ifdef c_plusplus // EDG has "long long" in non-strict mode diff --git a/project/jni/boost/include/boost/config/compiler/cray.hpp b/project/jni/boost/include/boost/config/compiler/cray.hpp index ad2eeaf55..5463ea08c 100644 --- a/project/jni/boost/include/boost/config/compiler/cray.hpp +++ b/project/jni/boost/include/boost/config/compiler/cray.hpp @@ -25,33 +25,35 @@ // // Cray peculiarities, probably version 7 specific: // -#undef BOOST_NO_AUTO_DECLARATIONS -#undef BOOST_NO_AUTO_MULTIDECLARATIONS +#undef BOOST_NO_CXX11_AUTO_DECLARATIONS +#undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #define BOOST_HAS_NRVO -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNICODE_LITERALS #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_HAS_NRVO -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_NULLPTR -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_LAMBDAS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DECLTYPE -#define BOOST_NO_CONSTEXPR +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CHAR16_T //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG #define BOOST_MATH_DISABLE_STD_FPCLASSIFY //#define BOOST_HAS_FPCLASSIFY diff --git a/project/jni/boost/include/boost/config/compiler/digitalmars.hpp b/project/jni/boost/include/boost/config/compiler/digitalmars.hpp index ed92306fb..15cc209d0 100644 --- a/project/jni/boost/include/boost/config/compiler/digitalmars.hpp +++ b/project/jni/boost/include/boost/config/compiler/digitalmars.hpp @@ -60,33 +60,35 @@ // // C++0x features // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if (__DMC__ < 0x812) -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if __DMC__ < 0x800 diff --git a/project/jni/boost/include/boost/config/compiler/gcc.hpp b/project/jni/boost/include/boost/config/compiler/gcc.hpp index 5a69cb493..c0ac30af2 100644 --- a/project/jni/boost/include/boost/config/compiler/gcc.hpp +++ b/project/jni/boost/include/boost/config/compiler/gcc.hpp @@ -42,9 +42,9 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for gcc versions before 3.0 -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -61,7 +61,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -146,9 +146,12 @@ # endif #endif -// C++0x features not implemented in any GCC version // -#define BOOST_NO_TEMPLATE_ALIASES +// 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 // @@ -161,65 +164,70 @@ # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html # if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define BOOST_HAS_VARIADIC_TMPL # else -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES # endif #endif // C++0x features in 4.4.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) # define BOOST_NO_SFINAE_EXPR #endif // C++0x features in 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif // C++0x features in 4.5.1 and later // #if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.5.1 +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif // C++0x features in 4.6.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #endif +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif // C++0x features not supported at all yet // -#define BOOST_NO_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE_N3276 #ifndef BOOST_COMPILER # define BOOST_COMPILER "GNU C++ version " __VERSION__ diff --git a/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp b/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp index 61dcedcc6..eaed4b5af 100644 --- a/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp +++ b/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp @@ -27,32 +27,33 @@ // C++0x features: // -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_NULLPTR -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_DECLTYPE -# define BOOST_NO_DECLTYPE_N3276 -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_NOEXCEPT -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/project/jni/boost/include/boost/config/compiler/hp_acc.hpp b/project/jni/boost/include/boost/config/compiler/hp_acc.hpp index 0d73b2875..4f5f81b3c 100644 --- a/project/jni/boost/include/boost/config/compiler/hp_acc.hpp +++ b/project/jni/boost/include/boost/config/compiler/hp_acc.hpp @@ -92,30 +92,32 @@ // #if !defined(__EDG__) -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and @@ -123,7 +125,7 @@ */ #if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE) - #define BOOST_NO_VARIADIC_MACROS + #define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif diff --git a/project/jni/boost/include/boost/config/compiler/intel.hpp b/project/jni/boost/include/boost/config/compiler/intel.hpp index a1704a488..8c746c187 100644 --- a/project/jni/boost/include/boost/config/compiler/intel.hpp +++ b/project/jni/boost/include/boost/config/compiler/intel.hpp @@ -199,52 +199,54 @@ template<> struct assert_intrinsic_wchar_t {}; // - ICC added static_assert in 11.0 (first version with C++0x support) // #if defined(BOOST_INTEL_STDCXX0X) -# undef BOOST_NO_STATIC_ASSERT +# undef BOOST_NO_CXX11_STATIC_ASSERT // // These pass our test cases, but aren't officially supported according to: // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // -//# undef BOOST_NO_LAMBDAS -//# undef BOOST_NO_DECLTYPE -//# undef BOOST_NO_AUTO_DECLARATIONS -//# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_LAMBDAS +//# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +//# undef BOOST_NO_CXX11_DECLTYPE +//# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +//# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION >= 1200) -//# undef BOOST_NO_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries -//# undef BOOST_NO_SCOPED_ENUMS // doesn't really work!! -# undef BOOST_NO_DELETED_FUNCTIONS -# undef BOOST_NO_DEFAULTED_FUNCTIONS -# undef BOOST_NO_LAMBDAS -# undef BOOST_NO_DECLTYPE -# undef BOOST_NO_AUTO_DECLARATIONS -# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries +//# undef BOOST_NO_CXX11_SCOPED_ENUMS // doesn't really work!! +# undef BOOST_NO_CXX11_DELETED_FUNCTIONS +# undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# undef BOOST_NO_CXX11_LAMBDAS +# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# undef BOOST_NO_CXX11_DECLTYPE +# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif // icl Version 12.1.0.233 Build 20110811 and possibly some other builds // had an incorrect __INTEL_COMPILER value of 9999. Intel say this has been fixed. #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION > 1200) -# undef BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# undef BOOST_NO_NULLPTR -# undef BOOST_NO_RVALUE_REFERENCES +# undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# undef BOOST_NO_CXX11_NULLPTR +# undef BOOST_NO_CXX11_RVALUE_REFERENCES # undef BOOST_NO_SFINAE_EXPR -# undef BOOST_NO_TEMPLATE_ALIASES -# undef BOOST_NO_VARIADIC_TEMPLATES +# undef BOOST_NO_CXX11_TEMPLATE_ALIASES +# undef BOOST_NO_CXX11_VARIADIC_TEMPLATES // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // continues to list scoped enum support as "Partial" -//# undef BOOST_NO_SCOPED_ENUMS +//# undef BOOST_NO_CXX11_SCOPED_ENUMS #endif #if defined(_MSC_VER) && (_MSC_VER <= 1700) // // Although the Intel compiler is capable of supporting these, it appears not to in MSVC compatibility mode: // -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES #endif #if (BOOST_INTEL_CXX_VERSION < 1200) diff --git a/project/jni/boost/include/boost/config/compiler/metrowerks.hpp b/project/jni/boost/include/boost/config/compiler/metrowerks.hpp index 02baecdde..184cb71c1 100644 --- a/project/jni/boost/include/boost/config/compiler/metrowerks.hpp +++ b/project/jni/boost/include/boost/config/compiler/metrowerks.hpp @@ -90,33 +90,35 @@ #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/project/jni/boost/include/boost/config/compiler/mpw.hpp b/project/jni/boost/include/boost/config/compiler/mpw.hpp index 45e1aa45c..14adee0cc 100644 --- a/project/jni/boost/include/boost/config/compiler/mpw.hpp +++ b/project/jni/boost/include/boost/config/compiler/mpw.hpp @@ -40,32 +40,34 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // versions check: diff --git a/project/jni/boost/include/boost/config/compiler/pathscale.hpp b/project/jni/boost/include/boost/config/compiler/pathscale.hpp index 94e44726f..304112635 100644 --- a/project/jni/boost/include/boost/config/compiler/pathscale.hpp +++ b/project/jni/boost/include/boost/config/compiler/pathscale.hpp @@ -32,49 +32,49 @@ # define BOOST_HAS_EXPM1 # define BOOST_HAS_DIRENT_H # define BOOST_HAS_CLOCK_GETTIME -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_STD_UNORDERED -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_NULLPTR -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_NOEXCEPT -# define BOOST_NO_LAMBDAS -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DECLTYPE -# define BOOST_NO_DECLTYPE_N3276 -# define BOOST_NO_CONSTEXPR +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_CONSTEXPR # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# define BOOST_NO_CHAR32_T -# define BOOST_NO_CHAR16_T -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CHRONO #endif diff --git a/project/jni/boost/include/boost/config/compiler/pgi.hpp b/project/jni/boost/include/boost/config/compiler/pgi.hpp index 0ae8af58e..fa32fefb4 100644 --- a/project/jni/boost/include/boost/config/compiler/pgi.hpp +++ b/project/jni/boost/include/boost/config/compiler/pgi.hpp @@ -1,6 +1,6 @@ // (C) Copyright Noel Belcourt 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. @@ -16,10 +16,29 @@ // if no threading API is detected. // -#if __PGIC__ >= 10 +#if __PGIC__ >= 11 // options requested by configure --enable-test #define BOOST_HAS_PTHREADS +#define BOOST_HAS_THREADS +#define BOOST_HAS_PTHREAD_YIELD +#define BOOST_HAS_NRVO +#define BOOST_HAS_LONG_LONG + +// options --enable-test wants undefined +#undef BOOST_NO_STDC_NAMESPACE +#undef BOOST_NO_EXCEPTION_STD_NAMESPACE +#undef BOOST_DEDUCED_TYPENAME + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS + +#elif __PGIC__ >= 10 + +// options requested by configure --enable-test +#define BOOST_HAS_THREADS #define BOOST_HAS_NRVO #define BOOST_HAS_LONG_LONG @@ -30,11 +49,11 @@ #elif __PGIC__ >= 7 -#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS #else @@ -46,30 +65,52 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NUMERIC_LIMITS +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SWPRINTF +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#define BOOST_NO_CXX11_HDR_UNORDERED_SET +#define BOOST_NO_CXX11_HDR_UNORDERED_MAP +#define BOOST_NO_CXX11_HDR_TYPEINDEX +#define BOOST_NO_CXX11_HDR_TYPE_TRAITS +#define BOOST_NO_CXX11_HDR_TUPLE +#define BOOST_NO_CXX11_HDR_THREAD +#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +#define BOOST_NO_CXX11_HDR_REGEX +#define BOOST_NO_CXX11_HDR_RATIO +#define BOOST_NO_CXX11_HDR_RANDOM +#define BOOST_NO_CXX11_HDR_MUTEX +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_HDR_FUTURE +#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_HDR_CHRONO +#define BOOST_NO_CXX11_HDR_ARRAY // // version check: diff --git a/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp b/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp index eaf6c741c..65beb5019 100644 --- a/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp +++ b/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp @@ -99,32 +99,34 @@ // # define BOOST_HAS_LONG_LONG -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // Version diff --git a/project/jni/boost/include/boost/config/compiler/vacpp.hpp b/project/jni/boost/include/boost/config/compiler/vacpp.hpp index b0407aab7..2410d5a3a 100644 --- a/project/jni/boost/include/boost/config/compiler/vacpp.hpp +++ b/project/jni/boost/include/boost/config/compiler/vacpp.hpp @@ -71,49 +71,59 @@ // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if ! __IBMCPP_AUTO_TYPEDEDUCTION -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if ! __IBMCPP_UTF_LITERAL__ -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif +#if ! __IBMCPP_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif -#define BOOST_NO_CONSTEXPR #if ! __IBMCPP_DECLTYPE -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #else # define BOOST_HAS_DECLTYPE #endif -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if ! __IBMCPP_EXTERN_TEMPLATE -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if ! __IBMCPP_VARIADIC_TEMPLATES // not enabled separately at this time -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#if ! __IBMCPP_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES +#endif +#if ! __IBMCPP_SCOPED_ENUM +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS #if ! __IBMCPP_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif #if ! __C99_MACRO_WITH_VA_ARGS -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif diff --git a/project/jni/boost/include/boost/config/compiler/visualc.hpp b/project/jni/boost/include/boost/config/compiler/visualc.hpp index 1a13f0dbd..aa4584df8 100644 --- a/project/jni/boost/include/boost/config/compiler/visualc.hpp +++ b/project/jni/boost/include/boost/config/compiler/visualc.hpp @@ -9,38 +9,54 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. - +// // Microsoft Visual C++ compiler setup: +// +// We need to be careful with the checks in this file, as contrary +// to popular belief there are versions with _MSC_VER with the final +// digit non-zero (mainly the MIPS cross compiler). +// +// So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX. +// No other comparisons (==, >, or <=) are safe. +// #define BOOST_MSVC _MSC_VER +// +// Helper macro BOOST_MSVC_FULL_VER for use in Boost code: +// #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif -// turn off the warnings before we #include anything +// Attempt to suppress VC6 warnings about the length of decorated names (obsolete): #pragma warning( disable : 4503 ) // warning: decorated name length exceeded +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +# error "Compiler not supported or configured - please reconfigure" +#endif + #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE -# if BOOST_MSVC == 1202 +# if _MSC_VER == 1202 # define BOOST_NO_STD_TYPEINFO # endif - // disable min/max macro defines on vc6: - // #endif /// Visual Studio has no fenv.h #define BOOST_NO_FENV_H -#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 +#if (_MSC_VER < 1310) // 130X == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS @@ -72,7 +88,7 @@ # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? -# if (_MSC_VER > 1200) +# if (_MSC_VER >= 1300) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -83,9 +99,9 @@ // it appears not to actually work: # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if defined(UNDER_CE) @@ -93,17 +109,16 @@ # define BOOST_NO_SWPRINTF #endif -#if _MSC_VER <= 1400 // 1400 == VC++ 8.0 +#if _MSC_VER < 1500 // 140X == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif -#if _MSC_VER == 1500 // 1500 == VC++ 9.0 +#if _MSC_VER < 1600 // 150X == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif -#if (_MSC_VER <= 1600) // MSVC (including the latest checked version) has not yet completely // implemented value-initialization, as is reported: // "VC++ does not value-initialize members of derived classes without @@ -117,11 +132,10 @@ // https://connect.microsoft.com/VisualStudio/feedback/details/100744 // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) -#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#endif +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 -# define BOOST_NO_INITIALIZER_LISTS +#if _MSC_VER < 1600 || !defined(BOOST_STRICT_CONFIG) // 150X == VC++ 9.0 +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #ifndef _NATIVE_WCHAR_T_DEFINED @@ -169,6 +183,16 @@ # define BOOST_NO_RTTI #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 // @@ -177,38 +201,44 @@ // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_NULLPTR -#define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_DECLTYPE #endif // _MSC_VER < 1600 #if _MSC_VER >= 1600 -#define BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H #endif +// C++ features supported by VC++ 11 (aka 2012) +// +#if _MSC_VER < 1700 +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif // _MSC_VER < 1700 + // C++0x features not supported by any versions -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // prefix and suffix headers: // @@ -219,6 +249,7 @@ # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif +#ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE @@ -230,13 +261,20 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1400 + // Note: I'm not aware of any CE compiler with version 13xx +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION evc8 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION evc9 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION evc10 -# elif _MSC_VER == 1700 +# elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION evc11 # else # if defined(BOOST_ASSERT_CONFIG) @@ -251,31 +289,26 @@ # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 -# elif _MSC_VER == 1300 +# elif _MSC_VER < 1310 # define BOOST_COMPILER_VERSION 7.0 -# elif _MSC_VER == 1310 +# elif _MSC_VER < 1400 # define BOOST_COMPILER_VERSION 7.1 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION 8.0 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION 9.0 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION 10.0 -# elif _MSC_VER == 1700 +# elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION 11.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif -#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) - -// -// versions check: -// we don't support Visual C++ prior to version 6: -#if _MSC_VER < 1200 -#error "Compiler not supported or configured - please reconfigure" +# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif + // // last known and checked version is 1700 (VC11, aka 2011): #if (_MSC_VER > 1700) diff --git a/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp b/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp index 1814bee2c..305885177 100644 --- a/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp +++ b/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp @@ -94,34 +94,44 @@ // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_FUNCTIONAL +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_SMART_PTR #endif -#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_0X_HDR_TUPLE) -# define BOOST_NO_0X_HDR_TUPLE +#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE) +# define BOOST_NO_CXX11_HDR_TUPLE #endif + +// C++0x headers implemented in 540 (as shipped by Microsoft) +// +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 540 +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +#endif + // // C++0x headers not yet (fully) implemented: // -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/project/jni/boost/include/boost/config/stdlib/libcomo.hpp b/project/jni/boost/include/boost/config/stdlib/libcomo.hpp index 341cf9708..29490f1b1 100644 --- a/project/jni/boost/include/boost/config/stdlib/libcomo.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libcomo.hpp @@ -35,26 +35,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL // // Intrinsic type_traits support. diff --git a/project/jni/boost/include/boost/config/stdlib/libcpp.hpp b/project/jni/boost/include/boost/config/stdlib/libcpp.hpp index 07c704333..3d574407e 100644 --- a/project/jni/boost/include/boost/config/stdlib/libcpp.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libcpp.hpp @@ -20,15 +20,16 @@ #define BOOST_HAS_THREADS #ifdef _LIBCPP_HAS_NO_VARIADICS -# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TUPLE #endif // // These appear to be unusable/incomplete so far: // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES diff --git a/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp b/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp index 03cea5c0f..c56dff225 100644 --- a/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp @@ -105,51 +105,61 @@ // C++0x headers in GCC 4.3.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #endif // C++0x headers in GCC 4.4.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_SMART_PTR #else # define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG # define BOOST_HAS_TR1_COMPLEX_OVERLOADS #endif -#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_0X_HDR_MUTEX)) -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_MUTEX +#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_CXX11_HDR_MUTEX)) +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_MUTEX #endif // C++0x features in GCC 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_RANDOM #endif -// C++0x features in GCC 4.5.0 and later +// C++0x features in GCC 4.6.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TYPEINDEX +#endif + +// C++0x features in GCC 4.7.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// Note that although existed prior to 4.7, "stead_clock" is spelled "monotonic_clock" +// so 4.7.0 is the first truely conforming one. +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_ALLOCATOR #endif // C++0x headers not yet (fully!) implemented // -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // --- end --- diff --git a/project/jni/boost/include/boost/config/stdlib/modena.hpp b/project/jni/boost/include/boost/config/stdlib/modena.hpp index 626e712b5..b483b6e02 100644 --- a/project/jni/boost/include/boost/config/stdlib/modena.hpp +++ b/project/jni/boost/include/boost/config/stdlib/modena.hpp @@ -24,26 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Modena C++ standard library" diff --git a/project/jni/boost/include/boost/config/stdlib/msl.hpp b/project/jni/boost/include/boost/config/stdlib/msl.hpp index adb3d4787..4f9a2da6e 100644 --- a/project/jni/boost/include/boost/config/stdlib/msl.hpp +++ b/project/jni/boost/include/boost/config/stdlib/msl.hpp @@ -48,26 +48,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/project/jni/boost/include/boost/config/stdlib/roguewave.hpp b/project/jni/boost/include/boost/config/stdlib/roguewave.hpp index 95ac36c6b..cb80f5708 100644 --- a/project/jni/boost/include/boost/config/stdlib/roguewave.hpp +++ b/project/jni/boost/include/boost/config/stdlib/roguewave.hpp @@ -155,29 +155,32 @@ #endif #if _RWSTD_VER < 0x05000000 -# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_ARRAY #endif // type_traits header is incomplete: -# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS // // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/project/jni/boost/include/boost/config/stdlib/sgi.hpp b/project/jni/boost/include/boost/config/stdlib/sgi.hpp index c8d77d55d..ae9b6ad90 100644 --- a/project/jni/boost/include/boost/config/stdlib/sgi.hpp +++ b/project/jni/boost/include/boost/config/stdlib/sgi.hpp @@ -118,26 +118,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "SGI standard library" diff --git a/project/jni/boost/include/boost/config/stdlib/stlport.hpp b/project/jni/boost/include/boost/config/stdlib/stlport.hpp index d30699922..bcc30b99e 100644 --- a/project/jni/boost/include/boost/config/stdlib/stlport.hpp +++ b/project/jni/boost/include/boost/config/stdlib/stlport.hpp @@ -71,10 +71,6 @@ # endif #endif -#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) -# define BOOST_NO_STD_UNORDERED -#endif - #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) # define BOOST_HAS_TR1_UNORDERED_SET # define BOOST_HAS_TR1_UNORDERED_MAP @@ -212,26 +208,29 @@ namespace boost { using std::min; using std::max; } // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/project/jni/boost/include/boost/config/stdlib/vacpp.hpp b/project/jni/boost/include/boost/config/stdlib/vacpp.hpp index 32a1fc08b..9d1694655 100644 --- a/project/jni/boost/include/boost/config/stdlib/vacpp.hpp +++ b/project/jni/boost/include/boost/config/stdlib/vacpp.hpp @@ -24,26 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Visual Age default standard library" diff --git a/project/jni/boost/include/boost/config/suffix.hpp b/project/jni/boost/include/boost/config/suffix.hpp index 72a0dc957..8ee88d90f 100644 --- a/project/jni/boost/include/boost/config/suffix.hpp +++ b/project/jni/boost/include/boost/config/suffix.hpp @@ -1,4 +1,5 @@ // 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 Darin Adler @@ -103,13 +104,6 @@ # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #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 - // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: @@ -334,38 +328,6 @@ # define BOOST_HASH_MAP_HEADER #endif -// -// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. -// - -#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) -# define BOOST_NO_INITIALIZER_LISTS -#endif -#if defined(BOOST_NO_INITIALIZER_LISTS) && !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -#endif - -// -// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined -// -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) -#define BOOST_HAS_RVALUE_REFS -#endif - -// -// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined -// -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) -#define BOOST_HAS_VARIADIC_TMPL -#endif - -// -// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined -// -#if !defined(BOOST_NO_DECLTYPE_N3276) && defined(BOOST_NO_DECLTYPE) -#define BOOST_NO_DECLTYPE_N3276 -#endif - // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -527,6 +489,18 @@ namespace boost{ # 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 --------------------------// // @@ -635,20 +609,6 @@ namespace std{ using ::type_info; } #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) #define BOOST_DO_JOIN2( X, Y ) X##Y -// -// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR -// These aid the transition to C++11 while still supporting C++03 compilers -// -#ifdef BOOST_NO_NOEXCEPT -# define BOOST_NOEXCEPT -# define BOOST_NOEXCEPT_IF(Predicate) -# define BOOST_NOEXCEPT_EXPR(Expression) false -#else -# define BOOST_NOEXCEPT noexcept -# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) -# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) -#endif - // // Set some default values for compiler/library/platform names. // These are for debugging config setup only: @@ -675,19 +635,6 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif -// -// constexpr workarounds -// -#if defined(BOOST_NO_CONSTEXPR) -#define BOOST_CONSTEXPR -#define BOOST_CONSTEXPR_OR_CONST const -#else -#define BOOST_CONSTEXPR constexpr -#define BOOST_CONSTEXPR_OR_CONST constexpr -#endif - -#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST - // BOOST_FORCEINLINE ---------------------------------------------// // Macro to use in place of 'inline' to force a function to be inline #if !defined(BOOST_FORCEINLINE) @@ -700,5 +647,274 @@ namespace std{ using ::type_info; } # endif #endif +// +// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined +// +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) +#define BOOST_NO_CXX11_DECLTYPE_N3276 BOOST_NO_CXX11_DECLTYPE #endif +// -------------------- Deprecated macros for 1.50 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP +// instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) +# ifndef BOOST_NO_CXX11_STD_UNORDERED +# define BOOST_NO_CXX11_STD_UNORDERED +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST instead of BOOST_NO_INITIALIZER_LISTS +#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + +// Use BOOST_NO_CXX11_HDR_ARRAY instead of BOOST_NO_0X_HDR_ARRAY +#if defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_BOOST_NO_0X_HDR_ARRAY) +# define BOOST_NO_0X_HDR_ARRAY +#endif +// Use BOOST_NO_CXX11_HDR_CHRONO instead of BOOST_NO_0X_HDR_CHRONO +#if defined(BOOST_NO_CXX11_HDR_CHRONO) && !defined(BOOST_NO_0X_HDR_CHRONO) +# define BOOST_NO_0X_HDR_CHRONO +#endif +// Use BOOST_NO_CXX11_HDR_CODECVT instead of BOOST_NO_0X_HDR_CODECVT +#if defined(BOOST_NO_CXX11_HDR_CODECVT) && !defined(BOOST_NO_0X_HDR_CODECVT) +# define BOOST_NO_0X_HDR_CODECVT +#endif +// Use BOOST_NO_CXX11_HDR_CONDITION_VARIABLE instead of BOOST_NO_0X_HDR_CONDITION_VARIABLE +#if defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) && !defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +#endif +// Use BOOST_NO_CXX11_HDR_FORWARD_LIST instead of BOOST_NO_0X_HDR_FORWARD_LIST +#if defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) && !defined(BOOST_NO_0X_HDR_FORWARD_LIST) +# define BOOST_NO_0X_HDR_FORWARD_LIST +#endif +// Use BOOST_NO_CXX11_HDR_FUTURE instead of BOOST_NO_0X_HDR_FUTURE +#if defined(BOOST_NO_CXX11_HDR_FUTURE) && !defined(BOOST_NO_0X_HDR_FUTURE) +# define BOOST_NO_0X_HDR_FUTURE +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST +// instead of BOOST_NO_0X_HDR_INITIALIZER_LIST or BOOST_NO_INITIALIZER_LISTS +#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# ifndef BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# endif +# ifndef BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_INITIALIZER_LISTS +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_MUTEX instead of BOOST_NO_0X_HDR_MUTEX +#if defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) +# define BOOST_NO_0X_HDR_MUTEX +#endif +// Use BOOST_NO_CXX11_HDR_RANDOM instead of BOOST_NO_0X_HDR_RANDOM +#if defined(BOOST_NO_CXX11_HDR_RANDOM) && !defined(BOOST_NO_0X_HDR_RANDOM) +# define BOOST_NO_0X_HDR_RANDOM +#endif +// Use BOOST_NO_CXX11_HDR_RATIO instead of BOOST_NO_0X_HDR_RATIO +#if defined(BOOST_NO_CXX11_HDR_RATIO) && !defined(BOOST_NO_0X_HDR_RATIO) +# define BOOST_NO_0X_HDR_RATIO +#endif +// Use BOOST_NO_CXX11_HDR_REGEX instead of BOOST_NO_0X_HDR_REGEX +#if defined(BOOST_NO_CXX11_HDR_REGEX) && !defined(BOOST_NO_0X_HDR_REGEX) +# define BOOST_NO_0X_HDR_REGEX +#endif +// Use BOOST_NO_CXX11_HDR_SYSTEM_ERROR instead of BOOST_NO_0X_HDR_SYSTEM_ERROR +#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_0X_HDR_SYSTEM_ERROR) +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +#endif +// Use BOOST_NO_CXX11_HDR_THREAD instead of BOOST_NO_0X_HDR_THREAD +#if defined(BOOST_NO_CXX11_HDR_THREAD) && !defined(BOOST_NO_0X_HDR_THREAD) +# define BOOST_NO_0X_HDR_THREAD +#endif +// Use BOOST_NO_CXX11_HDR_TUPLE instead of BOOST_NO_0X_HDR_TUPLE +#if defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE +#endif +// Use BOOST_NO_CXX11_HDR_TYPE_TRAITS instead of BOOST_NO_0X_HDR_TYPE_TRAITS +#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) +# define BOOST_NO_0X_HDR_TYPE_TRAITS +#endif +// Use BOOST_NO_CXX11_HDR_TYPEINDEX instead of BOOST_NO_0X_HDR_TYPEINDEX +#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) && !defined(BOOST_NO_0X_HDR_TYPEINDEX) +# define BOOST_NO_0X_HDR_TYPEINDEX +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_MAP instead of BOOST_NO_0X_HDR_UNORDERED_MAP +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) && !defined(BOOST_NO_0X_HDR_UNORDERED_MAP) +# define BOOST_NO_0X_HDR_UNORDERED_MAP +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET instead of BOOST_NO_0X_HDR_UNORDERED_SET +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_0X_HDR_UNORDERED_SET) +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// ------------------ End of deprecated macros for 1.50 --------------------------- + +// -------------------- Deprecated macros for 1.51 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_AUTO_DECLARATIONS instead of BOOST_NO_AUTO_DECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_AUTO_DECLARATIONS) +# define BOOST_NO_AUTO_DECLARATIONS +#endif +// Use BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS instead of BOOST_NO_AUTO_MULTIDECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS) && !defined(BOOST_NO_AUTO_MULTIDECLARATIONS) +# define BOOST_NO_AUTO_MULTIDECLARATIONS +#endif +// Use BOOST_NO_CXX11_CHAR16_T instead of BOOST_NO_CHAR16_T +#if defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CHAR16_T) +# define BOOST_NO_CHAR16_T +#endif +// Use BOOST_NO_CXX11_CHAR32_T instead of BOOST_NO_CHAR32_T +#if defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CHAR32_T) +# define BOOST_NO_CHAR32_T +#endif +// Use BOOST_NO_CXX11_TEMPLATE_ALIASES instead of BOOST_NO_TEMPLATE_ALIASES +#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_TEMPLATE_ALIASES) +# define BOOST_NO_TEMPLATE_ALIASES +#endif +// Use BOOST_NO_CXX11_CONSTEXPR instead of BOOST_NO_CONSTEXPR +#if defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CONSTEXPR) +# define BOOST_NO_CONSTEXPR +#endif +// Use BOOST_NO_CXX11_DECLTYPE_N3276 instead of BOOST_NO_DECLTYPE_N3276 +#if defined(BOOST_NO_CXX11_DECLTYPE_N3276) && !defined(BOOST_NO_DECLTYPE_N3276) +# define BOOST_NO_DECLTYPE_N3276 +#endif +// Use BOOST_NO_CXX11_DECLTYPE instead of BOOST_NO_DECLTYPE +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE) +# define BOOST_NO_DECLTYPE +#endif +// Use BOOST_NO_CXX11_DEFAULTED_FUNCTIONS instead of BOOST_NO_DEFAULTED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_DEFAULTED_FUNCTIONS) +# define BOOST_NO_DEFAULTED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_DELETED_FUNCTIONS instead of BOOST_NO_DELETED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_DELETED_FUNCTIONS) +# define BOOST_NO_DELETED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS instead of BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#endif +// Use BOOST_NO_CXX11_EXTERN_TEMPLATE instead of BOOST_NO_EXTERN_TEMPLATE +#if defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) && !defined(BOOST_NO_EXTERN_TEMPLATE) +# define BOOST_NO_EXTERN_TEMPLATE +#endif +// Use BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS instead of BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +// Use BOOST_NO_CXX11_LAMBDAS instead of BOOST_NO_LAMBDAS +#if defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) +# define BOOST_NO_LAMBDAS +#endif +// Use BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS instead of BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#if defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS) && !defined(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif +// Use BOOST_NO_CXX11_NOEXCEPT instead of BOOST_NO_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT) +# define BOOST_NO_NOEXCEPT +#endif +// Use BOOST_NO_CXX11_NULLPTR instead of BOOST_NO_NULLPTR +#if defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR) +# define BOOST_NO_NULLPTR +#endif +// Use BOOST_NO_CXX11_RAW_LITERALS instead of BOOST_NO_RAW_LITERALS +#if defined(BOOST_NO_CXX11_RAW_LITERALS) && !defined(BOOST_NO_RAW_LITERALS) +# define BOOST_NO_RAW_LITERALS +#endif +// Use BOOST_NO_CXX11_RVALUE_REFERENCES instead of BOOST_NO_RVALUE_REFERENCES +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES) +# define BOOST_NO_RVALUE_REFERENCES +#endif +// Use BOOST_NO_CXX11_SCOPED_ENUMS instead of BOOST_NO_SCOPED_ENUMS +#if defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_NO_SCOPED_ENUMS) +# define BOOST_NO_SCOPED_ENUMS +#endif +// Use BOOST_NO_CXX11_STATIC_ASSERT instead of BOOST_NO_STATIC_ASSERT +#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) +# define BOOST_NO_STATIC_ASSERT +#endif +// Use BOOST_NO_CXX11_STD_UNORDERED instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_STD_UNORDERED) && !defined(BOOST_NO_STD_UNORDERED) +# define BOOST_NO_STD_UNORDERED +#endif +// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) +# define BOOST_NO_UNICODE_LITERALS +#endif +// Use BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX instead of BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX) +# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#endif +// Use BOOST_NO_CXX11_VARIADIC_TEMPLATES instead of BOOST_NO_VARIADIC_TEMPLATES +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +# define BOOST_NO_VARIADIC_TEMPLATES +#endif +// Use BOOST_NO_CXX11_VARIADIC_MACROS instead of BOOST_NO_VARIADIC_MACROS +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS) +# define BOOST_NO_VARIADIC_MACROS +#endif +// Use BOOST_NO_CXX11_NUMERIC_LIMITS instead of BOOST_NO_NUMERIC_LIMITS_LOWEST +#if defined(BOOST_NO_CXX11_NUMERIC_LIMITS) && !defined(BOOST_NO_NUMERIC_LIMITS_LOWEST) +# define BOOST_NO_NUMERIC_LIMITS_LOWEST +#endif +// ------------------ End of deprecated macros for 1.51 --------------------------- + + + +// +// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR +// These aid the transition to C++11 while still supporting C++03 compilers +// +#ifdef BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NOEXCEPT +# define BOOST_NOEXCEPT_IF(Predicate) +# define BOOST_NOEXCEPT_EXPR(Expression) false +#else +# define BOOST_NOEXCEPT noexcept +# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) +# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) +#endif + +// +// constexpr workarounds +// +#if defined(BOOST_NO_CXX11_CONSTEXPR) +#define BOOST_CONSTEXPR +#define BOOST_CONSTEXPR_OR_CONST const +#else +#define BOOST_CONSTEXPR constexpr +#define BOOST_CONSTEXPR_OR_CONST constexpr +#endif + +#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST + +// +// Set BOOST_HAS_STATIC_ASSERT when BOOST_NO_CXX11_STATIC_ASSERT is not defined +// +#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 +#endif + +// +// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_CXX11_VARIADIC_TEMPLATES is not defined +// +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) +#define BOOST_HAS_VARIADIC_TMPL +#endif + + +#endif diff --git a/project/jni/boost/include/boost/config/user.hpp b/project/jni/boost/include/boost/config/user.hpp index 439d3c7ee..1e2ea1d3a 100644 --- a/project/jni/boost/include/boost/config/user.hpp +++ b/project/jni/boost/include/boost/config/user.hpp @@ -17,6 +17,10 @@ #define __arm__ 1 #define _REENTRANT 1 #define _GLIBCXX__PTHREADS 1 +// There is problem with std::atomic on android (and some other platforms). +// See this link for more info: +// https://code.google.com/p/android/issues/detail?id=42735#makechanges +#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 // define this to locate a compiler config file: // #define BOOST_COMPILER_CONFIG diff --git a/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp b/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp deleted file mode 100644 index 03e12d1d1..000000000 --- a/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp +++ /dev/null @@ -1,651 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Pablo Halpern 2009. 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) -// -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP -#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP - -#if (defined _MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -#include -#include -#include -#include -#include - -namespace boost { namespace container { - -template -class scoped_allocator_adaptor; - -template -scoped_allocator_adaptor make_scoped(); - -template -class scoped_allocator_adaptor_base : public OuterAlloc -{ - typedef allocator_traits OuterTraits; - -public: - // Workaround for inability of gcc-4.4.1 to expand InnerAllocs... -// typedef scoped_allocator_adaptor inner_allocator_type; - typedef decltype(make_scoped()) inner_allocator_type; - - scoped_allocator_adaptor_base(); - - template - scoped_allocator_adaptor_base(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs); - - template - scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other); - - inner_allocator_type& inner_allocator() - { return _M_inner_allocs; } - inner_allocator_type const& inner_allocator() const - { return _M_inner_allocs; } - - // Allocator propagation functions. - scoped_allocator_adaptor - select_on_container_copy_construction() const; - - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_copy_assignment::value || - inner_allocator_type::propagate_on_container_copy_assignment::value - > propagate_on_container_copy_assignment; - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_move_assignment::value || - inner_allocator_type::propagate_on_container_move_assignment::value - > propagate_on_container_move_assignment; - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_swap::value || - inner_allocator_type::propagate_on_container_swap::value - > propagate_on_container_swap; - -private: - inner_allocator_type _M_inner_allocs; -}; - -// Specialization with only one parameter. -template -class scoped_allocator_adaptor_base : public OuterAlloc -{ - typedef allocator_traits OuterTraits; -public: - typedef scoped_allocator_adaptor inner_allocator_type; - - scoped_allocator_adaptor_base(); - - template - scoped_allocator_adaptor_base(OuterA2&& outerAlloc); - - template - scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other); - - inner_allocator_type& inner_allocator() - { return static_cast(*this); } - - inner_allocator_type const& inner_allocator() const - { return static_cast(*this); } - - // Allocator propagation functions. - scoped_allocator_adaptor - select_on_container_copy_construction() const; - - typedef typename OuterTraits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment; - typedef typename OuterTraits::propagate_on_container_move_assignment propagate_on_container_move_assignment; - typedef typename OuterTraits::propagate_on_container_swap propagate_on_container_swap; -}; - -template -class scoped_allocator_adaptor - : public scoped_allocator_adaptor_base -{ - typedef scoped_allocator_adaptor_base _Base; - typedef allocator_traits _Traits; - -public: - typedef OuterAlloc outer_allocator_type; - typedef typename _Base::inner_allocator_type inner_allocator_type; - - typedef typename allocator_traits::size_type size_type; - typedef typename allocator_traits::difference_type difference_type; - typedef typename allocator_traits::pointer pointer; - typedef typename allocator_traits::const_pointer const_pointer; - typedef typename allocator_traits::void_pointer void_pointer; - typedef typename allocator_traits::const_void_pointer const_void_pointer; - typedef typename allocator_traits::value_type value_type; - - template - struct rebind { - typedef typename allocator_traits::template rebind_traits rebound_traits; - typedef typename rebound_traits::allocator_type rebound_outer; // exposition only - typedef scoped_allocator_adaptor other; - }; - - scoped_allocator_adaptor(); - scoped_allocator_adaptor(const scoped_allocator_adaptor& other); - - template - scoped_allocator_adaptor(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor(scoped_allocator_adaptor&& other); - - template - scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs); - - ~scoped_allocator_adaptor(); - - inner_allocator_type & inner_allocator() - { return _Base::inner_allocator(); } - inner_allocator_type const& inner_allocator() const - { return _Base::inner_allocator(); } - outer_allocator_type & outer_allocator() - { return *this; } - outer_allocator_type const& outer_allocator() const - { return *this; } - - pointer allocate(size_type n); - pointer allocate(size_type n, const_void_pointer hint); - void deallocate(pointer p, size_type n); - size_type max_size() const; - - template - void construct(T* p, Args&&... args); - - // Specializations to pass inner_allocator to pair::first and pair::second - template - void construct(std::pair* p); - template - void construct(std::pair* p, U&& x, V&& y); - template - void construct(std::pair* p, const std::pair& pr); - template - void construct(std::pair* p, std::pair&& pr); - - template - void destroy(T* p); -}; - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b); - -template -inline -bool operator!=(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b); - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor_base -/////////////////////////////////////////////////////////////////////////////// - -template -inline -scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base() -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base(OuterA2&& outerAlloc, - const InnerAllocs&... innerAllocs) - : OuterAlloc(std::forward(outerAlloc)) - , _M_inner_allocs(innerAllocs...) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - const scoped_allocator_adaptor& other) - : OuterAlloc(other.outer_allocator()) - , _M_inner_allocs(other.inner_allocator()) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - scoped_allocator_adaptor&& other) - : OuterAlloc(std::move(other.outer_allocator())) - , _M_inner_allocs(std::move(other.inner_allocator())) -{ -} - -template -inline -scoped_allocator_adaptor -scoped_allocator_adaptor_base:: - select_on_container_copy_construction() const -{ - return scoped_allocator_adaptor( - allocator_traits::select_on_container_copy_construction( - this->outer_allocator()), - allocator_traits::select_on_container_copy_construction( - this->inner_allocator())); -} - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor_base specialization -/////////////////////////////////////////////////////////////////////////////// - -template -inline -scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base() -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base(OuterA2&& outerAlloc) - : OuterAlloc(std::forward(outerAlloc)) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - const scoped_allocator_adaptor& other) - : OuterAlloc(other.outer_allocator()) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - scoped_allocator_adaptor&& other) - : OuterAlloc(std::move(other.outer_allocator())) -{ -} - -// template -// inline -// scoped_allocator_adaptor& -// scoped_allocator_adaptor_base::inner_allocator() -// { -// return *this; -// } - -// template -// inline -// scoped_allocator_adaptor const& -// scoped_allocator_adaptor_base::inner_allocator() cosnt -// { -// return *this; -// } - -template -inline -scoped_allocator_adaptor -scoped_allocator_adaptor_base:: -select_on_container_copy_construction() const -{ - return - allocator_traits::select_on_container_copy_construction( - this->outer_allocator()); -} - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor details -/////////////////////////////////////////////////////////////////////////////// - -namespace __details { - - // Overload resolution for __has_ctor resolves to this function - // when _Tp is constructible with _Args. Returns true_type(). - - static void* __void_p; // Declared but not defined - - template - inline - auto __has_ctor(int, _Args&&... __args) -> - decltype((new (__void_p) _Tp(__args...), std::true_type())) - { return std::true_type(); } - - // Overload resolution for __has_ctor resolves to this function - // when _Tp is not constructible with _Args. Returns false_type(). - template - auto __has_ctor(_LowPriorityConversion, _Args&&...) -> - std::false_type - { return std::false_type(); } - - template - struct __is_scoped_allocator_imp { - template - static char test(int, typename T::outer_allocator_type*); - template - static int test(_LowPriorityConversion, void*); - static const bool value = (1 == sizeof(test<_Alloc>(0, 0))); - }; - - template - struct __is_scoped_allocator - : std::integral_constant::value> - { - }; - -#if 0 - // Called when outer_allocator_type is not a scoped allocator - // (recursion stop). - template - inline - auto __outermost_alloc(_LowPriorityConversion, _Alloc& __a) -> - _Alloc& - { - return __a; - } - - // Called when outer_allocator_type is a scoped allocator to - // return the outermost allocator type. - template - inline auto __outermost_alloc(int, _Alloc& __a) -> - decltype(__outermost_alloc(0,__a.outer_allocator())) - { - return __a.outer_allocator(); - } -#endif - - template - inline void __dispatch_scoped_construct(std::false_type __uses_alloc, - _Ignore __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // _Tp doesn't use allocators. Construct without an - // allocator argument. - allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p, - std::forward<_Args>(__args)...); - } - - template - inline void __dispatch_scoped_construct(std::true_type __uses_alloc, - std::true_type __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // _Tp doesn't use allocators. Construct without an - // allocator argument. - allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p, - allocator_arg, __inner_alloc, - std::forward<_Args>(__args)...); - } - - template - inline void __dispatch_scoped_construct(std::true_type __uses_alloc, - std::false_type __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // If _Tp uses an allocator compatible with _InnerAlloc, - // but the specific constructor does not have a variant that - // takes an allocator argument, then program is malformed. -// static_assert(has_constructor<_Tp, _Args...>::value, -// "Cannot pass inner allocator to this constructor"); - - allocator_traits<_OuterAlloc>::construct( - __outer_alloc, __p, std::forward<_Args>(__args)..., - __inner_alloc); - } - - template - inline void __do_scoped_construct(std::false_type __scoped_outer, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // Dispatch construction to the correct __dispatch_scoped_construct() - // function based on whether _Tp uses an allocator of type - // _InnerAlloc and, if so, whether there exists the following - // constructor: - // _Tp(allocator_arg_t, _InnerAlloc, Args...). - auto __uses_alloc = uses_allocator<_Tp, _InnerAlloc>(); - auto __use_alloc_prefix = __has_ctor<_Tp>(0, allocator_arg, - __inner_alloc, - std::forward<_Args>(__args)...); - __dispatch_scoped_construct(__uses_alloc, __use_alloc_prefix, - __outer_alloc, - __inner_alloc, - __p, std::forward<_Args>(__args)...); - } - - template - void __do_scoped_construct(std::true_type __scoped_outer, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // Use outermost allocator if __outer_alloc is scoped - typedef typename _OuterAlloc::outer_allocator_type outerouter; - __do_scoped_construct(__is_scoped_allocator(), - __outer_alloc.outer_allocator(), - __inner_alloc, - __p, std::forward<_Args>(__args)...); - } - -} // end namespace __details - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor -/////////////////////////////////////////////////////////////////////////////// - -template -scoped_allocator_adaptor:: - scoped_allocator_adaptor() -{ -} - -template -scoped_allocator_adaptor:: - scoped_allocator_adaptor(const scoped_allocator_adaptor& other) - : _Base(other) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(const scoped_allocator_adaptor& other) - : _Base(other) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(scoped_allocator_adaptor&& other) - : _Base(std::move(other)) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs) - : _Base(std::forward(outerAlloc), innerAllocs...) -{ -} - -template -scoped_allocator_adaptor:: - ~scoped_allocator_adaptor() -{ -} - -template -inline typename allocator_traits::pointer -scoped_allocator_adaptor:: - allocate(size_type n) -{ - return allocator_traits::allocate(outer_allocator(), n); -} - -template -inline typename allocator_traits::pointer -scoped_allocator_adaptor:: - allocate(size_type n, const_void_pointer hint) -{ - return allocator_traits::allocate(outer_allocator(), n, hint); -} - -template -inline void scoped_allocator_adaptor:: - deallocate(pointer p, size_type n) -{ - allocator_traits::deallocate(outer_allocator(), p, n); -} - -template -inline typename allocator_traits::size_type -scoped_allocator_adaptor::max_size() const -{ - return allocator_traits::max_size(outer_allocator()); -} - -template - template - inline void scoped_allocator_adaptor:: - destroy(T* p) -{ - allocator_traits::destroy(outer_allocator(), p); -} - -template - template - inline - void scoped_allocator_adaptor::construct(T* p, - Args&&... args) -{ - __do_scoped_construct(__details::__is_scoped_allocator(), - this->outer_allocator(), this->inner_allocator(), - p, std::forward(args)...); -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p) -{ - construct(addressof(p->first)); - try { - construct(addressof(p->second)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, U&& x, V&& y) -{ - construct(addressof(p->first), std::forward(x)); - try { - construct(addressof(p->second), std::forward(y)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, const std::pair& pr) -{ - construct(addressof(p->first), pr.first); - try { - construct(addressof(p->second), pr.second); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, std::pair&& pr) -{ - construct(addressof(p->first), std::move(pr.first)); - try { - construct(addressof(p->second), std::move(pr.second)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return a.outer_allocator() == b.outer_allocator() - && a.inner_allocator() == b.inner_allocator(); -} - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return a.outer_allocator() == b.outer_allocator(); -} - -template -inline -bool operator!=(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return ! (a == b); -} - -}} // namespace boost { namespace container { - -#include - -#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP diff --git a/project/jni/boost/include/boost/container/allocator/allocator_traits.hpp b/project/jni/boost/include/boost/container/allocator_traits.hpp similarity index 74% rename from project/jni/boost/include/boost/container/allocator/allocator_traits.hpp rename to project/jni/boost/include/boost/container/allocator_traits.hpp index 01921615c..828d664d0 100644 --- a/project/jni/boost/include/boost/container/allocator/allocator_traits.hpp +++ b/project/jni/boost/include/boost/container/allocator_traits.hpp @@ -6,7 +6,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-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) // @@ -24,10 +24,11 @@ #include #include #include -#include +#include +#include #include #include -#include +#include #include //numeric_limits<>::max() #include //placement new #include //std::allocator @@ -53,6 +54,8 @@ struct is_std_allocator< std::allocator > ///@endcond +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits template struct allocator_traits { @@ -62,64 +65,64 @@ struct allocator_traits typedef typename Alloc::value_type value_type; #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //!Alloc::pointer if such a type exists; otherwise, value_type* + //! Alloc::pointer if such a type exists; otherwise, value_type* //! typedef unspecified pointer; - //!Alloc::const_pointer if such a type exists ; otherwise, pointer_traits::rebind::rebind::rebind. + typedef see_documentation const_pointer; + //! Non-standard extension + //! Alloc::reference if such a type exists; otherwise, value_type& + typedef see_documentation reference; + //! Non-standard extension + //! Alloc::const_reference if such a type exists ; otherwise, const value_type& + typedef see_documentation const_reference; + //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits::rebind. //! - typedef unspecified void_pointer; - //!Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits::rebind::rebind::difference_type. + typedef see_documentation const_void_pointer; + //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits::difference_type. //! - typedef unspecified difference_type; - //!Alloc::size_type if such a type exists ; otherwise, make_unsigned::type + typedef see_documentation difference_type; + //! Alloc::size_type if such a type exists ; otherwise, make_unsigned::type //! - typedef unspecified size_type; - //!Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_copy_assignment; - //!Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_move_assignment; - //!Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_swap; - //!Defines an allocator: Alloc::rebind::other if such a type exists; otherwise, Alloc - //!if Alloc is a class template instantiation of the form Alloc, where Args is zero or - //!more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + typedef see_documentation size_type; + //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_swap; + //! Defines an allocator: Alloc::rebind::other if such a type exists; otherwise, Alloc + //! if Alloc is a class template instantiation of the form Alloc, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. //! - //!In C++03 compilers
rebind_alloc
is a struct derived from an allocator - //!deduced by previously detailed rules. - template using rebind_alloc = unspecified; + //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator + //! deduced by previously detailed rules. + template using rebind_alloc = see_documentation; - //!In C++03 compilers
rebind_traits
is a struct derived from - //!
allocator_traits
, where `OtherAlloc` is
-      //!the allocator deduced by rules explained in `rebind_alloc`.
+      //! In C++03 compilers `rebind_traits` is a struct derived from
+      //! `allocator_traits`, where `OtherAlloc` is
+      //! the allocator deduced by rules explained in `rebind_alloc`.
       template  using rebind_traits = allocator_traits >;
 
-      //!Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
-      //!`type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
+      //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
+      //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
       template 
       struct portable_rebind_alloc
-      {  typedef unspecified_type type;  };
+      {  typedef see_documentation type;  };
    #else
       //pointer
       typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
          pointer, value_type*)
             pointer;
       //const_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
          const_pointer, typename boost::intrusive::pointer_traits::template
             rebind_pointer)
                const_pointer;
@@ -128,11 +131,11 @@ struct allocator_traits
          reference, typename container_detail::unvoid::type&)
             reference;
       //const_reference
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
          const_reference, const typename container_detail::unvoid::type&)
                const_reference;
       //void_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
          void_pointer, typename boost::intrusive::pointer_traits::template
             rebind_pointer)
                void_pointer;
@@ -162,22 +165,22 @@ struct allocator_traits
          propagate_on_container_swap, boost::false_type)
             propagate_on_container_swap;
 
-      #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+      #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
          //C++11
-         template  using rebind_alloc  = boost::intrusive::detail::type_rebinder::type;
+         template  using rebind_alloc  = typename boost::intrusive::detail::type_rebinder::type;
          template  using rebind_traits = allocator_traits< rebind_alloc >;
-      #else    //!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
          template 
          struct rebind_alloc : boost::intrusive::detail::type_rebinder::type
          {
             typedef typename boost::intrusive::detail::type_rebinder::type Base;
-            #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
             template 
-            rebind_alloc(Args&&... args)
+            rebind_alloc(BOOST_FWD_REF(Args)... args)
                : Base(boost::forward(args)...)
             {}
-            #else    //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
             #define BOOST_PP_LOCAL_MACRO(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, _))                       \
@@ -186,32 +189,32 @@ struct allocator_traits
             //
             #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
             #include BOOST_PP_LOCAL_ITERATE()
-            #endif   //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          };
 
          template 
          struct rebind_traits
             : allocator_traits::type>
          {};
-      #endif   //!defined(BOOST_NO_TEMPLATE_ALIASES)
+      #endif   // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
       template 
       struct portable_rebind_alloc
       {  typedef typename boost::intrusive::detail::type_rebinder::type type;  };
    #endif   //BOOST_CONTAINER_DOXYGEN_INVOKED
 
-   //!Returns: a.allocate(n)
+   //! Returns: `a.allocate(n)`
    //!
    static pointer allocate(Alloc &a, size_type n)
    {  return a.allocate(n);  }
 
-   //!Returns: a.deallocate(p, n)
+   //! Returns: `a.deallocate(p, n)`
    //!
-   //!Throws: Nothing
+   //! Throws: Nothing
    static void deallocate(Alloc &a, pointer p, size_type n)
    {  return a.deallocate(p, n);  }
 
-   //!Effects: calls `a.construct(p, std::forward(args)...)` if that call is well-formed;
-   //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+   //! Effects: calls `a.allocate(n, p)` if that call is well-formed;
+   //! otherwise, invokes `a.allocate(n)`
    static pointer allocate(Alloc &a, size_type n, const_void_pointer p)
    {
       const bool value = boost::container::container_detail::
@@ -221,8 +224,8 @@ struct allocator_traits
       return allocator_traits::priv_allocate(flag, a, n, p);
    }
 
-   //!Effects: calls a.destroy(p) if that call is well-formed;
-   //!otherwise, invokes `p->~T()`.
+   //! Effects: calls `a.destroy(p)` if that call is well-formed;
+   //! otherwise, invokes `p->~T()`.
    template
    static void destroy(Alloc &a, T*p)
    {
@@ -234,8 +237,8 @@ struct allocator_traits
       allocator_traits::priv_destroy(flag, a, p);
    }
 
-   //!Returns: a.max_size() if that expression is well-formed; otherwise,
-   //!`numeric_limits::max()`.
+   //! Returns: `a.max_size()` if that expression is well-formed; otherwise,
+   //! `numeric_limits::max()`.
    static size_type max_size(const Alloc &a)
    {
       const bool value = boost::container::container_detail::
@@ -245,8 +248,8 @@ struct allocator_traits
       return allocator_traits::priv_max_size(flag, a);
    }
 
-   //!Returns: a.select_on_container_copy_construction() if that expres sion is well- formed;
-   //!otherwise, a.
+   //! Returns: `a.select_on_container_copy_construction()` if that expression is well-formed;
+   //! otherwise, a.
    static Alloc select_on_container_copy_construction(const Alloc &a)
    {
       const bool value = boost::container::container_detail::
@@ -256,17 +259,17 @@ struct allocator_traits
       return allocator_traits::priv_select_on_container_copy_construction(flag, a);
    }
 
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-      //!Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; 
-      //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      //! Effects: calls `a.construct(p, std::forward(args)...)` if that call is well-formed;
+      //! otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
       template 
-      static void construct(Alloc & a, T* p, Args&&... args)
+      static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
       {
          ::boost::integral_constant::value> flag;
          allocator_traits::priv_construct(flag, a, p, ::boost::forward(args)...);
       }
    #endif
-
+   ///@cond
    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
       private:
       static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p)
@@ -295,10 +298,10 @@ struct allocator_traits
       static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a)
       {  return a;  }
 
-      #if defined(BOOST_CONTAINER_PERFECT_FORWARDING)
+      #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          template
-         static void priv_construct(boost::false_type, Alloc &a, T *p, Args && ...args)                    
-         {                                                                                                  
+         static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)                   
+         {                                                                                                 
             const bool value = boost::container::container_detail::
                   has_member_function_callable_with_construct
                      < Alloc, T*, Args... >::value;
@@ -307,19 +310,19 @@ struct allocator_traits
          }
 
          template
-         static void priv_construct(boost::true_type, Alloc &a, T *p, Args && ...args)
+         static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
          {
             priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward(args)...);
          }
 
          template
-         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, Args && ...args)
+         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
          {  a.construct( p, ::boost::forward(args)...);  }
 
          template
-         static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, 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)...); }
-      #else
+      #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          public:
          #define BOOST_PP_LOCAL_MACRO(n)                                                              \
          template                                 \
@@ -333,7 +336,7 @@ struct allocator_traits
          //
          #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
          #include BOOST_PP_LOCAL_ITERATE()
-      
+     
          private:
          #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
          template                                      \
@@ -368,7 +371,7 @@ struct allocator_traits
          //
          #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
          #include BOOST_PP_LOCAL_ITERATE()
-      #endif   //BOOST_CONTAINER_PERFECT_FORWARDING
+      #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
    #endif   //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    ///@endcond
diff --git a/project/jni/boost/include/boost/container/container_fwd.hpp b/project/jni/boost/include/boost/container/container_fwd.hpp
index da325e446..bdefd81e0 100644
--- a/project/jni/boost/include/boost/container/container_fwd.hpp
+++ b/project/jni/boost/include/boost/container/container_fwd.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -21,8 +21,8 @@
 
 /// @cond
 
-namespace boost{ 
-namespace intrusive{ 
+namespace boost{
+namespace intrusive{
    //Create namespace to avoid compilation errors
 }}
 
@@ -32,9 +32,9 @@ namespace bi = boost::intrusive;
 
 }}}
 
-#include  
-#include  
-#include  
+#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -49,109 +49,105 @@ namespace container {
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class vector;
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class stable_vector;
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class deque;
 
 //list class
 template  >
+         ,class Allocator = std::allocator >
 class list;
 
 //slist class
 template  >
+         ,class Allocator = std::allocator >
 class slist;
 
 //set class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class set;
 
 //multiset class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class multiset;
 
 //map class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class map;
 
 //multimap class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class multimap;
 
 //flat_set class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class flat_set;
 
 //flat_multiset class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class flat_multiset;
 
 //flat_map class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class flat_map;
 
 //flat_multimap class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class flat_multimap;
 
 //basic_string class
 template 
-         ,class A  = std::allocator > 
+         ,class Allocator  = std::allocator >
 class basic_string;
 
 //! Type used to tag that the input range is
 //! guaranteed to be ordered
-struct ordered_range_impl_t {};
+struct ordered_range_t
+{};
 
 //! Type used to tag that the input range is
 //! guaranteed to be ordered and unique
-struct ordered_unique_range_impl_t{};
-
-/// @cond
-
-typedef ordered_range_impl_t * ordered_range_t;
-typedef ordered_unique_range_impl_t *ordered_unique_range_t;
-
-/// @endcond
+struct ordered_unique_range_t
+   : public ordered_range_t
+{};
 
 //! Value used to tag that the input range is
 //! guaranteed to be ordered
-static const ordered_range_t ordered_range = 0;
+static const ordered_range_t ordered_range = ordered_range_t();
 
 //! Value used to tag that the input range is
 //! guaranteed to be ordered and unique
-static const ordered_unique_range_t ordered_unique_range = 0;
+static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t();
 
 /// @cond
 
diff --git a/project/jni/boost/include/boost/container/deque.hpp b/project/jni/boost/include/boost/container/deque.hpp
index 9ee0ee137..32fa480e9 100644
--- a/project/jni/boost/include/boost/container/deque.hpp
+++ b/project/jni/boost/include/boost/container/deque.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -44,7 +44,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -58,29 +58,30 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
 
 /// @cond
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
 class deque;
 
-template 
+template 
 struct deque_value_traits
 {
    typedef T value_type;
-   typedef A allocator_type;
+   typedef Allocator allocator_type;
    static const bool trivial_dctr = boost::has_trivial_destructor::value;
-   static const bool trivial_dctr_after_move = false;
-      //::boost::has_trivial_destructor_after_move::value || trivial_dctr;
+   static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move::value;
    static const bool trivial_copy = has_trivial_copy::value;
    static const bool nothrow_copy = has_nothrow_copy::value;
    static const bool trivial_assign = has_trivial_assign::value;
@@ -90,54 +91,54 @@ struct deque_value_traits
 
 // Note: this function is simply a kludge to work around several compilers'
 //  bugs in handling constant expressions.
-inline std::size_t deque_buf_size(std::size_t size) 
+inline std::size_t deque_buf_size(std::size_t size)
    {  return size < 512 ? std::size_t(512 / size) : std::size_t(1);  }
 
 // Deque base class.  It has two purposes.  First, its constructor
 //  and destructor allocate (but don't initialize) storage.  This makes
 //  exception safety easier.
-template 
+template 
 class deque_base
 {
    BOOST_COPYABLE_AND_MOVABLE(deque_base)
    public:
-   typedef allocator_traits                                     val_alloc_traits_type;
-   typedef typename val_alloc_traits_type::value_type              val_alloc_val;
-   typedef typename val_alloc_traits_type::pointer                 val_alloc_ptr;
-   typedef typename val_alloc_traits_type::const_pointer           val_alloc_cptr;
-   typedef typename val_alloc_traits_type::reference               val_alloc_ref;
-   typedef typename val_alloc_traits_type::const_reference         val_alloc_cref;
-   typedef typename val_alloc_traits_type::difference_type         val_alloc_diff;
-   typedef typename val_alloc_traits_type::size_type               val_alloc_size;
+   typedef allocator_traits                            val_alloc_traits_type;
+   typedef typename val_alloc_traits_type::value_type             val_alloc_val;
+   typedef typename val_alloc_traits_type::pointer                val_alloc_ptr;
+   typedef typename val_alloc_traits_type::const_pointer          val_alloc_cptr;
+   typedef typename val_alloc_traits_type::reference              val_alloc_ref;
+   typedef typename val_alloc_traits_type::const_reference        val_alloc_cref;
+   typedef typename val_alloc_traits_type::difference_type        val_alloc_diff;
+   typedef typename val_alloc_traits_type::size_type              val_alloc_size;
    typedef typename val_alloc_traits_type::template
-      portable_rebind_alloc::type                   ptr_alloc_t;
-   typedef allocator_traits                           ptr_alloc_traits_type;
+      portable_rebind_alloc::type                  ptr_alloc_t;
+   typedef allocator_traits                          ptr_alloc_traits_type;
    typedef typename ptr_alloc_traits_type::value_type             ptr_alloc_val;
    typedef typename ptr_alloc_traits_type::pointer                ptr_alloc_ptr;
    typedef typename ptr_alloc_traits_type::const_pointer          ptr_alloc_cptr;
    typedef typename ptr_alloc_traits_type::reference              ptr_alloc_ref;
    typedef typename ptr_alloc_traits_type::const_reference        ptr_alloc_cref;
-   typedef A                                                      allocator_type;
+   typedef Allocator                                                      allocator_type;
    typedef allocator_type                                         stored_allocator_type;
    typedef val_alloc_size                                         size_type;
 
    protected:
 
-   typedef deque_value_traits             traits_t;
+   typedef deque_value_traits             traits_t;
    typedef ptr_alloc_t                          map_allocator_type;
 
    static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
 
-   val_alloc_ptr priv_allocate_node() 
+   val_alloc_ptr priv_allocate_node()
       {  return this->alloc().allocate(s_buffer_size());  }
 
-   void priv_deallocate_node(val_alloc_ptr p) 
+   void priv_deallocate_node(val_alloc_ptr p)
       {  this->alloc().deallocate(p, s_buffer_size());  }
 
-   ptr_alloc_ptr priv_allocate_map(size_type n) 
+   ptr_alloc_ptr priv_allocate_map(size_type n)
       { return this->ptr_alloc().allocate(n); }
 
-   void priv_deallocate_map(ptr_alloc_ptr p, size_type n) 
+   void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
       { this->ptr_alloc().deallocate(p, n); }
 
  public:
@@ -145,7 +146,7 @@ class deque_base
    //  For any nonsingular iterator i:
    //    i.node is the address of an element in the map array.  The
    //      contents of i.node is a pointer to the beginning of a node.
-   //    i.first == //(i.node) 
+   //    i.first == //(i.node)
    //    i.last  == i.first + node_size
    //    i.cur is a pointer in the range [i.first, i.last).  NOTE:
    //      the implication of this is that i.cur is always a dereferenceable
@@ -160,18 +161,18 @@ class deque_base
    //    [start.cur, start.last) and [finish.first, finish.cur) are initialized
    //    objects, and [start.first, start.cur) and [finish.cur, finish.last)
    //    are uninitialized storage.
-   //  [map, map + map_size) is a valid, non-empty range.  
-   //  [start.node, finish.node] is a valid range contained within 
-   //    [map, map + map_size).  
-   //  A pointer in the range [map, map + map_size) points to an allocated node
+   //  [map, map + map_size) is a valid, non-empty range. 
+   //  [start.node, finish.node] is a valid range contained within
+   //    [map, map + map_size). 
+   //  Allocator pointer in the range [map, map + map_size) points to an allocated node
    //    if and only if the pointer is in the range [start.node, finish.node].
-   class const_iterator 
-      : public std::iterator
    {
       public:
-      static size_type s_buffer_size() { return deque_base::s_buffer_size(); }
+      static size_type s_buffer_size() { return deque_base::s_buffer_size(); }
 
       typedef std::random_access_iterator_tag   iterator_category;
       typedef val_alloc_val                     value_type;
@@ -182,33 +183,33 @@ class deque_base
       typedef ptr_alloc_ptr                     index_pointer;
       typedef const_iterator                    self_t;
 
-      friend class deque;
-      friend class deque_base;
+      friend class deque;
+      friend class deque_base;
 
-      protected: 
+      protected:
       val_alloc_ptr  m_cur;
       val_alloc_ptr  m_first;
       val_alloc_ptr  m_last;
       index_pointer  m_node;
 
-      public: 
-      const_iterator(val_alloc_ptr x, index_pointer y) 
+      public:
+      const_iterator(val_alloc_ptr x, index_pointer y)
          : m_cur(x), m_first(*y),
            m_last(*y + s_buffer_size()), m_node(y) {}
 
       const_iterator() : m_cur(0), m_first(0), m_last(0), m_node(0) {}
 
       const_iterator(const const_iterator& x)
-         : m_cur(x.m_cur),   m_first(x.m_first), 
+         : m_cur(x.m_cur),   m_first(x.m_first),
            m_last(x.m_last), m_node(x.m_node) {}
 
-      reference operator*() const 
+      reference operator*() const
          { return *this->m_cur; }
 
-      pointer operator->() const 
+      pointer operator->() const
          { return this->m_cur; }
 
-      difference_type operator-(const self_t& x) const 
+      difference_type operator-(const self_t& x) const
       {
          if(!this->m_cur && !x.m_cur){
             return 0;
@@ -217,24 +218,24 @@ class deque_base
             (this->m_cur - this->m_first) + (x.m_last - x.m_cur);
       }
 
-      self_t& operator++() 
+      self_t& operator++()
       {
          ++this->m_cur;
          if (this->m_cur == this->m_last) {
             this->priv_set_node(this->m_node + 1);
             this->m_cur = this->m_first;
          }
-         return *this; 
+         return *this;
       }
 
-      self_t operator++(int)  
+      self_t operator++(int) 
       {
          self_t tmp = *this;
          ++*this;
          return tmp;
       }
 
-      self_t& operator--() 
+      self_t& operator--()
       {
          if (this->m_cur == this->m_first) {
             this->priv_set_node(this->m_node - 1);
@@ -244,7 +245,7 @@ class deque_base
          return *this;
       }
 
-      self_t operator--(int) 
+      self_t operator--(int)
       {
          self_t tmp = *this;
          --*this;
@@ -261,7 +262,7 @@ class deque_base
             offset > 0 ? offset / difference_type(this->s_buffer_size())
                         : -difference_type((-offset - 1) / this->s_buffer_size()) - 1;
             this->priv_set_node(this->m_node + node_offset);
-            this->m_cur = this->m_first + 
+            this->m_cur = this->m_first +
             (offset - node_offset * difference_type(this->s_buffer_size()));
          }
          return *this;
@@ -270,41 +271,41 @@ class deque_base
       self_t operator+(difference_type n) const
          {  self_t tmp = *this; return tmp += n;  }
 
-      self_t& operator-=(difference_type n) 
+      self_t& operator-=(difference_type n)
          { return *this += -n; }
-       
-      self_t operator-(difference_type n) const 
+      
+      self_t operator-(difference_type n) const
          {  self_t tmp = *this; return tmp -= n;  }
 
-      reference operator[](difference_type n) const 
+      reference operator[](difference_type n) const
          { return *(*this + n); }
 
-      bool operator==(const self_t& x) const 
+      bool operator==(const self_t& x) const
          { return this->m_cur == x.m_cur; }
 
-      bool operator!=(const self_t& x) const 
+      bool operator!=(const self_t& x) const
          { return !(*this == x); }
 
-      bool operator<(const self_t& x) const 
+      bool operator<(const self_t& x) const
       {
-         return (this->m_node == x.m_node) ? 
+         return (this->m_node == x.m_node) ?
             (this->m_cur < x.m_cur) : (this->m_node < x.m_node);
       }
 
-      bool operator>(const self_t& x) const  
+      bool operator>(const self_t& x) const 
          { return x < *this; }
 
-      bool operator<=(const self_t& x) const 
+      bool operator<=(const self_t& x) const
          { return !(x < *this); }
 
-      bool operator>=(const self_t& x) const 
+      bool operator>=(const self_t& x) const
          { return !(*this < x); }
 
-      void priv_set_node(index_pointer new_node) 
+      void priv_set_node(index_pointer new_node)
       {
          this->m_node = new_node;
          this->m_first = *new_node;
-         this->m_last = this->m_first + difference_type(this->s_buffer_size());
+         this->m_last = this->m_first + this->s_buffer_size();
       }
 
       friend const_iterator operator+(difference_type n, const const_iterator& x)
@@ -323,8 +324,8 @@ class deque_base
       typedef ptr_alloc_ptr                     index_pointer;
       typedef const_iterator                    self_t;
 
-      friend class deque;
-      friend class deque_base;
+      friend class deque;
+      friend class deque_base;
 
       private:
       explicit iterator(const const_iterator& x) : const_iterator(x){}
@@ -343,12 +344,12 @@ class deque_base
       reference operator[](difference_type n) const { return *(*this + n); }
 
       //Increment / Decrement
-      iterator& operator++()  
+      iterator& operator++() 
          { this->const_iterator::operator++(); return *this;  }
 
       iterator operator++(int)
          { iterator tmp = *this; ++*this; return tmp; }
-      
+     
       iterator& operator--()
          {  this->const_iterator::operator--(); return *this;  }
 
@@ -379,7 +380,7 @@ class deque_base
       :  members_(a)
    { this->priv_initialize_map(num_elements); }
 
-   explicit deque_base(const allocator_type& a) 
+   explicit deque_base(const allocator_type& a)
       :  members_(a)
    {}
 
@@ -402,7 +403,7 @@ class deque_base
 
    private:
    deque_base(const deque_base&);
-  
+ 
    protected:
 
    void swap_members(deque_base &x)
@@ -423,7 +424,7 @@ class deque_base
 
          ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
          ptr_alloc_ptr nfinish = nstart + num_nodes;
-             
+            
          BOOST_TRY {
             this->priv_create_nodes(nstart, nfinish);
          }
@@ -508,16 +509,16 @@ class deque_base
       iterator        m_finish;
    } members_;
 
-   ptr_alloc_t &ptr_alloc() 
+   ptr_alloc_t &ptr_alloc()
    {  return members_;  }
-   
-   const ptr_alloc_t &ptr_alloc() const 
+  
+   const ptr_alloc_t &ptr_alloc() const
    {  return members_;  }
 
-   allocator_type &alloc() 
+   allocator_type &alloc()
    {  return members_;  }
-   
-   const allocator_type &alloc() const 
+  
+   const allocator_type &alloc() const
    {  return members_;  }
 };
 /// @endcond
@@ -525,323 +526,72 @@ class deque_base
 //! Deque class
 //!
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class deque : protected deque_base
+class deque : protected deque_base
 {
    /// @cond
    private:
-   typedef deque_base Base;
-   typedef typename Base::val_alloc_val            val_alloc_val;
-   typedef typename Base::val_alloc_ptr            val_alloc_ptr;
-   typedef typename Base::val_alloc_cptr           val_alloc_cptr;
-   typedef typename Base::val_alloc_ref            val_alloc_ref;
-   typedef typename Base::val_alloc_cref           val_alloc_cref;
-   typedef typename Base::val_alloc_size           val_alloc_size;
-   typedef typename Base::val_alloc_diff           val_alloc_diff;
-
-   typedef typename Base::ptr_alloc_t              ptr_alloc_t;
-   typedef typename Base::ptr_alloc_val            ptr_alloc_val;
-   typedef typename Base::ptr_alloc_ptr            ptr_alloc_ptr;
-   typedef typename Base::ptr_alloc_cptr           ptr_alloc_cptr;
-   typedef typename Base::ptr_alloc_ref            ptr_alloc_ref;
-   typedef typename Base::ptr_alloc_cref           ptr_alloc_cref;
+   typedef deque_base Base;
    /// @endcond
 
-   public:                         // Basic types
-   typedef T                                    value_type;
-   typedef val_alloc_ptr                        pointer;
-   typedef val_alloc_cptr                       const_pointer;
-   typedef val_alloc_ref                        reference;
-   typedef val_alloc_cref                       const_reference;
-   typedef val_alloc_size                       size_type;
-   typedef val_alloc_diff                       difference_type;
-   typedef typename Base::allocator_type        allocator_type;
+   public:
 
-   public:                                // Iterators
-   typedef typename Base::iterator              iterator;
-   typedef typename Base::const_iterator        const_iterator;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   typedef std::reverse_iterator const_reverse_iterator;
-   typedef std::reverse_iterator      reverse_iterator;
-
-   typedef allocator_type                       stored_allocator_type;
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(allocator_type)                                      stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator)                             iterator;
+   typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator)                       const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    /// @cond
 
    private:                      // Internal typedefs
    BOOST_COPYABLE_AND_MOVABLE(deque)
-   typedef ptr_alloc_ptr index_pointer;
-   static size_type s_buffer_size() 
+   typedef typename Base::ptr_alloc_ptr index_pointer;
+   static size_type s_buffer_size()
       { return Base::s_buffer_size(); }
-   typedef container_detail::advanced_insert_aux_int advanced_insert_aux_int_t;
-   typedef repeat_iterator  r_iterator;
-   typedef boost::move_iterator     move_it;
-   typedef allocator_traits                  allocator_traits_type;
+   typedef allocator_traits                  allocator_traits_type;
 
    /// @endcond
 
    public:
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
-   { return Base::alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return Base::alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return Base::alloc(); }
-
-   //! Effects: Returns an iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin() BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns an iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end() BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a const_iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns a const_iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
-      { return reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
-      { return reverse_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns a const_iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_start); }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start[difference_type(n)]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start[difference_type(n)]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n)
-      { this->priv_range_check(n); return (*this)[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n) const
-      { this->priv_range_check(n); return (*this)[n]; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front() BOOST_CONTAINER_NOEXCEPT
-      { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const BOOST_CONTAINER_NOEXCEPT
-      { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference back() BOOST_CONTAINER_NOEXCEPT
-      {  return *(end()-1); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference back() const BOOST_CONTAINER_NOEXCEPT
-      {  return *(cend()-1);  }
-
-   //! Effects: Returns the number of the elements contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish - this->members_.m_start; }
-
-   //! Effects: Returns the largest possible size of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
-      { return allocator_traits_type::max_size(this->alloc()); }
-
-   //! Effects: Returns true if the deque contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_finish == this->members_.m_start; }
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructors a deque.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   deque() 
+   deque()
       : Base()
    {}
 
    //! Effects: Constructs a deque taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit deque(const allocator_type& a) 
+   explicit deque(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       : Base(a)
    {}
 
@@ -850,13 +600,13 @@ class deque : protected deque_base
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit deque(size_type n)
       : Base(n, allocator_type())
    {
-      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-      proxy.uninitialized_copy_remaining_to(this->begin());
+      container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+      proxy.uninitialized_copy_n_and_update(this->begin(), n);
       //deque_base will deallocate in case of exception...
    }
 
@@ -865,17 +615,38 @@ class deque : protected deque_base
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    deque(size_type n, const value_type& value,
          const allocator_type& a = allocator_type())
       : Base(n, a)
    { this->priv_fill_initialize(value); }
 
+   //! Effects: Constructs a deque that will use a copy of allocator a
+   //!   and inserts a copy of the range [first, last) in the deque.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor
+   //!   throws or T's constructor taking an dereferenced InIt throws.
+   //!
+   //! Complexity: Linear to the range [first, last).
+   template 
+   deque(InIt first, InIt last, const allocator_type& a = allocator_type()
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
+      : Base(a)
+   {
+      typedef typename std::iterator_traits::iterator_category ItCat;
+      this->priv_range_initialize(first, last, ItCat());
+   }
+
    //! Effects: Copy constructs a deque.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    deque(const deque& x)
       :  Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
@@ -890,27 +661,50 @@ class deque : protected deque_base
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   deque(BOOST_RV_REF(deque) x) 
+   deque(BOOST_RV_REF(deque) x)
       :  Base(boost::move(static_cast(x)))
    {  this->swap_members(x);   }
 
-   //! Effects: Constructs a deque that will use a copy of allocator a
-   //!   and inserts a copy of the range [first, last) in the deque.
+   //! Effects: Copy constructs a vector using the specified allocator.
    //!
-   //! Throws: If allocator_type's default constructor or copy constructor
-   //!   throws or T's constructor taking an dereferenced InIt throws.
+   //! Postcondition: x == *this.
    //!
-   //! Complexity: Linear to the range [first, last).
-   template 
-   deque(InpIt first, InpIt last, const allocator_type& a = allocator_type())
-      : Base(a) 
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   deque(const deque& x, const allocator_type &a)
+      :  Base(a)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_initialize_dispatch(first, last, Result());
+      if(x.size()){
+         this->priv_initialize_map(x.size());
+         boost::container::uninitialized_copy_alloc
+            (this->alloc(), x.begin(), x.end(), this->members_.m_start);
+      }
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
+      :  Base(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         if(mx.size()){
+            this->priv_initialize_map(mx.size());
+            boost::container::uninitialized_copy_alloc
+               (this->alloc(), mx.begin(), mx.end(), this->members_.m_start);
+         }
+      }
    }
 
    //! Effects: Destroys the deque. All stored values are destroyed
@@ -921,18 +715,18 @@ class deque : protected deque_base
    //! Complexity: Linear to the number of elements.
    ~deque() BOOST_CONTAINER_NOEXCEPT
    {
-      priv_destroy_range(this->members_.m_start, this->members_.m_finish);
+      this->priv_destroy_range(this->members_.m_start, this->members_.m_finish);
    }
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to the number of elements in x.
-   deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x) 
+   deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
    {
       if (&x != this){
          allocator_type &this_alloc     = this->alloc();
@@ -984,195 +778,385 @@ class deque : protected deque_base
       return *this;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(deque &x)
-   {
-      this->swap_members(x);
-      container_detail::bool_ flag;
-      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
-      container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
-   }
-
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
    void assign(size_type n, const T& val)
-   {  this->priv_fill_assign(n, val);  }
+   {
+      typedef constant_iterator c_it;
+      this->assign(c_it(val, n), c_it());
+   }
 
    //! Effects: Assigns the the range [first, last) to *this.
    //!
    //! Throws: If memory allocation throws or
-   //!   T's constructor from dereferencing InpIt throws.
+   //!   T's constructor from dereferencing InIt throws.
    //!
    //! Complexity: Linear to n.
-   template 
-   void assign(InpIt first, InpIt last)
+   template 
+   void assign(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
-   }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the end of the deque.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(const T &x);
-
-   //! Effects: Constructs a new element in the end of the deque
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
-   #endif
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the front of the deque.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(const T &x);
-
-   //! Effects: Constructs a new element in the front of the deque
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
-   #endif
-
-   //! Effects: Removes the last element from the deque.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant time.
-   void pop_back() BOOST_CONTAINER_NOEXCEPT
-   {
-      if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
-         --this->members_.m_finish.m_cur;
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
-            );
+      iterator cur = this->begin();
+      for ( ; first != last && cur != end(); ++cur, ++first){
+         *cur = *first;
       }
-      else
-         this->priv_pop_back_aux();
-   }
-
-   //! Effects: Removes the first element from the deque.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant time.
-   void pop_front() BOOST_CONTAINER_NOEXCEPT
-   {
-      if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
-            );
-         ++this->members_.m_start.m_cur;
-      }
-      else 
-         this->priv_pop_front_aux();
-   }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of x before position.
-   //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, const T &x);
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a new element before position with mx's resources.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
-   #endif
-
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert n copies of x before pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator pos, size_type n, const value_type& x)
-   { this->priv_fill_insert(pos, n, x); }
-
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before pos.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator pos, InpIt first, InpIt last) 
-   {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(pos, first, last, Result());
-   }
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the end of the deque.
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws.
-   //!
-   //! Complexity: Amortized constant time
-   template 
-   void emplace_back(Args&&... args)
-   {
-      if(this->priv_push_back_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc()
-            , this->priv_push_back_simple_pos()
-            , boost::forward(args)...);
-         this->priv_push_back_simple_commit();
+      if (first == last){
+         this->erase(cur, this->cend());
       }
       else{
-         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_back_aux_impl(1, proxy);
+         this->insert(this->cend(), first, last);
       }
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   void assign(FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type len = std::distance(first, last);
+      if (len > size()) {
+         FwdIt mid = first;
+         std::advance(mid, this->size());
+         boost::copy_or_move(first, mid, begin());
+         this->insert(this->cend(), mid, last);
+      }
+      else{
+         this->erase(boost::copy_or_move(first, last, this->begin()), cend());
+      }
+   }
+   #endif
+
+   //! Effects: Returns a copy of the internal allocator.
+   //!
+   //! Throws: If allocator's copy constructor throws.
+   //!
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   { return Base::alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
+
+   //! Effects: Returns an iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns a const_iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns an iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a const_iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return reverse_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns a const_iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_start); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the deque contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_finish == this->members_.m_start; }
+
+   //! Effects: Returns the number of the elements contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish - this->members_.m_start; }
+
+   //! Effects: Returns the largest possible size of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+      { return allocator_traits_type::max_size(this->alloc()); }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
+   {
+      const size_type len = size();
+      if (new_size < len)
+         this->priv_erase_last_n(len - new_size);
+      else{
+         const size_type n = new_size - this->size();
+         container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+         priv_insert_back_aux_impl(n, proxy);
+      }
+   }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const value_type& x)
+   {
+      const size_type len = size();
+      if (new_size < len)
+         this->erase(this->members_.m_start + new_size, this->members_.m_finish);
+      else
+         this->insert(this->members_.m_finish, new_size - len, x);
+   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the deque is unchanged
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Constant.
+   void shrink_to_fit()
+   {
+      //This deque implementation already
+      //deallocates excess nodes when erasing
+      //so there is nothing to do except for
+      //empty deque
+      if(this->empty()){
+         this->priv_clear_map();
+      }
+   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front() BOOST_CONTAINER_NOEXCEPT
+      { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+      { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference back() BOOST_CONTAINER_NOEXCEPT
+      {  return *(end()-1); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+      {  return *(cend()-1);  }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start[difference_type(n)]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start[difference_type(n)]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   reference at(size_type n)
+      { this->priv_range_check(n); return (*this)[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const
+      { this->priv_range_check(n); return (*this)[n]; }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the beginning of the deque.
    //!
@@ -1190,9 +1174,30 @@ class deque : protected deque_base
          this->priv_push_front_simple_commit();
       }
       else{
-         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_front_aux_impl(1, proxy);
+         typedef container_detail::insert_non_movable_emplace_proxy type;
+         this->priv_insert_front_aux_impl(1, type(this->alloc(), boost::forward(args)...));
+      }
+   }
+
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... in the end of the deque.
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws.
+   //!
+   //! Complexity: Amortized constant time
+   template 
+   void emplace_back(Args&&... args)
+   {
+      if(this->priv_push_back_simple_available()){
+         allocator_traits_type::construct
+            ( this->alloc()
+            , this->priv_push_back_simple_pos()
+            , boost::forward(args)...);
+         this->priv_push_back_simple_commit();
+      }
+      else{
+         typedef container_detail::insert_non_movable_emplace_proxy type;
+         this->priv_insert_back_aux_impl(1, type(this->alloc(), boost::forward(args)...));
       }
    }
 
@@ -1217,11 +1222,8 @@ class deque : protected deque_base
          return (this->end()-1);
       }
       else{
-         size_type n = p - this->cbegin();
-         typedef container_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_aux_impl(p, 1, proxy);
-         return iterator(this->begin() + n);
+         typedef container_detail::insert_emplace_proxy type;
+         return this->priv_insert_aux_impl(p, 1, type(this->alloc(), boost::forward(args)...));
       }
    }
 
@@ -1229,25 +1231,6 @@ class deque : protected deque_base
 
    //advanced_insert_int.hpp includes all necessary preprocessor machinery...
    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                     \
-   {                                                                                         \
-      if(priv_push_back_simple_available()){                                                 \
-         allocator_traits_type::construct                                                    \
-            ( this->alloc()                                                                  \
-            , this->priv_push_back_simple_pos()                                              \
-              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
-         priv_push_back_simple_commit();                                                     \
-      }                                                                                      \
-      else{                                                                                  \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(                                        \
-            advanced_insert_aux_non_movable_emplace, n), arg)                                \
-                proxy                       \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
-         priv_insert_back_aux_impl(1, proxy);                                                \
-      }                                                                                      \
-   }                                                                                         \
-                                                                                             \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >  )  \
    void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                    \
    {                                                                                         \
@@ -1259,15 +1242,32 @@ class deque : protected deque_base
          priv_push_front_simple_commit();                                                    \
       }                                                                                      \
       else{                                                                                  \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT                                         \
-            (advanced_insert_aux_non_movable_emplace, n), arg)                               \
-                proxy                       \
+         container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n)             \
+                proxy               \
             (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
          priv_insert_front_aux_impl(1, proxy);                                               \
       }                                                                                      \
    }                                                                                         \
                                                                                              \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                     \
+   {                                                                                         \
+      if(priv_push_back_simple_available()){                                                 \
+         allocator_traits_type::construct                                                    \
+            ( this->alloc()                                                                  \
+            , this->priv_push_back_simple_pos()                                              \
+              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
+         priv_push_back_simple_commit();                                                     \
+      }                                                                                      \
+      else{                                                                                  \
+         container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n)             \
+                proxy               \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
+         priv_insert_back_aux_impl(1, proxy);                                                \
+      }                                                                                      \
+   }                                                                                         \
+                                                                                             \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
    iterator emplace(const_iterator p                                                         \
                     BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
    {                                                                                         \
@@ -1280,12 +1280,10 @@ class deque : protected deque_base
          return (this->end()-1);                                                             \
       }                                                                                      \
       else{                                                                                  \
-         size_type pos_num = p - this->cbegin();                                             \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)   \
-             proxy                          \
+         container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                         \
+             proxy                  \
             (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
-         this->priv_insert_aux_impl(p, 1, proxy);                                            \
-         return iterator(this->begin() + pos_num);                                           \
+         return this->priv_insert_aux_impl(p, 1, proxy);                                     \
       }                                                                                      \
    }                                                                                         \
    //!
@@ -1294,44 +1292,177 @@ class deque : protected deque_base
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the front of the deque.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const value_type& x) 
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the front of the deque
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the deque.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the deque
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or pos if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator pos, size_type n, const value_type& x)
    {
-      const size_type len = size();
-      if (new_size < len) 
-         this->erase(this->members_.m_start + new_size, this->members_.m_finish);
-      else
-         this->insert(this->members_.m_finish, new_size - len, x);
+      typedef constant_iterator c_it;
+      return this->insert(pos, c_it(x, n), c_it());
    }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
+   //! Requires: pos must be a valid iterator of *this.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Effects: Insert a copy of the [first, last) range before pos.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size) 
+   //! Returns: an iterator to the first inserted element or pos if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InIt throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator pos, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      const size_type len = size();
-      if (new_size < len) 
-         this->priv_erase_last_n(len - new_size);
-      else{
-         size_type n = new_size - this->size();
-         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-         priv_insert_back_aux_impl(n, proxy);
+      size_type n = 0;
+      iterator it(pos);
+      for(;first != last; ++first, ++n){
+         it = this->emplace(it, *first);
+         ++it;
       }
+      it -= n;
+      return it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, FwdIt first, FwdIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      container_detail::insert_range_proxy proxy(this->alloc(), first);
+      return priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
+   }
+   #endif
+
+   //! Effects: Removes the first element from the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_front() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
+         allocator_traits_type::destroy
+            ( this->alloc()
+            , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
+            );
+         ++this->members_.m_start.m_cur;
+      }
+      else
+         this->priv_pop_front_aux();
+   }
+
+   //! Effects: Removes the last element from the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
+         --this->members_.m_finish.m_cur;
+         allocator_traits_type::destroy
+            ( this->alloc()
+            , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
+            );
+      }
+      else
+         this->priv_pop_back_aux();
    }
 
    //! Effects: Erases the element at position pos.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
    //!   Constant if pos is the first or the last element.
@@ -1339,8 +1470,8 @@ class deque : protected deque_base
    {
       const_iterator next = pos;
       ++next;
-      difference_type index = pos - this->members_.m_start;
-      if (size_type(index) < (this->size() >> 1)) {
+      size_type index = pos - this->members_.m_start;
+      if (index < (this->size()/2)) {
          boost::move_backward(begin(), iterator(pos), iterator(next));
          pop_front();
       }
@@ -1356,7 +1487,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the distance between first and
-   //!   last plus the elements between pos and the 
+   //!   last plus the elements between pos and the
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
    iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
@@ -1366,9 +1497,9 @@ class deque : protected deque_base
          return this->members_.m_finish;
       }
       else {
-         difference_type n = last - first;
-         difference_type elems_before = first - this->members_.m_start;
-         if (elems_before < static_cast(this->size() - n) - elems_before) {
+         const size_type n = static_cast(last - first);
+         const size_type elems_before = static_cast(first - this->members_.m_start);
+         if (elems_before < (this->size() - n) - elems_before) {
             boost::move_backward(begin(), iterator(first), iterator(last));
             iterator new_start = this->members_.m_start + n;
             if(!Base::traits_t::trivial_dctr_after_move)
@@ -1388,18 +1519,17 @@ class deque : protected deque_base
       }
    }
 
-   void priv_erase_last_n(size_type n)
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(deque &x)
    {
-      if(n == this->size()) {
-         this->clear();
-      }
-      else {
-         iterator new_finish = this->members_.m_finish - n;
-         if(!Base::traits_t::trivial_dctr_after_move)
-            this->priv_destroy_range(new_finish, this->members_.m_finish);
-         this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
-         this->members_.m_finish = new_finish;
-      }
+      this->swap_members(x);
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+      container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
    }
 
    //! Effects: Erases all the elements of the deque.
@@ -1427,108 +1557,69 @@ class deque : protected deque_base
       this->members_.m_finish = this->members_.m_start;
    }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the deque is unchanged
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Constant.
-   void shrink_to_fit()
+   /// @cond
+   private:
+
+   void priv_erase_last_n(size_type n)
    {
-      //This deque implementation already
-      //deallocates excess nodes when erasing
-      //so there is nothing to do except for
-      //empty deque
-      if(this->empty()){
-         this->priv_clear_map();
+      if(n == this->size()) {
+         this->clear();
+      }
+      else {
+         iterator new_finish = this->members_.m_finish - n;
+         if(!Base::traits_t::trivial_dctr_after_move)
+            this->priv_destroy_range(new_finish, this->members_.m_finish);
+         this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
+         this->members_.m_finish = new_finish;
       }
    }
 
-   /// @cond
-   private:
-   void priv_range_check(size_type n) const 
+   void priv_range_check(size_type n) const
       {  if (n >= this->size())  BOOST_RETHROW std::out_of_range("deque");   }
 
-   iterator priv_insert(const_iterator position, const value_type &x) 
+   template 
+   iterator priv_insert(const_iterator position, BOOST_FWD_REF(U) x)
    {
       if (position == cbegin()){
-         this->push_front(x);
+         this->push_front(::boost::forward(x));
          return begin();
       }
       else if (position == cend()){
-         this->push_back(x);
-         return (end()-1);
+         this->push_back(::boost::forward(x));
+         return --end();
       }
       else {
-         size_type n = position - cbegin();
-         this->priv_insert_aux(position, size_type(1), x);
-         return iterator(this->begin() + n);
+         return priv_insert_aux_impl
+            (position, (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
       }
    }
 
-   iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx) 
-   {
-      if (position == cbegin()) {
-         this->push_front(boost::move(mx));
-         return begin();
-      }
-      else if (position == cend()) {
-         this->push_back(boost::move(mx));
-         return(end()-1);
-      }
-      else {
-         //Just call more general insert(pos, size, value) and return iterator
-         size_type n = position - begin();
-         this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
-         return iterator(this->begin() + n);
-      }
-   }
-
-   void priv_push_front(const value_type &t)
+   template 
+   void priv_push_front(BOOST_FWD_REF(U) x)
    {
       if(this->priv_push_front_simple_available()){
          allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_front_simple_pos(), t);
+            ( this->alloc(), this->priv_push_front_simple_pos(), ::boost::forward(x));
          this->priv_push_front_simple_commit();
       }
       else{
-         this->priv_insert_aux(cbegin(), size_type(1), t);
+         priv_insert_aux_impl
+            (this->cbegin(), (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
       }
    }
 
-   void priv_push_front(BOOST_RV_REF(value_type) t)
-   {
-      if(this->priv_push_front_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_front_simple_pos(), boost::move(t));
-         this->priv_push_front_simple_commit();
-      }
-      else{
-         this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
-      }
-   }
-
-   void priv_push_back(const value_type &t)
+   template 
+   void priv_push_back(BOOST_FWD_REF(U) x)
    {
       if(this->priv_push_back_simple_available()){
          allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_back_simple_pos(), t);
+            ( this->alloc(), this->priv_push_back_simple_pos(), ::boost::forward(x));
          this->priv_push_back_simple_commit();
       }
       else{
-         this->priv_insert_aux(cend(), size_type(1), t);
-      }
-   }
-
-   void priv_push_back(BOOST_RV_REF(T) t)
-   {
-      if(this->priv_push_back_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_back_simple_pos(), boost::move(t));
-         this->priv_push_back_simple_commit();
-      }
-      else{
-         this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+         priv_insert_aux_impl
+            (this->cend(), (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
+         container_detail::insert_copy_proxy proxy(this->alloc(), x);
       }
    }
 
@@ -1560,48 +1651,6 @@ class deque : protected deque_base
    void priv_push_front_simple_commit()
    {  --this->members_.m_start.m_cur;   }
 
-   template 
-   void priv_insert_aux(const_iterator pos, InpIt first, InpIt last, std::input_iterator_tag)
-   {
-      for(;first != last; ++first){
-         this->insert(pos, boost::move(value_type(*first)));
-      }
-   }
-
-   template 
-   void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag) 
-   {  this->priv_insert_aux(pos, first, last);  }
-
-  // assign(), a generalized assignment member function.  Two
-  // versions: one that takes a count, and one that takes a range.
-  // The range version is a member template, so we dispatch on whether
-  // or not the type is an integer.
-   void priv_fill_assign(size_type n, const T& val)
-   {
-      if (n > size()) {
-         std::fill(begin(), end(), val);
-         this->insert(cend(), n - size(), val);
-      }
-      else {
-         this->erase(cbegin() + n, cend());
-         std::fill(begin(), end(), val);
-      }
-   }
-
-   template 
-   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_) 
-   {
-      this->priv_initialize_map(n);
-      this->priv_fill_initialize(x);
-   }
-
-   template 
-   void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_range_initialize(first, last, ItCat());
-   }
-
    void priv_destroy_range(iterator p, iterator p2)
    {
       for(;p != p2; ++p){
@@ -1622,127 +1671,95 @@ class deque : protected deque_base
       }
    }
 
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-      { this->priv_fill_assign((size_type) n, (value_type)val); }
-
-   template 
-   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_assign_aux(first, last, ItCat());
-   }
-
-   template 
-   void priv_assign_aux(InpIt first, InpIt last, std::input_iterator_tag)
-   {
-      iterator cur = begin();
-      for ( ; first != last && cur != end(); ++cur, ++first)
-         *cur = *first;
-      if (first == last)
-         this->erase(cur, cend());
-      else
-         this->insert(cend(), first, last);
-   }
-
-   template 
-   void priv_assign_aux(FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      size_type len = std::distance(first, last);
-      if (len > size()) {
-         FwdIt mid = first;
-         std::advance(mid, size());
-         boost::copy_or_move(first, mid, begin());
-         this->insert(cend(), mid, last);
-      }
-      else
-         this->erase(boost::copy_or_move(first, last, begin()), cend());
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_) 
-   {  this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_insert_aux(pos, first, last, ItCat());
-   }
-
-   void priv_insert_aux(const_iterator pos, size_type n, const value_type& x)
-   {
-      typedef constant_iterator c_it;
-      this->priv_insert_aux(pos, c_it(x, n), c_it());
-   }
-
-   //Just forward all operations to priv_insert_aux_impl
-   template 
-   void priv_insert_aux(const_iterator p, FwdIt first, FwdIt last)
-   {
-      container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
-      priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
-   }
-
-   void priv_insert_aux_impl(const_iterator p, size_type n, advanced_insert_aux_int_t &interf)
+   template
+   iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy interf)
    {
       iterator pos(p);
+      const size_type pos_n = p - this->cbegin();
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
          pos = this->begin();
       }
 
-      const difference_type elemsbefore = pos - this->members_.m_start;
-      size_type length = this->size();
-      if (elemsbefore < static_cast(length / 2)) {
-         iterator new_start = this->priv_reserve_elements_at_front(n);
-         iterator old_start = this->members_.m_start;
-         pos = this->members_.m_start + elemsbefore;
-         if (elemsbefore >= difference_type(n)) {
-            iterator start_n = this->members_.m_start + difference_type(n); 
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), this->members_.m_start, start_n, new_start);
+      const size_type elemsbefore = static_cast(pos - this->members_.m_start);
+      const size_type length = this->size();
+      if (elemsbefore < length / 2) {
+         const iterator new_start = this->priv_reserve_elements_at_front(n);
+         const iterator old_start = this->members_.m_start;
+         if(!elemsbefore){
+            interf.uninitialized_copy_n_and_update(new_start, n);
             this->members_.m_start = new_start;
-            boost::move(start_n, pos, old_start);
-            interf.copy_remaining_to(pos - difference_type(n));
          }
-         else {
-            difference_type mid_count = (difference_type(n) - elemsbefore);
-            iterator mid_start = old_start - mid_count;
-            interf.uninitialized_copy_some_and_update(mid_start, mid_count, true);
-            this->members_.m_start = mid_start;
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), old_start, pos, new_start);
-            this->members_.m_start = new_start;
-            interf.copy_remaining_to(old_start);
+         else{
+            pos = this->members_.m_start + elemsbefore;
+            if (elemsbefore >= n) {
+               const iterator start_n = this->members_.m_start + n;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), this->members_.m_start, start_n, new_start);
+               this->members_.m_start = new_start;
+               boost::move(start_n, pos, old_start);
+               interf.copy_n_and_update(pos - n, n);
+            }
+            else {
+               const size_type mid_count = n - elemsbefore;
+               const iterator mid_start = old_start - mid_count;
+               interf.uninitialized_copy_n_and_update(mid_start, mid_count);
+               this->members_.m_start = mid_start;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), old_start, pos, new_start);
+               this->members_.m_start = new_start;
+               interf.copy_n_and_update(old_start, elemsbefore);
+            }
          }
       }
       else {
-         iterator new_finish = this->priv_reserve_elements_at_back(n);
-         iterator old_finish = this->members_.m_finish;
-         const difference_type elemsafter = 
-            difference_type(length) - elemsbefore;
-         pos = this->members_.m_finish - elemsafter;
-         if (elemsafter >= difference_type(n)) {
-            iterator finish_n = this->members_.m_finish - difference_type(n);
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
+         const iterator new_finish = this->priv_reserve_elements_at_back(n);
+         const iterator old_finish = this->members_.m_finish;
+         const size_type elemsafter = length - elemsbefore;
+         if(!elemsafter){
+            interf.uninitialized_copy_n_and_update(old_finish, n);
             this->members_.m_finish = new_finish;
-            boost::move_backward(pos, finish_n, old_finish);
-            interf.copy_remaining_to(pos);
          }
-         else {
-            interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
-            this->members_.m_finish += n-elemsafter;
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, old_finish, this->members_.m_finish);
-            this->members_.m_finish = new_finish;
-            interf.copy_remaining_to(pos);
+         else{
+            pos = this->members_.m_finish - elemsafter;
+            if (elemsafter >= n) {
+               iterator finish_n = this->members_.m_finish - difference_type(n);
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
+               this->members_.m_finish = new_finish;
+               boost::move_backward(pos, finish_n, old_finish);
+               interf.copy_n_and_update(pos, n);
+            }
+            else {
+               const size_type raw_gap = n - elemsafter;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, this->members_.m_finish + raw_gap);
+               BOOST_TRY{
+                  interf.uninitialized_copy_n_and_update(old_finish, raw_gap);
+               }
+               BOOST_CATCH(...){
+                  this->priv_destroy_range(this->members_.m_finish, this->members_.m_finish + (old_finish - pos));
+                  BOOST_RETHROW
+               }
+               BOOST_CATCH_END
+               this->members_.m_finish = new_finish;
+               interf.copy_n_and_update(pos, elemsafter);
+   /*
+               interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
+               this->members_.m_finish += n-elemsafter;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, this->members_.m_finish);
+               this->members_.m_finish = new_finish;
+               interf.copy_remaining_to(pos);
+   */
+            }
          }
       }
+      return this->begin() + pos_n;
    }
 
-   void priv_insert_back_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_insert_back_aux_impl(size_type n, InsertProxy interf)
    {
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
@@ -1750,31 +1767,33 @@ class deque : protected deque_base
 
       iterator new_finish = this->priv_reserve_elements_at_back(n);
       iterator old_finish = this->members_.m_finish;
-      interf.uninitialized_copy_some_and_update(old_finish, n, true);
+      interf.uninitialized_copy_n_and_update(old_finish, n);
       this->members_.m_finish = new_finish;
+      return iterator(this->members_.m_finish - n);
    }
 
-   void priv_insert_front_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_insert_front_aux_impl(size_type n, InsertProxy interf)
    {
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
       }
 
       iterator new_start = this->priv_reserve_elements_at_front(n);
-      interf.uninitialized_copy_some_and_update(new_start, difference_type(n), true);
+      interf.uninitialized_copy_n_and_update(new_start, n);
       this->members_.m_start = new_start;
+      return new_start;
    }
 
-
-   void priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
+   iterator priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
    {
       typedef constant_iterator c_it;
-      this->insert(pos, c_it(x, n), c_it());
+      return this->insert(pos, c_it(x, n), c_it());
    }
 
    // Precondition: this->members_.m_start and this->members_.m_finish have already been initialized,
    // but none of the deque's elements have yet been constructed.
-   void priv_fill_initialize(const value_type& value) 
+   void priv_fill_initialize(const value_type& value)
    {
       index_pointer cur;
       BOOST_TRY {
@@ -1792,13 +1811,13 @@ class deque : protected deque_base
       BOOST_CATCH_END
    }
 
-   template 
-   void priv_range_initialize(InpIt first, InpIt last, std::input_iterator_tag)
+   template 
+   void priv_range_initialize(InIt first, InIt last, std::input_iterator_tag)
    {
       this->priv_initialize_map(0);
       BOOST_TRY {
          for ( ; first != last; ++first)
-            this->push_back(*first);
+            this->emplace_back(*first);
       }
       BOOST_CATCH(...){
          this->clear();
@@ -1816,8 +1835,8 @@ class deque : protected deque_base
 
       index_pointer cur_node;
       BOOST_TRY {
-         for (cur_node = this->members_.m_start.m_node; 
-               cur_node < this->members_.m_finish.m_node; 
+         for (cur_node = this->members_.m_start.m_node;
+               cur_node < this->members_.m_finish.m_node;
                ++cur_node) {
             FwdIt mid = first;
             std::advance(mid, this->s_buffer_size());
@@ -1847,9 +1866,9 @@ class deque : protected deque_base
          );
    }
 
-   // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1.  Note that 
-   // if the deque has at least one element (a precondition for this member 
-   // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque 
+   // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1.  Note that
+   // if the deque has at least one element (a precondition for this member
+   // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
    // must have at least two nodes.
    void priv_pop_front_aux()
    {
@@ -1860,14 +1879,14 @@ class deque : protected deque_base
       this->priv_deallocate_node(this->members_.m_start.m_first);
       this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
       this->members_.m_start.m_cur = this->members_.m_start.m_first;
-   }      
+   }     
 
-   iterator priv_reserve_elements_at_front(size_type n) 
+   iterator priv_reserve_elements_at_front(size_type n)
    {
       size_type vacancies = this->members_.m_start.m_cur - this->members_.m_start.m_first;
       if (n > vacancies){
          size_type new_elems = n-vacancies;
-         size_type new_nodes = (new_elems + this->s_buffer_size() - 1) / 
+         size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
             this->s_buffer_size();
          size_type s = (size_type)(this->members_.m_start.m_node - this->members_.m_map);
          if (new_nodes > s){
@@ -1880,7 +1899,7 @@ class deque : protected deque_base
          }
          BOOST_CATCH(...) {
             for (size_type j = 1; j < i; ++j)
-               this->priv_deallocate_node(*(this->members_.m_start.m_node - j));      
+               this->priv_deallocate_node(*(this->members_.m_start.m_node - j));     
             BOOST_RETHROW
          }
          BOOST_CATCH_END
@@ -1888,7 +1907,7 @@ class deque : protected deque_base
       return this->members_.m_start - difference_type(n);
    }
 
-   iterator priv_reserve_elements_at_back(size_type n) 
+   iterator priv_reserve_elements_at_back(size_type n)
    {
       size_type vacancies = (this->members_.m_finish.m_last - this->members_.m_finish.m_cur) - 1;
       if (n > vacancies){
@@ -1905,7 +1924,7 @@ class deque : protected deque_base
          }
          BOOST_CATCH(...) {
             for (size_type j = 1; j < i; ++j)
-               this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));      
+               this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));     
             BOOST_RETHROW
          }
          BOOST_CATCH_END
@@ -1920,7 +1939,7 @@ class deque : protected deque_base
 
       index_pointer new_nstart;
       if (this->members_.m_map_size > 2 * new_num_nodes) {
-         new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2 
+         new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
                            + (add_at_front ? nodes_to_add : 0);
          if (new_nstart < this->members_.m_start.m_node)
             boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
@@ -1929,7 +1948,7 @@ class deque : protected deque_base
                (this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
       }
       else {
-         size_type new_map_size = 
+         size_type new_map_size =
             this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
 
          index_pointer new_map = this->priv_allocate_map(new_map_size);
@@ -1949,43 +1968,36 @@ class deque : protected deque_base
 };
 
 // Nonmember functions.
-template 
-inline bool operator==(const deque& x,
-                       const deque& y)
+template 
+inline bool operator==(const deque& x, const deque& y)
 {
    return x.size() == y.size() && equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool operator<(const deque& x,
-                      const deque& y) 
+template 
+inline bool operator<(const deque& x, const deque& y)
 {
    return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline bool operator!=(const deque& x,
-                       const deque& y) 
+template 
+inline bool operator!=(const deque& x, const deque& y)
    {  return !(x == y);   }
 
-template 
-inline bool operator>(const deque& x,
-                      const deque& y) 
+template 
+inline bool operator>(const deque& x, const deque& y)
    {  return y < x; }
 
-template 
-inline bool operator<=(const deque& x,
-                       const deque& y) 
-   {  return !(y < x); }
-
-template 
-inline bool operator>=(const deque& x,
-                       const deque& y) 
+template 
+inline bool operator>=(const deque& x, const deque& y)
    {  return !(x < y); }
 
+template 
+inline bool operator<=(const deque& x, const deque& y)
+   {  return !(y < x); }
 
-template 
-inline void swap(deque& x, deque& y)
+template 
+inline void swap(deque& x, deque& y)
 {  x.swap(y);  }
 
 }}
@@ -1993,15 +2005,14 @@ inline void swap(deque& x, deque& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   enum {   value = has_trivial_destructor::value  };
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 }
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp b/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
index 36495795f..42bdf4339 100644
--- a/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
+++ b/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -21,16 +21,28 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace boost {
 namespace container {
+
+namespace adaptive_pool_flag {
+
+static const unsigned int none            = 0u;
+static const unsigned int align_only      = 1u << 0u;
+static const unsigned int size_ordered    = 1u << 1u;
+static const unsigned int address_ordered = 1u << 2u;
+
+}  //namespace adaptive_pool_flag{
+
 namespace container_detail {
 
 template
@@ -42,42 +54,160 @@ struct hdr_offset_holder_t
    size_type hdr_offset;
 };
 
+template
+struct less_func;
+
+template
+struct less_func
+{
+   static bool less(SizeType, SizeType, const void *, const void *)
+   {  return true;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType ls, SizeType rs, const void *, const void *)
+   {  return ls < rs;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType, SizeType, const void *la, const void *ra)
+   {  return &la < &ra;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType ls, SizeType rs, const void *la, const void *ra)
+   {  return (ls < rs) || ((ls == rs) && (la < ra));  }
+};
+
+template
+struct block_container_traits
+{
+   typedef typename bi::make_set_base_hook
+      < bi::void_pointer
+      , bi::optimize_size
+      , bi::link_mode >::type hook_t;
+
+   template
+   struct container
+   {
+      typedef typename bi::make_multiset
+         , bi::size_type >::type  type;
+   };
+
+   template
+   static void reinsert_was_used(Container &container, typename Container::reference v, bool)
+   {
+      typedef typename Container::const_iterator const_block_iterator;
+      const const_block_iterator this_block
+         (Container::s_iterator_to(const_cast(v)));
+      const_block_iterator next_block(this_block);
+      if(++next_block != container.cend()){
+         if(this_block->free_nodes.size() > next_block->free_nodes.size()){
+            container.erase(this_block);
+            container.insert(v);
+         }
+      }
+   }
+
+   template
+   static void insert_was_empty(Container &container, typename Container::value_type &v, bool)
+   {
+      container.insert(v);
+   }
+
+   template
+   static void erase_first(Container &container)
+   {
+      container.erase(container.cbegin());
+   }
+
+   template
+   static void erase_last(Container &container)
+   {
+      container.erase(--container.cend());
+   }
+};
+
 template
+struct block_container_traits
+{
+   typedef typename bi::make_list_base_hook
+      < bi::void_pointer
+      , bi::link_mode >::type hook_t;
+
+   template
+   struct container
+   {
+      typedef typename bi::make_list
+         , bi::size_type, bi::constant_time_size >::type  type;
+   };
+
+   template
+   static void reinsert_was_used(Container &container, typename Container::value_type &v, bool is_full)
+   {
+      if(is_full){
+         container.erase(Container::s_iterator_to(v));
+         container.push_back(v);
+      }
+   }
+
+   template
+   static void insert_was_empty(Container &container, typename Container::value_type &v, bool is_full)
+   {
+      if(is_full){
+         container.push_back(v);
+      }
+      else{
+         container.push_front(v);
+      }
+   }
+
+   template
+   static void erase_first(Container &container)
+   {
+      container.pop_front();
+   }
+
+   template
+   static void erase_last(Container &container)
+   {
+      container.pop_back();
+   }
+};
+
+template
 struct adaptive_pool_types
 {
    typedef VoidPointer void_pointer;
-   typedef typename bi::make_set_base_hook
-      < bi::void_pointer
-      , bi::optimize_size
-      , bi::constant_time_size
-      , bi::link_mode >::type multiset_hook_t;
-   
+   static const bool ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered)) != 0;
+   typedef block_container_traits block_container_traits_t;
+   typedef typename block_container_traits_t::hook_t hook_t;
    typedef hdr_offset_holder_t hdr_offset_holder;
+   static const unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered);
+   typedef MultiallocationChain free_nodes_t;
 
    struct block_info_t
-      :  
-         public hdr_offset_holder,
-         public multiset_hook_t
+      : public hdr_offset_holder,
+        public hook_t
    {
-      typedef typename node_slist::node_slist_t free_nodes_t;
       //An intrusive list of free node from this block
       free_nodes_t free_nodes;
       friend bool operator <(const block_info_t &l, const block_info_t &r)
       {
-//      {  return l.free_nodes.size() < r.free_nodes.size();   }
-         //Let's order blocks first by free nodes and then by address
-         //so that highest address fully free blocks are deallocated.
-         //This improves returning memory to the OS (trimming).
-         const bool is_less  = l.free_nodes.size() < r.free_nodes.size();
-         const bool is_equal = l.free_nodes.size() == r.free_nodes.size();
-         return is_less || (is_equal && (&l < &r));
+         return less_func::
+            less(l.free_nodes.size(), r.free_nodes.size(), &l , &r);
       }
 
       friend bool operator ==(const block_info_t &l, const block_info_t &r)
       {  return &l == &r;  }
    };
-   typedef typename bi::make_multiset
-       >::type  block_multiset_t;
+   typedef typename block_container_traits_t:: template container::type  block_container_t;
 };
 
 template
@@ -89,7 +219,7 @@ inline size_type calculate_alignment
    const size_type divisor  = overhead_percent*real_node_size;
    const size_type dividend = hdr_offset_size*100;
    size_type elements_per_subblock = (dividend - 1)/divisor + 1;
-   size_type candidate_power_of_2 = 
+   size_type candidate_power_of_2 =
       upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size);
    bool overhead_satisfied = false;
    //Now calculate the wors-case overhead for a subblock
@@ -113,9 +243,9 @@ inline void calculate_num_subblocks
    , size_type &num_subblocks, size_type &real_num_node, size_type overhead_percent
    , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
 {
+   const size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
    size_type elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
    size_type possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
-   size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
    while(((possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements) < elements_per_block){
       ++possible_num_subblock;
    }
@@ -135,7 +265,7 @@ inline void calculate_num_subblocks
    real_num_node = (possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements;
 }
 
-template
+template
 class private_adaptive_node_pool_impl
 {
    //Non-copyable
@@ -147,27 +277,42 @@ class private_adaptive_node_pool_impl
    typedef typename SegmentManagerBase::void_pointer void_pointer;
    static const typename SegmentManagerBase::
       size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
+   //Flags
+   //align_only
+   static const bool AlignOnly      = (Flags & adaptive_pool_flag::align_only) != 0;
    typedef bool_            IsAlignOnly;
    typedef true_                       AlignOnlyTrue;
    typedef false_                      AlignOnlyFalse;
+   //size_ordered
+   static const bool SizeOrdered    = (Flags & adaptive_pool_flag::size_ordered) != 0;
+   typedef bool_          IsSizeOrdered;
+   typedef true_                       SizeOrderedTrue;
+   typedef false_                      SizeOrderedFalse;
+   //address_ordered
+   static const bool AddressOrdered = (Flags & adaptive_pool_flag::address_ordered) != 0;
+   typedef bool_       IsAddressOrdered;
+   typedef true_                       AddressOrderedTrue;
+   typedef false_                      AddressOrderedFalse;
 
    public:
-   typedef typename node_slist::node_t node_t;
-   typedef typename node_slist::node_slist_t free_nodes_t;
-   typedef typename SegmentManagerBase::multiallocation_chain     multiallocation_chain;
-   typedef typename SegmentManagerBase::size_type                 size_type;
+   typedef typename SegmentManagerBase::multiallocation_chain        multiallocation_chain;
+   typedef typename SegmentManagerBase::size_type                    size_type;
 
    private:
-   typedef typename adaptive_pool_types::block_info_t      block_info_t;
-   typedef typename adaptive_pool_types::block_multiset_t  block_multiset_t;
-   typedef typename block_multiset_t::iterator                                      block_iterator;
-   typedef typename adaptive_pool_types::hdr_offset_holder hdr_offset_holder;
+   typedef adaptive_pool_types
+              adaptive_pool_types_t;
+   typedef typename adaptive_pool_types_t::free_nodes_t              free_nodes_t;
+   typedef typename adaptive_pool_types_t::block_info_t              block_info_t;
+   typedef typename adaptive_pool_types_t::block_container_t         block_container_t;
+   typedef typename adaptive_pool_types_t::block_container_traits_t  block_container_traits_t;
+   typedef typename block_container_t::iterator                      block_iterator;
+   typedef typename block_container_t::const_iterator                const_block_iterator;
+   typedef typename adaptive_pool_types_t::hdr_offset_holder         hdr_offset_holder;
 
-   static const size_type MaxAlign = alignment_of::value;
+   static const size_type MaxAlign = alignment_of::value;
    static const size_type HdrSize  = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
    static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
 
-
    public:
    //!Segment manager typedef
    typedef SegmentManagerBase                 segment_manager_base_type;
@@ -181,7 +326,7 @@ class private_adaptive_node_pool_impl
       , unsigned char overhead_percent
       )
    :  m_max_free_blocks(max_free_blocks)
-   ,  m_real_node_size(lcm(node_size, size_type(alignment_of::value)))
+   ,  m_real_node_size(lcm(node_size, size_type(alignment_of::value)))
       //Round the size to a power of two value.
       //This is the total memory size (including payload) that we want to
       //allocate from the general-purpose allocator
@@ -195,7 +340,7 @@ class private_adaptive_node_pool_impl
    ,  m_real_num_node(AlignOnly ? (m_real_block_alignment - PayloadPerAllocation - HdrSize)/m_real_node_size : 0)
       //General purpose allocator
    ,  mp_segment_mngr_base(segment_mngr_base)
-   ,  m_block_multiset()
+   ,  m_block_container()
    ,  m_totally_free_blocks(0)
    {
       if(!AlignOnly){
@@ -214,7 +359,7 @@ class private_adaptive_node_pool_impl
 
    //!Destructor. Deallocates all allocated blocks. Never throws
    ~private_adaptive_node_pool_impl()
-   {  priv_clear();  }
+   {  this->priv_clear();  }
 
    size_type get_real_num_node() const
    {  return m_real_num_node; }
@@ -226,84 +371,157 @@ class private_adaptive_node_pool_impl
    //!Allocates array of count elements. Can throw
    void *allocate_node()
    {
-      priv_invariants();
+      this->priv_invariants();
       //If there are no free nodes we allocate a new block
-      if (m_block_multiset.empty()){ 
-         priv_alloc_block(1);
+      if(!m_block_container.empty()){
+         //We take the first free node the multiset can't be empty
+         free_nodes_t &free_nodes = m_block_container.begin()->free_nodes;
+         BOOST_ASSERT(!free_nodes.empty());
+         const size_type free_nodes_count = free_nodes.size();
+         void *first_node = container_detail::to_raw_pointer(free_nodes.pop_front());
+         if(free_nodes.empty()){
+            block_container_traits_t::erase_first(m_block_container);
+         }
+         m_totally_free_blocks -= static_cast(free_nodes_count == m_real_num_node);
+         this->priv_invariants();
+         return first_node;
+      }
+      else{
+         multiallocation_chain chain;
+         this->priv_append_from_new_blocks(1, chain, IsAlignOnly());
+         return container_detail::to_raw_pointer(chain.pop_front());
       }
-      //We take the first free node the multiset can't be empty
-      return priv_take_first_node();
    }
 
    //!Deallocates an array pointed by ptr. Never throws
    void deallocate_node(void *pElem)
    {
-      multiallocation_chain chain;
-      chain.push_front(void_pointer(pElem));
-      this->priv_reinsert_nodes_in_block(chain, 1);
-      //Update free block count<
-      if(m_totally_free_blocks > m_max_free_blocks){
-         this->priv_deallocate_free_blocks(m_max_free_blocks);
-      }
-      priv_invariants();
+      this->priv_invariants();
+      block_info_t &block_info = *this->priv_block_from_node(pElem);
+      BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node);
+
+      //We put the node at the beginning of the free node list
+      block_info.free_nodes.push_back(void_pointer(pElem));
+
+      //The loop reinserts all blocks except the last one
+      this->priv_reinsert_block(block_info, block_info.free_nodes.size() == 1);
+      this->priv_deallocate_free_blocks(m_max_free_blocks);
+      this->priv_invariants();
    }
 
-   //!Allocates n nodes. 
+   //!Allocates n nodes.
    //!Can throw
-   multiallocation_chain allocate_nodes(const size_type n)
+   void allocate_nodes(const size_type n, multiallocation_chain &chain)
    {
-      multiallocation_chain chain;
       size_type i = 0;
-      try{
-         priv_invariants();
+      BOOST_TRY{
+         this->priv_invariants();
          while(i != n){
             //If there are no free nodes we allocate all needed blocks
-            if (m_block_multiset.empty()){
-               priv_alloc_block(((n - i) - 1)/m_real_num_node + 1);
+            if (m_block_container.empty()){
+               this->priv_append_from_new_blocks(n - i, chain, IsAlignOnly());
+               BOOST_ASSERT(m_block_container.empty() || (++m_block_container.cbegin() == m_block_container.cend()));
+               BOOST_ASSERT(chain.size() == n);
+               break;
             }
-            free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
+            free_nodes_t &free_nodes = m_block_container.begin()->free_nodes;
             const size_type free_nodes_count_before = free_nodes.size();
-            if(free_nodes_count_before == m_real_num_node){
-               --m_totally_free_blocks;
-            }
-            const size_type num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
-            for(size_type j = 0; j != num_elems; ++j){
-               void *new_node = &free_nodes.front();
-               free_nodes.pop_front();
-               chain.push_back(new_node);
-            }
+            m_totally_free_blocks -= static_cast(free_nodes_count_before == m_real_num_node);
+            const size_type num_left  = n-i;
+            const size_type num_elems = (num_left < free_nodes_count_before) ? num_left : free_nodes_count_before;
+            typedef typename free_nodes_t::iterator free_nodes_iterator;
 
-            if(free_nodes.empty()){
-               m_block_multiset.erase(m_block_multiset.begin());
+            if(num_left < free_nodes_count_before){
+               const free_nodes_iterator it_bbeg(free_nodes.before_begin());
+               free_nodes_iterator it_bend(it_bbeg);
+               for(size_type j = 0; j != num_elems; ++j){
+                  ++it_bend;
+               }
+               free_nodes_iterator it_end = it_bend; ++it_end;
+               free_nodes_iterator it_beg = it_bbeg; ++it_beg;
+               free_nodes.erase_after(it_bbeg, it_end, num_elems);
+               chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems);
+               //chain.splice_after(chain.last(), free_nodes, it_bbeg, it_bend, num_elems);
+               BOOST_ASSERT(!free_nodes.empty());
+            }
+            else{
+               const free_nodes_iterator it_beg(free_nodes.begin()), it_bend(free_nodes.last());
+               free_nodes.clear();
+               chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems);
+               block_container_traits_t::erase_first(m_block_container);
             }
             i += num_elems;
          }
       }
-      catch(...){
-         this->deallocate_nodes(boost::move(chain));
-         throw;
+      BOOST_CATCH(...){
+         this->deallocate_nodes(chain);
+         BOOST_RETHROW
       }
-      priv_invariants();
-      return boost::move(chain);
+      BOOST_CATCH_END
+      this->priv_invariants();
    }
 
    //!Deallocates a linked list of nodes. Never throws
-   void deallocate_nodes(multiallocation_chain nodes)
+   void deallocate_nodes(multiallocation_chain &nodes)
    {
-      this->priv_reinsert_nodes_in_block(nodes, nodes.size());
-      if(m_totally_free_blocks > m_max_free_blocks){
+      this->priv_invariants();
+      //To take advantage of node locality, wait until two
+      //nodes belong to different blocks. Only then reinsert
+      //the block of the first node in the block tree.
+      //Cache of the previous block
+      block_info_t *prev_block_info = 0;
+
+      //If block was empty before this call, it's not already
+      //inserted in the block tree.
+      bool prev_block_was_empty     = false;
+      typedef typename free_nodes_t::iterator free_nodes_iterator;
+      {
+         const free_nodes_iterator itbb(nodes.before_begin()), ite(nodes.end());
+         free_nodes_iterator itf(nodes.begin()), itbf(itbb);
+         size_type splice_node_count = size_type(-1);
+         while(itf != ite){
+            void *pElem = container_detail::to_raw_pointer(&*itf);
+            block_info_t &block_info = *this->priv_block_from_node(pElem);
+            BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node);
+            ++splice_node_count;
+
+            //If block change is detected calculate the cached block position in the tree
+            if(&block_info != prev_block_info){
+               if(prev_block_info){ //Make sure we skip the initial "dummy" cache
+                  free_nodes_iterator it(itbb); ++it;
+                  nodes.erase_after(itbb, itf, splice_node_count);
+                  prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*it, &*itbf, splice_node_count);
+                  this->priv_reinsert_block(*prev_block_info, prev_block_was_empty);
+                  splice_node_count = 0;
+               }
+               //Update cache with new data
+               prev_block_was_empty = block_info.free_nodes.empty();
+               prev_block_info = &block_info;
+            }
+            itbf = itf;
+            ++itf;
+         }
+      }
+      if(prev_block_info){
+         //The loop reinserts all blocks except the last one
+         const free_nodes_iterator itfirst(nodes.begin()), itlast(nodes.last());
+         const size_type splice_node_count = nodes.size();
+         nodes.clear();
+         prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*itfirst, &*itlast, splice_node_count);
+         this->priv_reinsert_block(*prev_block_info, prev_block_was_empty);
+         this->priv_invariants();
          this->priv_deallocate_free_blocks(m_max_free_blocks);
       }
    }
 
    void deallocate_free_blocks()
-   {  this->priv_deallocate_free_blocks(0);   }
+   {  this->priv_deallocate_free_blocks(0);  }
 
    size_type num_free_nodes()
    {
-      typedef typename block_multiset_t::const_iterator citerator;
+      typedef typename block_container_t::const_iterator citerator;
       size_type count = 0;
-      citerator it (m_block_multiset.begin()), itend(m_block_multiset.end());
+      citerator it (m_block_container.begin()), itend(m_block_container.end());
       for(; it != itend; ++it){
          count += it->free_nodes.size();
       }
@@ -318,7 +536,7 @@ class private_adaptive_node_pool_impl
       BOOST_ASSERT(m_real_num_node == other.m_real_num_node);
       std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
       std::swap(m_totally_free_blocks, other.m_totally_free_blocks);
-      m_block_multiset.swap(other.m_block_multiset);
+      m_block_container.swap(other.m_block_container);
    }
 
    //Deprecated, use deallocate_free_blocks
@@ -326,84 +544,54 @@ class private_adaptive_node_pool_impl
    {  this->priv_deallocate_free_blocks(0);   }
 
    private:
+
    void priv_deallocate_free_blocks(size_type max_free_blocks)
+   {  //Trampoline function to ease inlining
+      if(m_totally_free_blocks > max_free_blocks){
+         this->priv_deallocate_free_blocks_impl(max_free_blocks);
+      }
+   }
+
+   void priv_deallocate_free_blocks_impl(size_type max_free_blocks)
    {
-      priv_invariants();
+      this->priv_invariants();
       //Now check if we've reached the free nodes limit
       //and check if we have free blocks. If so, deallocate as much
       //as we can to stay below the limit
-      for( block_iterator itend = m_block_multiset.end()
-         ; m_totally_free_blocks > max_free_blocks
-         ; --m_totally_free_blocks
-         ){
-         BOOST_ASSERT(!m_block_multiset.empty());
-         block_iterator it = itend;
+      multiallocation_chain chain;
+      {
+         const const_block_iterator itend = m_block_container.cend();
+         const_block_iterator it = itend;
          --it;
-         BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
-         m_block_multiset.erase_and_dispose(it, block_destroyer(this));
+         size_type totally_free_blocks = m_totally_free_blocks;
+
+         for( ; totally_free_blocks > max_free_blocks; --totally_free_blocks){
+            BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
+            void *addr = priv_first_subblock_from_block(const_cast(&*it));
+            --it;
+            block_container_traits_t::erase_last(m_block_container);
+            chain.push_front(void_pointer(addr));
+         }
+         BOOST_ASSERT((m_totally_free_blocks - max_free_blocks) == chain.size());
+         m_totally_free_blocks = max_free_blocks;
       }
+      this->mp_segment_mngr_base->deallocate_many(chain);
    }
 
-   void priv_reinsert_nodes_in_block(multiallocation_chain &chain, size_type n)
+   void priv_reinsert_block(block_info_t &prev_block_info, const bool prev_block_was_empty)
    {
-      block_iterator block_it(m_block_multiset.end());
-      while(n--){
-         void *pElem = container_detail::to_raw_pointer(chain.front());
-         chain.pop_front();
-         priv_invariants();
-         block_info_t *block_info = this->priv_block_from_node(pElem);
-         BOOST_ASSERT(block_info->free_nodes.size() < m_real_num_node);
-         //We put the node at the beginning of the free node list
-         node_t * to_deallocate = static_cast(pElem);
-         block_info->free_nodes.push_front(*to_deallocate);
+      //Cache the free nodes from the block
+      const size_type this_block_free_nodes = prev_block_info.free_nodes.size();
+      const bool is_full = this_block_free_nodes == m_real_num_node;
 
-         block_iterator this_block(block_multiset_t::s_iterator_to(*block_info));
-         block_iterator next_block(this_block);
-         ++next_block;
-
-         //Cache the free nodes from the block
-         size_type this_block_free_nodes = this_block->free_nodes.size();
-
-         if(this_block_free_nodes == 1){
-            m_block_multiset.insert(m_block_multiset.begin(), *block_info);
-         }
-         else{
-            block_iterator next_block(this_block);
-            ++next_block;
-            if(next_block != block_it){
-               size_type next_free_nodes = next_block->free_nodes.size();
-               if(this_block_free_nodes > next_free_nodes){
-                  //Now move the block to the new position
-                  m_block_multiset.erase(this_block);
-                  m_block_multiset.insert(*block_info);
-               }
-            }
-         }
-         //Update free block count
-         if(this_block_free_nodes == m_real_num_node){
-            ++m_totally_free_blocks;
-         }
-         priv_invariants();
+      //Update free block count
+      m_totally_free_blocks += static_cast(is_full);
+      if(prev_block_was_empty){
+         block_container_traits_t::insert_was_empty(m_block_container, prev_block_info, is_full);
       }
-   }
-
-   node_t *priv_take_first_node()
-   {
-      BOOST_ASSERT(m_block_multiset.begin() != m_block_multiset.end());
-      //We take the first free node the multiset can't be empty
-      free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
-      node_t *first_node = &free_nodes.front();
-      const size_type free_nodes_count = free_nodes.size();
-      BOOST_ASSERT(0 != free_nodes_count);
-      free_nodes.pop_front();
-      if(free_nodes_count == 1){
-         m_block_multiset.erase(m_block_multiset.begin());
+      else{
+         block_container_traits_t::reinsert_was_used(m_block_container, prev_block_info, is_full);
       }
-      else if(free_nodes_count == m_real_num_node){
-         --m_totally_free_blocks;
-      }
-      priv_invariants();
-      return first_node;
    }
 
    class block_destroyer;
@@ -412,33 +600,31 @@ class private_adaptive_node_pool_impl
    class block_destroyer
    {
       public:
-      block_destroyer(const this_type *impl)
-         :  mp_impl(impl)
+      block_destroyer(const this_type *impl, multiallocation_chain &chain)
+         :  mp_impl(impl), m_chain(chain)
       {}
 
-      void operator()(typename block_multiset_t::pointer to_deallocate)
+      void operator()(typename block_container_t::pointer to_deallocate)
       {  return this->do_destroy(to_deallocate, IsAlignOnly()); }
 
       private:
-      void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyTrue)
+      void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyTrue)
       {
-         size_type free_nodes = to_deallocate->free_nodes.size();
-         (void)free_nodes;
-         BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
-         mp_impl->mp_segment_mngr_base->deallocate(to_deallocate);
+         BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node);
+         m_chain.push_back(to_deallocate);
       }
 
-      void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyFalse)
+      void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyFalse)
       {
-         size_type free_nodes = to_deallocate->free_nodes.size();
-         (void)free_nodes;
-         BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
+         BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node);
          BOOST_ASSERT(0 == to_deallocate->hdr_offset);
-         hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
-         mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
+         hdr_offset_holder *hdr_off_holder =
+            mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
+         m_chain.push_back(hdr_off_holder);
       }
 
       const this_type *mp_impl;
+      multiallocation_chain &m_chain;
    };
 
    //This macro will activate invariant checking. Slow, but helpful for debugging the code.
@@ -447,44 +633,45 @@ class private_adaptive_node_pool_impl
    #ifdef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
    #undef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
    {
-      //We iterate through the block tree to free the memory
-      block_iterator it(m_block_multiset.begin()), 
-                     itend(m_block_multiset.end()), to_deallocate;
-      if(it != itend){
-         for(++it; it != itend; ++it){
-            block_iterator prev(it);
-            --prev;
-            size_type sp = prev->free_nodes.size(),
-                        si = it->free_nodes.size();
-            BOOST_ASSERT(sp <= si);
-            (void)sp;   (void)si;
+      const const_block_iterator itend(m_block_container.end());
+
+      {  //We iterate through the block tree to free the memory
+         const_block_iterator it(m_block_container.begin());
+   
+         if(it != itend){
+            for(++it; it != itend; ++it){
+               const_block_iterator prev(it);
+               --prev;
+               BOOST_ASSERT(*prev < *it);
+               (void)prev;   (void)it;
+            }
          }
       }
-      //Check that the total free nodes are correct
-      it    = m_block_multiset.begin();
-      itend = m_block_multiset.end();
-      size_type total_free_nodes = 0;
-      for(; it != itend; ++it){
-         total_free_nodes += it->free_nodes.size();
+      {  //Check that the total free nodes are correct
+         const_block_iterator it(m_block_container.cbegin());
+         size_type total_free_nodes = 0;
+         for(; it != itend; ++it){
+            total_free_nodes += it->free_nodes.size();
+         }
+         BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
       }
-      BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
-
-      //Check that the total totally free blocks are correct
-      it    = m_block_multiset.begin();
-      itend = m_block_multiset.end();
-      total_free = 0;
-      for(; it != itend; ++it){
-         total_free += it->free_nodes.size() == m_real_num_node;
+      {  //Check that the total totally free blocks are correct
+         BOOST_ASSERT(m_block_container.size() >= m_totally_free_blocks);
+         const_block_iterator it = m_block_container.cend();
+         size_type total_free_blocks = m_totally_free_blocks;
+         while(total_free_blocks--){
+            BOOST_ASSERT((--it)->free_nodes.size() == m_real_num_node);
+         }
       }
-      BOOST_ASSERT(total_free >= m_totally_free_blocks);
 
       if(!AlignOnly){
          //Check that header offsets are correct
-         it = m_block_multiset.begin();
+         const_block_iterator it = m_block_container.begin();
          for(; it != itend; ++it){
-            hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it);
+            hdr_offset_holder *hdr_off_holder = this->priv_first_subblock_from_block(const_cast(&*it));
             for(size_type i = 0, max = m_num_subblocks; i < max; ++i){
-               BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast(&*it)- reinterpret_cast(hdr_off_holder)));
+               const size_type offset = reinterpret_cast(const_cast(&*it)) - reinterpret_cast(hdr_off_holder);
+               BOOST_ASSERT(hdr_off_holder->hdr_offset == offset);
                BOOST_ASSERT(0 == ((size_type)hdr_off_holder & (m_real_block_alignment - 1)));
                BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
                hdr_off_holder = reinterpret_cast(reinterpret_cast(hdr_off_holder) + m_real_block_alignment);
@@ -500,19 +687,21 @@ class private_adaptive_node_pool_impl
    void priv_clear()
    {
       #ifndef NDEBUG
-      block_iterator it    = m_block_multiset.begin();
-      block_iterator itend = m_block_multiset.end();
-      size_type num_free_nodes = 0;
+      block_iterator it    = m_block_container.begin();
+      block_iterator itend = m_block_container.end();
+      size_type n_free_nodes = 0;
       for(; it != itend; ++it){
          //Check for memory leak
          BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
-         ++num_free_nodes;
+         ++n_free_nodes;
       }
-      BOOST_ASSERT(num_free_nodes == m_totally_free_blocks);
+      BOOST_ASSERT(n_free_nodes == m_totally_free_blocks);
       #endif
       //Check for memory leaks
-      priv_invariants();
-      m_block_multiset.clear_and_dispose(block_destroyer(this));
+      this->priv_invariants();
+      multiallocation_chain chain;
+      m_block_container.clear_and_dispose(block_destroyer(this, chain));
+      this->mp_segment_mngr_base->deallocate_many(chain);
       m_totally_free_blocks = 0;
    }
 
@@ -534,93 +723,129 @@ class private_adaptive_node_pool_impl
    }
 
    block_info_t *priv_block_from_node(void *node) const
-   {  return priv_block_from_node(node, IsAlignOnly());   }
+   {  return this->priv_block_from_node(node, IsAlignOnly());   }
 
    hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block) const
+   {  return this->priv_first_subblock_from_block(block, IsAlignOnly());   }
+
+   hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyFalse) const
    {
-      hdr_offset_holder *hdr_off_holder = reinterpret_cast
+      hdr_offset_holder *const hdr_off_holder = reinterpret_cast
             (reinterpret_cast(block) - (m_num_subblocks-1)*m_real_block_alignment);
       BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast(block) - reinterpret_cast(hdr_off_holder)));
-     BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+      BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
       BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
       return hdr_off_holder;
    }
 
-   //!Allocates a several blocks of nodes. Can throw
-   void priv_alloc_block(size_type n, AlignOnlyTrue)
+   hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyTrue) const
    {
-      size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
-      for(size_type i = 0; i != n; ++i){
-         //We allocate a new NodeBlock and put it the last
-         //element of the tree
-         char *mem_address = static_cast
-            (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
-         if(!mem_address)   throw std::bad_alloc();
-         ++m_totally_free_blocks;
-         block_info_t *c_info = new(mem_address)block_info_t();
-         m_block_multiset.insert(m_block_multiset.end(), *c_info);
-         
-         mem_address += HdrSize;
-         //We initialize all Nodes in Node Block to insert 
-         //them in the free Node list
-         typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
-         for(size_type i = 0; i < m_real_num_node; ++i){
-            prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *(node_t*)mem_address);
-            mem_address   += m_real_node_size;
+      return reinterpret_cast(block);
+   }
+
+   void priv_dispatch_block_chain_or_free
+      ( multiallocation_chain &chain, block_info_t &c_info, size_type num_node
+      , char *mem_address, size_type total_elements, bool insert_block_if_free)
+   {
+      BOOST_ASSERT(chain.size() <= total_elements);
+      //First add all possible nodes to the chain
+      const size_type left = total_elements - chain.size();
+      const size_type max_chain = (num_node < left) ? num_node : left;
+      mem_address = static_cast(container_detail::to_raw_pointer
+         (chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, max_chain)));
+      //Now store remaining nodes in the free list
+      if(const size_type max_free = num_node - max_chain){
+         free_nodes_t & free_nodes = c_info.free_nodes;
+         free_nodes.incorporate_after(free_nodes.last(), void_pointer(mem_address), m_real_node_size, max_free);
+         if(insert_block_if_free){
+            m_block_container.push_front(c_info);
          }
       }
    }
 
-   void priv_alloc_block(size_type n, AlignOnlyFalse)
+   //!Allocates a several blocks of nodes. Can throw
+   void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyTrue)
    {
-      size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
-      size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
-      size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+      BOOST_ASSERT(m_block_container.empty());
+      BOOST_ASSERT(min_elements > 0);
+      const size_type n = (min_elements - 1)/m_real_num_node + 1;
+      const size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
+      const size_type total_elements = chain.size() + min_elements;
+      for(size_type i = 0; i != n; ++i){
+         //We allocate a new NodeBlock and put it the last
+         //element of the tree
+         char *mem_address = static_cast
+            (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
+         if(!mem_address){
+            //In case of error, free memory deallocating all nodes (the new ones allocated
+            //in this function plus previously stored nodes in chain).
+            this->deallocate_nodes(chain);
+            throw std::bad_alloc();
+         }
+         block_info_t &c_info = *new(mem_address)block_info_t();
+         mem_address += HdrSize;
+         if(i != (n-1)){
+            chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, m_real_num_node);
+         }
+         else{
+            this->priv_dispatch_block_chain_or_free(chain, c_info, m_real_num_node, mem_address, total_elements, true);
+         }
+      }
+   }
+
+   void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyFalse)
+   {
+      BOOST_ASSERT(m_block_container.empty());
+      BOOST_ASSERT(min_elements > 0);
+      const size_type n = (min_elements - 1)/m_real_num_node + 1;
+      const size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
+      const size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
+      const size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+      const size_type total_elements = chain.size() + min_elements;
 
       for(size_type i = 0; i != n; ++i){
          //We allocate a new NodeBlock and put it the last
          //element of the tree
          char *mem_address = static_cast
             (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
-         if(!mem_address)   throw std::bad_alloc();
-         ++m_totally_free_blocks;
-
+         if(!mem_address){
+            //In case of error, free memory deallocating all nodes (the new ones allocated
+            //in this function plus previously stored nodes in chain).
+            this->deallocate_nodes(chain);
+            throw std::bad_alloc();
+         }
          //First initialize header information on the last subblock
          char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
-         block_info_t *c_info = new(hdr_addr)block_info_t();
+         block_info_t &c_info = *new(hdr_addr)block_info_t();
          //Some structural checks
-         BOOST_ASSERT(static_cast(&static_cast(c_info)->hdr_offset) ==
-                static_cast(c_info));
-         typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
-         for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
-            ; subblock < maxsubblock
-            ; ++subblock, mem_address += m_real_block_alignment){
-            //Initialize header offset mark
-            new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
-            char *pNode = mem_address + HdrOffsetSize;
-            for(size_type i = 0; i < elements_per_subblock; ++i){
-               prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
-               pNode   += m_real_node_size;
+         BOOST_ASSERT(static_cast(&static_cast(c_info).hdr_offset) ==
+                      static_cast(&c_info));   (void)c_info;
+         if(i != (n-1)){
+            for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
+               ; subblock < maxsubblock
+               ; ++subblock, mem_address += m_real_block_alignment){
+               //Initialize header offset mark
+               new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
+               chain.incorporate_after
+                  (chain.last(), void_pointer(mem_address + HdrOffsetSize), m_real_node_size, elements_per_subblock);
             }
+            chain.incorporate_after(chain.last(), void_pointer(hdr_addr + HdrSize), m_real_node_size, hdr_subblock_elements);
          }
-         {
-            char *pNode = hdr_addr + HdrSize;
-            //We initialize all Nodes in Node Block to insert 
-            //them in the free Node list
-            for(size_type i = 0; i < hdr_subblock_elements; ++i){
-               prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
-               pNode   += m_real_node_size;
+         else{
+            for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
+               ; subblock < maxsubblock
+               ; ++subblock, mem_address += m_real_block_alignment){
+               //Initialize header offset mark
+               new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
+               this->priv_dispatch_block_chain_or_free
+                  (chain, c_info, elements_per_subblock, mem_address + HdrOffsetSize, total_elements, false);
             }
+            this->priv_dispatch_block_chain_or_free
+               (chain, c_info, hdr_subblock_elements, hdr_addr + HdrSize, total_elements, true);
          }
-         //Insert the block after the free node list is full
-         m_block_multiset.insert(m_block_multiset.end(), *c_info);
       }
    }
 
-   //!Allocates a block of nodes. Can throw std::bad_alloc
-   void priv_alloc_block(size_type n)
-   {  return priv_alloc_block(n, IsAlignOnly());   }
-
    private:
    typedef typename boost::intrusive::pointer_traits
       ::template rebind_pointer::type   segment_mngr_base_ptr_t;
@@ -634,9 +859,9 @@ class private_adaptive_node_pool_impl
    //This is the real number of nodes per block
    //const
    size_type m_real_num_node;
-   segment_mngr_base_ptr_t                mp_segment_mngr_base;   //Segment manager
-   block_multiset_t                       m_block_multiset;       //Intrusive block list
-   size_type                            m_totally_free_blocks;  //Free blocks
+   segment_mngr_base_ptr_t             mp_segment_mngr_base;   //Segment manager
+   block_container_t                    m_block_container;       //Intrusive block list
+   size_type                           m_totally_free_blocks;  //Free blocks
 };
 
 }  //namespace container_detail {
diff --git a/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp b/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
index 58199c7aa..4c4fef6e5 100644
--- a/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
+++ b/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -17,163 +17,180 @@
 
 #include "config_begin.hpp"
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include   //std::iterator_traits
 #include 
+#include 
 
 namespace boost { namespace container { namespace container_detail {
 
-//This class will be interface for operations dependent on FwdIt types used advanced_insert_aux_impl
-template
-struct advanced_insert_aux_int
-{
-   typedef typename std::iterator_traits::difference_type difference_type;
-   virtual void copy_remaining_to(Iterator p) = 0;
-   virtual void uninitialized_copy_remaining_to(Iterator p) = 0;
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
-   virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
-   virtual ~advanced_insert_aux_int() {}
-};
-
-//This class template will adapt each FwIt types to advanced_insert_aux_int
 template
-struct advanced_insert_aux_proxy
-   :  public advanced_insert_aux_int
+struct insert_range_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
    typedef typename allocator_traits::size_type size_type;
    typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
 
-   advanced_insert_aux_proxy(A& a, FwdIt first, FwdIt last)
-      :  a_(a), first_(first), last_(last)
+   insert_range_proxy(A& a, FwdIt first)
+      :  a_(a), first_(first)
    {}
 
-   virtual ~advanced_insert_aux_proxy()
-   {}
-
-   virtual void copy_remaining_to(Iterator p)
-   {  ::boost::copy_or_move(first_, last_, p);  }
-
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, last_, p);  }
-
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void uninitialized_copy_n_and_update(Iterator pos, size_type n)
    {
-      FwdIt mid = first_;
-      std::advance(mid, division_count);
-      if(first_n){
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, mid, pos);
-         first_ = mid;
-      }
-      else{
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, mid, last_, pos);
-         last_ = mid;
-      }
+      this->first_ = ::boost::container::uninitialized_copy_or_move_alloc_n_source
+         (this->a_, this->first_, n, pos);
    }
 
-   virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void copy_n_and_update(Iterator pos, size_type n)
    {
-      FwdIt mid = first_;
-      std::advance(mid, division_count);
-      if(first_n){
-         ::boost::copy_or_move(first_, mid, pos);
-         first_ = mid;
-      }
-      else{
-         ::boost::copy_or_move(mid, last_, pos);
-         last_ = mid;
-      }
+      this->first_ = ::boost::container::copy_or_move_n_source(this->first_, n, pos);
    }
+
    A &a_;
-   FwdIt first_, last_;
+   FwdIt first_;
 };
 
-//This class template will adapt default construction insertions to advanced_insert_aux_int
+
 template
-struct default_construct_aux_proxy
-   :  public advanced_insert_aux_int
+struct insert_n_copies_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
    typedef typename allocator_traits::size_type size_type;
    typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
 
-   default_construct_aux_proxy(A &a, size_type count)
-      :  a_(a), count_(count)
+   insert_n_copies_proxy(A& a, const value_type &v)
+      :  a_(a), v_(v)
    {}
 
-   virtual ~default_construct_aux_proxy()
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {  std::uninitialized_fill_n(p, n, v_);   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {  std::fill_n(p, n, v_);  }
+
+   A &a_;
+   const value_type &v_;
+};
+
+template
+struct insert_default_constructed_n_proxy
+{
+   typedef ::boost::container::allocator_traits alloc_traits;
+   typedef typename allocator_traits::size_type size_type;
+   typedef typename allocator_traits::value_type value_type;
+
+
+   explicit insert_default_constructed_n_proxy(A &a)
+      :  a_(a)
    {}
 
-   virtual void copy_remaining_to(Iterator)
-   {  //This should never be called with any count
-      BOOST_ASSERT(count_ == 0);
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      Iterator orig_p = p;
+      size_type n_left = n;
+      BOOST_TRY{
+         for(; n_left--; ++p){
+            alloc_traits::construct(this->a_, container_detail::to_raw_pointer(&*p));
+         }
+      }
+      BOOST_CATCH(...){
+         for(; orig_p != p; ++orig_p){
+            alloc_traits::destroy(this->a_, container_detail::to_raw_pointer(&*orig_p++));
+         }
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
    }
 
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  this->priv_uninitialized_copy(p, count_); }
-
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void copy_n_and_update(Iterator, size_type)
    {
-      size_type new_count;
-      if(first_n){
-         new_count = division_count;
-      }
-      else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
-      }
-      this->priv_uninitialized_copy(pos, new_count);
-   }
-
-   virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
-   {
-      BOOST_ASSERT(count_ == 0);
-      size_type new_count;
-      if(first_n){
-         new_count = division_count;
-      }
-      else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
-      }
-      //This function should never called with a count different to zero
-      BOOST_ASSERT(new_count == 0);
-      (void)new_count;
+      BOOST_ASSERT(false);
    }
 
    private:
-   void priv_uninitialized_copy(Iterator p, const size_type n)
-   {
-      BOOST_ASSERT(n <= count_);
-      Iterator orig_p = p;
-      size_type i = 0;
-      try{
-         for(; i < n; ++i, ++p){
-            alloc_traits::construct(a_, container_detail::to_raw_pointer(&*p));
-         }
-      }
-      catch(...){
-         while(i--){
-            alloc_traits::destroy(a_, container_detail::to_raw_pointer(&*orig_p++));
-         }
-         throw;
-      }
-      count_ -= n;
-   }
    A &a_;
-   size_type count_;
 };
 
+template
+struct insert_copy_proxy
+{
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename alloc_traits::size_type size_type;
+   typedef typename alloc_traits::value_type value_type;
+
+   insert_copy_proxy(A& a, const value_type &v)
+      :  a_(a), v_(v)
+   {}
+
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , v_
+                              );
+   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      *p =v_;
+   }
+
+   A &a_;
+   const value_type &v_;
+};
+
+
+template
+struct insert_move_proxy
+{
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename alloc_traits::size_type size_type;
+   typedef typename alloc_traits::value_type value_type;
+
+   insert_move_proxy(A& a, value_type &v)
+      :  a_(a), v_(v)
+   {}
+
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , ::boost::move(v_)
+                              );
+   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      *p = ::boost::move(v_);
+   }
+
+   A &a_;
+   value_type &v_;
+};
+
+template
+insert_move_proxy get_insert_value_proxy(A& a, BOOST_RV_REF(typename std::iterator_traits::value_type) v)
+{
+   return insert_move_proxy(a, v);
+}
+
+template
+insert_copy_proxy get_insert_value_proxy(A& a, const typename std::iterator_traits::value_type &v)
+{
+   return insert_copy_proxy(a, v);
+}
+
 }}}   //namespace boost { namespace container { namespace container_detail {
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include 
-#include 
-#include 
+#include 
 #include 
 //#include  //For debugging purposes
 
@@ -181,125 +198,74 @@ namespace boost {
 namespace container {
 namespace container_detail {
 
-
-//This class template will adapt emplace construction insertions of movable types 
-//to advanced_insert_aux_int
 template
-struct advanced_insert_aux_non_movable_emplace
-   :  public advanced_insert_aux_int
+struct insert_non_movable_emplace_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
-   typedef typename allocator_traits::size_type size_type;
-   typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
-   typedef typename build_number_seq::type             index_tuple_t;
+   typedef boost::container::allocator_traits   alloc_traits;
+   typedef typename alloc_traits::size_type        size_type;
+   typedef typename alloc_traits::value_type       value_type;
 
-   explicit advanced_insert_aux_non_movable_emplace(A &a, Args&&... args)
-      : a_(a)
-      , args_(args...)
-      , used_(false)
+   typedef typename build_number_seq::type index_tuple_t;
+
+   explicit insert_non_movable_emplace_proxy(A &a, Args&&... args)
+      : a_(a), args_(args...)
    {}
 
-   ~advanced_insert_aux_non_movable_emplace()
-   {}
-
-   virtual void copy_remaining_to(Iterator)
-   //This code can't be called since value_type is not movable or copyable
-   {  BOOST_ASSERT(false);   }
-
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  this->priv_uninitialized_copy_remaining_to(index_tuple_t(), p);   }
-
-   virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {  this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
-
-   virtual void copy_some_and_update(Iterator, difference_type, bool )
-   //This code can't be called since value_type is not movable or copyable
-   {  BOOST_ASSERT(false);   }
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {  this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, n);  }
 
    private:
    template
-   void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
+   void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, size_type n)
    {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            alloc_traits::construct( a_
-                                   , container_detail::to_raw_pointer(&*p)
-                                   , ::boost::container::container_detail::
-                                       stored_ref::forward(get(args_))...
-                                   );
-            used_ = true;
-         }
-      }
-   }
-
-   template
-   void priv_uninitialized_copy_remaining_to(const index_tuple&, Iterator p)
-   {
-      if(!used_){
-         alloc_traits::construct( a_
-                                , container_detail::to_raw_pointer(&*p)
-                                , ::boost::container::container_detail::
-                                    stored_ref::forward(get(args_))...
-                                );
-         used_ = true;
-      }
+      BOOST_ASSERT(n == 1); (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , ::boost::forward(get(this->args_))...
+                              );
    }
 
    protected:
    A &a_;
    tuple args_;
-   bool used_;
 };
 
-//This class template will adapt emplace construction insertions of movable types 
-//to advanced_insert_aux_int
 template
-struct advanced_insert_aux_emplace
-   :  public advanced_insert_aux_non_movable_emplace
+struct insert_emplace_proxy
+   :  public insert_non_movable_emplace_proxy
 {
-   typedef advanced_insert_aux_non_movable_emplace base_t;
-   typedef typename base_t::value_type       value_type;
-   typedef typename base_t::difference_type  difference_type;
-   typedef typename base_t::index_tuple_t    index_tuple_t;
+   typedef insert_non_movable_emplace_proxy base_t;
+   typedef boost::container::allocator_traits   alloc_traits;
+   typedef typename base_t::value_type             value_type;
+   typedef typename base_t::size_type              size_type;
+   typedef typename base_t::index_tuple_t          index_tuple_t;
 
-   explicit advanced_insert_aux_emplace(A &a, Args&&... args)
-      : base_t(a, boost::forward(args)...)
+   explicit insert_emplace_proxy(A &a, Args&&... args)
+      : base_t(a, ::boost::forward(args)...)
    {}
 
-   ~advanced_insert_aux_emplace()
-   {}
-
-   //Override only needed functions
-   virtual void copy_remaining_to(Iterator p)
-   {  this->priv_copy_remaining_to(index_tuple_t(), p);   }
-
-   virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {  this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
+   void copy_n_and_update(Iterator p, size_type n)
+   {  this->priv_copy_some_and_update(index_tuple_t(), p, n);  }
 
    private:
-   template
-   void priv_copy_remaining_to(const index_tuple&, Iterator p)
-   {
-      if(!this->used_){
-         *p = boost::move(value_type (
-            ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
-         this->used_ = true;
-      }
-   }
 
    template
-   void priv_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
+   void priv_copy_some_and_update(const index_tuple&, Iterator p, size_type n)
    {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!this->used_){
-            *p = boost::move(value_type(
-               ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
-            this->used_ = true;
-         }
+      BOOST_ASSERT(n ==1); (void)n;
+      aligned_storage::value> v;
+      value_type *vp = static_cast(static_cast(&v));
+      alloc_traits::construct(this->a_, vp,
+         ::boost::forward(get(this->args_))...);
+      BOOST_TRY{
+         *p = ::boost::move(*vp);
       }
+      BOOST_CATCH(...){
+         alloc_traits::destroy(this->a_, vp);
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+      alloc_traits::destroy(this->a_, vp);
    }
 };
 
@@ -307,115 +273,80 @@ struct advanced_insert_aux_emplace
 
 #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-#include  
+#include 
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
-#define BOOST_PP_LOCAL_MACRO(n)                                                     \
-template        \
-struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)  \
-   :  public advanced_insert_aux_int                                      \
+#define BOOST_PP_LOCAL_MACRO(N)                                                     \
+template        \
+struct BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                        \
 {                                                                                   \
    typedef boost::container::allocator_traits alloc_traits;                      \
-   typedef typename allocator_traits::size_type size_type;                       \
-   typedef typename allocator_traits::value_type value_type;                     \
-   typedef typename advanced_insert_aux_int::difference_type              \
-      difference_type;                                                              \
+   typedef typename alloc_traits::size_type size_type;                              \
+   typedef typename alloc_traits::value_type value_type;                            \
                                                                                     \
-   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)      \
-      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+   BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                            \
+      ( A &a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
       : a_(a)                                                                       \
-      , used_(false)                                                                \
-      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_INIT, _)                   \
-    {}                                                                              \
+      BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_INIT, _)                   \
+   {}                                                                               \
                                                                                     \
-   virtual void copy_remaining_to(Iterator)                                         \
-   {  BOOST_ASSERT(false);   }                                                      \
-                                                                                    \
-   virtual void uninitialized_copy_remaining_to(Iterator p)                         \
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)                    \
    {                                                                                \
-      if(!used_){                                                                   \
-         alloc_traits::construct                                                    \
-            ( a_                                                                    \
-            , container_detail::to_raw_pointer(&*p)                                 \
-            BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)         \
-            );                                                                      \
-         used_ = true;                                                              \
-      }                                                                             \
+      BOOST_ASSERT(n == 1); (void)n;                                                \
+      alloc_traits::construct                                                       \
+         ( this->a_                                                                 \
+         , container_detail::to_raw_pointer(&*p)                                    \
+         BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)            \
+         );                                                                         \
    }                                                                                \
                                                                                     \
-   virtual void uninitialized_copy_some_and_update                                  \
-      (Iterator p, difference_type division_count, bool first_n)                    \
-   {                                                                                \
-      BOOST_ASSERT(division_count <=1);                                             \
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-         if(!used_){                                                                \
-            alloc_traits::construct                                                 \
-               ( a_                                                                 \
-               , container_detail::to_raw_pointer(&*p)                              \
-               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)      \
-               );                                                                   \
-            used_ = true;                                                           \
-         }                                                                          \
-      }                                                                             \
-   }                                                                                \
-                                                                                    \
-   virtual void copy_some_and_update(Iterator, difference_type, bool)               \
+   void copy_n_and_update(Iterator, size_type)                                      \
    {  BOOST_ASSERT(false);   }                                                      \
                                                                                     \
+   protected:                                                                       \
    A &a_;                                                                           \
-   bool used_;                                                                      \
-   BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
+   BOOST_PP_REPEAT(N, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
 };                                                                                  \
                                                                                     \
-template        \
-struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)              \
-   : BOOST_PP_CAT(BOOST_PP_CAT(                                                     \
-      advanced_insert_aux_non_movable_emplace, n), arg)                             \
-         < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P) >                        \
+template        \
+struct BOOST_PP_CAT(insert_emplace_proxy_arg, N)                                    \
+   : BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                          \
+         < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) >                        \
 {                                                                                   \
-   typedef BOOST_PP_CAT(BOOST_PP_CAT(                                               \
-      advanced_insert_aux_non_movable_emplace, n), arg)                             \
-          base_t;                 \
+   typedef BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                    \
+          base_t;                 \
    typedef typename base_t::value_type       value_type;                            \
-   typedef typename base_t::difference_type  difference_type;                       \
+   typedef typename base_t::size_type  size_type;                                   \
+   typedef boost::container::allocator_traits alloc_traits;                      \
                                                                                     \
-   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                  \
-      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
-      : base_t(a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) )   \
-    {}                                                                              \
+   BOOST_PP_CAT(insert_emplace_proxy_arg, N)                                        \
+      ( A &a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+      : base_t(a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_FORWARD, _) )   \
+   {}                                                                               \
                                                                                     \
-   virtual void copy_remaining_to(Iterator p)                                       \
+   void copy_n_and_update(Iterator p, size_type n)                                  \
    {                                                                                \
-      if(!this->used_){                                                             \
-         value_type v BOOST_PP_LPAREN_IF(n)                                         \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)                  \
-            BOOST_PP_RPAREN_IF(n);                                                  \
-         *p = boost::move(v);                                                       \
-         this->used_ = true;                                                        \
+      BOOST_ASSERT(n == 1); (void)n;                                                \
+      aligned_storage::value> v;       \
+      value_type *vp = static_cast(static_cast(&v));          \
+      alloc_traits::construct(this->a_, vp                                          \
+         BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _));          \
+      BOOST_TRY{                                                                    \
+         *p = ::boost::move(*vp);                                                   \
       }                                                                             \
-   }                                                                                \
-                                                                                    \
-   virtual void copy_some_and_update                                                \
-      (Iterator p, difference_type division_count, bool first_n)                    \
-   {                                                                                \
-      BOOST_ASSERT(division_count <=1);                                             \
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-         if(!this->used_){                                                          \
-            value_type v BOOST_PP_LPAREN_IF(n)                                      \
-                  BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)            \
-                BOOST_PP_RPAREN_IF(n);                                              \
-            *p = boost::move(v);                                                    \
-            this->used_ = true;                                                     \
-         }                                                                          \
+      BOOST_CATCH(...){                                                             \
+         alloc_traits::destroy(this->a_, vp);                                       \
+         BOOST_RETHROW                                                              \
       }                                                                             \
+      BOOST_CATCH_END                                                               \
+      alloc_traits::destroy(this->a_, vp);                                          \
    }                                                                                \
 };                                                                                  \
 //!
-
 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
diff --git a/project/jni/boost/include/boost/container/detail/algorithms.hpp b/project/jni/boost/include/boost/container/detail/algorithms.hpp
index a2713f50f..824e44b90 100644
--- a/project/jni/boost/include/boost/container/detail/algorithms.hpp
+++ b/project/jni/boost/include/boost/container/detail/algorithms.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -34,6 +34,30 @@
 namespace boost {
 namespace container {
 
+template
+struct is_default_construct_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct is_default_construct_iterator >
+{
+   static const bool value = true;
+};
+
+template
+struct is_emplace_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct is_emplace_iterator >
+{
+   static const bool value = true;
+};
+
 template
 inline void construct_in_place(A &a, T* dest, InpIt source)
 {     boost::container::allocator_traits::construct(a, dest, *source);  }
@@ -51,7 +75,7 @@ inline void construct_in_place(A &a, T *dest, emplace_iterator ei)
    ei.construct_in_place(a, dest);
 }
 
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/allocation_type.hpp b/project/jni/boost/include/boost/container/detail/allocation_type.hpp
index edad487c5..1ebf20ed7 100644
--- a/project/jni/boost/include/boost/container/detail/allocation_type.hpp
+++ b/project/jni/boost/include/boost/container/detail/allocation_type.hpp
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -23,7 +23,7 @@ namespace container {
 
 /// @cond
 enum allocation_type_v
-{   
+{  
    // constants for allocation commands
    allocate_new_v   = 0x01,
    expand_fwd_v     = 0x02,
diff --git a/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp b/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp
new file mode 100644
index 000000000..d69e61bc9
--- /dev/null
+++ b/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp
@@ -0,0 +1,163 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP
+#define BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include              //allocator_traits
+#include  //multiallocation_chain
+#include           //version_type
+#include        //allocation_type
+#include                    //integral_constant
+#include                //pointer_traits
+#include                                           //pair
+#include                                         //runtime_error
+#include            //BOOST_TRY
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template::value>
+struct allocator_version_traits
+{
+   typedef ::boost::container::container_detail::integral_constant
+       alloc_version;
+
+   typedef typename Allocator::multiallocation_chain multiallocation_chain;
+
+   typedef typename boost::container::allocator_traits::pointer    pointer;
+   typedef typename boost::container::allocator_traits::size_type  size_type;
+
+   //Node allocation interface
+   static pointer allocate_one(Allocator &a)
+   {  return a.allocate_one();   }
+
+   static void deallocate_one(Allocator &a, const pointer &p)
+   {  a.deallocate_one(p);   }
+
+   static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+   {  return a.allocate_individual(n, m);   }
+
+   static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+   {  a.deallocate_individual(holder);   }
+
+   static std::pair
+      allocation_command(Allocator &a, allocation_type command,
+                         size_type limit_size, size_type preferred_size,
+                         size_type &received_size, const pointer &reuse)
+   {
+      return a.allocation_command
+         (command, limit_size, preferred_size, received_size, reuse);
+   }
+};
+
+template
+struct allocator_version_traits
+{
+   typedef ::boost::container::container_detail::integral_constant
+       alloc_version;
+
+   typedef typename boost::container::allocator_traits::pointer    pointer;
+   typedef typename boost::container::allocator_traits::size_type  size_type;
+   typedef typename boost::container::allocator_traits::value_type value_type;
+
+   typedef typename boost::intrusive::pointer_traits::
+         template rebind_pointer::type                void_ptr;
+   typedef container_detail::basic_multiallocation_chain
+                                                  multialloc_cached_counted;
+   typedef boost::container::container_detail::
+      transform_multiallocation_chain
+         < multialloc_cached_counted, value_type>           multiallocation_chain;
+
+   //Node allocation interface
+   static pointer allocate_one(Allocator &a)
+   {  return a.allocate(1);   }
+
+   static void deallocate_one(Allocator &a, const pointer &p)
+   {  a.deallocate(p, 1);   }
+
+   static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+   {
+      while(!holder.empty()){
+         a.deallocate(holder.pop_front(), 1);
+      }
+   }
+
+   struct allocate_individual_rollback
+   {
+      allocate_individual_rollback(Allocator &a, multiallocation_chain &chain)
+         : mr_a(a), mp_chain(&chain)
+      {}
+
+      ~allocate_individual_rollback()
+      {
+         if(mp_chain)
+            allocator_version_traits::deallocate_individual(mr_a, *mp_chain);
+      }
+
+      void release()
+      {
+         mp_chain = 0;
+      }
+
+      Allocator &mr_a;
+      multiallocation_chain * mp_chain;
+   };
+
+   static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+   {
+      allocate_individual_rollback rollback(a, m);
+      while(n--){
+         m.push_front(a.allocate(1));
+      }
+      rollback.release();
+   }
+
+   static std::pair
+      allocation_command(Allocator &a, allocation_type command,
+                         size_type, size_type preferred_size,
+                         size_type &received_size, const pointer &)
+   {
+      std::pair ret(pointer(), false);
+      if(!(command & allocate_new)){
+         if(!(command & nothrow_allocation)){
+            throw std::runtime_error("version 1 allocator without allocate_new flag");
+         }
+      }
+      else{
+         received_size = preferred_size;
+         BOOST_TRY{
+            ret.first = a.allocate(received_size);
+         }
+         BOOST_CATCH(...){
+            if(!(command & nothrow_allocation)){
+               BOOST_RETHROW
+            }
+         }
+         BOOST_CATCH_END
+      }
+      return ret;
+   }
+};
+
+}  //namespace container_detail {
+}  //namespace container {
+}  //namespace boost {
+
+#include 
+
+#endif // ! defined(BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP)
diff --git a/project/jni/boost/include/boost/container/detail/config_begin.hpp b/project/jni/boost/include/boost/container/detail/config_begin.hpp
index bd44daacf..83c2cfe40 100644
--- a/project/jni/boost/include/boost/container/detail/config_begin.hpp
+++ b/project/jni/boost/include/boost/container/detail/config_begin.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -45,4 +45,5 @@
                                     //    with /GR-; unpredictable behavior may result
    #pragma warning (disable : 4673) //  throwing '' the following types will not be considered at the catch site
    #pragma warning (disable : 4671) //  the copy constructor is inaccessible
+   #pragma warning (disable : 4584) //  X is already a base-class of Y
 #endif   //BOOST_MSVC
diff --git a/project/jni/boost/include/boost/container/detail/config_end.hpp b/project/jni/boost/include/boost/container/detail/config_end.hpp
index b71fabcda..34513718c 100644
--- a/project/jni/boost/include/boost/container/detail/config_end.hpp
+++ b/project/jni/boost/include/boost/container/detail/config_end.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
diff --git a/project/jni/boost/include/boost/container/detail/destroyers.hpp b/project/jni/boost/include/boost/container/detail/destroyers.hpp
index 26ae089aa..f9bfd867a 100644
--- a/project/jni/boost/include/boost/container/detail/destroyers.hpp
+++ b/project/jni/boost/include/boost/container/detail/destroyers.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,12 +21,74 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
+//!A deleter for scoped_ptr that deallocates the memory
+//!allocated for an object using a STL allocator.
+template 
+struct scoped_deallocator
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::pointer pointer;
+   typedef container_detail::integral_constant::value>                   alloc_version;
+   typedef container_detail::integral_constant     allocator_v1;
+   typedef container_detail::integral_constant     allocator_v2;
+
+   private:
+   void priv_deallocate(allocator_v1)
+   {  m_alloc.deallocate(m_ptr, 1); }
+
+   void priv_deallocate(allocator_v2)
+   {  m_alloc.deallocate_one(m_ptr); }
+
+   BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
+
+   public:
+
+   pointer     m_ptr;
+   A&  m_alloc;
+
+   scoped_deallocator(pointer p, A& a)
+      : m_ptr(p), m_alloc(a)
+   {}
+
+   ~scoped_deallocator()
+   {  if (m_ptr)priv_deallocate(alloc_version());  }
+
+   scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
+      :  m_ptr(o.m_ptr), m_alloc(o.m_alloc)
+   {  o.release();  }
+
+   pointer get() const
+   {  return m_ptr;  }
+
+   void release()
+   {  m_ptr = 0; }
+};
+
+template 
+struct null_scoped_deallocator
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
+
+   null_scoped_deallocator(pointer, Allocator&, size_type)
+   {}
+
+   void release()
+   {}
+
+   pointer get() const
+   {  return pointer();  }
+};
+
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an array of objects using a STL allocator.
 template 
@@ -65,6 +127,44 @@ struct null_scoped_array_deallocator
    {}
 };
 
+template 
+struct scoped_destroy_deallocator
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
+   typedef container_detail::integral_constant::value>                          alloc_version;
+   typedef container_detail::integral_constant  allocator_v1;
+   typedef container_detail::integral_constant  allocator_v2;
+
+   scoped_destroy_deallocator(pointer p, Allocator& a)
+      : m_ptr(p), m_alloc(a) {}
+
+   ~scoped_destroy_deallocator()
+   {
+      if(m_ptr){
+         AllocTraits::destroy(m_alloc, container_detail::to_raw_pointer(m_ptr));
+         priv_deallocate(m_ptr, alloc_version());
+      }
+   }
+
+   void release()
+   {  m_ptr = 0; }
+
+   private:
+
+   void priv_deallocate(const pointer &p, allocator_v1)
+   {  AllocTraits::deallocate(m_alloc, p, 1); }
+
+   void priv_deallocate(const pointer &p, allocator_v2)
+   {  m_alloc.deallocate_one(p); }
+
+   pointer     m_ptr;
+   Allocator&  m_alloc;
+};
+
 
 //!A deleter for scoped_ptr that destroys
 //!an object using a STL allocator.
@@ -85,13 +185,20 @@ struct scoped_destructor_n
 
    void increment_size(size_type inc)
    {  m_n += inc;   }
-   
+
+   void increment_size_backwards(size_type inc)
+   {  m_n += inc;   m_p -= inc;  }
+
+   void shrink_forward(size_type inc)
+   {  m_n -= inc;   m_p += inc;  }
+  
    ~scoped_destructor_n()
    {
       if(!m_p) return;
       value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
-      for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
+      while(m_n--){
          AllocTraits::destroy(m_a, raw_ptr);
+      }
    }
 
    private:
@@ -115,10 +222,59 @@ struct null_scoped_destructor_n
    void increment_size(size_type)
    {}
 
+   void increment_size_backwards(size_type)
+   {}
+
    void release()
    {}
 };
 
+template
+class scoped_destructor
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   public:
+   typedef typename A::value_type value_type;
+   scoped_destructor(A &a, value_type *pv)
+      : pv_(pv), a_(a)
+   {}
+
+   ~scoped_destructor()
+   {
+      if(pv_){
+         AllocTraits::destroy(a_, pv_);
+      }
+   }
+
+   void release()
+   {  pv_ = 0; }
+
+   private:
+   value_type *pv_;
+   A &a_;
+};
+
+
+template
+class value_destructor
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   public:
+   typedef typename A::value_type value_type;
+   value_destructor(A &a, value_type &rv)
+      : rv_(rv), a_(a)
+   {}
+
+   ~value_destructor()
+   {
+      AllocTraits::destroy(a_, &rv_);
+   }
+
+   private:
+   value_type &rv_;
+   A &a_;
+};
+
 template 
 class allocator_destroyer
 {
@@ -149,13 +305,59 @@ class allocator_destroyer
    void operator()(const pointer &p)
    {
       AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
-      priv_deallocate(p, alloc_version());
+      this->priv_deallocate(p, alloc_version());
    }
 };
 
+template 
+class allocator_destroyer_and_chain_builder
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename A::multiallocation_chain    multiallocation_chain;
 
-}  //namespace container_detail { 
-}  //namespace container { 
+   A & a_;
+   multiallocation_chain &c_;
+
+   public:
+   allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c)
+      :  a_(a), c_(c)
+   {}
+
+   void operator()(const typename A::pointer &p)
+   {
+      allocator_traits::destroy(a_, container_detail::to_raw_pointer(p));
+      c_.push_back(p);
+   }
+};
+
+template 
+class allocator_multialloc_chain_node_deallocator
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename A::multiallocation_chain    multiallocation_chain;
+   typedef allocator_destroyer_and_chain_builder chain_builder;
+
+   A & a_;
+   multiallocation_chain c_;
+
+   public:
+   allocator_multialloc_chain_node_deallocator(A &a)
+      :  a_(a), c_()
+   {}
+
+   chain_builder get_chain_builder()
+   {  return chain_builder(a_, c_);  }
+
+   ~allocator_multialloc_chain_node_deallocator()
+   {
+      a_.deallocate_individual(c_);
+   }
+};
+
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/flat_tree.hpp b/project/jni/boost/include/boost/container/detail/flat_tree.hpp
index 44438386a..2af12d431 100644
--- a/project/jni/boost/include/boost/container/detail/flat_tree.hpp
+++ b/project/jni/boost/include/boost/container/detail/flat_tree.hpp
@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -25,13 +25,15 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost {
 
@@ -46,24 +48,24 @@ class flat_tree_value_compare
    typedef Value              first_argument_type;
    typedef Value              second_argument_type;
    typedef bool               return_type;
-   public:     
+   public:    
    flat_tree_value_compare()
       : Compare()
    {}
 
-   flat_tree_value_compare(const Compare &pred) 
+   flat_tree_value_compare(const Compare &pred)
       : Compare(pred)
    {}
 
    bool operator()(const Value& lhs, const Value& rhs) const
-   { 
+   {
       KeyOfValue key_extract;
-      return Compare::operator()(key_extract(lhs), key_extract(rhs)); 
+      return Compare::operator()(key_extract(lhs), key_extract(rhs));
    }
 
    const Compare &get_comp() const
       {  return *this;  }
-   
+  
    Compare &get_comp()
       {  return *this;  }
 };
@@ -79,7 +81,7 @@ struct get_flat_tree_iterators
    typedef std::reverse_iterator      const_reverse_iterator;
 };
 
-template 
 class flat_tree
 {
@@ -90,7 +92,7 @@ class flat_tree
    typedef flat_tree_value_compare value_compare;
 
  private:
-   struct Data 
+   struct Data
       //Inherit from value_compare to do EBO
       : public value_compare
    {
@@ -102,19 +104,27 @@ class flat_tree
       {}
 
       Data(const Data &d)
-         : value_compare(d), m_vect(d.m_vect)
+         : value_compare(static_cast(d)), m_vect(d.m_vect)
       {}
 
       Data(BOOST_RV_REF(Data) d)
-         : value_compare(boost::move(d)), m_vect(boost::move(d.m_vect))
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect))
       {}
 
-      Data(const Compare &comp) 
+      Data(const Data &d, const A &a)
+         : value_compare(static_cast(d)), m_vect(d.m_vect, a)
+      {}
+
+      Data(BOOST_RV_REF(Data) d, const A &a)
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect), a)
+      {}
+
+      Data(const Compare &comp)
          : value_compare(comp), m_vect()
       {}
 
       Data(const Compare &comp,
-           const allocator_t &alloc) 
+           const allocator_t &alloc)
          : value_compare(comp), m_vect(alloc)
       {}
 
@@ -165,6 +175,10 @@ class flat_tree
    //!Standard extension
    typedef allocator_type                             stored_allocator_type;
 
+   private:
+   typedef allocator_traits stored_allocator_traits;
+
+   public:
    flat_tree()
       : m_data()
    { }
@@ -177,7 +191,7 @@ class flat_tree
       : m_data(comp, a)
    { }
 
-   flat_tree(const flat_tree& x) 
+   flat_tree(const flat_tree& x)
       :  m_data(x.m_data)
    { }
 
@@ -185,6 +199,14 @@ class flat_tree
       :  m_data(boost::move(x.m_data))
    { }
 
+   flat_tree(const flat_tree& x, const allocator_type &a)
+      :  m_data(x.m_data, a)
+   { }
+
+   flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a)
+      :  m_data(boost::move(x.m_data), a)
+   { }
+
    template 
    flat_tree( ordered_range_t, InputIterator first, InputIterator last
             , const Compare& comp     = Compare()
@@ -192,6 +214,21 @@ class flat_tree
       : m_data(comp, a)
    { this->m_data.m_vect.insert(this->m_data.m_vect.end(), first, last); }
 
+   template 
+   flat_tree( bool unique_insertion
+            , InputIterator first, InputIterator last
+            , const Compare& comp     = Compare()
+            , const allocator_type& a = allocator_type())
+      : m_data(comp, a)
+   {
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         this->insert_equal(first, last);
+      }
+   }
+
    ~flat_tree()
    { }
 
@@ -201,66 +238,66 @@ class flat_tree
    flat_tree&  operator=(BOOST_RV_REF(flat_tree) mx)
    {  m_data = boost::move(mx.m_data); return *this;  }
 
-   public:    
+   public:   
    // accessors:
-   Compare key_comp() const 
+   Compare key_comp() const
    { return this->m_data.get_comp(); }
 
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return this->m_data.m_vect.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   const stored_allocator_type &get_stored_allocator() const
    {  return this->m_data.m_vect.get_stored_allocator(); }
 
    stored_allocator_type &get_stored_allocator()
    {  return this->m_data.m_vect.get_stored_allocator(); }
 
-   iterator begin() 
+   iterator begin()
    { return this->m_data.m_vect.begin(); }
 
-   const_iterator begin() const 
+   const_iterator begin() const
    { return this->cbegin(); }
 
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return this->m_data.m_vect.begin(); }
 
-   iterator end() 
+   iterator end()
    { return this->m_data.m_vect.end(); }
 
-   const_iterator end() const 
+   const_iterator end() const
    { return this->cend(); }
 
-   const_iterator cend() const 
+   const_iterator cend() const
    { return this->m_data.m_vect.end(); }
 
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin()
    { return reverse_iterator(this->end()); }
 
-   const_reverse_iterator rbegin() const 
+   const_reverse_iterator rbegin() const
    {  return this->crbegin();  }
 
-   const_reverse_iterator crbegin() const 
+   const_reverse_iterator crbegin() const
    {  return const_reverse_iterator(this->cend());  }
 
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return reverse_iterator(this->begin()); }
 
-   const_reverse_iterator rend() const 
-   { return this->crend(); } 
+   const_reverse_iterator rend() const
+   { return this->crend(); }
 
-   const_reverse_iterator crend() const 
-   { return const_reverse_iterator(this->cbegin()); } 
+   const_reverse_iterator crend() const
+   { return const_reverse_iterator(this->cbegin()); }
 
-   bool empty() const 
+   bool empty() const
    { return this->m_data.m_vect.empty(); }
 
-   size_type size() const 
+   size_type size() const
    { return this->m_data.m_vect.size(); }
 
-   size_type max_size() const 
+   size_type max_size() const
    { return this->m_data.m_vect.max_size(); }
 
-   void swap(flat_tree& other) 
+   void swap(flat_tree& other)
    {  this->m_data.swap(other.m_data);  }
 
    public:
@@ -268,9 +305,9 @@ class flat_tree
    std::pair insert_unique(const value_type& val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(val, data);
+      std::pair ret = this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, val);
+         ret.first = this->priv_insert_commit(data, val);
       }
       return ret;
    }
@@ -278,14 +315,13 @@ class flat_tree
    std::pair insert_unique(BOOST_RV_REF(value_type) val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(val, data);
+      std::pair ret = this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret;
    }
 
-
    iterator insert_equal(const value_type& val)
    {
       iterator i = this->upper_bound(KeyOfValue()(val));
@@ -303,9 +339,9 @@ class flat_tree
    iterator insert_unique(const_iterator pos, const value_type& val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(pos, val, data);
+      std::pair ret = this->priv_insert_unique_prepare(pos, val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, val);
+         ret.first = this->priv_insert_commit(data, val);
       }
       return ret.first;
    }
@@ -313,9 +349,9 @@ class flat_tree
    iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(pos, mval, data);
+      std::pair ret = this->priv_insert_unique_prepare(pos, mval, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(mval));
+         ret.first = this->priv_insert_commit(data, boost::move(mval));
       }
       return ret.first;
    }
@@ -323,30 +359,169 @@ class flat_tree
    iterator insert_equal(const_iterator pos, const value_type& val)
    {
       insert_commit_data data;
-      priv_insert_equal_prepare(pos, val, data);
-      return priv_insert_commit(data, val);
+      this->priv_insert_equal_prepare(pos, val, data);
+      return this->priv_insert_commit(data, val);
    }
 
    iterator insert_equal(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
-      priv_insert_equal_prepare(pos, mval, data);
-      return priv_insert_commit(data, boost::move(mval));
+      this->priv_insert_equal_prepare(pos, mval, data);
+      return this->priv_insert_commit(data, boost::move(mval));
    }
 
    template 
    void insert_unique(InIt first, InIt last)
+   {  this->priv_insert_unique_loop(first, last); }
+
+   template 
+   void insert_equal(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_equal_loop(first, last);  }
+
+   template 
+   void insert_equal(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      for ( ; first != last; ++first)
-         this->insert_unique(*first);
+      const size_type len = static_cast(std::distance(first, last));
+      this->reserve(this->size()+len);
+      this->priv_insert_equal_loop(first, last);
+   }
+
+   //Ordered
+
+   template 
+   void insert_equal(ordered_range_t, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_equal_loop_ordered(first, last); }
+
+   template 
+   void insert_equal(ordered_range_t, FwdIt first, FwdIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value &&
+		   container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      const size_type len = static_cast(std::distance(first, last));
+      this->reserve(this->size()+len);
+      this->priv_insert_equal_loop_ordered(first, last);
+   }
+
+   template 
+   void insert_equal(ordered_range_t, BidirIt first, BidirIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value &&
+           !container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      size_type len = static_cast(std::distance(first, last));
+      const size_type BurstSize = 16;
+      size_type positions[BurstSize];
+
+      //Prereserve all memory so that iterators are not invalidated
+      this->reserve(this->size()+len);
+      const const_iterator b(this->cbegin());
+      const_iterator pos(b);
+      //Loop in burst sizes
+      while(len){
+         const size_type burst = len < BurstSize ? len : BurstSize;
+         const const_iterator ce(this->cend());
+         len -= burst;
+         for(size_type i = 0; i != burst; ++i){
+            //Get the insertion position for each key
+            pos = const_cast(*this).priv_upper_bound(pos, ce, KeyOfValue()(*first));
+            positions[i] = static_cast(pos - b);
+            ++first;
+         }
+         //Insert all in a single step in the precalculated positions
+         this->m_data.m_vect.insert_ordered_at(burst, positions + burst, first);
+         //Next search position updated
+         pos += burst;
+      }
    }
 
    template 
-   void insert_equal(InIt first, InIt last)
+   void insert_unique(ordered_unique_range_t, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value ||
+           container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_unique_loop_hint(first, last);  }
+
+   template 
+   void insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !(container_detail::is_input_iterator::value ||
+             container_detail::is_forward_iterator::value)
+         >::type * = 0
+      #endif
+      )
    {
-      typedef typename 
-         std::iterator_traits::iterator_category ItCat;
-      priv_insert_equal(first, last, ItCat());
+      size_type len = static_cast(std::distance(first, last));
+      const size_type BurstSize = 16;
+      size_type positions[BurstSize];
+      size_type skips[BurstSize];
+
+      //Prereserve all memory so that iterators are not invalidated
+      this->reserve(this->size()+len);
+      const const_iterator b(this->cbegin());
+      const_iterator pos(b);
+      const value_compare &value_comp = this->m_data;
+      skips[0u] = 0u;
+      //Loop in burst sizes
+      while(len){
+         const size_type burst = len < BurstSize ? len : BurstSize;
+         size_type unique_burst = 0u;
+         const const_iterator ce(this->cend());
+         while(unique_burst < burst && len > 0){
+            //Get the insertion position for each key
+            const value_type & val = *first++;
+            --len;
+            pos = const_cast(*this).priv_lower_bound(pos, ce, KeyOfValue()(val));
+            //Check if already present
+            if(pos != ce && !value_comp(val, *pos)){
+               if(unique_burst > 0){
+                  ++skips[unique_burst-1];
+               }
+               continue;
+            }
+
+            //If not present, calculate position
+            positions[unique_burst] = static_cast(pos - b);
+            skips[unique_burst++] = 0u;
+         }
+         if(unique_burst){
+            //Insert all in a single step in the precalculated positions
+            this->m_data.m_vect.insert_ordered_at(unique_burst, positions + unique_burst, skips + unique_burst, first);
+            //Next search position updated
+            pos += unique_burst;
+         }
+      }
    }
 
    #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -354,12 +529,16 @@ class flat_tree
    template 
    std::pair emplace_unique(Args&&... args)
    {
-      value_type && val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
       std::pair ret =
-         priv_insert_unique_prepare(val, data);
+         this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret;
    }
@@ -367,11 +546,15 @@ class flat_tree
    template 
    iterator emplace_hint_unique(const_iterator hint, Args&&... args)
    {
-      value_type && val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(hint, val, data);
+      std::pair ret = this->priv_insert_unique_prepare(hint, val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -379,7 +562,11 @@ class flat_tree
    template 
    iterator emplace_equal(Args&&... args)
    {
-      value_type &&val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       iterator i = this->upper_bound(KeyOfValue()(val));
       i = this->m_data.m_vect.insert(i, boost::move(val));
       return i;
@@ -388,10 +575,15 @@ class flat_tree
    template 
    iterator emplace_hint_equal(const_iterator hint, Args&&... args)
    {
-      value_type &&val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
-      priv_insert_equal_prepare(hint, val, data);
-      return priv_insert_commit(data, boost::move(val));
+      this->priv_insert_equal_prepare(hint, val, data);
+      iterator i = this->priv_insert_commit(data, boost::move(val));
+      return i;
    }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -401,14 +593,16 @@ class flat_tree
    std::pair                                                              \
       emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                  \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a, val);                                  \
       insert_commit_data data;                                                            \
-      std::pair ret = priv_insert_unique_prepare(val, data);               \
+      std::pair ret = this->priv_insert_unique_prepare(val, data);         \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val));                          \
+         ret.first = this->priv_insert_commit(data, boost::move(val));                    \
       }                                                                                   \
       return ret;                                                                         \
    }                                                                                      \
@@ -417,14 +611,16 @@ class flat_tree
    iterator emplace_hint_unique(const_iterator hint                                       \
                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))      \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       insert_commit_data data;                                                            \
-      std::pair ret = priv_insert_unique_prepare(hint, val, data);         \
+      std::pair ret = this->priv_insert_unique_prepare(hint, val, data);   \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val));                          \
+         ret.first = this->priv_insert_commit(data, boost::move(val));                    \
       }                                                                                   \
       return ret.first;                                                                   \
    }                                                                                      \
@@ -432,10 +628,12 @@ class flat_tree
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
    iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       iterator i = this->upper_bound(KeyOfValue()(val));                                  \
       i = this->m_data.m_vect.insert(i, boost::move(val));                                \
       return i;                                                                           \
@@ -445,14 +643,18 @@ class flat_tree
    iterator emplace_hint_equal(const_iterator hint                                        \
                       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))        \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       insert_commit_data data;                                                            \
-      priv_insert_equal_prepare(hint, val, data);                                         \
-      return priv_insert_commit(data, boost::move(val));                                  \
+      this->priv_insert_equal_prepare(hint, val, data);                                   \
+      iterator i = this->priv_insert_commit(data, boost::move(val));                      \
+      return i;                                                                           \
    }                                                                                      \
+
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
@@ -490,22 +692,22 @@ class flat_tree
    // set operations:
    iterator find(const key_type& k)
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       iterator i = this->lower_bound(k);
 
-      if (i != this->end() && key_comp(k, KeyOfValue()(*i))){  
-         i = this->end();  
+      if (i != this->end() && key_cmp(k, KeyOfValue()(*i))){ 
+         i = this->end(); 
       }
       return i;
    }
 
    const_iterator find(const key_type& k) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       const_iterator i = this->lower_bound(k);
 
-      if (i != this->end() && key_comp(k, KeyOfValue()(*i))){  
-         i = this->end();  
+      if (i != this->end() && key_cmp(k, KeyOfValue()(*i))){ 
+         i = this->end(); 
       }
       return i;
    }
@@ -535,11 +737,11 @@ class flat_tree
    std::pair equal_range(const key_type& k) const
    {  return this->priv_equal_range(this->begin(), this->end(), k);  }
 
-   size_type capacity() const           
+   size_type capacity() const          
    { return this->m_data.m_vect.capacity(); }
 
-   void reserve(size_type count)       
-   { this->m_data.m_vect.reserve(count);   }
+   void reserve(size_type cnt)      
+   { this->m_data.m_vect.reserve(cnt);   }
 
    private:
    struct insert_commit_data
@@ -567,29 +769,29 @@ class flat_tree
             data.position = pos;
          }
          else{
-            data.position = 
+            data.position =
                this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
          }
       }
       else{
-         data.position = 
+         data.position =
             this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
       }
    }
 
    std::pair priv_insert_unique_prepare
-      (const_iterator beg, const_iterator end, const value_type& val, insert_commit_data &commit_data)
+      (const_iterator b, const_iterator e, const value_type& val, insert_commit_data &commit_data)
    {
       const value_compare &value_comp  = this->m_data;
-      commit_data.position = this->priv_lower_bound(beg, end, KeyOfValue()(val));
+      commit_data.position = this->priv_lower_bound(b, e, KeyOfValue()(val));
       return std::pair
          ( *reinterpret_cast(&commit_data.position)
-         , commit_data.position == end || value_comp(val, *commit_data.position));
+         , commit_data.position == e || value_comp(val, *commit_data.position));
    }
 
    std::pair priv_insert_unique_prepare
       (const value_type& val, insert_commit_data &commit_data)
-   {  return priv_insert_unique_prepare(this->begin(), this->end(), val, commit_data);   }
+   {  return this->priv_insert_unique_prepare(this->begin(), this->end(), val, commit_data);   }
 
    std::pair priv_insert_unique_prepare
       (const_iterator pos, const value_type& val, insert_commit_data &commit_data)
@@ -652,7 +854,7 @@ class flat_tree
    RanIt priv_lower_bound(RanIt first, RanIt last,
                           const key_type & key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle;
@@ -662,7 +864,7 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key_extract(*middle), key)) {
+         if (key_cmp(key_extract(*middle), key)) {
             ++middle;
             first = middle;
             len = len - half - 1;
@@ -677,7 +879,7 @@ class flat_tree
    RanIt priv_upper_bound(RanIt first, RanIt last,
                           const key_type & key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle;
@@ -687,12 +889,12 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key, key_extract(*middle))) {
+         if (key_cmp(key, key_extract(*middle))) {
             len = half;
          }
          else{
             first = ++middle;
-            len = len - half - 1;  
+            len = len - half - 1; 
          }
       }
       return first;
@@ -702,7 +904,7 @@ class flat_tree
    std::pair
       priv_equal_range(RanIt first, RanIt last, const key_type& key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle, left, right;
@@ -712,12 +914,12 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key_extract(*middle), key)){
+         if (key_cmp(key_extract(*middle), key)){
             first = middle;
             ++first;
             len = len - half - 1;
          }
-         else if (key_comp(key, key_extract(*middle))){
+         else if (key_cmp(key, key_extract(*middle))){
             len = half;
          }
          else {
@@ -730,75 +932,94 @@ class flat_tree
       return std::pair(first, first);
    }
 
-   template 
-   void priv_insert_equal(FwdIt first, FwdIt last, std::forward_iterator_tag)
+   template
+   void priv_insert_equal_loop(InIt first, InIt last)
    {
-      size_type len = static_cast(std::distance(first, last));
-      this->reserve(this->size()+len);
-      this->priv_insert_equal(first, last, std::input_iterator_tag());
+      for ( ; first != last; ++first){
+         this->insert_equal(*first);
+      }
    }
 
-   template 
-   void priv_insert_equal(InIt first, InIt last, std::input_iterator_tag)
+   template
+   void priv_insert_equal_loop_ordered(InIt first, InIt last)
    {
-      for ( ; first != last; ++first)
-         this->insert_equal(*first);
+      const_iterator pos(this->cend());
+      for ( ; first != last; ++first){
+         pos = this->insert_equal(pos, *first);
+      }
+   }
+
+   template
+   void priv_insert_unique_loop(InIt first, InIt last)
+   {
+      for ( ; first != last; ++first){
+         this->insert_unique(*first);
+      }
+   }
+
+   template
+   void priv_insert_unique_loop_ordered(InIt first, InIt last)
+   {
+      const_iterator pos(this->cend());
+      for ( ; first != last; ++first){
+         pos = this->insert_unique(pos, *first);
+      }
    }
 };
 
-template 
-inline bool 
-operator==(const flat_tree& x, 
+inline bool
+operator==(const flat_tree& x,
            const flat_tree& y)
 {
   return x.size() == y.size() &&
          std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const flat_tree& x, 
+inline bool
+operator<(const flat_tree& x,
           const flat_tree& y)
 {
-  return std::lexicographical_compare(x.begin(), x.end(), 
+  return std::lexicographical_compare(x.begin(), x.end(),
                                       y.begin(), y.end());
 }
 
-template 
-inline bool 
-operator!=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator!=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(x == y); }
 
-template 
-inline bool 
-operator>(const flat_tree& x, 
-          const flat_tree& y) 
+inline bool
+operator>(const flat_tree& x,
+          const flat_tree& y)
    {  return y < x;  }
 
-template 
-inline bool 
-operator<=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator<=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(y < x);  }
 
-template 
-inline bool 
-operator>=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator>=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(x < y);  }
 
 
-template 
-inline void 
-swap(flat_tree& x, 
+inline void
+swap(flat_tree& x,
      flat_tree& y)
    {  x.swap(y);  }
 
@@ -808,11 +1029,11 @@ swap(flat_tree& x,
 /*
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
 struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
 */
 }  //namespace boost {
diff --git a/project/jni/boost/include/boost/container/detail/function_detector.hpp b/project/jni/boost/include/boost/container/detail/function_detector.hpp
index c37c76684..5a5f6fd77 100644
--- a/project/jni/boost/include/boost/container/detail/function_detector.hpp
+++ b/project/jni/boost/include/boost/container/detail/function_detector.hpp
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga  2009-2011.
+// (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
@@ -15,7 +15,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright 2007 Alexandre Courpron
 //
-// Permission to use, copy, modify, redistribute and sell this software, 
+// Permission to use, copy, modify, redistribute and sell this software,
 // provided that this copyright notice appears on all copies of the software.
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -74,7 +74,7 @@ namespace function_detector {
    public : \
       static const int check = NotFound + (sizeof(Test(0, 0)) - sizeof(NotFoundType));\
    };\
-}}} //namespace boost::container::function_detector { 
+}}} //namespace boost::container::function_detector {
 
 #define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
     ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
diff --git a/project/jni/boost/include/boost/container/detail/iterators.hpp b/project/jni/boost/include/boost/container/detail/iterators.hpp
index 899cbe434..f58c4ce63 100644
--- a/project/jni/boost/include/boost/container/detail/iterators.hpp
+++ b/project/jni/boost/include/boost/container/detail/iterators.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -20,12 +20,12 @@
 
 #include "config_begin.hpp"
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
-#include 
 #else
 #include 
 #endif
@@ -33,7 +33,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 
 template 
 class constant_iterator
@@ -50,9 +50,9 @@ class constant_iterator
    constant_iterator()
       :  m_ptr(0), m_num(0){}
 
-   constant_iterator& operator++() 
+   constant_iterator& operator++()
    { increment();   return *this;   }
-   
+  
    constant_iterator operator++(int)
    {
       constant_iterator result (*this);
@@ -60,9 +60,9 @@ class constant_iterator
       return result;
    }
 
-   constant_iterator& operator--() 
+   constant_iterator& operator--()
    { decrement();   return *this;   }
-   
+  
    constant_iterator operator--(int)
    {
       constant_iterator result (*this);
@@ -161,9 +161,9 @@ class default_construct_iterator
    default_construct_iterator()
       :  m_num(0){}
 
-   default_construct_iterator& operator++() 
+   default_construct_iterator& operator++()
    { increment();   return *this;   }
-   
+  
    default_construct_iterator operator++(int)
    {
       default_construct_iterator result (*this);
@@ -171,9 +171,9 @@ class default_construct_iterator
       return result;
    }
 
-   default_construct_iterator& operator--() 
+   default_construct_iterator& operator--()
    { decrement();   return *this;   }
-   
+  
    default_construct_iterator operator--(int)
    {
       default_construct_iterator result (*this);
@@ -222,14 +222,12 @@ class default_construct_iterator
    default_construct_iterator operator-(Difference off) const
    {  return *this + (-off);  }
 
-   const T& operator*() const
-   { return dereference(); }
-
-   const T* operator->() const
-   { return &(dereference()); }
-
-   const T& operator[] (Difference n) const
-   { return dereference(); }
+   //This pseudo-iterator's dereference operations have no sense since value is not
+   //constructed until ::boost::container::construct_in_place is called.
+   //So comment them to catch bad uses
+   //const T& operator*() const;
+   //const T& operator[](difference_type) const;
+   //const T* operator->() const;
 
    private:
    Difference  m_num;
@@ -247,7 +245,7 @@ class default_construct_iterator
    {  return other.m_num < m_num;   }
 
    const T & dereference() const
-   { 
+   {
       static T dummy;
       return dummy;
    }
@@ -273,9 +271,9 @@ class repeat_iterator
    repeat_iterator()
       :  m_ptr(0), m_num(0){}
 
-   this_type& operator++() 
+   this_type& operator++()
    { increment();   return *this;   }
-   
+  
    this_type operator++(int)
    {
       this_type result (*this);
@@ -283,9 +281,9 @@ class repeat_iterator
       return result;
    }
 
-   this_type& operator--() 
+   this_type& operator--()
    { increment();   return *this;   }
-   
+  
    this_type operator--(int)
    {
       this_type result (*this);
@@ -384,9 +382,9 @@ class emplace_iterator
    emplace_iterator()
       :  m_num(0), m_pe(0){}
 
-   this_type& operator++() 
+   this_type& operator++()
    { increment();   return *this;   }
-   
+  
    this_type operator++(int)
    {
       this_type result (*this);
@@ -394,9 +392,9 @@ class emplace_iterator
       return result;
    }
 
-   this_type& operator--() 
+   this_type& operator--()
    { decrement();   return *this;   }
-   
+  
    this_type operator--(int)
    {
       this_type result (*this);
@@ -445,14 +443,12 @@ class emplace_iterator
    this_type operator-(difference_type off) const
    {  return *this + (-off);  }
 
-   const T& operator*() const
-   { return dereference(); }
-
-   const T& operator[](difference_type) const
-   { return dereference(); }
-
-   const T* operator->() const
-   { return &(dereference()); }
+   //This pseudo-iterator's dereference operations have no sense since value is not
+   //constructed until ::boost::container::construct_in_place is called.
+   //So comment them to catch bad uses
+   //const T& operator*() const;
+   //const T& operator[](difference_type) const;
+   //const T* operator->() const;
 
    template
    void construct_in_place(A &a, T* ptr)
@@ -475,7 +471,7 @@ class emplace_iterator
    {  return other.m_num < m_num;   }
 
    const T & dereference() const
-   { 
+   {
       static T dummy;
       return dummy;
    }
@@ -506,14 +502,13 @@ struct emplace_functor
    void inplace_impl(A &a, T* ptr, const container_detail::index_tuple&)
    {
       allocator_traits::construct
-         (a, ptr, container_detail::stored_ref::forward
-          (container_detail::get(args_))...);
+         (a, ptr, ::boost::forward(container_detail::get(args_))...);
    }
 
    container_detail::tuple args_;
 };
 
-#else
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #define BOOST_PP_LOCAL_MACRO(n)                                                        \
    BOOST_PP_EXPR_IF(n, template <)                                                     \
@@ -522,16 +517,16 @@ struct emplace_functor
    struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                          \
    {                                                                                   \
       BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                              \
-         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                       \
-      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}    \
+         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                        \
+      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}      \
                                                                                        \
       template                                                       \
       void operator()(A &a, T *ptr)                                                    \
       {                                                                                \
          allocator_traits::construct                                                \
-            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) );\
+            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) ); \
       }                                                                                \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                         \
+      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
    };                                                                                  \
    //!
 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -539,10 +534,78 @@ struct emplace_functor
 
 #endif
 
-}  //namespace container { 
+namespace container_detail {
+
+template
+struct has_iterator_category
+{
+   template 
+   static char test(int, typename X::iterator_category*);
+
+   template 
+   static int test(int, ...);
+
+   static const bool value = (1 == sizeof(test(0, 0)));
+};
+
+
+template::value >
+struct is_input_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_input_iterator
+{
+   static const bool value = false;
+};
+
+template::value >
+struct is_forward_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_forward_iterator
+{
+   static const bool value = false;
+};
+
+template::value >
+struct is_bidirectional_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_bidirectional_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct iiterator_types
+{
+   typedef typename std::iterator_traits::pointer         it_pointer;
+   typedef typename std::iterator_traits::difference_type difference_type;
+   typedef typename ::boost::intrusive::pointer_traits::
+      template rebind_pointer::type                               pointer;
+   typedef typename ::boost::intrusive::pointer_traits::
+      template rebind_pointer::type                         const_pointer;
+   typedef typename ::boost::intrusive::
+      pointer_traits::reference                             reference;
+   typedef typename ::boost::intrusive::
+      pointer_traits::reference                       const_reference;
+};
+
+
+}  //namespace container_detail {
+
+}  //namespace container {
 }  //namespace boost {
 
 #include 
 
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
-
diff --git a/project/jni/boost/include/boost/container/detail/math_functions.hpp b/project/jni/boost/include/boost/container/detail/math_functions.hpp
index 4613573d4..fe8386be6 100644
--- a/project/jni/boost/include/boost/container/detail/math_functions.hpp
+++ b/project/jni/boost/include/boost/container/detail/math_functions.hpp
@@ -1,10 +1,10 @@
 //////////////////////////////////////////////////////////////////////////////
 //
 // (C) Copyright Stephen Cleary 2000.
-// (C) Copyright Ion Gaztanaga 2007-2011.
+// (C) Copyright Ion Gaztanaga 2007-2012.
 //
 // 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)
 //
 // See http://www.boost.org/libs/container for documentation.
@@ -94,7 +94,7 @@ inline std::size_t floor_log2 (std::size_t x)
 
    std::size_t n = x;
    std::size_t log2 = 0;
-   
+  
    for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
       std::size_t tmp = n >> shift;
       if (tmp)
diff --git a/project/jni/boost/include/boost/container/allocator/memory_util.hpp b/project/jni/boost/include/boost/container/detail/memory_util.hpp
similarity index 98%
rename from project/jni/boost/include/boost/container/allocator/memory_util.hpp
rename to project/jni/boost/include/boost/container/detail/memory_util.hpp
index ea4bc0554..c00172c60 100644
--- a/project/jni/boost/include/boost/container/allocator/memory_util.hpp
+++ b/project/jni/boost/include/boost/container/detail/memory_util.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-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)
 //
diff --git a/project/jni/boost/include/boost/container/detail/mpl.hpp b/project/jni/boost/include/boost/container/detail/mpl.hpp
index c2d0ce41b..74a1ce0e6 100644
--- a/project/jni/boost/include/boost/container/detail/mpl.hpp
+++ b/project/jni/boost/include/boost/container/detail/mpl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,7 +20,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template 
@@ -109,24 +109,24 @@ struct if_
 
 
 template 
-struct select1st 
-//   : public std::unary_function 
+struct select1st
+//   : public std::unary_function
 {
    template
-   const typename Pair::first_type& operator()(const OtherPair& x) const 
+   const typename Pair::first_type& operator()(const OtherPair& x) const
    {  return x.first;   }
 
-   const typename Pair::first_type& operator()(const typename Pair::first_type& x) const 
+   const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
    {  return x;   }
 };
 
 // identity is an extension: it is not part of the standard.
 template 
-struct identity 
-//   : public std::unary_function 
+struct identity
+//   : public std::unary_function
 {
    typedef T type;
-   const T& operator()(const T& x) const 
+   const T& operator()(const T& x) const
    { return x; }
 };
 
@@ -152,8 +152,8 @@ template  struct unvoid { typedef T type; };
 template <> struct unvoid { struct type { }; };
 template <> struct unvoid { struct type { }; };
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #endif   //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
diff --git a/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp b/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
index a67fd770b..2e29f9c1a 100644
--- a/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
+++ b/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace boost {
 namespace container {
@@ -45,30 +45,43 @@ class basic_multiallocation_chain
                     > slist_impl_t;
    slist_impl_t slist_impl_;
 
-   static node & to_node(VoidPointer p)
-   {  return *static_cast(static_cast(container_detail::to_raw_pointer(p))); }
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type    node_ptr;
+   typedef typename boost::intrusive::
+      pointer_traits                              node_ptr_traits;
+
+   static node & to_node(const VoidPointer &p)
+   {  return *static_cast(static_cast(container_detail::to_raw_pointer(p)));  }
+
+   static VoidPointer from_node(node &n)
+   {  return node_ptr_traits::pointer_to(n);  }
+
+   static node_ptr to_node_ptr(const VoidPointer &p)
+   {  return node_ptr_traits::static_cast_from(p);   }
 
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
 
    public:
 
-
-   typedef VoidPointer  void_pointer;
-   typedef typename slist_impl_t::iterator iterator;
-   typedef typename slist_impl_t::size_type size_type;
+   typedef VoidPointer                       void_pointer;
+   typedef typename slist_impl_t::iterator   iterator;
+   typedef typename slist_impl_t::size_type  size_type;
 
    basic_multiallocation_chain()
       :  slist_impl_()
    {}
 
+   basic_multiallocation_chain(const void_pointer &b, const void_pointer &before_e, size_type n)
+      :  slist_impl_(to_node_ptr(b), to_node_ptr(before_e), n)
+   {}
+
    basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
-      :  slist_impl_()
-   {  slist_impl_.swap(other.slist_impl_); }
+      :  slist_impl_(::boost::move(other.slist_impl_))
+   {}
 
    basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
    {
-      basic_multiallocation_chain tmp(boost::move(other));
-      this->swap(tmp);
+      slist_impl_ = ::boost::move(other.slist_impl_);
       return *this;
    }
 
@@ -96,37 +109,52 @@ class basic_multiallocation_chain
    iterator insert_after(iterator it, void_pointer m)
    {  return slist_impl_.insert_after(it, to_node(m));   }
 
-   void push_front(void_pointer m)
-   {  return slist_impl_.push_front(to_node(m));   }
+   void push_front(const void_pointer &m)
+   {  return slist_impl_.push_front(to_node(m));  }
 
-   void push_back(void_pointer m)
+   void push_back(const void_pointer &m)
    {  return slist_impl_.push_back(to_node(m));   }
 
-   void pop_front()
-   {  return slist_impl_.pop_front();   }
+   void_pointer pop_front()
+   {
+      node & n = slist_impl_.front();
+      void_pointer ret = from_node(n);
+      slist_impl_.pop_front();
+      return ret;
+   }
 
-   void *front()
-   {  return &*slist_impl_.begin();   }
-
-   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end)
-   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end);   }
-
-   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
-   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end, n);   }
+   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_b, before_e, n);   }
 
    void splice_after(iterator after_this, basic_multiallocation_chain &x)
    {  slist_impl_.splice_after(after_this, x.slist_impl_);   }
 
-   void incorporate_after(iterator after_this, void_pointer begin , iterator before_end)
-   {  slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end));   }
+   void erase_after(iterator before_b, iterator e, size_type n)
+   {  slist_impl_.erase_after(before_b, e, n);   }
 
-   void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
-   {  slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end), n);   }
+   void_pointer incorporate_after(iterator after_this, const void_pointer &b, size_type unit_bytes, size_type num_units)
+   {
+      typedef typename boost::intrusive::pointer_traits char_pointer_traits;
+      char_ptr elem = char_pointer_traits::static_cast_from(b);
+      if(num_units){
+         char_ptr prev_elem = elem;
+         elem += unit_bytes;
+         for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
+            ::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem);
+            prev_elem = elem;
+         }
+         slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);
+      }
+      return elem;
+   }
+
+   void incorporate_after(iterator after_this, void_pointer b, void_pointer before_e, size_type n)
+   {  slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(before_e), n);   }
 
    void swap(basic_multiallocation_chain &x)
    {  slist_impl_.swap(x.slist_impl_);   }
 
-   static iterator iterator_to(void_pointer p)
+   static iterator iterator_to(const void_pointer &p)
    {  return slist_impl_t::s_iterator_to(to_node(p));   }
 
    std::pair extract_data()
@@ -150,63 +178,66 @@ struct cast_functor
 
 template
 class transform_multiallocation_chain
+   : public MultiallocationChain
 {
    private:
    BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
+   //transform_multiallocation_chain(const transform_multiallocation_chain &);
+   //transform_multiallocation_chain & operator=(const transform_multiallocation_chain &);
 
-   MultiallocationChain   holder_;
    typedef typename MultiallocationChain::void_pointer   void_pointer;
    typedef typename boost::intrusive::pointer_traits
-      ::template rebind_pointer::type   pointer;
+                                           void_pointer_traits;
+   typedef typename void_pointer_traits::template
+      rebind_pointer::type                            pointer;
+   typedef typename boost::intrusive::pointer_traits
+                                                pointer_traits;
 
-   static pointer cast(void_pointer p)
-   {
-      return pointer(static_cast(container_detail::to_raw_pointer(p)));
-   }
+   static pointer cast(const void_pointer &p)
+   {  return pointer_traits::static_cast_from(p);  }
 
    public:
    typedef transform_iterator
       < typename MultiallocationChain::iterator
-      , container_detail::cast_functor  >                 iterator;
-   typedef typename MultiallocationChain::size_type           size_type;
+      , container_detail::cast_functor  >             iterator;
+   typedef typename MultiallocationChain::size_type      size_type;
 
    transform_multiallocation_chain()
-      : holder_()
+      : MultiallocationChain()
    {}
 
    transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
-      : holder_()
-   {  this->swap(other); }
+      : MultiallocationChain(::boost::move(static_cast(other)))
+   {}
 
    transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
-      : holder_(boost::move(other))
+      : MultiallocationChain(::boost::move(static_cast(other)))
    {}
 
    transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
    {
-      transform_multiallocation_chain tmp(boost::move(other));
-      this->swap(tmp);
-      return *this;
+      return static_cast
+         (this->MultiallocationChain::operator=(::boost::move(static_cast(other))));
    }
-
-   void push_front(pointer mem)
+/*
+   void push_front(const pointer &mem)
    {  holder_.push_front(mem);  }
 
+   void push_back(const pointer &mem)
+   {  return holder_.push_back(mem);   }
+
    void swap(transform_multiallocation_chain &other_chain)
    {  holder_.swap(other_chain.holder_); }
 
-   void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
-   {  holder_.splice_after(after_this.base(), x.holder_, before_begin.base(), before_end.base(), n);  }
-
-   void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
-   {  holder_.incorporate_after(after_this.base(), begin, before_end, n);  }
-
-   void pop_front()
-   {  holder_.pop_front();  }
-
-   pointer front()
-   {  return cast(holder_.front());   }
+   void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+   {  holder_.splice_after(after_this.base(), x.holder_, before_b.base(), before_e.base(), n);  }
 
+   void incorporate_after(iterator after_this, pointer b, pointer before_e, size_type n)
+   {  holder_.incorporate_after(after_this.base(), b, before_e, n);  }
+*/
+   pointer pop_front()
+   {  return cast(this->MultiallocationChain::pop_front());  }
+/*
    bool empty() const
    {  return holder_.empty(); }
 
@@ -227,20 +258,21 @@ class transform_multiallocation_chain
 
    void clear()
    {  holder_.clear(); }
-
+*/
    iterator insert_after(iterator it, pointer m)
-   {  return iterator(holder_.insert_after(it.base(), m)); }
+   {  return iterator(this->MultiallocationChain::insert_after(it.base(), m)); }
 
-   static iterator iterator_to(pointer p)
+   static iterator iterator_to(const pointer &p)
    {  return iterator(MultiallocationChain::iterator_to(p));  }
 
-   std::pair extract_data()
-   {  return holder_.extract_data();  }
-
-   MultiallocationChain extract_multiallocation_chain()
+   std::pair extract_data()
    {
-      return MultiallocationChain(boost::move(holder_));
+      std::pair data(this->MultiallocationChain::extract_data());
+      return std::pair(cast(data.first), cast(data.second));
    }
+/*
+   MultiallocationChain &extract_multiallocation_chain()
+   {  return holder_;  }*/
 };
 
 }}}
diff --git a/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp b/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
index 9b0a0a524..7d851c06e 100644
--- a/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
+++ b/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -21,120 +21,30 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
+#include 
+#include 
 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
 #include 
+#include 
 
 
 namespace boost {
 namespace container {
 namespace container_detail {
 
-//!A deleter for scoped_ptr that deallocates the memory
-//!allocated for an object using a STL allocator.
-template 
-struct scoped_deallocator
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::pointer pointer;
-   typedef container_detail::integral_constant::value>                   alloc_version;
-   typedef container_detail::integral_constant     allocator_v1;
-   typedef container_detail::integral_constant     allocator_v2;
-
-   private:
-   void priv_deallocate(allocator_v1)
-   {  m_alloc.deallocate(m_ptr, 1); }
-
-   void priv_deallocate(allocator_v2)
-   {  m_alloc.deallocate_one(m_ptr); }
-
-   BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
-
-   public:
-
-   pointer     m_ptr;
-   A&  m_alloc;
-
-   scoped_deallocator(pointer p, A& a)
-      : m_ptr(p), m_alloc(a)
-   {}
-
-   ~scoped_deallocator()
-   {  if (m_ptr)priv_deallocate(alloc_version());  }
-
-   scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
-      :  m_ptr(o.m_ptr), m_alloc(o.m_alloc)
-   {  o.release();  }
-
-   pointer get() const
-   {  return m_ptr;  }
-
-   void release()
-   {  m_ptr = 0; }
-};
-
-template 
-class allocator_destroyer_and_chain_builder
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::value_type value_type;
-   typedef typename A::multiallocation_chain    multiallocation_chain;
-
-   A & a_;
-   multiallocation_chain &c_;
-
-   public:
-   allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c)
-      :  a_(a), c_(c)
-   {}
-
-   void operator()(const typename A::pointer &p)
-   {
-      allocator_traits::destroy(a_, container_detail::to_raw_pointer(p));
-      c_.push_front(p);
-   }
-};
-
-template 
-class allocator_multialloc_chain_node_deallocator
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::value_type value_type;
-   typedef typename A::multiallocation_chain    multiallocation_chain;
-   typedef allocator_destroyer_and_chain_builder chain_builder;
-
-   A & a_;
-   multiallocation_chain c_;
-
-   public:
-   allocator_multialloc_chain_node_deallocator(A &a)
-      :  a_(a), c_()
-   {}
-
-   chain_builder get_chain_builder()
-   {  return chain_builder(a_, c_);  }
-
-   ~allocator_multialloc_chain_node_deallocator()
-   {
-      if(!c_.empty())
-         a_.deallocate_individual(boost::move(c_));
-   }
-};
-
 template
 struct node_compare
    :  private ValueCompare
@@ -181,6 +91,7 @@ struct node_alloc_holder
    typedef typename ICont::const_iterator             icont_citerator;
    typedef allocator_destroyer             Destroyer;
    typedef allocator_traits                NodeAllocTraits;
+   typedef allocator_version_traits        AllocVersionTraits;
 
    private:
    BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
@@ -188,11 +99,11 @@ struct node_alloc_holder
    public:
 
    //Constructors for sequence containers
-   node_alloc_holder() 
+   node_alloc_holder()
       : members_()
    {}
 
-   explicit node_alloc_holder(const ValAlloc &a) 
+   explicit node_alloc_holder(const ValAlloc &a)
       : members_(a)
    {}
 
@@ -205,7 +116,7 @@ struct node_alloc_holder
    {  this->icont().swap(x.icont());  }
 
    //Constructors for associative containers
-   explicit node_alloc_holder(const ValAlloc &a, const Pred &c) 
+   explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
       : members_(a, c)
    {}
 
@@ -223,7 +134,7 @@ struct node_alloc_holder
    {  this->icont().swap(x.icont());  }
 
    void copy_assign_alloc(const node_alloc_holder &x)
-   {  
+   { 
       container_detail::bool_ flag;
       container_detail::assign_alloc( static_cast(this->members_)
                                     , static_cast(x.members_), flag);
@@ -243,63 +154,25 @@ struct node_alloc_holder
    {  return allocator_traits_type::max_size(this->node_alloc());  }
 
    NodePtr allocate_one()
-   {  return this->allocate_one(alloc_version());   }
-
-   NodePtr allocate_one(allocator_v1)
-   {  return this->node_alloc().allocate(1);   }
-
-   NodePtr allocate_one(allocator_v2)
-   {  return this->node_alloc().allocate_one();   }
+   {  return AllocVersionTraits::allocate_one(this->node_alloc());   }
 
    void deallocate_one(const NodePtr &p)
-   {  return this->deallocate_one(p, alloc_version());   }
+   {  AllocVersionTraits::deallocate_one(this->node_alloc(), p);  }
 
-   void deallocate_one(const NodePtr &p, allocator_v1)
-   {  this->node_alloc().deallocate(p, 1);   }
-
-   void deallocate_one(const NodePtr &p, allocator_v2)
-   {  this->node_alloc().deallocate_one(p);   }
-/*
-   template
-   static void construct(A &a, const NodePtr &ptr,
-      BOOST_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
-   {
-      typedef typename Node::hook_type                hook_type;
-      typedef typename Node::value_type::first_type   first_type;
-      typedef typename Node::value_type::second_type  second_type;
-      Node *nodeptr = container_detail::to_raw_pointer(ptr);
-
-      //Hook constructor does not throw
-      allocator_traits::construct(a, static_cast(nodeptr));
-
-      //Now construct pair members_holder
-      value_type *valueptr = &nodeptr->get_data();
-      allocator_traits::construct(a, &valueptr->first, boost::move(value.first));
-      BOOST_TRY{
-         allocator_traits::construct(a, &valueptr->second, boost::move(value.second));
-      }
-      BOOST_CATCH(...){
-         allocator_traits::destroy(a, &valueptr->first);
-         BOOST_RETHROW
-      }
-      BOOST_CATCH_END
-   }
-*/
    #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-/*
-   template
-   static void construct(A &a, const NodePtr &ptr, Args &&...args)
-   {  
-   }
-*/
+
    template
    NodePtr create_node(Args &&...args)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
       allocator_traits::construct
-         (this->node_alloc(), container_detail::to_raw_pointer(p), boost::forward(args)...);
+         ( this->node_alloc()
+         , container_detail::addressof(p->m_data), boost::forward(args)...);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -313,9 +186,11 @@ struct node_alloc_holder
       NodePtr p = this->allocate_one();                                                   \
       Deallocator node_deallocator(p, this->node_alloc());                                \
       allocator_traits::construct                                              \
-         (this->node_alloc(), container_detail::to_raw_pointer(p)                         \
+         (this->node_alloc(), container_detail::addressof(p->m_data)                      \
             BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));              \
       node_deallocator.release();                                                         \
+      typedef typename Node::hook_type hook_type;                                         \
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;      \
       return (p);                                                                         \
    }                                                                                      \
    //!
@@ -329,8 +204,11 @@ struct node_alloc_holder
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
-      ::boost::container::construct_in_place(this->node_alloc(), container_detail::to_raw_pointer(p), it);
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -348,38 +226,51 @@ struct node_alloc_holder
    }
 
    template
-   FwdIterator allocate_many_and_construct
+   void allocate_many_and_construct
       (FwdIterator beg, difference_type n, Inserter inserter)
    {
-      if(n){
-         typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
+      /*
+      NodePtr p = this->allocate_one();
+      Deallocator node_deallocator(p, this->node_alloc());
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
+      node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
+      return (p);
+      */
+      typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
 
-         //Try to allocate memory in a single block
-         multiallocation_chain mem(this->node_alloc().allocate_individual(n));
-         int constructed = 0;
-         Node *p = 0;
-         BOOST_TRY{
-               for(difference_type i = 0; i < n; ++i, ++beg, --constructed){
-               p = container_detail::to_raw_pointer(mem.front());
-               mem.pop_front();
-               //This can throw
-               constructed = 0;
-               boost::container::construct_in_place(this->node_alloc(), p, beg);
-               ++constructed;
-               //This can throw in some containers (predicate might throw)
-               inserter(*p);
-            }
+      //Try to allocate memory in a single block
+      typedef typename multiallocation_chain::iterator multialloc_iterator;
+      multiallocation_chain mem;
+      this->node_alloc().allocate_individual(n, mem);
+      multialloc_iterator itbeg(mem.begin()), itlast(mem.last());
+      mem.clear();
+      Node *p = 0;
+      NodeAlloc &nalloc = this->node_alloc();
+      BOOST_TRY{
+         while(n--){
+            p = container_detail::to_raw_pointer(&*itbeg);
+            ++itbeg;
+            //This can throw
+            Deallocator node_deallocator(p, nalloc);
+            boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg);
+            ++beg;
+            node_deallocator.release();
+            //This does not throw
+            typedef typename Node::hook_type hook_type;
+            ::new(static_cast(p)) hook_type;
+            //This can throw in some containers (predicate might throw)
+            inserter(*p);
          }
-         BOOST_CATCH(...){
-            if(constructed){
-               allocator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(p));
-            }
-            this->node_alloc().deallocate_individual(boost::move(mem));
-            BOOST_RETHROW
-         }
-         BOOST_CATCH_END
       }
-      return beg;
+      BOOST_CATCH(...){
+         mem.incorporate_after(mem.last(), &*itbeg, &*itlast, n);
+         this->node_alloc().deallocate_individual(mem);
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
    }
 
    void clear(allocator_v1)
@@ -392,7 +283,7 @@ struct node_alloc_holder
       this->icont().clear_and_dispose(builder);
       //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled::value == true));
       if(!chain.empty())
-         this->node_alloc().deallocate_individual(boost::move(chain));
+         this->node_alloc().deallocate_individual(chain);
    }
 
    icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v1)
@@ -400,8 +291,13 @@ struct node_alloc_holder
 
    icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v2)
    {
-      allocator_multialloc_chain_node_deallocator chain_holder(this->node_alloc());
-      return this->icont().erase_and_dispose(first, last, chain_holder.get_chain_builder());
+      typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
+      NodeAlloc & nalloc = this->node_alloc();
+      multiallocation_chain chain;
+      allocator_destroyer_and_chain_builder chain_builder(nalloc, chain);
+      icont_iterator ret_it = this->icont().erase_and_dispose(first, last, chain_builder);
+      nalloc.deallocate_individual(chain);
+      return ret_it;
    }
 
    template
diff --git a/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp b/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
index 9ee9e311c..53e35ac36 100644
--- a/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
+++ b/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -26,10 +26,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include    //std::unary_function
 
+
 namespace boost {
 namespace container {
 namespace container_detail {
@@ -85,19 +87,19 @@ class private_node_pool_impl
    {  return container_detail::to_raw_pointer(mp_segment_mngr_base);  }
 
    void *allocate_node()
-   {  return priv_alloc_node();  }
-   
+   {  return this->priv_alloc_node();  }
+  
    //!Deallocates an array pointed by ptr. Never throws
    void deallocate_node(void *ptr)
-   {  priv_dealloc_node(ptr); }
+   {  this->priv_dealloc_node(ptr); }
 
-   //!Allocates a singly linked list of n nodes ending in null pointer. 
-   multiallocation_chain allocate_nodes(const size_type n)
+   //!Allocates a singly linked list of n nodes ending in null pointer.
+   void allocate_nodes(const size_type n, multiallocation_chain &chain)
    {
       //Preallocate all needed blocks to fulfill the request
       size_type cur_nodes = m_freelist.size();
       if(cur_nodes < n){
-         priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
+         this->priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
       }
 
       //We just iterate the needed nodes to get the last we'll erase
@@ -118,20 +120,18 @@ class private_node_pool_impl
 
       //Now take the last erased node and just splice it in the end
       //of the intrusive list that will be traversed by the multialloc iterator.
-      multiallocation_chain chain;
       chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n);
       m_allocated += n;
-      return boost::move(chain);
    }
 
-   void deallocate_nodes(multiallocation_chain chain)
+   void deallocate_nodes(multiallocation_chain &chain)
    {
       typedef typename multiallocation_chain::iterator iterator;
       iterator it(chain.begin()), itend(chain.end());
       while(it != itend){
          void *pElem = &*it;
          ++it;
-         priv_dealloc_node(pElem);
+         this->priv_dealloc_node(pElem);
       }
    }
 
@@ -238,7 +238,7 @@ class private_node_pool_impl
       push_in_list(free_nodes_t &l, typename free_nodes_t::iterator &it)
          :  slist_(l), last_it_(it)
       {}
-      
+     
       void operator()(typename free_nodes_t::pointer p) const
       {
          slist_.push_front(*p);
@@ -258,10 +258,10 @@ class private_node_pool_impl
       is_between(const void *addr, std::size_t size)
          :  beg_(static_cast(addr)), end_(beg_+size)
       {}
-      
+     
       bool operator()(typename free_nodes_t::const_reference v) const
       {
-         return (beg_ <= reinterpret_cast(&v) && 
+         return (beg_ <= reinterpret_cast(&v) &&
                  end_ >  reinterpret_cast(&v));
       }
       private:
@@ -275,7 +275,7 @@ class private_node_pool_impl
    {
       //If there are no free nodes we allocate a new block
       if (m_freelist.empty())
-         priv_alloc_block();
+         this->priv_alloc_block(1);
       //We take the first free node
       node_t *n = (node_t*)&m_freelist.front();
       m_freelist.pop_front();
@@ -295,14 +295,13 @@ class private_node_pool_impl
    }
 
    //!Allocates several blocks of nodes. Can throw
-   void priv_alloc_block(size_type num_blocks = 1)
+   void priv_alloc_block(size_type num_blocks)
    {
-      if(!num_blocks)
-         return;
-      size_type blocksize = 
+      BOOST_ASSERT(num_blocks > 0);
+      size_type blocksize =
          get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of::value);
 
-      try{
+      BOOST_TRY{
          for(size_type i = 0; i != num_blocks; ++i){
             //We allocate a new NodeBlock and put it as first
             //element in the free Node list
@@ -311,17 +310,18 @@ class private_node_pool_impl
             char *pBlock = pNode;
             m_blocklist.push_front(get_block_hook(pBlock, blocksize));
 
-            //We initialize all Nodes in Node Block to insert 
+            //We initialize all Nodes in Node Block to insert
             //them in the free Node list
-            for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
+            for(size_type j = 0; j < m_nodes_per_block; ++j, pNode += m_real_node_size){
                m_freelist.push_front(*new (pNode) node_t);
             }
          }
       }
-      catch(...){
+      BOOST_CATCH(...){
          //to-do: if possible, an efficient way to deallocate allocated blocks
-         throw;
+         BOOST_RETHROW
       }
+      BOOST_CATCH_END
    }
 
    //!Deprecated, use deallocate_free_blocks
@@ -335,13 +335,13 @@ class private_node_pool_impl
    private:
    //!Returns a reference to the block hook placed in the end of the block
    static node_t & get_block_hook (void *block, size_type blocksize)
-   {  
-      return *reinterpret_cast(reinterpret_cast(block) + blocksize);  
+   { 
+      return *reinterpret_cast(reinterpret_cast(block) + blocksize); 
    }
 
    //!Returns the starting address of the block reference to the block hook placed in the end of the block
    void *get_block_from_hook (node_t *hook, size_type blocksize)
-   {  
+   { 
       return (reinterpret_cast(hook) - blocksize);
    }
 
diff --git a/project/jni/boost/include/boost/container/detail/pair.hpp b/project/jni/boost/include/boost/container/detail/pair.hpp
index 1aeff9113..79753a861 100644
--- a/project/jni/boost/include/boost/container/detail/pair.hpp
+++ b/project/jni/boost/include/boost/container/detail/pair.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,12 +20,15 @@
 #include "config_begin.hpp"
 #include 
 
+#include 
+#include 
 #include 
 #include 
 
 #include    //std::pair
+#include  //std::swap
 
-#include 
+#include 
 #include 
 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -33,7 +36,7 @@
 #endif
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template 
@@ -62,6 +65,33 @@ struct pair_nat;
 struct piecewise_construct_t { };
 static const piecewise_construct_t piecewise_construct = piecewise_construct_t();
 
+/*
+template 
+struct pair
+{
+    template  pair(pair&& p);
+    template 
+        pair(piecewise_construct_t, tuple first_args,
+             tuple second_args);
+
+    template  pair& operator=(const pair& p);
+    pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value &&
+                                       is_nothrow_move_assignable::value);
+    template  pair& operator=(pair&& p);
+
+    void swap(pair& p) noexcept(noexcept(swap(first, p.first)) &&
+                                noexcept(swap(second, p.second)));
+};
+
+template  bool operator==(const pair&, const pair&);
+template  bool operator!=(const pair&, const pair&);
+template  bool operator< (const pair&, const pair&);
+template  bool operator> (const pair&, const pair&);
+template  bool operator>=(const pair&, const pair&);
+template  bool operator<=(const pair&, const pair&);
+*/
+
+
 template 
 struct pair
 {
@@ -79,47 +109,40 @@ struct pair
    pair()
       : first(), second()
    {}
-/*
-   //pair from two values
-   pair(const T1 &t1, const T2 &t2)
-      : first(t1)
-      , second(t2)
-   {}
-
-
-   //pair from two values
-   pair(BOOST_RV_REF(T1) t1, BOOST_RV_REF(T2) t2)
-      : first(::boost::move(t1))
-      , second(::boost::move(t2))
-   {}
-*/
-   template
-   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
-      : first(::boost::forward(u))
-      , second(::boost::forward(v))
-   {}
 
    //pair copy assignment
    pair(const pair& x)
       : first(x.first), second(x.second)
    {}
 
-   template 
-   pair(const pair &p)
-      : first(p.first), second(p.second)
-   {}
-
    //pair move constructor
    pair(BOOST_RV_REF(pair) p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   pair(const pair &p)
+      : first(p.first), second(p.second)
+   {}
+
+   template 
+   pair(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   //std::pair copy constructor
+   //pair from two values
+   pair(const T1 &t1, const T2 &t2)
+      : first(t1)
+      , second(t2)
+   {}
+
+   template
+   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
+      : first(::boost::forward(u))
+      , second(::boost::forward(v))
+   {}
+
+   //And now compatibility with std::pair
    pair(const std::pair& x)
       : first(x.first), second(x.second)
    {}
@@ -129,17 +152,20 @@ struct pair
       : first(p.first), second(p.second)
    {}
 
-   //std::pair move constructor
-   template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   template 
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    //piecewise_construct missing
+   //template  pair(pair&& p);
+   //template 
+   //   pair(piecewise_construct_t, tuple first_args,
+   //        tuple second_args);
 /*
    //Variadic versions
    template
@@ -179,14 +205,6 @@ struct pair
       return *this;
    }
 
-   template 
-   pair& operator=(const pair&p)
-   {
-      first  = p.first;
-      second = p.second;
-      return *this;
-   }
-
    //pair move assignment
    pair& operator=(BOOST_RV_REF(pair) p)
    {
@@ -196,7 +214,23 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   typename ::boost::container::container_detail::enable_if_c
+      < !(::boost::container::container_detail::is_same::value &&
+          ::boost::container::container_detail::is_same::value)
+      , pair &>::type
+      operator=(const pair&p)
+   {
+      first  = p.first;
+      second = p.second;
+      return *this;
+   }
+
+   template 
+   typename ::boost::container::container_detail::enable_if_c
+      < !(::boost::container::container_detail::is_same::value &&
+          ::boost::container::container_detail::is_same::value)
+      , pair &>::type
+      operator=(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -220,7 +254,7 @@ struct pair
    }
 
    //std::pair move assignment
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -228,7 +262,7 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -280,8 +314,8 @@ inline void swap(pair& x, pair& y)
    swap(x.second, y.second);
 }
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 
 
 //Without this specialization recursive flat_(multi)map instantiation fails
@@ -303,7 +337,7 @@ struct is_class< ::boost::container::container_detail::pair >
    : public ::boost::true_type
 {};
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
 
 template
 struct has_move_emulation_enabled< ::boost::container::container_detail::pair >
diff --git a/project/jni/boost/include/boost/container/detail/pool_common.hpp b/project/jni/boost/include/boost/container/detail/pool_common.hpp
index c66e2cd18..983d1413a 100644
--- a/project/jni/boost/include/boost/container/detail/pool_common.hpp
+++ b/project/jni/boost/include/boost/container/detail/pool_common.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -34,7 +34,7 @@ struct node_slist
    typedef slist_hook_t node_t;
 
    typedef typename bi::make_slist
-      , bi::base_hook >::type node_slist_t;
+      , bi::cache_last, bi::base_hook >::type node_slist_t;
 };
 
 template
diff --git a/project/jni/boost/include/boost/container/detail/preprocessor.hpp b/project/jni/boost/include/boost/container/detail/preprocessor.hpp
index 9916fbac6..4e175a82f 100644
--- a/project/jni/boost/include/boost/container/detail/preprocessor.hpp
+++ b/project/jni/boost/include/boost/container/detail/preprocessor.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -16,18 +16,14 @@
 #endif
 
 #include 
-
-#ifndef BOOST_NO_RVALUE_REFERENCES
-#include 
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
-
 #include 
+#include 
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 //#error "This file is not needed when perfect forwarding is available"
 #endif   //BOOST_CONTAINER_PERFECT_FORWARDING
 
-#include  
+#include 
 #include 
 #include 
 #include 
@@ -43,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
 
@@ -52,7 +49,7 @@
 //This cast is ugly but it is necessary until "perfect forwarding"
 //is achieved in C++0x. Meanwhile, if we want to be able to
 //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) \
    BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
    //!
@@ -60,9 +57,13 @@
    #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    const 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
+#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \
+const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
+//!
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
    #define BOOST_CONTAINER_PP_PARAM(U, u) \
    U && u \
    //!
@@ -70,37 +71,87 @@
    #define BOOST_CONTAINER_PP_PARAM(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
 
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+   #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) ))           \
+   //!
 
-      #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) ))           \
-      //!
-
-   #else    //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-
-      #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
-      BOOST_PP_CAT(m_p, n) (static_cast( BOOST_PP_CAT(p, n) ))           \
-      //!
-
-   #endif   //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-
-#else //BOOST_NO_RVALUE_REFERENCES
+#else //BOOST_NO_CXX11_RVALUE_REFERENCES
 
    #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
    BOOST_PP_CAT(m_p, n) (const_cast(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)
 
+      namespace boost {
+      namespace container {
+      namespace container_detail {
+         template
+         struct ref_holder;
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &t)
+               : t_(t)
+            {}
+            T &t_;
+            T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(const T &t)
+               : t_(t)
+            {}
+            const T &t_;
+            const T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(const T &t)
+               : t_(t)
+            {}
+            const T &t_;
+            const T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &&t)
+               : t_(t)
+            {}
+            T &t_;
+            T && get() {  return ::boost::move(t_);   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &&t)
+               : t_(t)
+            {}
+            T &t_;
+            T && get()  { return ::boost::move(t_); }
+         };
+
+      }  //namespace container_detail {
+      }  //namespace container {
+      }  //namespace boost {
+
       #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
-      BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);            \
+         ::boost::container::container_detail::ref_holder BOOST_PP_CAT(m_p, n);  \
       //!
 
    #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
@@ -111,26 +162,25 @@
 
    #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)  \
    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::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(this->m_p, n) ) \
+   #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) \
-   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)   \
   BOOST_PP_CAT(++this->m_p, n)                     \
@@ -140,11 +190,11 @@
 
 
 #define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \
-boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
+::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
 //!
 
 #define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \
-boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
+::boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
 //!
 
 #define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \
@@ -152,7 +202,11 @@ BOOST_PP_CAT(*this->m_p, n) \
 //!
 
 #define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data)   \
-  BOOST_PP_CAT(class P, n) = void                                      \
+  BOOST_PP_CAT(class P, n) = void                                    \
+//!
+
+#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \
+  BOOST_PP_CAT(class P, n) = default_type                                  \
 //!
 
 #define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \
diff --git a/project/jni/boost/include/boost/container/detail/stored_ref.hpp b/project/jni/boost/include/boost/container/detail/stored_ref.hpp
deleted file mode 100644
index df0faa85a..000000000
--- a/project/jni/boost/include/boost/container/detail/stored_ref.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/container for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_CONTAINER_DETAIL_STORED_REF_HPP
-#define BOOST_CONTAINER_DETAIL_STORED_REF_HPP
-
-#include "config_begin.hpp"
-#include 
-
-#ifndef BOOST_NO_RVALUE_REFERENCES
-
-namespace boost{
-namespace container{
-namespace container_detail{
-
-template
-struct stored_ref
-{
-
-   static T && forward(T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return boost::move(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T && forward(const T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return static_cast(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static T && forward(T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return boost::move(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T && forward(const T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return static_cast(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T & forward(const T &t)
-   {  return t; }
-};
-
-template
-struct stored_ref
-{
-   static T & forward(T &t)
-   {  return t; }
-};
-
-}  //namespace container_detail{
-}  //namespace container{
-}  //namespace boost{
-
-#else
-#error "This header can be included only for compiler with rvalue references"
-#endif   //BOOST_NO_RVALUE_REFERENCES
-
-#include 
-
-#endif   //BOOST_CONTAINER_DETAIL_STORED_REF_HPP
diff --git a/project/jni/boost/include/boost/container/detail/transform_iterator.hpp b/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
index 17eca9ef6..98f5c04d6 100644
--- a/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
+++ b/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -24,7 +24,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 
 template 
 struct operator_arrow_proxy
@@ -74,7 +74,7 @@ class transform_iterator
    {}
 
    //Constructors
-   transform_iterator& operator++() 
+   transform_iterator& operator++()
    { increment();   return *this;   }
 
    transform_iterator operator++(int)
@@ -168,7 +168,7 @@ make_transform_iterator(Iterator it, UnaryFunc fun)
    return transform_iterator(it, fun);
 }
 
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/tree.hpp b/project/jni/boost/include/boost/container/detail/tree.hpp
index 6cd91ed2a..9cb3c9f80 100644
--- a/project/jni/boost/include/boost/container/detail/tree.hpp
+++ b/project/jni/boost/include/boost/container/detail/tree.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -15,7 +15,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -27,7 +27,8 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
@@ -41,15 +42,15 @@ namespace container {
 namespace container_detail {
 
 template
-struct value_compare_impl
+struct tree_value_compare
    :  public KeyCompare
 {
    typedef Value        value_type;
-   typedef KeyCompare   key_compare; 
+   typedef KeyCompare   key_compare;
    typedef KeyOfValue   key_of_value;
    typedef Key          key_type;
 
-   value_compare_impl(const key_compare &kcomp)
+   tree_value_compare(const key_compare &kcomp)
       :  key_compare(kcomp)
    {}
 
@@ -90,70 +91,38 @@ struct rbtree_hook
       >::type  type;
 };
 
+//This trait is used to type-pun std::pair because in C++03
+//compilers std::pair is useless for C++11 features
 template
-struct rbtree_type
+struct rbtree_internal_data_type
 {
    typedef T type;
 };
 
 template
-struct rbtree_type< std::pair >
+struct rbtree_internal_data_type< std::pair >
 {
    typedef pair type;
 };
 
+
+//The node to be store in the tree
 template 
 struct rbtree_node
    :  public rbtree_hook::type
 {
    private:
-   BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+   //BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+   rbtree_node();
 
    public:
    typedef typename rbtree_hook::type hook_type;
 
    typedef T value_type;
-   typedef typename rbtree_type::type internal_type;
+   typedef typename rbtree_internal_data_type::type internal_type;
 
    typedef rbtree_node node_type;
 
-   rbtree_node()
-      : m_data()
-   {}
-
-   rbtree_node(const rbtree_node &other)
-      : m_data(other.m_data)
-   {}
-
-   rbtree_node(BOOST_RV_REF(rbtree_node) other)
-      : m_data(boost::move(other.m_data))
-   {}
-
-   #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                           \
-   template                                \
-   rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))           \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))        \
-   {}                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   template
-   rbtree_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   rbtree_node &operator=(const rbtree_node &other)
-   {  do_assign(other.m_data);   return *this;  }
-
-   rbtree_node &operator=(BOOST_RV_REF(rbtree_node) other)
-   {  do_move(other.m_data);   return *this;  }
-
    T &get_data()
    {
       T* ptr = reinterpret_cast(&this->m_data);
@@ -166,7 +135,6 @@ struct rbtree_node
       return *ptr;
    }
 
-   private:
    internal_type m_data;
 
    template
@@ -188,22 +156,22 @@ struct rbtree_node
    {  m_data = v; }
 
    template
-   void do_move(std::pair &p)
+   void do_move_assign(std::pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      const_cast(m_data.first) = ::boost::move(p.first);
+      m_data.second = ::boost::move(p.second);
    }
 
    template
-   void do_move(pair &p)
+   void do_move_assign(pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      const_cast(m_data.first) = ::boost::move(p.first);
+      m_data.second  = ::boost::move(p.second);
    }
 
    template
-   void do_move(V &v)
-   {  m_data = boost::move(v); }
+   void do_move_assign(V &v)
+   {  m_data = ::boost::move(v); }
 };
 
 }//namespace container_detail {
@@ -236,22 +204,22 @@ struct intrusive_rbtree_type
 
 namespace container_detail {
 
-template 
 class rbtree
    : protected container_detail::node_alloc_holder
       < A
       , typename container_detail::intrusive_rbtree_type
-           
+          
          >::type
       , KeyCompare
       >
 {
    typedef typename container_detail::intrusive_rbtree_type
-         < A, value_compare_impl
+         < A, tree_value_compare
             
          >::type                                            Icont;
-   typedef container_detail::node_alloc_holder  
+   typedef container_detail::node_alloc_holder 
                                       AllocHolder;
    typedef typename AllocHolder::NodePtr                    NodePtr;
    typedef rbtree < Key, Value, KeyOfValue
@@ -280,22 +248,23 @@ class rbtree
       {
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
-            try{
+            BOOST_TRY{
                //This can throw
-               *p = other;
+               p->do_assign(other.m_data);
                return p;
             }
-            catch(...){
+            BOOST_CATCH(...){
                //If there is an exception destroy the whole source
                m_holder.destroy_node(p);
                while((p = m_icont.unlink_leftmost_without_rebalance())){
                   m_holder.destroy_node(p);
                }
-               throw;
+               BOOST_RETHROW
             }
+            BOOST_CATCH_END
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -317,22 +286,23 @@ class rbtree
       {
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
-            try{
+            BOOST_TRY{
                //This can throw
-               *p = boost::move(other);
+               p->do_move_assign(const_cast(other).m_data);
                return p;
             }
-            catch(...){
+            BOOST_CATCH(...){
                //If there is an exception destroy the whole source
                m_holder.destroy_node(p);
                while((p = m_icont.unlink_leftmost_without_rebalance())){
                   m_holder.destroy_node(p);
                }
-               throw;
+               BOOST_RETHROW
             }
+            BOOST_CATCH_END
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -348,7 +318,7 @@ class rbtree
    typedef Value                                      value_type;
    typedef A                                          allocator_type;
    typedef KeyCompare                                 key_compare;
-   typedef value_compare_impl< Key, Value
+   typedef tree_value_compare< Key, Value
                         , KeyCompare, KeyOfValue>     value_compare;
    typedef typename boost::container::
       allocator_traits::pointer                    pointer;
@@ -431,17 +401,17 @@ class rbtree
       {}
 
       //Pointer like operators
-      const_reference operator*()  const 
+      const_reference operator*()  const
       { return  m_it->get_data();  }
 
-      const_pointer   operator->() const 
+      const_pointer   operator->() const
       { return  const_pointer(&m_it->get_data()); }
 
       //Increment / Decrement
-      const_iterator& operator++()       
+      const_iterator& operator++()      
       { prot_incr();  return *this; }
 
-      const_iterator operator++(int)      
+      const_iterator operator++(int)     
       { iiterator tmp = m_it; ++*this; return const_iterator(tmp);  }
 
       const_iterator& operator--()
@@ -465,7 +435,7 @@ class rbtree
       explicit iterator(iiterator it)
          :  const_iterator(it)
       {}
-   
+  
       iiterator get()
       {  return this->m_it;   }
 
@@ -478,16 +448,18 @@ class rbtree
       iterator(){}
 
       //Pointer like operators
-      reference operator*()  const {  return  this->m_it->get_data();  }
-      pointer   operator->() const {  return  pointer(&this->m_it->get_data());  }
+      reference operator*()  const
+         {  return this->m_it->get_data();  }
+      pointer   operator->() const
+         {  return boost::intrusive::pointer_traits::pointer_to(this->m_it->get_data());  }
 
       //Increment / Decrement
-      iterator& operator++()  
+      iterator& operator++() 
          { this->prot_incr(); return *this;  }
 
       iterator operator++(int)
          { iiterator tmp = this->m_it; ++*this; return iterator(tmp); }
-      
+     
       iterator& operator--()
          {  this->prot_decr(); return *this;  }
 
@@ -507,34 +479,109 @@ class rbtree
    {}
 
    template 
-   rbtree(InputIterator first, InputIterator last, const key_compare& comp,
-          const allocator_type& a, bool unique_insertion)
+   rbtree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
+          const allocator_type& a
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+            || container_detail::is_same::value
+         >::type * = 0
+      #endif
+         )
       : AllocHolder(a, comp)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(first, last, unique_insertion, alloc_version(), ItCat());
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         this->insert_equal(first, last);
+      }
+   }
+
+   template 
+   rbtree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
+          const allocator_type& a
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !(container_detail::is_input_iterator::value
+            || container_detail::is_same::value)
+         >::type * = 0
+      #endif
+         )
+      : AllocHolder(a, comp)
+   {
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         //Optimized allocation and construction
+         this->allocate_many_and_construct
+            (first, std::distance(first, last), insert_equal_end_hint_functor(this->icont()));
+      }
    }
 
    template 
    rbtree( ordered_range_t, InputIterator first, InputIterator last
-         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type())
+         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
+         #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , typename container_detail::enable_if_c
+            < container_detail::is_input_iterator::value
+               || container_detail::is_same::value
+            >::type * = 0
+         #endif
+         )
       : AllocHolder(a, comp)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_ordered_nodes(first, last, alloc_version(), ItCat());
+      this->insert_equal(first, last);
    }
 
-   rbtree(const rbtree& x) 
+   template 
+   rbtree( ordered_range_t, InputIterator first, InputIterator last
+         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
+         #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , typename container_detail::enable_if_c
+            < !(container_detail::is_input_iterator::value
+               || container_detail::is_same::value)
+            >::type * = 0
+         #endif
+         )
+      : AllocHolder(a, comp)
+   {
+      //Optimized allocation and construction
+      this->allocate_many_and_construct
+         (first, std::distance(first, last), push_back_functor(this->icont()));
+   }
+
+   rbtree(const rbtree& x)
       :  AllocHolder(x, x.key_comp())
    {
       this->icont().clone_from
          (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
    }
 
-   rbtree(BOOST_RV_REF(rbtree) x) 
-      :  AllocHolder(boost::move(static_cast(x)), x.key_comp())
+   rbtree(BOOST_RV_REF(rbtree) x)
+      :  AllocHolder(::boost::move(static_cast(x)), x.key_comp())
    {}
 
+   rbtree(const rbtree& x, const allocator_type &a)
+      :  AllocHolder(a, x.key_comp())
+   {
+      this->icont().clone_from
+         (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+   }
+
+   rbtree(BOOST_RV_REF(rbtree) x, const allocator_type &a)
+      :  AllocHolder(a, x.key_comp())
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->icont().clone_from
+            (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+      }
+   }
+
    ~rbtree()
    {} //AllocHolder clears the tree
 
@@ -552,7 +599,7 @@ class rbtree
          //Transfer all the nodes to a temporary tree
          //If anything goes wrong, all the nodes will be destroyed
          //automatically
-         Icont other_tree(boost::move(this->icont()));
+         Icont other_tree(::boost::move(this->icont()));
 
          //Now recreate the source tree reusing nodes stored by other_tree
          this->icont().clone_from
@@ -578,7 +625,7 @@ class rbtree
          if(this_alloc == x_alloc){
             //Destroy and swap pointers
             this->clear();
-            this->icont() = boost::move(x.icont());
+            this->icont() = ::boost::move(x.icont());
             //Move allocator if needed
             this->AllocHolder::move_assign_alloc(x);
          }
@@ -587,7 +634,7 @@ class rbtree
             //Transfer all the nodes to a temporary tree
             //If anything goes wrong, all the nodes will be destroyed
             //automatically
-            Icont other_tree(boost::move(this->icont()));
+            Icont other_tree(::boost::move(this->icont()));
 
             //Now recreate the source tree reusing nodes stored by other_tree
             this->icont().clone_from
@@ -605,18 +652,18 @@ class rbtree
       return *this;
    }
 
-   public:    
+   public:   
    // accessors:
-   value_compare value_comp() const 
+   value_compare value_comp() const
    {  return this->icont().value_comp().value_comp(); }
 
-   key_compare key_comp() const 
+   key_compare key_comp() const
    {  return this->icont().value_comp().value_comp().key_comp(); }
 
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    {  return allocator_type(this->node_alloc()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   const stored_allocator_type &get_stored_allocator() const
    {  return this->node_alloc(); }
 
    stored_allocator_type &get_stored_allocator()
@@ -647,46 +694,46 @@ class rbtree
    {  return this->crend();   }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return const_iterator(this->non_const_icont().begin()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return const_iterator(this->non_const_icont().end()); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return const_reverse_iterator(cend()); } 
+   const_reverse_iterator crbegin() const
+   { return const_reverse_iterator(cend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return const_reverse_iterator(cbegin()); }
 
-   bool empty() const 
+   bool empty() const
    {  return !this->size();  }
 
-   size_type size() const 
+   size_type size() const
    {  return this->icont().size();   }
 
-   size_type max_size() const 
+   size_type max_size() const
    {  return AllocHolder::max_size();  }
 
    void swap(ThisType& x)
@@ -700,7 +747,7 @@ class rbtree
    std::pair insert_unique_check
       (const key_type& key, insert_commit_data &data)
    {
-      std::pair ret = 
+      std::pair ret =
          this->icont().insert_unique_check(key, KeyNodeCompare(value_comp()), data);
       return std::pair(iterator(ret.first), ret.second);
    }
@@ -708,7 +755,7 @@ class rbtree
    std::pair insert_unique_check
       (const_iterator hint, const key_type& key, insert_commit_data &data)
    {
-      std::pair ret = 
+      std::pair ret =
          this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(value_comp()), data);
       return std::pair(iterator(ret.first), ret.second);
    }
@@ -757,12 +804,14 @@ class rbtree
    {
       value_type &v = p->get_data();
       insert_commit_data data;
+      scoped_destroy_deallocator destroy_deallocator(p, this->node_alloc());
       std::pair ret =
          this->insert_unique_check(KeyOfValue()(v), data);
       if(!ret.second){
-         Destroyer(this->node_alloc())(p);
          return ret;
       }
+      //No throw insertion part, release rollback
+      destroy_deallocator.release();
       return std::pair
          ( iterator(iiterator(this->icont().insert_unique_commit(*p, data)))
          , true );
@@ -872,9 +921,9 @@ class rbtree
       if(this->empty()){
          //Insert with end hint, to achieve linear
          //complexity if [first, last) is ordered
-         const_iterator end(this->end());
+         const_iterator hint(this->cend());
          for( ; first != last; ++first)
-            this->insert_unique(end, *first);
+            hint = this->insert_unique(hint, *first);
       }
       else{
          for( ; first != last; ++first)
@@ -913,9 +962,9 @@ class rbtree
    {
       //Insert with end hint, to achieve linear
       //complexity if [first, last) is ordered
-      const_iterator end(this->cend());
+      const_iterator hint(this->cend());
       for( ; first != last; ++first)
-         this->insert_equal(end, *first);
+         hint = this->insert_equal(hint, *first);
    }
 
    iterator erase(const_iterator position)
@@ -927,7 +976,7 @@ class rbtree
    iterator erase(const_iterator first, const_iterator last)
    {  return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
 
-   void clear() 
+   void clear()
    {  AllocHolder::clear(alloc_version());  }
 
    // set operations:
@@ -953,14 +1002,14 @@ class rbtree
    {  return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(value_comp())));  }
 
    std::pair equal_range(const key_type& k)
-   {  
+   {
       std::pair ret =
          this->icont().equal_range(k, KeyNodeCompare(value_comp()));
       return std::pair(iterator(ret.first), iterator(ret.second));
    }
 
    std::pair equal_range(const key_type& k) const
-   {  
+   {
       std::pair ret =
          this->non_const_icont().equal_range(k, KeyNodeCompare(value_comp()));
       return std::pair
@@ -968,167 +1017,98 @@ class rbtree
    }
 
    private:
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (InpIterator beg, InpIterator end, bool unique, allocator_v1, std::input_iterator_tag)
-   {
-      if(unique){
-         for (; beg != end; ++beg){
-            this->insert_unique(*beg);
-         }
-      }
-      else{
-         for (; beg != end; ++beg){
-            this->insert_equal(*beg);
-         }
-      }
-   }
 
-   template
-   void priv_create_and_insert_nodes
-      (InpIterator beg, InpIterator end, bool unique, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(beg, end, unique, allocator_v1(), std::input_iterator_tag());
-   }
+   class insert_equal_end_hint_functor;
+   friend class insert_equal_end_hint_functor;
 
-   class insertion_functor;
-   friend class insertion_functor;
-
-   class insertion_functor
+   class insert_equal_end_hint_functor
    {
       Icont &icont_;
+      const iconst_iterator cend_;
 
       public:
-      insertion_functor(Icont &icont)
-         :  icont_(icont)
+      insert_equal_end_hint_functor(Icont &icont)
+         :  icont_(icont), cend_(this->icont_.cend())
       {}
 
       void operator()(Node &n)
-      {  this->icont_.insert_equal(this->icont_.cend(), n); }
+      {  this->icont_.insert_equal(cend_, n); }
    };
 
+   class push_back_functor;
+   friend class push_back_functor;
 
-   template
-   void priv_create_and_insert_nodes
-      (FwdIterator beg, FwdIterator end, bool unique, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         if(unique){
-            priv_create_and_insert_nodes(beg, end, unique, allocator_v2(), std::input_iterator_tag());
-         }
-         else{
-            //Optimized allocation and construction
-            this->allocate_many_and_construct
-               (beg, std::distance(beg, end), insertion_functor(this->icont()));
-         }
-      }
-   }
-
-   //Iterator range version
-   template
-   void priv_create_and_insert_ordered_nodes
-      (InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
-   {
-      const_iterator cend_n(this->cend());
-      for (; beg != end; ++beg){
-         this->insert_before(cend_n, *beg);
-      }
-   }
-
-   template
-   void priv_create_and_insert_ordered_nodes
-      (InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_ordered_nodes(beg, end, allocator_v1(), std::input_iterator_tag());
-   }
-
-   class back_insertion_functor;
-   friend class back_insertion_functor;
-
-   class back_insertion_functor
+   class push_back_functor
    {
       Icont &icont_;
 
       public:
-      back_insertion_functor(Icont &icont)
+      push_back_functor(Icont &icont)
          :  icont_(icont)
       {}
 
       void operator()(Node &n)
       {  this->icont_.push_back(n); }
    };
-
-
-   template
-   void priv_create_and_insert_ordered_nodes
-      (FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         //Optimized allocation and construction
-         this->allocate_many_and_construct
-            (beg, std::distance(beg, end), back_insertion_functor(this->icont()));
-      }
-   }
 };
 
-template 
-inline bool 
-operator==(const rbtree& x, 
+inline bool
+operator==(const rbtree& x,
            const rbtree& y)
 {
   return x.size() == y.size() &&
          std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const rbtree& x, 
+inline bool
+operator<(const rbtree& x,
           const rbtree& y)
 {
-  return std::lexicographical_compare(x.begin(), x.end(), 
+  return std::lexicographical_compare(x.begin(), x.end(),
                                       y.begin(), y.end());
 }
 
-template 
-inline bool 
-operator!=(const rbtree& x, 
+inline bool
+operator!=(const rbtree& x,
            const rbtree& y) {
   return !(x == y);
 }
 
-template 
-inline bool 
-operator>(const rbtree& x, 
+inline bool
+operator>(const rbtree& x,
           const rbtree& y) {
   return y < x;
 }
 
-template 
-inline bool 
-operator<=(const rbtree& x, 
+inline bool
+operator<=(const rbtree& x,
            const rbtree& y) {
   return !(y < x);
 }
 
-template 
-inline bool 
-operator>=(const rbtree& x, 
+inline bool
+operator>=(const rbtree& x,
            const rbtree& y) {
   return !(x < y);
 }
 
 
-template 
-inline void 
-swap(rbtree& x, 
+inline void
+swap(rbtree& x,
      rbtree& y)
 {
   x.swap(y);
@@ -1139,12 +1119,12 @@ swap(rbtree& x,
 /*
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
 struct has_trivial_destructor_after_move
     >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
 */
 } //namespace boost  {
diff --git a/project/jni/boost/include/boost/container/detail/type_traits.hpp b/project/jni/boost/include/boost/container/detail/type_traits.hpp
index 6a0b3ed58..5020ee9fc 100644
--- a/project/jni/boost/include/boost/container/detail/type_traits.hpp
+++ b/project/jni/boost/include/boost/container/detail/type_traits.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 // (C) Copyright John Maddock 2000.
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,14 +21,21 @@
 
 #include "config_begin.hpp"
 
-#include 
+#include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 struct nat{};
 
+template 
+struct LowPriorityConversion
+{
+   // Convertible from T with user-defined-conversion rank.
+   LowPriorityConversion(const U&) { }
+};
+
 //boost::alignment_of yields to 10K lines of preprocessed code, so we
 //need an alternative
 template  struct alignment_of;
@@ -83,7 +90,7 @@ struct remove_reference
    typedef T type;
 };
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
 template
 struct remove_reference
@@ -195,7 +202,7 @@ struct remove_ref_const
 };
 
 } // namespace container_detail
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/utilities.hpp b/project/jni/boost/include/boost/container/detail/utilities.hpp
index ee0fe993b..5c294e1cd 100644
--- a/project/jni/boost/include/boost/container/detail/utilities.hpp
+++ b/project/jni/boost/include/boost/container/detail/utilities.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -18,16 +18,29 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
 namespace container_detail {
 
+template 
+inline T* addressof(T& obj)
+{
+   return static_cast(
+	   static_cast(
+	      const_cast(
+            &reinterpret_cast(obj)
+   )));
+}
+
 template
 const T &max_value(const T &a, const T &b)
 {  return a > b ? a : b;   }
@@ -112,46 +125,6 @@ struct ct_rounded_size
 {
    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
 };
-/*
-template 
-struct __rw_is_enum
-{
-   struct _C_no { };
-   struct _C_yes { int _C_dummy [2]; };
-
-   struct _C_indirect {
-   // prevent classes with user-defined conversions from matching
-
-   // use double to prevent float->int gcc conversion warnings
-   _C_indirect (double);
-};
-
-// nested struct gets rid of bogus gcc errors
-struct _C_nest {
-   // supply first argument to prevent HP aCC warnings
-   static _C_no _C_is (int, ...);
-   static _C_yes _C_is (int, _C_indirect);
-
-   static _TypeT _C_make_T ();
-};
-
-enum {
-   _C_val = sizeof (_C_yes) == sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
-   && !::boost::is_fundamental<_TypeT>::value
-};
-
-}; 
-*/
-
-template
-struct move_const_ref_type
-   : if_c
-//   < ::boost::is_fundamental::value || ::boost::is_pointer::value || ::boost::is_member_pointer::value || ::boost::is_enum::value
-   < !::boost::is_class::value
-   ,const T &
-   ,BOOST_CATCH_CONST_RLVALUE(T)
-   >
-{};
 
 }  //namespace container_detail {
 
@@ -174,13 +147,95 @@ template
     typename F> // F models ForwardIterator
 F uninitialized_move_alloc(A &a, I f, I l, F r)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
-      ++f; ++r;
+   F back = r;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
    return r;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_move_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, boost::move(*first));
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_move_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, boost::move(*first));
+//!   \endcode
+//!
+//! Returns: first (after incremented)
+template
+    // F models ForwardIterator
+I uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return f;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //                               uninitialized_copy_alloc
@@ -200,13 +255,95 @@ template
     typename F> // F models ForwardIterator
 F uninitialized_copy_alloc(A &a, I f, I l, F r)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
-      ++f; ++r;
+   F back = r;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
    return r;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: first (after incremented)
+template
+    // F models ForwardIterator
+I uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return f;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //                               uninitialized_copy_alloc
@@ -223,13 +360,23 @@ F uninitialized_copy_alloc(A &a, I f, I l, F r)
 template
     
+    typename T>
 void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*f), t);
-      ++f;
+   F back = f;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*f), t);
+         ++f;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != l; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -262,6 +409,169 @@ F uninitialized_copy_or_move_alloc
    return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                            uninitialized_copy_or_move_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc_n
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_move_alloc_n(a, f, n, r);
+}
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc_n
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_copy_alloc_n(a, f, n, r);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                            uninitialized_copy_or_move_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+I uninitialized_copy_or_move_alloc_n_source
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_move_alloc_n_source(a, f, n, r);
+}
+
+template
+   // F models ForwardIterator
+I uninitialized_copy_or_move_alloc_n_source
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_copy_alloc_n_source(a, f, n, r);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // 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 >::type* = 0)
+{
+   while (f != l) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return r;
+}
+
+template
+   // 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 >::type* = 0)
+{
+   while (f != l) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+inline F copy_or_move_n(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return r;
+}
+
+template
+   // F models ForwardIterator
+inline F copy_or_move_n(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+inline I copy_or_move_n_source(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return f;
+}
+
+template
+   // F models ForwardIterator
+inline I copy_or_move_n_source(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return f;
+}
+
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/project/jni/boost/include/boost/container/detail/value_init.hpp b/project/jni/boost/include/boost/container/detail/value_init.hpp
index afbc9c1e3..ec1a99c56 100644
--- a/project/jni/boost/include/boost/container/detail/value_init.hpp
+++ b/project/jni/boost/include/boost/container/detail/value_init.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,7 +21,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template
@@ -36,8 +36,8 @@ struct value_init
    T m_t;
 };
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp b/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
index f21f972ab..d903dfa04 100644
--- a/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
+++ b/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -21,7 +21,7 @@
 #include    //std::size_t
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template
@@ -136,7 +136,7 @@ struct index_tuple{};
 template >
 struct build_number_seq;
 
-template 
+template
 struct build_number_seq >
    : build_number_seq >
 {};
diff --git a/project/jni/boost/include/boost/container/detail/version_type.hpp b/project/jni/boost/include/boost/container/detail/version_type.hpp
index 46344faca..e47ba26f1 100644
--- a/project/jni/boost/include/boost/container/detail/version_type.hpp
+++ b/project/jni/boost/include/boost/container/detail/version_type.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -38,7 +38,7 @@ struct version_type
 
 namespace impl{
 
-template , typename T::version>::value>
 struct extract_version
 {
diff --git a/project/jni/boost/include/boost/container/detail/workaround.hpp b/project/jni/boost/include/boost/container/detail/workaround.hpp
index 45ab2f2c4..06cb7337c 100644
--- a/project/jni/boost/include/boost/container/detail/workaround.hpp
+++ b/project/jni/boost/include/boost/container/detail/workaround.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -13,19 +13,32 @@
 
 #include 
 
-#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)
    #define BOOST_CONTAINER_PERFECT_FORWARDING
 #endif
 
-#if defined(BOOST_NO_NOEXCEPT)
-   #define BOOST_CONTAINER_NOEXCEPT
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
+   #if defined(BOOST_MSVC)
+      #define BOOST_CONTAINER_NOEXCEPT throw()
+   #else
+      #define BOOST_CONTAINER_NOEXCEPT
+   #endif
    #define BOOST_CONTAINER_NOEXCEPT_IF(x)
 #else
    #define BOOST_CONTAINER_NOEXCEPT    noexcept
    #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
 #endif
 
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
+    && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
+   #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
+#endif
+
+//Macros for documentation purposes. For code, expands to the argument
+#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE
+#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE
+
 #include 
 
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
diff --git a/project/jni/boost/include/boost/container/flat_map.hpp b/project/jni/boost/include/boost/container/flat_map.hpp
index 2d4515b4a..2dd2210e0 100644
--- a/project/jni/boost/include/boost/container/flat_map.hpp
+++ b/project/jni/boost/include/boost/container/flat_map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -26,33 +26,25 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators == and <, needed for friend declarations.
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
-#else
-template 
-#endif
+template 
 class flat_map;
 
-template 
-inline bool operator==(const flat_map& x, 
-                       const flat_map& y);
+template 
+inline bool operator==(const flat_map& x,
+                       const flat_map& y);
 
-template 
-inline bool operator<(const flat_map& x, 
-                      const flat_map& y);
+template 
+inline bool operator<(const flat_map& x,
+                      const flat_map& y);
 
 namespace container_detail{
 
@@ -73,346 +65,414 @@ static D force_copy(S s)
 /// @endcond
 
 //! A flat_map is a kind of associative container that supports unique keys (contains at
-//! most one of each key value) and provides for fast retrieval of values of another 
+//! most one of each key value) and provides for fast retrieval of values of another
 //! type T based on the keys. The flat_map class supports random-access iterators.
-//! 
-//! A flat_map satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. A flat_map also provides 
-//! most operations described for unique keys. For a 
+//!
+//! A flat_map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. A flat_map also provides
+//! most operations described for unique keys. For a
 //! flat_map the key_type is Key and the value_type is std::pair
 //! (unlike std::map which value_type is std::pair<const Key, T>).
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair >).
-//! 
+//!
 //! flat_map is similar to std::map but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_map invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_map invalidates iterators and references 
+//! Erasing an element of a flat_map invalidates iterators and references
 //! pointing to elements that come after (their keys are bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< Key, T> > >
 #else
-template 
+template 
 #endif
-class flat_map 
+class flat_map
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_map)
    //This is the tree that we should store if pair was movable
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+   typedef container_detail::flat_tree,
+                           container_detail::select1st< std::pair >,
+                           Compare,
+                           Allocator> tree_t;
 
    //This is the real tree stored here. It's based on a movable pair
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st >, 
-                           Pred, 
-                           typename allocator_traits::template portable_rebind_alloc
+   typedef container_detail::flat_tree,
+                           container_detail::select1st >,
+                           Compare,
+                           typename allocator_traits::template portable_rebind_alloc
                                >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
-   typedef typename impl_tree_t::pointer                 impl_pointer;
-   typedef typename impl_tree_t::const_pointer           impl_const_pointer;
-   typedef typename impl_tree_t::reference               impl_reference;
-   typedef typename impl_tree_t::const_reference         impl_const_reference;
-   typedef typename impl_tree_t::value_compare           impl_value_compare;
-   typedef typename impl_tree_t::iterator                impl_iterator;
    typedef typename impl_tree_t::const_iterator          impl_const_iterator;
-   typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
-   typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
-   typedef allocator_traits                           allocator_traits_type;
-
-
-
+   typedef container_detail::flat_tree_value_compare
+      < Compare
+      , container_detail::select1st< std::pair >
+      , std::pair >                                                         value_compare_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::iterator                  iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+      ::pointer>::const_iterator               const_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::reverse_iterator          reverse_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::const_reverse_iterator    const_reverse_iterator_impl;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef Key                                              key_type;
-   typedef T                                                mapped_type;
-   typedef typename std::pair        value_type;
-   typedef typename allocator_traits_type::pointer          pointer;
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   typedef typename allocator_traits_type::reference        reference;
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   typedef typename impl_tree_t::size_type                  size_type;
-   typedef typename impl_tree_t::difference_type            difference_type;
-
-   typedef container_detail::flat_tree_value_compare
-      < Pred
-      , container_detail::select1st< std::pair >
-      , std::pair >                                 value_compare;
-   typedef Pred                                             key_compare;
-   typedef typename container_detail::
-      get_flat_tree_iterators::iterator            iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators::const_iterator      const_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::reverse_iterator                        reverse_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::const_reverse_iterator                  const_reverse_iterator;
-   typedef A                                                allocator_type;
-   typedef A                                                stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                        value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(Allocator)                                        stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                    iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                              const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(reverse_iterator_impl)                            reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_reverse_iterator_impl)                      const_reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(impl_value_type)                                  movable_value_type;
 
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Default constructs an empty flat_map.
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_map() 
+   flat_map()
       : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type()) 
+   explicit flat_map(const Compare& comp, const allocator_type& a = allocator_type())
       : m_flat_tree(comp, container_detail::force(a)) {}
 
-   //! Effects: Constructs an empty flat_map using the specified comparison object and 
+   //! Effects: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   flat_map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   flat_map(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force(a)) 
-      { m_flat_tree.insert_unique(first, last); }
+      : m_flat_tree(true, first, last, comp, container_detail::force(a))
+   {}
 
-   //! Effects: Constructs an empty flat_map using the specified comparison object and 
+   //! Effects: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_map( ordered_unique_range_t, InputIterator first, InputIterator last
-           , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+           , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a flat_map.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_map(const flat_map& x) 
+   flat_map(const flat_map& x)
       : m_flat_tree(x.m_flat_tree) {}
 
    //! Effects: Move constructs a flat_map.
    //!   Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_map(BOOST_RV_REF(flat_map) x) 
+   flat_map(BOOST_RV_REF(flat_map) x)
       : m_flat_tree(boost::move(x.m_flat_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a flat_map using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
+   flat_map(const flat_map& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_map using the specified allocator.
+   //!   Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if x.get_allocator() == a, linear otherwise.
+   flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a)
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
    {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: Move constructs a flat_map.
    //!   Constructs *this using x's resources.
-   //! 
+   //!
    //! Complexity: Construct.
-   //! 
+   //!
    //! Postcondition: x is emptied.
-   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
+   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return container_detail::force(m_flat_tree.key_comp()); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
-      { return container_detail::force(m_flat_tree.get_allocator()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.get_allocator()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-      { return container_detail::force(m_flat_tree.begin()); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const 
-      { return container_detail::force(m_flat_tree.cbegin()); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-      { return container_detail::force(m_flat_tree.end()); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
-   //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
-      { return container_detail::force(m_flat_tree.cend()); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return container_detail::force(m_flat_tree.rbegin()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return container_detail::force(m_flat_tree.rbegin()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return container_detail::force(m_flat_tree.crbegin()); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
-      { return container_detail::force(m_flat_tree.rend()); }
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
-      { return container_detail::force(m_flat_tree.rend()); }
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cbegin()); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cend()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crbegin()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
-      { return container_detail::force(m_flat_tree.crend()); }
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crend()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT        
+      { return m_flat_tree.capacity(); }
+
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+   //!
+   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
+   //!
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: If there is no key equivalent to x in the flat_map, inserts 
+   //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //!   value_type(x, T()) into the flat_map.
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type &operator[](const key_type& k);
 
-   //! Effects: If there is no key equivalent to x in the flat_map, inserts 
+   //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //! value_type(move(x), T()) into the flat_map (the key is move-constructed)
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type &operator[](key_type &&k) ;
 
    #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
    #endif
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
+   //!
    //! Throws: An exception object of type out_of_range if no such element is present.
+   //!
    //! Complexity: logarithmic.
    T& at(const key_type& k)
    {
@@ -423,8 +483,10 @@ class flat_map
       return i->second;
    }
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
+   //!
    //! Throws: An exception object of type out_of_range if no such element is present.
+   //!
    //! Complexity: logarithmic.
    const T& at(const key_type& k) const
    {
@@ -435,124 +497,19 @@ class flat_map
       return i->second;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(flat_map& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
-
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(const value_type& x) 
-      { return container_detail::force >(
-         m_flat_tree.insert_unique(container_detail::force(x))); }
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return container_detail::force >(
-      m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); }
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(impl_value_type) x) 
-   {
-      return container_detail::force >
-      (m_flat_tree.insert_unique(boost::move(x)));
-   }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, const value_type& x)
-      { return container_detail::force_copy(
-         m_flat_tree.insert_unique(container_detail::force(position), container_detail::force(x))); }
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
-      { return container_detail::force_copy
-         (m_flat_tree.insert_unique(container_detail::force(position), boost::move(container_detail::force(x)))); }
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
-   {
-      return container_detail::force_copy(
-         m_flat_tree.insert_unique(container_detail::force(position), boost::move(x)));
-   }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_flat_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is no element in the container 
+   //!   std::forward(args)... if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -565,7 +522,7 @@ class flat_map
    {  return container_detail::force_copy< std::pair >(m_flat_tree.emplace_unique(boost::forward(args)...)); }
 
    //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -578,8 +535,11 @@ class flat_map
    //! Note: If an element is inserted it might invalidate elements.
    template 
    iterator emplace_hint(const_iterator hint, Args&&... args)
-   {  return container_detail::force_copy
-      (m_flat_tree.emplace_hint_unique(container_detail::force(hint), boost::forward(args)...)); }
+   {
+      return container_detail::force_copy
+         (m_flat_tree.emplace_hint_unique( container_detail::force_copy(hint)
+                                         , boost::forward(args)...));
+   }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
@@ -593,7 +553,7 @@ class flat_map
    iterator emplace_hint(const_iterator hint                                                       \
                          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))              \
    {  return container_detail::force_copy(m_flat_tree.emplace_hint_unique                \
-            (container_detail::force(hint)                                    \
+            (container_detail::force_copy(hint)                               \
                BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                 \
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -601,18 +561,147 @@ class flat_map
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(const value_type& x)
+      { return container_detail::force_copy >(
+         m_flat_tree.insert_unique(container_detail::force(x))); }
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(BOOST_RV_REF(value_type) x)
+   {  return container_detail::force_copy >(
+      m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); }
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(BOOST_RV_REF(movable_value_type) x)
+   {
+      return container_detail::force_copy >
+      (m_flat_tree.insert_unique(boost::move(x)));
+   }
+
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, const value_type& x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_unique( container_detail::force_copy(position)
+                                  , container_detail::force(x)));
+   }
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_unique( container_detail::force_copy(position)
+                                   , boost::move(container_detail::force(x))));
+   }
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_unique(container_detail::force_copy(position), boost::move(x)));
+   }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_flat_tree.insert_unique(first, last);  }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Requires: [first ,last) must be ordered according to the predicate and must be
+   //! unique values.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element. This
+   //!   function is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(ordered_unique_range, first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
-      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
+   iterator erase(const_iterator position)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.erase(container_detail::force_copy(position)));
+   }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -620,7 +709,7 @@ class flat_map
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       { return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -632,106 +721,113 @@ class flat_map
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return container_detail::force_copy
-         (m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
+   {
+      return container_detail::force_copy(
+         m_flat_tree.erase( container_detail::force_copy(first)
+                          , container_detail::force_copy(last)));
+   }
+
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_map& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return container_detail::force_copy(m_flat_tree.key_comp()); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return container_detail::force_copy(m_flat_tree.find(x)); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
-      { return container_detail::force(m_flat_tree.find(x)); }
+   const_iterator find(const key_type& x) const
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       {  return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.lower_bound(x)); }
+   const_iterator lower_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
       {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
+   const_iterator upper_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
-      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
+   std::pair equal_range(const key_type& x)
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) const 
-      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
+   std::pair equal_range(const key_type& x) const
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x)); }
 
    /// @cond
    template 
@@ -752,7 +848,7 @@ class flat_map
       }
       return (*i).second;
    }
-   mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk) 
+   mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
    {
       key_type &k = mk;
       iterator i = lower_bound(k);
@@ -766,448 +862,445 @@ class flat_map
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator==(const flat_map& x,
+                       const flat_map& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_map& x, 
-                      const flat_map& y) 
+template 
+inline bool operator<(const flat_map& x,
+                      const flat_map& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator!=(const flat_map& x,
+                       const flat_map& y)
    {  return !(x == y); }
 
-template 
-inline bool operator>(const flat_map& x, 
-                      const flat_map& y) 
+template 
+inline bool operator>(const flat_map& x,
+                      const flat_map& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator<=(const flat_map& x,
+                       const flat_map& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator>=(const flat_map& x,
+                       const flat_map& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_map& x, 
-                 flat_map& y) 
+template 
+inline void swap(flat_map& x,
+                 flat_map& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
-#else
-template 
-#endif
+template 
 class flat_multimap;
 
-template 
-inline bool operator==(const flat_multimap& x, 
-                       const flat_multimap& y);
+template 
+inline bool operator==(const flat_multimap& x,
+                       const flat_multimap& y);
 
-template 
-inline bool operator<(const flat_multimap& x, 
-                      const flat_multimap& y);
+template 
+inline bool operator<(const flat_multimap& x,
+                      const flat_multimap& y);
 /// @endcond
 
-//! A flat_multimap is a kind of associative container that supports equivalent keys 
-//! (possibly containing multiple copies of the same key value) and provides for 
-//! fast retrieval of values of another type T based on the keys. The flat_multimap 
+//! A flat_multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
+//! fast retrieval of values of another type T based on the keys. The flat_multimap
 //! class supports random-access iterators.
-//! 
-//! A flat_multimap satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
+//!
+//! A flat_multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
 //! flat_multimap the key_type is Key and the value_type is std::pair
 //! (unlike std::multimap which value_type is std::pair<const Key, T>).
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair >).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< Key, T> > >
 #else
-template 
+template 
 #endif
-class flat_multimap 
+class flat_multimap
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+   typedef container_detail::flat_tree,
+                           container_detail::select1st< std::pair >,
+                           Compare,
+                           Allocator> tree_t;
    //This is the real tree stored here. It's based on a movable pair
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st >, 
-                           Pred, 
-                           typename allocator_traits::template portable_rebind_alloc
+   typedef container_detail::flat_tree,
+                           container_detail::select1st >,
+                           Compare,
+                           typename allocator_traits::template portable_rebind_alloc
                                >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
-   typedef typename impl_tree_t::pointer                 impl_pointer;
-   typedef typename impl_tree_t::const_pointer           impl_const_pointer;
-   typedef typename impl_tree_t::reference               impl_reference;
-   typedef typename impl_tree_t::const_reference         impl_const_reference;
-   typedef typename impl_tree_t::value_compare           impl_value_compare;
-   typedef typename impl_tree_t::iterator                impl_iterator;
    typedef typename impl_tree_t::const_iterator          impl_const_iterator;
-   typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
-   typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
-   typedef allocator_traits                           allocator_traits_type;
-
+   typedef container_detail::flat_tree_value_compare
+      < Compare
+      , container_detail::select1st< std::pair >
+      , std::pair >                                                         value_compare_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::iterator                  iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+      ::pointer>::const_iterator               const_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::reverse_iterator          reverse_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::const_reverse_iterator    const_reverse_iterator_impl;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef Key                                              key_type;
-   typedef T                                                mapped_type;
-   typedef Pred                                             key_compare;
-   typedef typename std::pair        value_type;
-   typedef typename allocator_traits_type::pointer          pointer;
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   typedef typename allocator_traits_type::reference        reference;
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   typedef typename impl_tree_t::size_type                  size_type;
-   typedef typename impl_tree_t::difference_type            difference_type;
-   typedef container_detail::flat_tree_value_compare
-      < Pred
-      , container_detail::select1st< std::pair >
-      , std::pair >                                 value_compare;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                        value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(Allocator)                                        stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                    iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                              const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(reverse_iterator_impl)                            reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_reverse_iterator_impl)                      const_reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(impl_value_type)                                  movable_value_type;
 
-   typedef typename container_detail::
-      get_flat_tree_iterators::iterator            iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators::const_iterator      const_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::reverse_iterator                        reverse_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::const_reverse_iterator                  const_reverse_iterator;
-   typedef A                                                allocator_type;
-   //Non-standard extension
-   typedef A                                                stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty flat_map.
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_multimap() 
+   flat_multimap()
       : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_multimap(const Pred& comp,
+   explicit flat_multimap(const Compare& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, container_detail::force(a)) { }
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    flat_multimap(InputIterator first, InputIterator last,
-            const Pred& comp        = Pred(),
+            const Compare& comp        = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force(a)) 
-      { m_flat_tree.insert_equal(first, last); }
+      : m_flat_tree(false, first, last, comp, container_detail::force(a))
+   {}
 
-   //! Effects: Constructs an empty flat_multimap using the specified comparison object and 
+   //! Effects: Constructs an empty flat_multimap using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_multimap(ordered_range_t, InputIterator first, InputIterator last,
-            const Pred& comp        = Pred(),
+            const Compare& comp        = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a flat_multimap.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_multimap(const flat_multimap& x) 
+   flat_multimap(const flat_multimap& x)
       : m_flat_tree(x.m_flat_tree) { }
 
    //! Effects: Move constructs a flat_multimap. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_multimap(BOOST_RV_REF(flat_multimap) x) 
+   flat_multimap(BOOST_RV_REF(flat_multimap) x)
       : m_flat_tree(boost::move(x.m_flat_tree))
+   {}
+
+   //! Effects: Copy constructs a flat_multimap using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multimap(const flat_multimap& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a)
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
    { }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x) 
+   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx) 
+   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx)
       {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return container_detail::force(m_flat_tree.key_comp()); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
-      { return container_detail::force(m_flat_tree.get_allocator()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.get_allocator()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-      { return container_detail::force(m_flat_tree.begin()); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-      { return container_detail::force(m_flat_tree.end()); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return container_detail::force(m_flat_tree.rbegin()); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return container_detail::force(m_flat_tree.rbegin()); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
-      { return container_detail::force(m_flat_tree.rend()); }
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
-      { return container_detail::force(m_flat_tree.rend()); }
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cbegin()); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cend()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crbegin()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crend()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_multimap& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const value_type& x) 
-      { return container_detail::force_copy(m_flat_tree.insert_equal(container_detail::force(x))); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(impl_value_type) x) 
-      { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, const value_type& x) 
-      { return container_detail::force_copy
-         (m_flat_tree.insert_equal(container_detail::force(position), container_detail::force(x))); }
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {
-      return container_detail::force_copy
-         (m_flat_tree.insert_equal(container_detail::force(position)
-                                  , boost::move(x)));
-   }
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x) 
-   {
-      return container_detail::force_copy(
-         m_flat_tree.insert_equal(container_detail::force(position), boost::move(x)));
-   }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_equal(first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic search time plus linear insertion
    //!   to the elements with bigger keys than x.
@@ -1233,7 +1326,7 @@ class flat_multimap
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {
       return container_detail::force_copy(m_flat_tree.emplace_hint_equal
-         (container_detail::force(hint), boost::forward(args)...));
+         (container_detail::force_copy(hint), boost::forward(args)...));
    }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -1248,7 +1341,7 @@ class flat_multimap
    iterator emplace_hint(const_iterator hint                                                       \
                          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))              \
    {  return container_detail::force_copy(m_flat_tree.emplace_hint_equal                 \
-            (container_detail::force(hint)                                    \
+            (container_detail::force_copy(hint)                               \
                BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                 \
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -1256,18 +1349,135 @@ class flat_multimap
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const value_type& x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_equal(container_detail::force(x)));
+   }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(BOOST_RV_REF(value_type) x)
+   { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(BOOST_RV_REF(impl_value_type) x)
+      { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, const value_type& x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_equal( container_detail::force_copy(position)
+                                  , container_detail::force(x)));
+   }
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_equal(container_detail::force_copy(position)
+                                  , boost::move(x)));
+   }
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_equal(container_detail::force_copy(position), boost::move(x)));
+   }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(first, last); }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Requires: [first ,last) must be ordered according to the predicate.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element. This
+   //!   function is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(ordered_range, first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
-      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
+   iterator erase(const_iterator position)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.erase(container_detail::force_copy(position)));
+   }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -1275,7 +1485,7 @@ class flat_multimap
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       { return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1287,25 +1497,53 @@ class flat_multimap
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return container_detail::force_copy
-         (m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
+   {
+      return container_detail::force_copy
+         (m_flat_tree.erase( container_detail::force_copy(first)
+                           , container_detail::force_copy(last)));
+   }
+
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_multimap& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return container_detail::force_copy(m_flat_tree.key_comp()); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
@@ -1318,77 +1556,55 @@ class flat_multimap
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
-      { return container_detail::force(m_flat_tree.find(x)); }
+   const_iterator find(const key_type& x) const
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       { return m_flat_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
-      {return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
+   iterator lower_bound(const key_type& x)
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key
+   //! Returns: Allocator const iterator pointing to the first element with key
    //!   not less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.lower_bound(x));  }
+   const_iterator lower_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x));  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
       {return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key
+   //! Returns: Allocator const iterator pointing to the first element with key
    //!   not less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
+   const_iterator upper_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_multimap& x,
@@ -1400,38 +1616,38 @@ class flat_multimap
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator==(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_multimap& x, 
-                      const flat_multimap& y) 
+template 
+inline bool operator<(const flat_multimap& x,
+                      const flat_multimap& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator!=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(x == y);  }
 
-template 
-inline bool operator>(const flat_multimap& x, 
-                      const flat_multimap& y) 
+template 
+inline bool operator>(const flat_multimap& x,
+                      const flat_multimap& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator<=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator>=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_multimap& x, flat_multimap& y) 
+template 
+inline void swap(flat_multimap& x, flat_multimap& y)
    {  x.swap(y);  }
 
 }}
@@ -1439,16 +1655,16 @@ inline void swap(flat_multimap& x, flat_multimap& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move< boost::container::flat_multimap >
+template 
+struct has_trivial_destructor_after_move< boost::container::flat_multimap >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
-}  //namespace boost { 
+
+}  //namespace boost {
 
 /// @endcond
 
diff --git a/project/jni/boost/include/boost/container/flat_set.hpp b/project/jni/boost/include/boost/container/flat_set.hpp
index f36730972..82bdea8c0 100644
--- a/project/jni/boost/include/boost/container/flat_set.hpp
+++ b/project/jni/boost/include/boost/container/flat_set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -24,405 +24,384 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators < and ==, needed for friend declaration.
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class flat_set;
 
-template 
-inline bool operator==(const flat_set& x, 
-                       const flat_set& y);
+template 
+inline bool operator==(const flat_set& x,
+                       const flat_set& y);
 
-template 
-inline bool operator<(const flat_set& x, 
-                      const flat_set& y);
+template 
+inline bool operator<(const flat_set& x,
+                      const flat_set& y);
 /// @endcond
 
-//! flat_set is a Sorted Associative Container that stores objects of type Key. 
-//! flat_set is a Simple Associative Container, meaning that its value type, 
-//! as well as its key type, is Key. It is also a Unique Associative Container, 
-//! meaning that no two elements are the same. 
-//! 
+//! flat_set is a Sorted Associative Container that stores objects of type Key.
+//! flat_set is a Simple Associative Container, meaning that its value type,
+//! as well as its key type, is Key. It is also a Unique Associative Container,
+//! meaning that no two elements are the same.
+//!
 //! flat_set is similar to std::set but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_set invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_set invalidates iterators and references 
+//! Erasing an element of a flat_set invalidates iterators and references
 //! pointing to elements that come after (their keys are bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class flat_set 
+class flat_set
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_set)
-   typedef container_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Compare, Allocator> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_set
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef typename tree_t::key_compare            key_compare;
-   typedef typename tree_t::value_compare          value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
-   //! Effects: Defatuls constructs an empty flat_map.
-   //! 
+   //! Effects: Default constructs an empty flat_set.
+   //!
    //! Complexity: Constant.
    explicit flat_set()
       : m_flat_tree()
    {}
 
-   //! Effects: Constructs an empty flat_map using the specified
+   //! Effects: Constructs an empty flat_set using the specified
    //! comparison object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_set(const Pred& comp,
+   explicit flat_set(const Compare& comp,
                      const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a)
    {}
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   flat_set(InputIterator first, InputIterator last, 
-            const Pred& comp = Pred(),
+   flat_set(InputIterator first, InputIterator last,
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, a) 
-      { m_flat_tree.insert_unique(first, last); }
+      : m_flat_tree(true, first, last, comp, a)
+   {}
 
-   //! Effects: Constructs an empty flat_set using the specified comparison object and 
+   //! Effects: Constructs an empty flat_set using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
-   flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, 
-            const Pred& comp = Pred(),
+   flat_set(ordered_unique_range_t, InputIterator first, InputIterator last,
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
-   //! Effects: Copy constructs a map.
-   //! 
+   //! Effects: Copy constructs a set.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set(const flat_set& x) 
-      : m_flat_tree(x.m_flat_tree) {}
+   flat_set(const flat_set& x)
+      : m_flat_tree(x.m_flat_tree)
+   {}
 
-   //! Effects: Move constructs a map. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //! Effects: Move constructs a set. Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_set(BOOST_RV_REF(flat_set) mx) 
+   flat_set(BOOST_RV_REF(flat_set) mx)
       : m_flat_tree(boost::move(mx.m_flat_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a set using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
+   flat_set(const flat_set& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_set(BOOST_RV_REF(flat_set) mx, const allocator_type &a)
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Makes *this a copy of the previous value of xx.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
+   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return m_flat_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return m_flat_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    {  return m_flat_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    {  return m_flat_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
-   //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const 
-      { return m_flat_tree.cbegin(); }
-
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
-   //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
-      { return m_flat_tree.cend(); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return m_flat_tree.rbegin(); } 
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return m_flat_tree.rbegin(); } 
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return m_flat_tree.crbegin(); } 
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend()
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.cbegin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.cend(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.crbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.crend(); }
 
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_set& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
+   //! Throws: If memory allocation allocation throws or Key's copy constructor throws.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   std::pair insert(T &x)
-   { return this->insert(const_cast(x)); }
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or Key's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   template
-   std::pair insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_unique(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_unique(position, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is no element in the container 
+   //! Effects: Inserts an object x of type Key constructed with
+   //!   std::forward(args)... if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -434,8 +413,8 @@ class flat_set
    std::pair emplace(Args&&... args)
    {  return m_flat_tree.emplace_unique(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //! Effects: Inserts an object of type Key constructed with
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -468,17 +447,106 @@ class flat_set
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(const value_type &x);
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(value_type &&x);
+   #else
+   private:
+   typedef std::pair insert_return_pair;
+   public:
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(first, last);  }
+
+   //! Requires: first, last are not iterators into *this and
+   //! must be ordered according to the predicate and must be
+   //! unique values.
+   //!
+   //! Effects: inserts each element from the range [first,last) .This function
+   //! is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: Non-standard extension. If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(ordered_unique_range, first, last);  }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
       {  return m_flat_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -487,7 +555,7 @@ class flat_set
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       {  return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -498,58 +566,83 @@ class flat_set
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
       {  return m_flat_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_set& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return m_flat_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
       { return m_flat_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       {  return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return m_flat_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
       {  return m_flat_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -559,48 +652,25 @@ class flat_set
    iterator upper_bound(const key_type& x)
       {  return m_flat_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
       {  return m_flat_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return m_flat_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return m_flat_tree.equal_range(x); }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_set&, const flat_set&);
@@ -609,414 +679,407 @@ class flat_set
    friend bool operator< (const flat_set&, const flat_set&);
 
    private:
-   std::pair priv_insert(const T &x) 
-   {  return m_flat_tree.insert_unique(x);  }
+   template
+   std::pair priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_unique(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_flat_tree.insert_unique(p, x); }
+   template
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_unique(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator==(const flat_set& x,
+                       const flat_set& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_set& x, 
-                      const flat_set& y) 
+template 
+inline bool operator<(const flat_set& x,
+                      const flat_set& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator!=(const flat_set& x,
+                       const flat_set& y)
    {  return !(x == y);   }
 
-template 
-inline bool operator>(const flat_set& x, 
-                      const flat_set& y) 
+template 
+inline bool operator>(const flat_set& x,
+                      const flat_set& y)
    {  return y < x; }
 
-template 
-inline bool operator<=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator<=(const flat_set& x,
+                       const flat_set& y)
    {  return !(y < x); }
 
-template 
-inline bool operator>=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator>=(const flat_set& x,
+                       const flat_set& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_set& x, flat_set& y) 
+template 
+inline void swap(flat_set& x, flat_set& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value &&has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value &&has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class flat_multiset;
 
-template 
-inline bool operator==(const flat_multiset& x, 
-                       const flat_multiset& y);
+template 
+inline bool operator==(const flat_multiset& x,
+                       const flat_multiset& y);
 
-template 
-inline bool operator<(const flat_multiset& x, 
-                      const flat_multiset& y);
+template 
+inline bool operator<(const flat_multiset& x,
+                      const flat_multiset& y);
 /// @endcond
 
-//! flat_multiset is a Sorted Associative Container that stores objects of type Key. 
-//! flat_multiset is a Simple Associative Container, meaning that its value type, 
+//! flat_multiset is a Sorted Associative Container that stores objects of type Key.
+//! flat_multiset is a Simple Associative Container, meaning that its value type,
 //! as well as its key type, is Key.
 //! flat_Multiset can store multiple copies of the same key value.
-//! 
+//!
 //! flat_multiset is similar to std::multiset but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_multiset invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_multiset invalidates iterators and references 
+//! Erasing an element of a flat_multiset invalidates iterators and references
 //! pointing to elements that come after (their keys are equal or bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class flat_multiset 
+class flat_multiset
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
-   typedef container_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Compare, Allocator> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_multiset
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef typename tree_t::key_compare            key_compare;
-   typedef typename tree_t::value_compare          value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   //! Effects: Defatuls constructs an empty flat_map.
-   //! 
+   //! Effects: Default constructs an empty flat_multiset.
+   //!
    //! Complexity: Constant.
    explicit flat_multiset()
       : m_flat_tree()
    {}
 
-   explicit flat_multiset(const Pred& comp,
+   explicit flat_multiset(const Compare& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a) {}
 
    template 
    flat_multiset(InputIterator first, InputIterator last,
-                 const Pred& comp        = Pred(),
+                 const Compare& comp        = Compare(),
                  const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, a) 
-      { m_flat_tree.insert_equal(first, last); }
+      : m_flat_tree(false, first, last, comp, a)
+   {}
 
-   //! Effects: Constructs an empty flat_multiset using the specified comparison object and 
+   //! Effects: Constructs an empty flat_multiset using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last ). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_multiset(ordered_range_t, InputIterator first, InputIterator last,
-                 const Pred& comp        = Pred(),
+                 const Compare& comp        = Compare(),
                  const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
-   flat_multiset(const flat_multiset& x) 
-      : m_flat_tree(x.m_flat_tree) {}
-
-   flat_multiset(BOOST_RV_REF(flat_multiset) x) 
-      : m_flat_tree(boost::move(x.m_flat_tree))
+   //! Effects: Copy constructs a flat_multiset.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x)
+      : m_flat_tree(x.m_flat_tree)
    {}
 
-   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) 
+   //! Effects: Move constructs a flat_multiset. Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Postcondition: x is emptied.
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx)
+      : m_flat_tree(boost::move(mx.m_flat_tree))
+   {}
+
+   //! Effects: Copy constructs a flat_multiset using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx, const allocator_type &a)
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
-   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx) 
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return m_flat_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return m_flat_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_stored_allocator(); }
 
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return m_flat_tree.rbegin(); } 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return m_flat_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return m_flat_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend()
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_multiset& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation allocation throws or Key's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(T &x)
-   { return this->insert(const_cast(x)); }
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or Key's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   template
-   iterator insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a new value_type move constructed from x
-   //!   and returns the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_equal(boost::move(x));   }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts a new value move constructed  from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_equal(position, boost::move(x));  }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_equal(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic search time plus linear insertion
    //!   to the elements with bigger keys than x.
@@ -1026,7 +1089,7 @@ class flat_multiset
    iterator emplace(Args&&... args)
    {  return m_flat_tree.emplace_equal(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... in the container.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -1059,17 +1122,93 @@ class flat_multiset
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const value_type &x);
+
+   //! Effects: Inserts a new value_type move constructed from x
+   //!   and returns the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts a new value move constructed  from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(first, last);  }
+
+   //! Requires: first, last are not iterators into *this and
+   //! must be ordered according to the predicate.
+   //!
+   //! Effects: inserts each element from the range [first,last) .This function
+   //! is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: Non-standard extension. If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(ordered_range, first, last);  }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
       {  return m_flat_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1078,7 +1217,7 @@ class flat_multiset
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       {  return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1089,58 +1228,83 @@ class flat_multiset
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
       {  return m_flat_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_multiset& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return m_flat_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
       { return m_flat_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       { return m_flat_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return m_flat_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
       {  return m_flat_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -1150,48 +1314,25 @@ class flat_multiset
    iterator upper_bound(const key_type& x)
       {  return m_flat_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
       {  return m_flat_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return m_flat_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return m_flat_tree.equal_range(x); }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_multiset&,
@@ -1200,60 +1341,62 @@ class flat_multiset
    friend bool operator< (const flat_multiset&,
                           const flat_multiset&);
    private:
-   iterator priv_insert(const T &x) 
-   {  return m_flat_tree.insert_equal(x);  }
+   template 
+   iterator priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_equal(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_flat_tree.insert_equal(p, x); }
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_equal(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator==(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_multiset& x, 
-                      const flat_multiset& y) 
+template 
+inline bool operator<(const flat_multiset& x,
+                      const flat_multiset& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator!=(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return !(x == y);  }
 
-template 
-inline bool operator>(const flat_multiset& x, 
-                      const flat_multiset& y) 
+template 
+inline bool operator>(const flat_multiset& x,
+                      const flat_multiset& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator<=(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator>=(const flat_multiset& x,
+                       const flat_multiset& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(flat_multiset& x, flat_multiset& y) 
+template 
+inline void swap(flat_multiset& x, flat_multiset& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/list.hpp b/project/jni/boost/include/boost/container/list.hpp
index 6df999bb5..571e63aca 100644
--- a/project/jni/boost/include/boost/container/list.hpp
+++ b/project/jni/boost/include/boost/container/list.hpp
@@ -1,14 +1,14 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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.
 //
 
-#ifndef BOOST_CONTAINER_LIST_HPP_
-#define BOOST_CONTAINER_LIST_HPP_
+#ifndef BOOST_CONTAINER_LIST_HPP
+#define BOOST_CONTAINER_LIST_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -18,8 +18,9 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +33,7 @@
 #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 #else
 //Preprocessor library to emulate perfect forwarding
-#include  
+#include 
 #endif
 
 #include 
@@ -43,13 +44,8 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 namespace container_detail {
@@ -65,37 +61,18 @@ template 
 struct list_node
    :  public list_hook::type
 {
+   private:
+   list_node();
 
-   list_node()
-      : m_data()
-   {}
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   list_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-
-   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   list_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                          \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                     \
-   {}                                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename list_hook::type hook_type;
    T m_data;
 };
 
-template
+template
 struct intrusive_list_type
 {
-   typedef boost::container::allocator_traits   allocator_traits_type;
+   typedef boost::container::allocator_traits   allocator_traits_type;
    typedef typename allocator_traits_type::value_type value_type;
    typedef typename boost::intrusive::pointer_traits
       ::template
@@ -113,42 +90,140 @@ struct intrusive_list_type
    typedef container_type                       type ;
 };
 
+template
+class list_const_iterator
+   : public std::iterator< std::bidirectional_iterator_tag, T
+                         , typename iiterator_types::difference_type
+                         , typename iiterator_types::const_pointer
+                         , typename iiterator_types::const_reference>
+{
+   protected:
+
+   IIterator m_it;
+
+   public:
+   typedef typename iiterator_types::const_pointer     const_pointer;
+   typedef typename iiterator_types::const_reference   const_reference;
+
+   //Constructors
+   list_const_iterator()
+      : m_it()
+   {}
+
+   explicit list_const_iterator(const IIterator &it) 
+      : m_it(it)
+   {}
+
+   //Pointer like operators
+   const_reference operator*() const
+   { return this->m_it->m_data;  }
+
+   const_pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   list_const_iterator& operator++()      
+   { ++this->m_it;  return *this; }
+
+   list_const_iterator operator++(int)     
+   { IIterator tmp = this->m_it; ++*this; return list_const_iterator(tmp);  }
+
+   list_const_iterator& operator--()
+   { --this->m_it; return *this;   }
+
+   list_const_iterator operator--(int)
+   {  IIterator tmp = this->m_it; --*this; return list_const_iterator(tmp); }
+
+   //Comparison operators
+   friend bool operator== (const list_const_iterator& l, const list_const_iterator& r)
+   {  return l.m_it == r.m_it;  }
+
+   friend bool operator!= (const list_const_iterator& l, const list_const_iterator& r)
+   {  return l.m_it != r.m_it;  }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
+template
+class list_iterator
+   : public list_const_iterator
+{
+   private:
+   typedef list_const_iterator const_iterator;
+
+   public:
+   typedef typename iiterator_types::pointer           pointer;
+   typedef typename iiterator_types::reference         reference;
+
+   //Constructors
+   list_iterator()
+      : const_iterator()
+   {}
+
+   explicit list_iterator(const IIterator &it)
+      :  const_iterator(it)
+   {}
+
+   //Pointer like operators
+   reference operator*()  const
+   {  return  this->m_it->m_data;  }
+
+   pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   list_iterator& operator++() 
+   { ++this->m_it; return *this;  }
+
+   list_iterator operator++(int)
+   { IIterator tmp = this->m_it; ++*this; return list_iterator(tmp); }
+
+   list_iterator& operator--()
+   { --this->m_it; return *this;   }
+
+   list_iterator operator--(int)
+   {  IIterator tmp = this->m_it; --*this; return list_iterator(tmp); }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
 }  //namespace container_detail {
 /// @endcond
 
 //! A list is a doubly linked list. That is, it is a Sequence that supports both
-//! forward and backward traversal, and (amortized) constant time insertion and 
-//! removal of elements at the beginning or the end, or in the middle. Lists have 
-//! the important property that insertion and splicing do not invalidate iterators 
-//! to list elements, and that even removal invalidates only the iterators that point 
-//! to the elements that are removed. The ordering of iterators may be changed 
-//! (that is, list::iterator might have a different predecessor or successor 
-//! after a list operation than it did before), but the iterators themselves will 
-//! not be invalidated or made to point to different elements unless that invalidation 
+//! forward and backward traversal, and (amortized) constant time insertion and
+//! removal of elements at the beginning or the end, or in the middle. Lists have
+//! the important property that insertion and splicing do not invalidate iterators
+//! to list elements, and that even removal invalidates only the iterators that point
+//! to the elements that are removed. The ordering of iterators may be changed
+//! (that is, list::iterator might have a different predecessor or successor
+//! after a list operation than it did before), but the iterators themselves will
+//! not be invalidated or made to point to different elements unless that invalidation
 //! or mutation is explicit.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class list 
+class list
    : protected container_detail::node_alloc_holder
-      ::type>
+      ::type>
 {
    /// @cond
-   typedef typename 
-      container_detail::intrusive_list_type::type Icont;
-   typedef list                                 ThisType;
-   typedef container_detail::node_alloc_holder        AllocHolder;
-   typedef typename AllocHolder::NodePtr              NodePtr;
-   typedef typename AllocHolder::NodeAlloc            NodeAlloc;
-   typedef typename AllocHolder::ValAlloc             ValAlloc;
-   typedef typename AllocHolder::Node                 Node;
-   typedef container_detail::allocator_destroyer     Destroyer;
-   typedef typename AllocHolder::allocator_v1         allocator_v1;
-   typedef typename AllocHolder::allocator_v2         allocator_v2;
-   typedef typename AllocHolder::alloc_version        alloc_version;
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef typename
+      container_detail::intrusive_list_type::type Icont;
+   typedef container_detail::node_alloc_holder  AllocHolder;
+   typedef typename AllocHolder::NodePtr                          NodePtr;
+   typedef typename AllocHolder::NodeAlloc                        NodeAlloc;
+   typedef typename AllocHolder::ValAlloc                         ValAlloc;
+   typedef typename AllocHolder::Node                             Node;
+   typedef container_detail::allocator_destroyer       Destroyer;
+   typedef typename AllocHolder::allocator_v1                     allocator_v1;
+   typedef typename AllocHolder::allocator_v2                     allocator_v2;
+   typedef typename AllocHolder::alloc_version                    alloc_version;
+   typedef boost::container::allocator_traits          allocator_traits_type;
 
    class equal_to_value
    {
@@ -178,157 +253,55 @@ class list
       bool operator()(const Node &a) const
       {  return static_cast(*this)(a.m_data);  }
    };
-   /// @endcond
 
-   public:
-   //! The type of object, T, stored in the list
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                                allocator_type;
-   //! Non-standard extension: the stored allocator type
-   typedef NodeAlloc                                        stored_allocator_type;
-
-   /// @cond
-   private:
    BOOST_COPYABLE_AND_MOVABLE(list)
-   typedef difference_type                         list_difference_type;
-   typedef pointer                                 list_pointer;
-   typedef const_pointer                           list_const_pointer;
-   typedef reference                               list_reference;
-   typedef const_reference                         list_const_reference;
+
+   typedef container_detail::list_iterator      iterator_impl;
+   typedef container_detail::list_const_iteratorconst_iterator_impl;
    /// @endcond
 
    public:
-   //! Const iterator used to iterate through a list. 
-   class const_iterator
-      /// @cond
-      : public std::iterator
-   {
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-      protected:
-      typename Icont::iterator m_it;
-      explicit const_iterator(typename Icont::iterator it)  : m_it(it){}
-      void prot_incr() { ++m_it; }
-      void prot_decr() { --m_it; }
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(NodeAlloc)                                           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                       iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                                 const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
-      private:
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class list;
-      typedef list_difference_type        difference_type;
-
-      //Constructors
-      const_iterator()
-         :  m_it()
-      {}
-
-      //Pointer like operators
-      const_reference operator*()  const 
-      { return  m_it->m_data;  }
-
-      const_pointer   operator->() const 
-      { return  const_pointer(&m_it->m_data); }
-
-      //Increment / Decrement
-      const_iterator& operator++()       
-      { prot_incr();  return *this; }
-
-      const_iterator operator++(int)      
-      { typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp);  }
-
-      const_iterator& operator--()
-      {   prot_decr(); return *this;   }
-
-      const_iterator operator--(int)
-      {  typename Icont::iterator tmp = m_it; --*this; return const_iterator(tmp); }
-
-      //Comparison operators
-      bool operator==   (const const_iterator& r)  const
-      {  return m_it == r.m_it;  }
-
-      bool operator!=   (const const_iterator& r)  const
-      {  return m_it != r.m_it;  }
-   }
-   /// @endcond
-   ;
-
-   //! Iterator used to iterate through a list
-   class iterator
-   /// @cond
-      : public const_iterator
-   {
-
-      private:
-      explicit iterator(typename Icont::iterator it)
-         :  const_iterator(it)
-      {}
-   
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class list;
-      typedef list_pointer       pointer;
-      typedef list_reference     reference;
-
-      //Constructors
-      iterator(){}
-
-      //Pointer like operators
-      reference operator*()  const {  return  this->m_it->m_data;  }
-      pointer   operator->() const {  return  pointer(&this->m_it->m_data);  }
-
-      //Increment / Decrement
-      iterator& operator++()  
-         { this->prot_incr(); return *this;  }
-
-      iterator operator++(int)
-         { typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
-      
-      iterator& operator--()
-         {  this->prot_decr(); return *this;  }
-
-      iterator operator--(int)
-         {  iterator tmp = *this; --*this; return tmp; }
-   };
-   /// @endcond
-
-   //! Iterator used to iterate backwards through a list. 
-   typedef std::reverse_iterator        reverse_iterator;
-   //! Const iterator used to iterate backwards through a list. 
-   typedef std::reverse_iterator  const_reverse_iterator;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs a list.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   list() 
+   list()
       : AllocHolder()
    {}
 
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit list(const allocator_type &a)
+   explicit list(const allocator_type &a) BOOST_CONTAINER_NOEXCEPT
       : AllocHolder(a)
    {}
 
@@ -337,10 +310,10 @@ class list
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit list(size_type n)
-      : AllocHolder(A())
+      : AllocHolder(Allocator())
    {  this->resize(n);  }
 
    //! Effects: Constructs a list that will use a copy of allocator a
@@ -348,32 +321,60 @@ class list
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   list(size_type n, const T& value, const A& a = A())
+   list(size_type n, const T& value, const Allocator& a = Allocator())
       : AllocHolder(a)
    {  this->insert(this->cbegin(), n, value);  }
 
    //! Effects: Copy constructs a list.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
-   list(const list& x) 
+   list(const list& x)
       : AllocHolder(x)
    {  this->insert(this->cbegin(), x.begin(), x.end());   }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    list(BOOST_RV_REF(list) x)
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   list(const list& x, const allocator_type &a)
+      : AllocHolder(a)
+   {  this->insert(this->cbegin(), x.begin(), x.end());   }
+
+   //! Effects: Move constructor sing the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   list(BOOST_RV_REF(list) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
    //! Effects: Constructs a list that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the list.
    //!
@@ -382,7 +383,7 @@ class list
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   list(InpIt first, InpIt last, const A &a = A())
+   list(InpIt first, InpIt last, const Allocator &a = Allocator())
       : AllocHolder(a)
    {  this->insert(this->cbegin(), first, last);  }
 
@@ -392,331 +393,18 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements.
-   ~list()
+   ~list() BOOST_CONTAINER_NOEXCEPT
    {} //AllocHolder clears the list
 
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const
-   {  return allocator_type(this->node_alloc()); }
-
-   const stored_allocator_type &get_stored_allocator() const 
-   {  return this->node_alloc(); }
-
-   stored_allocator_type &get_stored_allocator()
-   {  return this->node_alloc(); }
-
-   //! Effects: Erases all the elements of the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements in the list.
-   void clear()
-   {  AllocHolder::clear(alloc_version());  }
-
-   //! Effects: Returns an iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin()
-   { return iterator(this->icont().begin()); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const
-   {  return this->cbegin();   }
-
-   //! Effects: Returns an iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end()
-   {  return iterator(this->icont().end());  }
-
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const
-   {  return this->cend();  }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin()
-   {  return reverse_iterator(end());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const
-   {  return this->crbegin();  }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend()
-   {  return reverse_iterator(begin());   }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const
-   {  return this->crend();   }
-
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const
-   {  return const_iterator(this->non_const_icont().begin());   }
-
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const
-   {  return const_iterator(this->non_const_icont().end());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const
-   {  return const_reverse_iterator(this->cend());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const
-   {  return const_reverse_iterator(this->cbegin());   }
-
-   //! Effects: Returns true if the list contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const 
-   {  return !this->size();  }
-
-   //! Effects: Returns the number of the elements contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const 
-   {   return this->icont().size();   }
-
-   //! Effects: Returns the largest possible size of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const 
-   {  return AllocHolder::max_size();  }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the beginning of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(const T &x);
-
-   //! Effects: Constructs a new element in the beginning of the list
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
-   #endif
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the end of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(const T &x);
-
-   //! Effects: Constructs a new element in the end of the list
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
-   #endif
-
-   //! Effects: Removes the first element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_front()              
-   {  this->erase(this->cbegin());      }
-
-   //! Effects: Removes the last element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_back()               
-   {  const_iterator tmp = this->cend(); this->erase(--tmp);  }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front()             
-   { return *this->begin(); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const 
-   { return *this->begin(); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference back()              
-   { return *(--this->end()); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference back()  const 
-   { return *(--this->end()); }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x)
-   {
-      const_iterator iend = this->cend();
-      size_type len = this->size();
-      
-      if(len > new_size){
-         size_type to_erase = len - new_size;
-         while(to_erase--){
-            --iend;
-         }
-         this->erase(iend, this->cend());
-      }
-      else{
-         this->priv_create_and_insert_nodes(iend, new_size - len, x);
-      }
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size)
-   {
-      const_iterator iend = this->end();
-      size_type len = this->size();
-      
-      if(len > new_size){
-         size_type to_erase = len - new_size;
-         const_iterator ifirst;
-         if(to_erase < len/2u){
-            ifirst = iend;
-            while(to_erase--){
-               --ifirst;
-            }
-         }
-         else{
-            ifirst = this->begin();
-            size_type to_skip = len - to_erase;
-            while(to_skip--){
-               ++ifirst;
-            }
-         }
-         this->erase(ifirst, iend);
-      }
-      else{
-         this->priv_create_and_insert_nodes(this->cend(), new_size - len);
-      }
-   }
-
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(ThisType& x)
-   {  AllocHolder::swap(x);   }
-
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to the number of elements in x.
-   ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
+   list& operator=(BOOST_COPY_ASSIGN_REF(list) x)
    {
       if (&x != this){
          NodeAlloc &this_alloc     = this->node_alloc();
@@ -740,7 +428,7 @@ class list
    //! Throws: If allocator_type's copy constructor throws.
    //!
    //! Complexity: Constant.
-   ThisType& operator=(BOOST_RV_REF(ThisType) x)
+   list& operator=(BOOST_RV_REF(list) x)
    {
       if (&x != this){
          NodeAlloc &this_alloc = this->node_alloc();
@@ -763,53 +451,291 @@ class list
       return *this;
    }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x before p.
+   //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
-   void insert(const_iterator p, size_type n, const T& x)
-   { this->priv_create_and_insert_nodes(p, n, x); }
-
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before p.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator p, InpIt first, InpIt last) 
+   void assign(size_type n, const T& val)
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(p, first, last, Result());
+      typedef constant_iterator cvalue_iterator;
+      return this->assign(cvalue_iterator(val, n), cvalue_iterator());
    }
 
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Requires: position must be a valid iterator of *this.
+   //! Effects: Assigns the the range [first, last) to *this.
    //!
-   //! Effects: Insert a copy of x before position.
+   //! Throws: If memory allocation throws or
+   //!   T's constructor from dereferencing InpIt throws.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   iterator insert(const_iterator position, const T &x);
+   //! Complexity: Linear to n.
+   template 
+   void assign(InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
+   {
+      iterator first1      = this->begin();
+      const iterator last1 = this->end();
+      for ( ; first1 != last1 && first != last; ++first1, ++first)
+         *first1 = *first;
+      if (first == last)
+         this->erase(first1, last1);
+      else{
+         this->insert(last1, first, last);
+      }
+   }
 
-   //! Requires: position must be a valid iterator of *this.
+   //! Effects: Returns a copy of the internal allocator.
    //!
-   //! Effects: Insert a new element before position with mx's resources.
+   //! Throws: If allocator's copy constructor throws.
    //!
-   //! Throws: If memory allocation throws.
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return allocator_type(this->node_alloc()); }
+
+   //! Effects: Returns a reference to the internal allocator.
    //!
-   //! Complexity: Amortized constant time.
-   iterator insert(const_iterator position, T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
-   #endif
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().begin()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cbegin();   }
+
+   //! Effects: Returns an iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->icont().end());  }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cend();  }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(end());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->crbegin();  }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(begin());   }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->crend();   }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->non_const_icont().begin());   }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->non_const_icont().end());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->cend());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->cbegin());   }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the list contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   {  return !this->size();  }
+
+   //! Effects: Returns the number of the elements contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+   {   return this->icont().size();   }
+
+   //! Effects: Returns the largest possible size of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   {  return AllocHolder::max_size();  }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
+   {
+      if(!priv_try_shrink(new_size)){
+         typedef default_construct_iterator default_iterator;
+         this->insert(this->cend(), default_iterator(new_size - this->size()), default_iterator());
+      }
+   }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      if(!priv_try_shrink(new_size)){
+         this->insert(this->cend(), new_size - this->size(), x);
+      }
+   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front() BOOST_CONTAINER_NOEXCEPT
+   { return *this->begin(); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+   { return *this->begin(); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference back() BOOST_CONTAINER_NOEXCEPT
+   { return *(--this->end()); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+   { return *(--this->end()); }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -822,9 +748,7 @@ class list
    //! Complexity: Constant
    template 
    void emplace_back(Args&&... args)
-   {
-      this->emplace(this->cend(), boost::forward(args)...);
-   }
+   {  this->emplace(this->cend(), boost::forward(args)...); }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the beginning of the list.
@@ -835,9 +759,7 @@ class list
    //! Complexity: Constant
    template 
    void emplace_front(Args&&... args)
-   {
-      this->emplace(this->cbegin(), boost::forward(args)...);
-   }
+   {  this->emplace(this->cbegin(), boost::forward(args)...);  }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... before p.
@@ -884,6 +806,157 @@ class list
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the beginning of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the beginning of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator p, size_type n, const T& x)
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->insert(p, cvalue_iterator(x, n), cvalue_iterator());
+   }
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator p, InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && (container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      #endif
+      )
+   {
+      const typename Icont::iterator ipos(p.get());
+      iterator ret_it(ipos);
+      if(first != last){
+         ret_it = iterator(this->icont().insert(ipos, *this->create_node_from_it(first)));
+         ++first;
+      }
+      for (; first != last; ++first){
+         this->icont().insert(ipos, *this->create_node_from_it(first));
+      }
+      return ret_it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !(container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      )
+   {
+      //Optimized allocation and construction
+      insertion_functor func(this->icont(), p.get());
+      iterator before_p(p.get());
+      --before_p;
+      this->allocate_many_and_construct(first, std::distance(first, last), func);
+      return ++before_p;
+   }
+   #endif
+
+   //! Effects: Removes the first element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_front() BOOST_CONTAINER_NOEXCEPT
+   {  this->erase(this->cbegin());      }
+
+   //! Effects: Removes the last element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {  const_iterator tmp = this->cend(); this->erase(--tmp);  }
+
    //! Requires: p must be a valid iterator of *this.
    //!
    //! Effects: Erases the element at p p.
@@ -891,7 +964,7 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Amortized constant time.
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
    {  return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); }
 
    //! Requires: first and last must be valid iterator to elements in *this.
@@ -901,137 +974,195 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the distance between first and last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {  return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
 
-   //! Effects: Assigns the n copies of val to *this.
+   //! Effects: Swaps the contents of *this and x.
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to n.
-   void assign(size_type n, const T& val) 
-   {  this->priv_fill_assign(n, val);  }
+   //! Complexity: Constant.
+   void swap(list& x)
+   {  AllocHolder::swap(x);   }
 
-   //! Effects: Assigns the the range [first, last) to *this.
+   //! Effects: Erases all the elements of the list.
    //!
-   //! Throws: If memory allocation throws or
-   //!   T's constructor from dereferencing InpIt throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to n.
-   template 
-   void assign(InpIt first, InpIt last) 
-   {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
-   }
+   //! Complexity: Linear to the number of elements in the list.
+   void clear() BOOST_CONTAINER_NOEXCEPT
+   {  AllocHolder::clear(alloc_version());  }
+
+   //////////////////////////////////////////////
+   //
+   //              slist operations
+   //
+   //////////////////////////////////////////////
 
    //! Requires: p must point to an element contained
-   //!   by the list. x != *this
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
    //!
    //! Effects: Transfers all the elements of list x to this list, before the
    //!   the element pointed by p. No destructors or copy constructors are called.
    //!
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
+   //! Throws: Nothing
    //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, list& x) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont());
    }
 
    //! Requires: p must point to an element contained
-   //!   by this list. i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //!   If p == i or p == ++i, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(list) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, list &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      //BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), i.get());
    }
 
    //! Requires: p must point to an element contained
-   //!   by this list. first and last must point to elements contained in list x.
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
    //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear to the number of elements transferred.
-   //! 
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), i);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of elements transferred.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), first.get(), last.get());
    }
 
    //! Requires: p must point to an element contained
    //!   by this list. first and last must point to elements contained in list x.
-   //!   n == std::distance(first, last)
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
    //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of elements transferred.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   n == std::distance(first, last). this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws:  Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   //!
+   //! Note: Non-standard extension
+   void splice(const_iterator p, list &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
    }
 
-   //! Effects: Reverses the order of elements in the list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: This function is linear time.
-   //! 
-   //! Note: Iterators and references are not invalidated
-   void reverse()
-   {  this->icont().reverse(); }    
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   n == std::distance(first, last). this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   //!
+   //! Note: Non-standard extension
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last, n);  }
 
    //! Effects: Removes all the elements that compare equal to value.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: Linear time. It performs exactly size() comparisons for equality.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void remove(const T& value)
-   {  remove_if(equal_to_value(value));  }
+   {  this->remove_if(equal_to_value(value));  }
 
    //! Effects: Removes all the elements for which a specified
    //!   predicate is satisfied.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() calls to the predicate.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    template 
@@ -1041,25 +1172,25 @@ class list
       this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that are equal from the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void unique()
    {  this->unique(value_equal());  }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that satisfy some binary predicate from the list.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
-   //! 
+   //!
+   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    template 
@@ -1069,65 +1200,93 @@ class list
       this->icont().unique_and_dispose(Predicate(binary_pred), Destroyer(this->node_alloc()));
    }
 
-   //! Requires: The lists x and *this must be distinct. 
+   //! Requires: The lists x and *this must be distinct.
    //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this according to std::less. The merge is stable; 
-   //!   that is, if an element from *this is equivalent to one from x, then the element 
-   //!   from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   void merge(list& x)
+   void merge(list &x)
    {  this->merge(x, value_less());  }
 
+   //! Requires: The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   void merge(BOOST_RV_REF(list) x)
+   {  this->merge(static_cast(x)); }
+
    //! Requires: p must be a comparison function that induces a strict weak
    //!   ordering and both *this and x must be sorted according to that ordering
-   //!   The lists x and *this must be distinct. 
-   //! 
+   //!   The lists x and *this must be distinct.
+   //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this. The merge is stable; that is, if an element from *this is 
-   //!   equivalent to one from x, then the element from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   //! 
+   //!
    //! Note: Iterators and references to *this are not invalidated.
    template 
-   void merge(list &x, StrictWeakOrdering comp)
+   void merge(list &x, const StrictWeakOrdering &comp)
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().merge(x.icont(),
-            ValueCompareToNodeCompare(comp));
-      }
-      else{
-         throw std::runtime_error("list::merge called with unequal allocators");
-      }
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().merge(x.icont(),
+         ValueCompareToNodeCompare(comp));
    }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
+   //! Note: Iterators and references to *this are not invalidated.
+   template 
+   void merge(BOOST_RV_REF(list) x, StrictWeakOrdering comp)
+   {  this->merge(static_cast(x), comp); }
+
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
    //!
-   //! Throws: Nothing.
+   //! Throws: If comparison throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //!   
+   //!  
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    void sort()
    {  this->sort(value_less());  }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comp throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    template 
@@ -1139,65 +1298,79 @@ class list
       this->icont().sort(ValueCompareToNodeCompare(comp));
    }
 
+   //! Effects: Reverses the order of elements in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: This function is linear time.
+   //!
+   //! Note: Iterators and references are not invalidated
+   void reverse() BOOST_CONTAINER_NOEXCEPT
+   {  this->icont().reverse(); }   
+
    /// @cond
    private:
 
-   iterator priv_insert(const_iterator p, const T &x) 
+   bool priv_try_shrink(size_type new_size)
+   {
+      const size_type len = this->size();
+      if(len > new_size){
+         const const_iterator iend = this->cend();
+         size_type to_erase = len - new_size;
+         const_iterator ifirst;
+         if(to_erase < len/2u){
+            ifirst = iend;
+            while(to_erase--){
+               --ifirst;
+            }
+         }
+         else{
+            ifirst = this->cbegin();
+            size_type to_skip = len - to_erase;
+            while(to_skip--){
+               ++ifirst;
+            }
+         }
+         this->erase(ifirst, iend);
+         return true;
+      }
+      else{
+         return false;
+      }
+   }
+
+   iterator priv_insert(const_iterator p, const T &x)
    {
       NodePtr tmp = AllocHolder::create_node(x);
       return iterator(this->icont().insert(p.get(), *tmp));
    }
 
-   iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) 
+   iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
    {
       NodePtr tmp = AllocHolder::create_node(boost::move(x));
       return iterator(this->icont().insert(p.get(), *tmp));
    }
 
-   void priv_push_back (const T &x)   
+   void priv_push_back (const T &x)  
    {  this->insert(this->cend(), x);    }
 
    void priv_push_back (BOOST_RV_REF(T) x)
    {  this->insert(this->cend(), boost::move(x));    }
 
-   void priv_push_front (const T &x)   
+   void priv_push_front (const T &x)  
    {  this->insert(this->cbegin(), x);  }
 
    void priv_push_front (BOOST_RV_REF(T) x)
    {  this->insert(this->cbegin(), boost::move(x));  }
 
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end)
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(pos, beg, end, alloc_version(), ItCat());
-   }
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
-   {
-      for (; beg != end; ++beg){
-         this->icont().insert(pos.get(), *this->create_node_from_it(beg));
-      }
-   }
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(pos, beg, end, allocator_v1(), std::input_iterator_tag());
-   }
-
    class insertion_functor;
    friend class insertion_functor;
 
    class insertion_functor
    {
       Icont &icont_;
-      typename Icont::const_iterator pos_;
+      typedef typename Icont::const_iterator iconst_iterator;
+      const iconst_iterator pos_;
 
       public:
       insertion_functor(Icont &icont, typename Icont::const_iterator pos)
@@ -1205,78 +1378,11 @@ class list
       {}
 
       void operator()(Node &n)
-      {  this->icont_.insert(pos_, n); }
+      {
+         this->icont_.insert(pos_, n);
+      }
    };
 
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         //Optimized allocation and construction
-         this->allocate_many_and_construct
-            (beg, std::distance(beg, end), insertion_functor(this->icont(), pos.get()));
-      }
-   }
-
-   //Default constructed version
-   void priv_create_and_insert_nodes(const_iterator pos, size_type n)
-   {
-      typedef default_construct_iterator default_iterator;
-      this->priv_create_and_insert_nodes(pos, default_iterator(n), default_iterator());
-   }
-
-   //Copy constructed version
-   void priv_create_and_insert_nodes(const_iterator pos, size_type n, const T& x)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->priv_create_and_insert_nodes(pos, cvalue_iterator(x, n), cvalue_iterator());
-   }
-
-   //Dispatch to detect iterator range or integer overloads
-   template 
-   void priv_insert_dispatch(const_iterator p,
-                             InputIter first, InputIter last,
-                             container_detail::false_)
-   {  this->priv_create_and_insert_nodes(p, first, last);   }
-
-   template
-   void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_) 
-   {  this->insert(p, (size_type)n, x);  }
-
-   void priv_fill_assign(size_type n, const T& val) 
-   {
-      iterator i = this->begin(), iend = this->end();
-
-      for ( ; i != iend && n > 0; ++i, --n)
-         *i = val;
-      if (n > 0){
-         this->priv_create_and_insert_nodes(this->cend(), n, val);
-      }
-      else{
-         this->erase(i, cend());
-      }
-   }
-
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-   {  this->priv_fill_assign((size_type) n, (T) val); }
-
-   template 
-   void priv_assign_dispatch(InputIter first2, InputIter last2, container_detail::false_)
-   {
-      iterator first1   = this->begin();
-      iterator last1    = this->end();
-      for ( ; first1 != last1 && first2 != last2; ++first1, ++first2)
-         *first1 = *first2;
-      if (first2 == last2)
-         this->erase(first1, last1);
-      else{
-         this->priv_create_and_insert_nodes(last1, first2, last2);
-      }
-   }
-
    //Functors for member algorithm defaults
    struct value_less
    {
@@ -1293,13 +1399,13 @@ class list
 
 };
 
-template 
-inline bool operator==(const list& x, const list& y)
+template 
+inline bool operator==(const list& x, const list& y)
 {
    if(x.size() != y.size()){
       return false;
    }
-   typedef typename list::const_iterator const_iterator;
+   typedef typename list::const_iterator const_iterator;
    const_iterator end1 = x.end();
 
    const_iterator i1 = x.begin();
@@ -1311,39 +1417,39 @@ inline bool operator==(const list& x, const list& y)
    return i1 == end1;
 }
 
-template 
-inline bool operator<(const list& x,
-                      const list& y)
+template 
+inline bool operator<(const list& x,
+                      const list& y)
 {
   return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline bool operator!=(const list& x, const list& y) 
+template 
+inline bool operator!=(const list& x, const list& y)
 {
   return !(x == y);
 }
 
-template 
-inline bool operator>(const list& x, const list& y) 
+template 
+inline bool operator>(const list& x, const list& y)
 {
   return y < x;
 }
 
-template 
-inline bool operator<=(const list& x, const list& y) 
+template 
+inline bool operator<=(const list& x, const list& y)
 {
   return !(y < x);
 }
 
-template 
-inline bool operator>=(const list& x, const list& y) 
+template 
+inline bool operator>=(const list& x, const list& y)
 {
   return !(x < y);
 }
 
-template 
-inline void swap(list& x, list& y)
+template 
+inline void swap(list& x, list& y)
 {
   x.swap(y);
 }
@@ -1351,15 +1457,14 @@ inline void swap(list& x, list& y)
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 namespace container {
 
 /// @endcond
@@ -1368,4 +1473,4 @@ namespace container {
 
 #include 
 
-#endif // BOOST_CONTAINER_LIST_HPP_
+#endif // BOOST_CONTAINER_LIST_HPP
diff --git a/project/jni/boost/include/boost/container/map.hpp b/project/jni/boost/include/boost/container/map.hpp
index 8f7ecd42b..d4ab4236b 100644
--- a/project/jni/boost/include/boost/container/map.hpp
+++ b/project/jni/boost/include/boost/container/map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -30,328 +30,393 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
 
-
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators == and <, needed for friend declarations.
-template 
-inline bool operator==(const map& x, 
-                       const map& y);
+template 
+inline bool operator==(const map& x,
+                       const map& y);
 
-template 
-inline bool operator<(const map& x, 
-                      const map& y);
+template 
+inline bool operator<(const map& x,
+                      const map& y);
 /// @endcond
 
-//! A map is a kind of associative container that supports unique keys (contains at 
-//! most one of each key value) and provides for fast retrieval of values of another 
+//! A map is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of values of another
 //! type T based on the keys. The map class supports bidirectional iterators.
-//! 
-//! A map satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
+//!
+//! A map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
 //! map the key_type is Key and the value_type is std::pair.
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair > ).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< const Key, T> > >
 #else
-template 
+template 
 #endif
-class map 
+class map
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(map)
-   typedef container_detail::rbtree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
-   tree_t m_tree;  // red-black tree representing map
 
+   typedef std::pair  value_type_impl;
+   typedef container_detail::rbtree
+      , Compare, Allocator> tree_t;
+   typedef container_detail::pair  movable_value_type_impl;
+   typedef container_detail::tree_value_compare
+      < Key, value_type_impl, Compare, container_detail::select1st
+      >  value_compare_impl;
+   tree_t m_tree;  // red-black tree representing map
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef T                                       mapped_type;
-   typedef Pred                                    key_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
-   typedef std::pair        nonconst_value_type;
-   typedef container_detail::pair
-                            nonconst_impl_value_type;
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                  value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                        iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                  const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)          const_reverse_iterator;
+   typedef std::pair                                         nonconst_value_type;
+   typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl)                          movable_value_type;
 
-   /// @cond
-   class value_compare_impl
-      :  public Pred,
-         public std::binary_function 
-   {
-      friend class map;
-    protected :
-      value_compare_impl(const Pred &c) : Pred(c) {}
-    public:
-      bool operator()(const value_type& x, const value_type& y) const {
-         return Pred::operator()(x.first, y.first);
-      }
-   };
-   /// @endcond
-   typedef value_compare_impl             value_compare;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty map.
-   //! 
+   //!
    //! Complexity: Constant.
    map()
       : m_tree()
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object 
+   //! Effects: Constructs an empty map using the specified comparison object
    //! and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit map(const Pred& comp,
+   explicit map(const Compare& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   map(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, true) 
+      : m_tree(true, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty map using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
    map( ordered_unique_range_t, InputIterator first, InputIterator last
-      , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_tree(ordered_range, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Copy constructs a map.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   map(const map& x) 
+   map(const map& x)
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Move constructs a map. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   map(BOOST_RV_REF(map) x) 
+   map(BOOST_RV_REF(map) x)
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Copy constructs a map using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   map(const map& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Move constructs a map using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if x == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   map(BOOST_RV_REF(map) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
    map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
    map& operator=(BOOST_RV_REF(map) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return value_compare(m_tree.key_comp()); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   { return m_tree.begin(); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-   { return m_tree.end(); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.begin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.end(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.rbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.max_size(); }
 
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: If there is no key equivalent to x in the map, inserts 
+   //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(x, T()) into the map.
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type& operator[](const key_type &k);
 
-   //! Effects: If there is no key equivalent to x in the map, inserts 
+   //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type& operator[](key_type &&k);
    #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
    #endif
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
    //! Complexity: logarithmic.
    T& at(const key_type& k)
@@ -363,7 +428,7 @@ class map
       return i->second;
    }
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
    //! Complexity: logarithmic.
    const T& at(const key_type& k) const
@@ -375,70 +440,68 @@ class map
       return i->second;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(map& x)
-   { m_tree.swap(x.m_tree); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
-   //! Effects: Inserts x if and only if there is no element in the container 
+   //! Effects: Inserts x if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(const value_type& x) 
+   std::pair insert(const value_type& x)
    { return m_tree.insert_unique(x); }
 
-   //! Effects: Inserts a new value_type created from the pair if and only if 
+   //! Effects: Inserts a new value_type created from the pair if and only if
    //! there is no element in the container  with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(const nonconst_value_type& x) 
+   std::pair insert(const nonconst_value_type& x)
    { return m_tree.insert_unique(x); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(nonconst_value_type) x) 
+   std::pair insert(BOOST_RV_REF(nonconst_value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(nonconst_impl_value_type) x) 
+   std::pair insert(BOOST_RV_REF(movable_value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
+   std::pair insert(BOOST_RV_REF(value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
-   //! Effects: Inserts a copy of x in the container if and only if there is 
+   //! Effects: Inserts a copy of x in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -447,10 +510,10 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, const value_type& x)
+   iterator insert(const_iterator position, const value_type& x)
    { return m_tree.insert_unique(position, x); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -459,10 +522,10 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -471,7 +534,7 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! Effects: Inserts a copy of x in the container.
@@ -480,7 +543,7 @@ class map
    //! Returns: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   iterator insert(iterator position, const nonconst_value_type& x)
+   iterator insert(const_iterator position, const nonconst_value_type& x)
    { return m_tree.insert_unique(position, x); }
 
    //! Effects: Inserts an element move constructed from x in the container.
@@ -489,27 +552,27 @@ class map
    //! Returns: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   iterator insert(iterator position, BOOST_RV_REF(value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! Requires: first, last are not iterators into *this.
    //!
-   //! Effects: inserts each element from the range [first,last) if and only 
+   //! Effects: inserts each element from the range [first,last) if and only
    //!   if there is no element with key equivalent to the key of that element.
    //!
    //! Complexity: At most N log(size()+N) (N is the distance from first to last)
    template 
-   void insert(InputIterator first, InputIterator last) 
+   void insert(InputIterator first, InputIterator last)
    {  m_tree.insert_unique(first, last);  }
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with an equivalent key.
    //!   p is a hint pointing to where the insert should start to search.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -520,7 +583,7 @@ class map
    {  return m_tree.emplace_unique(boost::forward(args)...); }
 
    //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with an equivalent key.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -554,11 +617,11 @@ class map
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -566,7 +629,7 @@ class map
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -574,75 +637,109 @@ class map
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(map& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return value_compare(m_tree.key_comp()); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.find(x) == m_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -660,13 +757,13 @@ class map
       // i->first is greater than or equivalent to k.
       if (i == end() || key_comp()(k, (*i).first)){
          container_detail::value_init m;
-         nonconst_impl_value_type val(k, boost::move(m.m_t));
+         movable_value_type val(k, boost::move(m.m_t));
          i = insert(i, boost::move(val));
       }
       return (*i).second;
    }
 
-   mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk) 
+   mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
    {
       key_type &k = mk;
       //we can optimize this
@@ -674,7 +771,7 @@ class map
       // i->first is greater than or equivalent to k.
       if (i == end() || key_comp()(k, (*i).first)){
          container_detail::value_init m;
-         nonconst_impl_value_type val(boost::move(k), boost::move(m.m_t));
+         movable_value_type val(boost::move(k), boost::move(m.m_t));
          i = insert(i, boost::move(val));
       }
       return (*i).second;
@@ -683,429 +780,408 @@ class map
    /// @endcond
 };
 
-template 
-inline bool operator==(const map& x, 
-                       const map& y) 
+template 
+inline bool operator==(const map& x,
+                       const map& y)
    {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const map& x, 
-                      const map& y) 
+template 
+inline bool operator<(const map& x,
+                      const map& y)
    {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator!=(const map& x,
+                       const map& y)
    {  return !(x == y); }
 
-template 
-inline bool operator>(const map& x, 
-                      const map& y) 
+template 
+inline bool operator>(const map& x,
+                      const map& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator<=(const map& x,
+                       const map& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator>=(const map& x,
+                       const map& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(map& x, map& y) 
+template 
+inline void swap(map& x, map& y)
    {  x.swap(y);  }
 
 /// @cond
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
-template 
-inline bool operator==(const multimap& x, 
-                       const multimap& y);
+template 
+inline bool operator==(const multimap& x,
+                       const multimap& y);
 
-template 
-inline bool operator<(const multimap& x, 
-                      const multimap& y);
+template 
+inline bool operator<(const multimap& x,
+                      const multimap& y);
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
 
-//! A multimap is a kind of associative container that supports equivalent keys 
-//! (possibly containing multiple copies of the same key value) and provides for 
+//! A multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
 //! fast retrieval of values of another type T based on the keys. The multimap class
 //! supports bidirectional iterators.
-//! 
-//! A multimap satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
-//! map the key_type is Key and the value_type is std::pair. 
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! A multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
+//! map the key_type is Key and the value_type is std::pair.
 //!
-//! A is the allocator to allocate the value_types
+//! Compare is the ordering function for Keys (e.g. std::less).
+//!
+//! Allocator is the allocator to allocate the value_types
 //!(e.g. allocator< std::pair<const Key, T> >).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< const Key, T> > >
 #else
-template 
+template 
 #endif
-class multimap 
+class multimap
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multimap)
-   typedef container_detail::rbtree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+
+   typedef std::pair  value_type_impl;
+   typedef container_detail::rbtree
+      , Compare, Allocator> tree_t;
+   typedef container_detail::pair  movable_value_type_impl;
+   typedef container_detail::tree_value_compare
+      < Key, value_type_impl, Compare, container_detail::select1st
+      >  value_compare_impl;
    tree_t m_tree;  // red-black tree representing map
-   typedef typename container_detail::
-      move_const_ref_type::type insert_key_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef T                                       mapped_type;
-   typedef Pred                                    key_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
-   typedef std::pair        nonconst_value_type;
-   typedef container_detail::pair
-                            nonconst_impl_value_type;
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                  value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                        iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                  const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)          const_reverse_iterator;
+   typedef std::pair                                         nonconst_value_type;
+   typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl)                          movable_value_type;
 
-   /// @cond
-   class value_compare_impl
-      :  public Pred,
-         public std::binary_function 
-   {
-      friend class multimap;
-    protected :
-      value_compare_impl(const Pred &c) : Pred(c) {}
-    public:
-      bool operator()(const value_type& x, const value_type& y) const {
-         return Pred::operator()(x.first, y.first);
-      }
-   };
-   /// @endcond
-   typedef value_compare_impl                      value_compare;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty multimap.
-   //! 
+   //!
    //! Complexity: Constant.
    multimap()
       : m_tree()
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit multimap(const Pred& comp, const allocator_type& a = allocator_type())
+   explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    multimap(InputIterator first, InputIterator last,
-            const Pred& comp = Pred(),
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, false) 
+      : m_tree(false, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty multimap using the specified comparison object and 
+   //! Effects: Constructs an empty multimap using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
-   multimap(ordered_range_t ordered_range, InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
-
    //! Effects: Copy constructs a multimap.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multimap(const multimap& x) 
+   multimap(const multimap& x)
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Move constructs a multimap. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   multimap(BOOST_RV_REF(multimap) x) 
+   multimap(BOOST_RV_REF(multimap) x)
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Copy constructs a multimap.
+   //!
+   //! Complexity: Linear in x.size().
+   multimap(const multimap& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Move constructs a multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x) 
+   multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   multimap& operator=(BOOST_RV_REF(multimap) x) 
+   multimap& operator=(BOOST_RV_REF(multimap) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return value_compare(m_tree.key_comp()); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   { return m_tree.begin(); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-   { return m_tree.end(); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.begin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.end(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.rbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(multimap& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const value_type& x) 
-   { return m_tree.insert_equal(x); }
-
-   //! Effects: Inserts a new value constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const nonconst_value_type& x) 
-   { return m_tree.insert_equal(x); }
-
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(BOOST_RV_REF(nonconst_value_type) x) 
-   { return m_tree.insert_equal(boost::move(x)); }
-
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(BOOST_RV_REF(nonconst_impl_value_type) x) 
-   { return m_tree.insert_equal(boost::move(x)); }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, const value_type& x)
-   { return m_tree.insert_equal(position, x); }
-
-   //! Effects: Inserts a new value constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, const nonconst_value_type& x)
-   { return m_tree.insert_equal(position, x); }
-
-   //! Effects: Inserts a new value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
-   { return m_tree.insert_equal(position, boost::move(x)); }
-
-   //! Effects: Inserts a new value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
-   { return m_tree.insert_equal(position, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_equal(first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -1153,14 +1229,95 @@ class multimap
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const value_type& x)
+   { return m_tree.insert_equal(x); }
+
+   //! Effects: Inserts a new value constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const nonconst_value_type& x)
+   { return m_tree.insert_equal(x); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(BOOST_RV_REF(nonconst_value_type) x)
+   { return m_tree.insert_equal(boost::move(x)); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(BOOST_RV_REF(movable_value_type) x)
+   { return m_tree.insert_equal(boost::move(x)); }
+
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, const value_type& x)
+   { return m_tree.insert_equal(position, x); }
+
+   //! Effects: Inserts a new value constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, const nonconst_value_type& x)
+   { return m_tree.insert_equal(position, x); }
+
+   //! Effects: Inserts a new value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x)
+   { return m_tree.insert_equal(position, boost::move(x)); }
+
+   //! Effects: Inserts a new value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
+   { return m_tree.insert_equal(position, boost::move(x)); }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_equal(first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1168,7 +1325,7 @@ class multimap
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1176,76 +1333,109 @@ class multimap
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(multimap& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return value_compare(m_tree.key_comp()); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const iterator pointing to an element with the key
+   //! Returns: Allocator const iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    { return m_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x);  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x); }
 
-   //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
-   //!
-   //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
-   {  return m_tree.equal_range(x);   }
-
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x)
+   {  return m_tree.equal_range(x);   }
+
+   //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
+   //!
+   //! Complexity: Logarithmic
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x);   }
 
    /// @cond
@@ -1259,52 +1449,52 @@ class multimap
    /// @endcond
 };
 
-template 
-inline bool operator==(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator==(const multimap& x,
+                       const multimap& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const multimap& x, 
-                      const multimap& y) 
+template 
+inline bool operator<(const multimap& x,
+                      const multimap& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator!=(const multimap& x,
+                       const multimap& y)
 {  return !(x == y);  }
 
-template 
-inline bool operator>(const multimap& x, 
-                      const multimap& y) 
+template 
+inline bool operator>(const multimap& x,
+                      const multimap& y)
 {  return y < x;  }
 
-template 
-inline bool operator<=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator<=(const multimap& x,
+                       const multimap& y)
 {  return !(y < x);  }
 
-template 
-inline bool operator>=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator>=(const multimap& x,
+                       const multimap& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(multimap& x, multimap& y) 
+template 
+inline void swap(multimap& x, multimap& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/scoped_allocator.hpp b/project/jni/boost/include/boost/container/scoped_allocator.hpp
new file mode 100644
index 000000000..39fd4da90
--- /dev/null
+++ b/project/jni/boost/include/boost/container/scoped_allocator.hpp
@@ -0,0 +1,1470 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Pablo Halpern 2009. 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)
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-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.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+
+#if (defined MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace boost { namespace container {
+
+//! Remark: if a specialization is derived from true_type, indicates that T may be constructed
+//! with an allocator as its last constructor argument.  Ideally, all constructors of T (including the
+//! copy and move constructors) should have a variant that accepts a final argument of
+//! allocator_type.
+//!
+//! Requires: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_type is the last
+//! parameter.  If not all constructors of T can be called with a final allocator_type argument,
+//! and if T is used in a context where a container must call such a constructor, then the program is
+//! ill-formed.
+//!
+//! [Example:
+//!  template  >  
+//!  class Z {
+//!    public:
+//!      typedef Allocator allocator_type;
+//!
+//!    // Default constructor with optional allocator suffix
+//!    Z(const allocator_type& a = allocator_type());
+//!
+//!    // Copy constructor and allocator-extended copy constructor
+//!    Z(const Z& zz);
+//!    Z(const Z& zz, const allocator_type& a);
+//! };
+//!
+//! // Specialize trait for class template Z
+//! template  >
+//! struct constructible_with_allocator_suffix > 
+//!      : ::boost::true_type { };
+//! -- end example]
+//!
+//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
+//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
+//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
+//! Applications aiming portability with several compilers should always define this trait.
+//!
+//! In conforming C++11 compilers or compilers supporting SFINAE expressions
+//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
+//! to detect if a type should be constructed with suffix or prefix allocator arguments.
+template 
+struct constructible_with_allocator_suffix
+   : ::boost::false_type
+{};
+
+//! Remark: if a specialization is derived from true_type, indicates that T may be constructed
+//! with allocator_arg and T::allocator_type as its first two constructor arguments. 
+//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
+//! that accepts these two initial arguments.
+//!
+//! Requires: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_arg_t is the first
+//! parameter and allocator_type is the second parameter.  If not all constructors of T can be
+//! called with these initial arguments, and if T is used in a context where a container must call such
+//! a constructor, then the program is ill-formed.
+//!
+//! [Example:
+//! template  >
+//! class Y {
+//!    public:
+//!       typedef Allocator allocator_type;
+//! 
+//!       // Default constructor with and allocator-extended default constructor
+//!       Y();
+//!       Y(allocator_arg_t, const allocator_type& a);
+//! 
+//!       // Copy constructor and allocator-extended copy constructor
+//!       Y(const Y& yy);
+//!       Y(allocator_arg_t, const allocator_type& a, const Y& yy);
+//! 
+//!       // Variadic constructor and allocator-extended variadic constructor
+//!       template Y(Args&& args...);
+//!       template 
+//!       Y(allocator_arg_t, const allocator_type& a, Args&&... args);
+//! };
+//! 
+//! // Specialize trait for class template Y
+//! template  >
+//! struct constructible_with_allocator_prefix > 
+//!       : ::boost::true_type { };
+//! 
+//! -- end example]
+//!
+//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
+//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
+//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
+//! Applications aiming portability with several compilers should always define this trait.
+//!
+//! In conforming C++11 compilers or compilers supporting SFINAE expressions
+//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
+//! to detect if a type should be constructed with suffix or prefix allocator arguments.
+template 
+struct constructible_with_allocator_prefix
+    : ::boost::false_type
+{};
+
+///@cond
+
+namespace container_detail {
+
+template
+struct uses_allocator_imp
+{
+   // Use SFINAE (Substitution Failure Is Not An Error) to detect the
+   // presence of an 'allocator_type' nested type convertilble from Alloc.
+
+   private:
+   // Match this function if TypeT::allocator_type exists and is
+   // implicitly convertible from Alloc
+   template 
+   static char test(int, typename U::allocator_type);
+
+   // Match this function if TypeT::allocator_type does not exist or is
+   // not convertible from Alloc.
+   template 
+   static int test(LowPriorityConversion, LowPriorityConversion);
+
+   static Alloc alloc;  // Declared but not defined
+
+   public:
+   enum { value = sizeof(test(0, alloc)) == sizeof(char) };
+};
+
+}  //namespace container_detail {
+
+///@endcond
+
+//! Remark: Automatically detects if T has a nested allocator_type that is convertible from
+//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
+//! specialize this type to derive from true_type for a T of user-defined type if T does not
+//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
+//!
+//! Result: derived from true_type if Convertible and
+//! derived from false_type otherwise.
+template 
+struct uses_allocator
+   : boost::integral_constant::value>
+{};
+
+///@cond
+
+namespace container_detail {
+
+template 
+struct is_scoped_allocator_imp
+{
+   template 
+   static char test(int, typename T::outer_allocator_type*);
+
+   template 
+   static int test(LowPriorityConversion, void*);
+
+   static const bool value = (sizeof(char) == sizeof(test(0, 0)));
+};
+
+template::value >
+struct outermost_allocator_type_impl
+{
+   typedef typename MaybeScopedAlloc::outer_allocator_type outer_type;
+   typedef typename outermost_allocator_type_impl::type type;
+};
+
+template
+struct outermost_allocator_type_impl
+{
+   typedef MaybeScopedAlloc type;
+};
+
+template::value >
+struct outermost_allocator_imp
+{
+   typedef MaybeScopedAlloc type;
+
+   static type &get(MaybeScopedAlloc &a)
+   {  return a;  }
+
+   static const type &get(const MaybeScopedAlloc &a)
+   {  return a;  }
+};
+
+template
+struct outermost_allocator_imp
+{
+   typedef typename MaybeScopedAlloc::outer_allocator_type outer_type;
+   typedef typename outermost_allocator_type_impl::type type;
+
+   static type &get(MaybeScopedAlloc &a)
+   {  return outermost_allocator_imp::get(a.outer_allocator());  }
+
+   static const type &get(const MaybeScopedAlloc &a)
+   {  return outermost_allocator_imp::get(a.outer_allocator());  }
+};
+
+}  //namespace container_detail {
+
+template 
+struct is_scoped_allocator
+   : boost::integral_constant::value>
+{};
+
+template 
+struct outermost_allocator
+   : container_detail::outermost_allocator_imp
+{};
+
+template 
+typename container_detail::outermost_allocator_imp::type &
+   get_outermost_allocator(Alloc &a)
+{  return container_detail::outermost_allocator_imp::get(a);   }
+
+template 
+const typename container_detail::outermost_allocator_imp::type &
+   get_outermost_allocator(const Alloc &a)
+{  return container_detail::outermost_allocator_imp::get(a);   }
+
+namespace container_detail {
+
+// Check if we can detect is_convertible using advanced SFINAE expressions
+#if !defined(BOOST_NO_SFINAE_EXPR)
+
+   //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list
+   //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html
+   //! Thanks Mathias!
+
+   //With variadic templates, we need a single class to implement the trait
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template
+   struct is_constructible_impl
+   {
+      typedef char yes_type;
+      struct no_type
+      { char padding[2]; };
+
+      template
+      struct dummy;
+
+      template
+      static yes_type test(dummy()...))>*);
+
+      template
+      static no_type test(...);
+
+      static const bool value = sizeof(test(0)) == sizeof(yes_type);
+   };
+
+   template
+   struct is_constructible
+      : boost::integral_constant::value>
+   {};
+
+   template 
+   struct is_constructible_with_allocator_prefix
+      : is_constructible
+   {};
+
+   #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   //Without variadic templates, we need to use de preprocessor to generate
+   //some specializations.
+
+   #define BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS \
+      BOOST_PP_ADD(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, 3)
+   //!
+
+   //Generate N+1 template parameters so that we can specialize N
+   template
+   struct is_constructible_impl;
+
+   //Generate N specializations, from 0 to
+   //BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS parameters
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   template                                     \
+   struct is_constructible_impl                                                                    \
+                                                                                            \
+   {                                                                                               \
+      typedef char yes_type;                                                                       \
+      struct no_type                                                                               \
+      { char padding[2]; };                                                                        \
+                                                                                                   \
+      template                                                                      \
+      struct dummy;                                                                                \
+                                                                                                   \
+      template                                                                            \
+      static yes_type test(dummy*);    \
+                                                                                                   \
+      template                                                                            \
+      static no_type test(...);                                                                    \
+                                                                                                   \
+      static const bool value = sizeof(test(0)) == sizeof(yes_type);                            \
+   };                                                                                              \
+   //!
+
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   //Finally just inherit from the implementation to define he trait
+   template< class T
+           BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS
+                                 , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                 , void)
+           >
+   struct is_constructible
+      : boost::integral_constant
+         < bool
+         , is_constructible_impl
+            < T
+            BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P)
+            , void>::value
+         >
+   {};
+
+   //Finally just inherit from the implementation to define he trait
+   template 
+   struct is_constructible_with_allocator_prefix
+      : is_constructible
+         < T, allocator_arg_t, InnerAlloc
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2), P)
+         >
+   {};
+/*
+   template 
+   struct is_constructible_with_allocator_suffix
+      : is_constructible
+         < T
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1), P)
+         , InnerAlloc
+         >
+   {};*/
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#else    // #if !defined(BOOST_NO_SFINAE_EXPR)
+
+   //Without advanced SFINAE expressions, we can't use is_constructible
+   //so backup to constructible_with_allocator_xxx
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template < class T, class InnerAlloc, class ...Args>
+   struct is_constructible_with_allocator_prefix
+      : constructible_with_allocator_prefix
+   {};
+/*
+   template < class T, class InnerAlloc, class ...Args>
+   struct is_constructible_with_allocator_suffix
+      : constructible_with_allocator_suffix
+   {};*/
+
+   #else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template < class T
+            , class InnerAlloc
+            BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+                                  , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                  , void)
+            >
+   struct is_constructible_with_allocator_prefix
+      : constructible_with_allocator_prefix
+   {};
+/*
+   template < class T
+            , class InnerAlloc
+            BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+                                  , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                  , void)
+            >
+   struct is_constructible_with_allocator_suffix
+      : constructible_with_allocator_suffix
+   {};*/
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#endif   // #if !defined(BOOST_NO_SFINAE_EXPR)
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_allocator_prefix_suffix
+   ( boost::true_type  use_alloc_prefix, OutermostAlloc& outermost_alloc
+   , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args)
+{
+   (void)use_alloc_prefix;
+   allocator_traits::construct
+      ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward(args)...);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_allocator_prefix_suffix
+   ( boost::false_type use_alloc_prefix, OutermostAlloc& outermost_alloc
+   , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)use_alloc_prefix;
+   allocator_traits::construct
+      (outermost_alloc, p, ::boost::forward(args)..., inner_alloc);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_uses_allocator
+   ( boost::true_type uses_allocator, OutermostAlloc& outermost_alloc
+   , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)uses_allocator;
+   //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix::value ||
+   //                     is_constructible_with_allocator_suffix::value ));
+   dispatch_allocator_prefix_suffix
+      ( is_constructible_with_allocator_prefix()
+      , outermost_alloc, inner_alloc, p, ::boost::forward(args)...);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_uses_allocator
+   ( boost::false_type uses_allocator, OutermostAlloc & outermost_alloc
+   , InnerAlloc & inner_alloc
+   ,T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)uses_allocator; (void)inner_alloc;
+   allocator_traits::construct
+      (outermost_alloc, p, ::boost::forward(args)...);
+}
+
+#else    //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#define BOOST_PP_LOCAL_MACRO(n)                                                              \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_allocator_prefix_suffix(                                                \
+                                       boost::true_type  use_alloc_prefix,                   \
+                                       OutermostAlloc& outermost_alloc,                      \
+                                       InnerAlloc&    inner_alloc,                           \
+                                       T* p                                                  \
+                              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))   \
+{                                                                                            \
+   (void)use_alloc_prefix,                                                                   \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p, allocator_arg, inner_alloc                                        \
+       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                      \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_allocator_prefix_suffix(                                                \
+                           boost::false_type use_alloc_prefix,                               \
+                           OutermostAlloc& outermost_alloc,                                  \
+                           InnerAlloc&    inner_alloc,                                       \
+                           T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+{                                                                                            \
+   (void)use_alloc_prefix;                                                                   \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p                                                                    \
+       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                        \
+      , inner_alloc);                                                                        \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_uses_allocator(boost::true_type uses_allocator,                         \
+                        OutermostAlloc& outermost_alloc,                                     \
+                        InnerAlloc&    inner_alloc,                                          \
+                        T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))    \
+{                                                                                            \
+   (void)uses_allocator;                                                                     \
+   dispatch_allocator_prefix_suffix                                                          \
+      (is_constructible_with_allocator_prefix                                                \
+         < T, InnerAlloc BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>()                              \
+         , outermost_alloc, inner_alloc, p                                                   \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                    \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_uses_allocator(boost::false_type uses_allocator                         \
+                        ,OutermostAlloc &    outermost_alloc                                 \
+                        ,InnerAlloc &    inner_alloc                                         \
+                        ,T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))   \
+{                                                                                            \
+   (void)uses_allocator; (void)inner_alloc;                                                  \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));   \
+}                                                                                            \
+//!
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif   //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template 
+class scoped_allocator_adaptor_base
+   : public OuterAlloc
+{
+   typedef allocator_traits outer_traits_type;
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)
+
+   public:
+   template 
+   struct rebind_base
+   {
+      typedef scoped_allocator_adaptor_base other;
+   };
+
+   typedef OuterAlloc outer_allocator_type;
+   typedef scoped_allocator_adaptor inner_allocator_type;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_copy_assignment::value ||
+      inner_allocator_type::propagate_on_container_copy_assignment::value
+      > propagate_on_container_copy_assignment;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_move_assignment::value ||
+      inner_allocator_type::propagate_on_container_move_assignment::value
+      > propagate_on_container_move_assignment;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_swap::value ||
+      inner_allocator_type::propagate_on_container_swap::value
+      > propagate_on_container_swap;
+
+   scoped_allocator_adaptor_base()
+      {}
+
+   template 
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      , m_inner(args...)
+      {}
+
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+      : outer_allocator_type(::boost::move(other.outer_allocator()))
+      , m_inner(::boost::move(other.inner_allocator()))
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base
+          BOOST_RV_REF_END other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   protected:
+   struct internal_type_t{};
+
+   template 
+   scoped_allocator_adaptor_base
+      ( internal_type_t
+      , BOOST_FWD_REF(OuterA2) outerAlloc
+      , const inner_allocator_type &inner)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      , m_inner(inner)
+   {}
+
+   public:
+
+   scoped_allocator_adaptor_base &operator=
+      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(other.outer_allocator());
+      m_inner = other.inner_allocator();
+      return *this;
+   }
+
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));
+      m_inner = ::boost::move(other.inner_allocator());
+      return *this;
+   }
+
+   inner_allocator_type&       inner_allocator()
+      { return m_inner; }
+
+   inner_allocator_type const& inner_allocator() const
+      { return m_inner; }
+
+   outer_allocator_type      & outer_allocator()
+      { return static_cast(*this); }
+
+   const outer_allocator_type &outer_allocator() const
+      { return static_cast(*this); }
+
+   private:
+   inner_allocator_type m_inner;
+};
+
+#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+//Let's add a dummy first template parameter to allow creating
+//specializations up to maximum InnerAlloc count
+template <
+   typename OuterAlloc
+   , bool Dummy
+   BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
+   >
+class scoped_allocator_adaptor_base;
+
+//Specializations for the adaptor with InnerAlloc allocators
+
+#define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+template                                                                                                \
+class scoped_allocator_adaptor_base                                                                                            \
+   : public OuterAlloc                                                                          \
+{                                                                                               \
+   typedef allocator_traits outer_traits_type;                                      \
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)                                    \
+                                                                                                \
+   public:                                                                                      \
+   template                                                                      \
+   struct rebind_base                                                                           \
+   {                                                                                            \
+      typedef scoped_allocator_adaptor_base other;                                                                               \
+   };                                                                                           \
+                                                                                                \
+   typedef OuterAlloc outer_allocator_type;                                                     \
+   typedef scoped_allocator_adaptor inner_allocator_type;                                                                   \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_copy_assignment::value ||                       \
+      inner_allocator_type::propagate_on_container_copy_assignment::value                       \
+      > propagate_on_container_copy_assignment;                                                 \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_move_assignment::value ||                       \
+      inner_allocator_type::propagate_on_container_move_assignment::value                       \
+      > propagate_on_container_move_assignment;                                                 \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_swap::value ||                                  \
+      inner_allocator_type::propagate_on_container_swap::value                                  \
+      > propagate_on_container_swap;                                                            \
+                                                                                                \
+   scoped_allocator_adaptor_base()                                                              \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc                              \
+      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _))                  \
+      : outer_allocator_type(::boost::forward(outerAlloc))                             \
+      , m_inner(BOOST_PP_ENUM_PARAMS(n, q))                                                     \
+      {}                                                                                        \
+                                                                                                \
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)                    \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)             \
+      : outer_allocator_type(::boost::move(other.outer_allocator()))                            \
+      , m_inner(::boost::move(other.inner_allocator()))                                         \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)                                                                              \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base                                                                \
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base BOOST_RV_REF_END other)                                                              \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   protected:                                                                                   \
+   struct internal_type_t{};                                                                    \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base                                                                \
+      ( internal_type_t                                                                         \
+      , BOOST_FWD_REF(OuterA2) outerAlloc                                                       \
+      , const inner_allocator_type &inner)                                                      \
+      : outer_allocator_type(::boost::forward(outerAlloc))                             \
+      , m_inner(inner)                                                                          \
+   {}                                                                                           \
+                                                                                                \
+   public:                                                                                      \
+   scoped_allocator_adaptor_base &operator=                                                     \
+      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)                              \
+   {                                                                                            \
+      outer_allocator_type::operator=(other.outer_allocator());                                 \
+      m_inner = other.inner_allocator();                                                        \
+      return *this;                                                                             \
+   }                                                                                            \
+                                                                                                \
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)  \
+   {                                                                                            \
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));                    \
+      m_inner = ::boost::move(other.inner_allocator());                                         \
+      return *this;                                                                             \
+   }                                                                                            \
+                                                                                                \
+   inner_allocator_type&       inner_allocator()                                                \
+      { return m_inner; }                                                                       \
+                                                                                                \
+   inner_allocator_type const& inner_allocator() const                                          \
+      { return m_inner; }                                                                       \
+                                                                                                \
+   outer_allocator_type      & outer_allocator()                                                \
+      { return static_cast(*this); }                                     \
+                                                                                                \
+   const outer_allocator_type &outer_allocator() const                                          \
+      { return static_cast(*this); }                               \
+                                                                                                \
+   private:                                                                                     \
+   inner_allocator_type m_inner;                                                                \
+};                                                                                              \
+//!
+#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif   //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+//Specialization for adaptor without any InnerAlloc
+template 
+class scoped_allocator_adaptor_base
+   < OuterAlloc
+   #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+      , true
+      BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat)
+   #endif
+   >
+   : public OuterAlloc
+{
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)
+   public:
+
+   template 
+   struct rebind_base
+   {
+      typedef scoped_allocator_adaptor_base
+         ::template portable_rebind_alloc::type
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         > other;
+   };
+
+   typedef OuterAlloc                           outer_allocator_type;
+   typedef allocator_traits         outer_traits_type;
+   typedef scoped_allocator_adaptor inner_allocator_type;
+   typedef typename outer_traits_type::
+      propagate_on_container_copy_assignment    propagate_on_container_copy_assignment;
+   typedef typename outer_traits_type::
+      propagate_on_container_move_assignment    propagate_on_container_move_assignment;
+   typedef typename outer_traits_type::
+      propagate_on_container_swap               propagate_on_container_swap;
+
+   scoped_allocator_adaptor_base()
+      {}
+
+   template 
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      {}
+
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+      : outer_allocator_type(::boost::move(other.outer_allocator()))
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (const scoped_allocator_adaptor_base<
+         OuterA2
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         >& other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<
+         OuterA2
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         > BOOST_RV_REF_END other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   protected:
+   struct internal_type_t{};
+
+   template 
+   scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      {}
+ 
+   public:
+   scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(other.outer_allocator());
+      return *this;
+   }
+
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));
+      return *this;
+   }
+
+   inner_allocator_type&       inner_allocator()
+      { return static_cast(*this); }
+
+   inner_allocator_type const& inner_allocator() const
+      { return static_cast(*this); }
+
+   outer_allocator_type      & outer_allocator()
+      { return static_cast(*this); }
+
+   const outer_allocator_type &outer_allocator() const
+      { return static_cast(*this); }
+};
+
+}  //namespace container_detail {
+
+///@endcond
+
+//Scoped allocator
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   //! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
+   //! The class template scoped_allocator_adaptor is an allocator template that specifies
+   //! the memory resource (the outer allocator) to be used by a container (as any other
+   //! allocator does) and also specifies an inner allocator resource to be passed to
+   //! the constructor of every element within the container.
+   //!
+   //! This adaptor is
+   //! instantiated with one outer and zero or more inner allocator types. If
+   //! instantiated with only one allocator type, the inner allocator becomes the
+   //! scoped_allocator_adaptor itself, thus using the same allocator resource for the
+   //! container and every element within the container and, if the elements themselves
+   //! are containers, each of their elements recursively. If instantiated with more than
+   //! one allocator, the first allocator is the outer allocator for use by the container,
+   //! the second allocator is passed to the constructors of the container's elements,
+   //! and, if the elements themselves are containers, the third allocator is passed to
+   //! the elements' elements, and so on. If containers are nested to a depth greater
+   //! than the number of allocators, the last allocator is used repeatedly, as in the
+   //! single-allocator case, for any remaining recursions.
+   //!
+   //! [Note: The
+   //! scoped_allocator_adaptor is derived from the outer allocator type so it can be
+   //! substituted for the outer allocator type in most expressions. -end note]
+   //!
+   //! In the construct member functions, `OUTERMOST(x)` is x if x does not have
+   //! an `outer_allocator()` member function and
+   //! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is
+   //! `allocator_traits`.
+   //!
+   //! [Note: `OUTERMOST(x)` and
+   //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
+   //! the definition of `outer_allocator()` to ensure that the recursion terminates.
+   //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
+   template 
+   class scoped_allocator_adaptor
+
+   #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor
+
+   #endif   // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+template 
+class scoped_allocator_adaptor
+#endif
+   : public container_detail::scoped_allocator_adaptor_base
+         
+{
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor)
+
+   public:
+   /// @cond
+   typedef container_detail::scoped_allocator_adaptor_base
+                             base_type;
+   typedef typename base_type::internal_type_t internal_type_t;
+   /// @endcond
+   typedef OuterAlloc                                       outer_allocator_type;
+   //! Type: For exposition only
+   //!
+   typedef allocator_traits                     outer_traits_type;
+   //! Type: `scoped_allocator_adaptor` if `sizeof...(InnerAllocs)` is zero; otherwise,
+   //! `scoped_allocator_adaptor`.
+   typedef typename base_type::inner_allocator_type         inner_allocator_type;
+   typedef typename outer_traits_type::value_type           value_type;
+   typedef typename outer_traits_type::size_type            size_type;
+   typedef typename outer_traits_type::difference_type      difference_type;
+   typedef typename outer_traits_type::pointer              pointer;
+   typedef typename outer_traits_type::const_pointer        const_pointer;
+   typedef typename outer_traits_type::void_pointer         void_pointer;
+   typedef typename outer_traits_type::const_void_pointer   const_void_pointer;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_copy_assignment::value` is
+   //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_copy_assignment                propagate_on_container_copy_assignment;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_move_assignment::value` is
+   //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_move_assignment                propagate_on_container_move_assignment;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_swap::value` is true for any
+   //! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_swap                           propagate_on_container_swap;
+
+   //! Type: Rebinds scoped allocator to
+   //!    `typedef scoped_allocator_adaptor
+   //!      < typename outer_traits_type::template portable_rebind_alloc::type
+   //!      , InnerAllocs... >`
+   template 
+   struct rebind
+   {
+      typedef scoped_allocator_adaptor
+         < typename outer_traits_type::template portable_rebind_alloc::type
+         #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , InnerAllocs...
+         #else
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
+         #endif
+         > other;
+   };
+
+   //! Effects: value-initializes the OuterAlloc base class
+   //! and the inner allocator object.
+   scoped_allocator_adaptor()
+      {}
+
+   ~scoped_allocator_adaptor()
+      {}
+
+   //! Effects: initializes each allocator within the adaptor with
+   //! the corresponding allocator from other.
+   scoped_allocator_adaptor(const scoped_allocator_adaptor& other)
+      : base_type(other.base())
+      {}
+
+   //! Effects: move constructs each allocator within the adaptor with
+   //! the corresponding allocator from other.
+   scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other)
+      : base_type(::boost::move(other.base()))
+      {}
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes the OuterAlloc base class with boost::forward(outerAlloc) and inner
+   //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
+   //! corresponding allocator from the argument list).
+   template 
+   scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs)
+      : base_type(::boost::forward(outerAlloc), innerAllocs...)
+      {}
+   #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   template                                                                      \
+   scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc                                   \
+                     BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _))   \
+      : base_type(::boost::forward(outerAlloc)                                         \
+                  BOOST_PP_ENUM_TRAILING_PARAMS(n, q)                                           \
+                  )                                                                             \
+      {}                                                                                        \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes each allocator within the adaptor with the corresponding allocator from other.
+   template 
+   scoped_allocator_adaptor(const scoped_allocator_adaptor &other)
+      : base_type(other.base())
+      {}
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes each allocator within the adaptor with the corresponding allocator
+   //! rvalue from other.
+   template 
+   scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor BOOST_RV_REF_END other)
+      : base_type(::boost::move(other.base()))
+      {}
+
+   scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
+   {
+      base_type::operator=(static_cast(other));
+      return *this;
+   }
+
+   scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
+   {
+      base_type::operator=(boost::move(static_cast(other)));
+      return *this;
+   }
+
+   //! Returns:
+   //!   `static_cast(*this)`.
+   outer_allocator_type      & outer_allocator()
+      {  return *this; }
+
+   //! Returns:
+   //!   `static_cast(*this)`.
+   const outer_allocator_type &outer_allocator() const
+      {  return *this; }
+
+   //! Returns:
+   //!   *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
+   inner_allocator_type&       inner_allocator()
+      {  return base_type::inner_allocator(); }
+
+   //! Returns:
+   //!   *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
+   inner_allocator_type const& inner_allocator() const
+      {  return base_type::inner_allocator(); }
+
+   //! Returns:
+   //!   `allocator_traits::max_size(outer_allocator())`.
+   size_type max_size() const
+   {
+      return outer_traits_type::max_size(this->outer_allocator());
+   }
+
+   //! Effects:
+   //!   calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`.
+   template 
+   void destroy(T* p)
+   {
+      allocator_traits::type>
+         ::destroy(get_outermost_allocator(this->outer_allocator()), p);
+   }
+
+   //! Returns:
+   //! `allocator_traits::allocate(outer_allocator(), n)`.
+   pointer allocate(size_type n)
+   {
+      return outer_traits_type::allocate(this->outer_allocator(), n);
+   }
+
+   //! Returns:
+   //! `allocator_traits::allocate(outer_allocator(), n, hint)`.
+   pointer allocate(size_type n, const_void_pointer hint)
+   {
+      return outer_traits_type::allocate(this->outer_allocator(), n, hint);
+   }
+
+   //! Effects:
+   //! `allocator_traits::deallocate(outer_allocator(), p, n)`.
+   void deallocate(pointer p, size_type n)
+   {
+      outer_traits_type::deallocate(this->outer_allocator(), p, n);
+   }
+
+   //! Returns: Allocator new scoped_allocator_adaptor object where each allocator
+   //! A in the adaptor is initialized from the result of calling
+   //! `allocator_traits::select_on_container_copy_construction()` on
+   //! the corresponding allocator in *this.
+   scoped_allocator_adaptor select_on_container_copy_construction() const
+   {
+      return scoped_allocator_adaptor
+         (internal_type_t()
+         ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
+         ,outer_traits_type::select_on_container_copy_construction(this->inner_allocator())
+         );
+   }
+   /// @cond
+   base_type &base()             { return *this; }
+
+   const base_type &base() const { return *this; }
+   /// @endcond
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Effects:
+   //! 1) If `uses_allocator::value` is false calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct
+   //!       (OUTERMOST(*this), p, std::forward(args)...)`.
+   //!
+   //! 2) Otherwise, if `uses_allocator::value` is true and
+   //!    `is_constructible::value` is true, calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
+   //!    inner_allocator(), std::forward(args)...)`.
+   //!
+   //! [Note: In compilers without advanced decltype SFINAE support, `is_constructible` can't
+   //! be implemented so that condition will be replaced by
+   //! constructible_with_allocator_prefix::value. -end note]
+   //!
+   //! 3) Otherwise, if uses_allocator::value is true and
+   //!    `is_constructible::value` is true, calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
+   //!    std::forward(args)..., inner_allocator())`.
+   //!
+   //! [Note: In compilers without advanced decltype SFINAE support, `is_constructible` can't be
+   //! implemented so that condition will be replaced by
+   //! `constructible_with_allocator_suffix::value`. -end note]
+   //!
+   //! 4) Otherwise, the program is ill-formed.
+   //!
+   //! [Note: An error will result if `uses_allocator` evaluates
+   //! to true but the specific constructor does not take an allocator. This definition prevents a silent
+   //! failure to pass an inner allocator to a contained element. -end note]
+   template < typename T, class ...Args>
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   void
+   #else
+   typename container_detail::enable_if_c::value, void>::type
+   #endif
+   construct(T* p, BOOST_FWD_REF(Args)...args)
+   {
+      container_detail::dispatch_uses_allocator
+         ( uses_allocator()
+         , get_outermost_allocator(this->outer_allocator())
+         , this->inner_allocator()
+         , p, ::boost::forward(args)...);
+   }
+
+   #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
+   //overload selection problems when the first parameter is a pair.
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   template < typename T                                                                        \
+            BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+            >                                                                                   \
+   typename container_detail::enable_if_c::value, void>::type     \
+      construct(T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))               \
+   {                                                                                            \
+      container_detail::dispatch_uses_allocator                                                 \
+         ( uses_allocator()                                            \
+         , get_outermost_allocator(this->outer_allocator())                                     \
+         , this->inner_allocator()                                                              \
+         , p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
+   }                                                                                            \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   template 
+   void construct(std::pair* p)
+   {  this->construct_pair(p);  }
+
+   template 
+   void construct(container_detail::pair* p)
+   {  this->construct_pair(p);  }
+
+   template 
+   void construct(std::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {  this->construct_pair(p, ::boost::forward(x), ::boost::forward(y));   }
+
+   template 
+   void construct(container_detail::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {  this->construct_pair(p, ::boost::forward(x), ::boost::forward(y));   }
+  
+   template 
+   void construct(std::pair* p, const std::pair& x)
+   {  this->construct_pair(p, x);   }
+
+   template 
+   void construct( container_detail::pair* p
+                 , const container_detail::pair& x)
+   {  this->construct_pair(p, x);   }
+  
+   template 
+   void construct( std::pair* p
+                 , BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END x)
+   {  this->construct_pair(p, x);   }
+
+   template 
+   void construct( container_detail::pair* p
+                 , BOOST_RV_REF_BEG container_detail::pair BOOST_RV_REF_END x)
+   {  this->construct_pair(p, x);   }
+
+   /// @cond
+   private:
+   template 
+   void construct_pair(Pair* p)
+   {
+      this->construct(container_detail::addressof(p->first));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {
+      this->construct(container_detail::addressof(p->first), ::boost::forward(x));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), ::boost::forward(y));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, const Pair2& pr)
+   {
+      this->construct(container_detail::addressof(p->first), pr.first);
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), pr.second);
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr)
+   {
+      this->construct(container_detail::addressof(p->first), ::boost::move(pr.first));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), ::boost::move(pr.second));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   //template 
+   //void construct(pair* p, piecewise_construct_t, tuple x, tuple y);
+
+   private:
+   template 
+   scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner)
+      : base_type(internal_type_t(), ::boost::forward(outer), inner)
+   {}
+
+   /// @endcond
+};
+
+template 
+inline bool operator==(
+   const scoped_allocator_adaptor& a,
+   const scoped_allocator_adaptor& b)
+{
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)  
+   const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
+   #else
+   const bool has_zero_inner =
+      boost::container::container_detail::is_same
+         ::value;
+   #endif
+
+    return a.outer_allocator() == b.outer_allocator()
+        && (has_zero_inner || a.inner_allocator() == b.inner_allocator());
+}
+
+template 
+inline bool operator!=(
+   const scoped_allocator_adaptor& a,
+   const scoped_allocator_adaptor& b)
+{
+    return ! (a == b);
+}
+
+}} // namespace boost { namespace container {
+
+#include 
+
+#endif //  BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
diff --git a/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp b/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp
new file mode 100644
index 000000000..ef2479933
--- /dev/null
+++ b/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-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.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+
+#if (defined MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include 
+#include 
+#endif
+
+namespace boost { namespace container {
+
+///@cond
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor;
+
+   #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor;
+
+   template 
+   class scoped_allocator_adaptor;
+
+   #endif   // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+
+#else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template 
+class scoped_allocator_adaptor;
+
+#endif
+
+///@endcond
+
+//! The allocator_arg_t struct is an empty structure type used as a unique type to
+//! disambiguate constructor and function overloading. Specifically, several types
+//! have constructors with allocator_arg_t as the first argument, immediately followed
+//! by an argument of a type that satisfies the Allocator requirements
+struct allocator_arg_t{};
+
+//! A instance of type allocator_arg_t
+//!
+static const allocator_arg_t allocator_arg = allocator_arg_t();
+
+template 
+struct constructible_with_allocator_suffix;
+
+template 
+struct constructible_with_allocator_prefix;
+
+template 
+struct uses_allocator;
+
+}} // namespace boost { namespace container {
+
+#include 
+
+#endif //  BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
diff --git a/project/jni/boost/include/boost/container/set.hpp b/project/jni/boost/include/boost/container/set.hpp
index b25e7013f..0b4937610 100644
--- a/project/jni/boost/include/boost/container/set.hpp
+++ b/project/jni/boost/include/boost/container/set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -23,402 +23,357 @@
 #include 
 #include 
 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
+#include 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators < and ==, needed for friend declaration.
-template 
-inline bool operator==(const set& x, 
-                       const set& y);
+template 
+inline bool operator==(const set& x,
+                       const set& y);
 
-template 
-inline bool operator<(const set& x, 
-                      const set& y);
+template 
+inline bool operator<(const set& x,
+                      const set& y);
 /// @endcond
 
-//! A set is a kind of associative container that supports unique keys (contains at 
-//! most one of each key value) and provides for fast retrieval of the keys themselves. 
-//! Class set supports bidirectional iterators. 
-//! 
-//! A set satisfies all of the requirements of a container and of a reversible container 
-//! , and of an associative container. A set also provides most operations described in 
+//! A set is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of the keys themselves.
+//! Class set supports bidirectional iterators.
+//!
+//! A set satisfies all of the requirements of a container and of a reversible container
+//! , and of an associative container. A set also provides most operations described in
 //! for unique keys.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class set 
+class set
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(set)
-   typedef container_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Compare, Allocator> tree_t;
    tree_t m_tree;  // red-black tree representing set
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef Pred                                    key_compare;
-   typedef Pred                                    value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty set.
-   //! 
+   //!
    //! Complexity: Constant.
    set()
       : m_tree()
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object 
+   //! Effects: Constructs an empty set using the specified comparison object
    //! and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit set(const Pred& comp,
+   explicit set(const Compare& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   set(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   set(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, true) 
+      : m_tree(true, first, last, comp, a)
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
    set( ordered_unique_range_t, InputIterator first, InputIterator last
-      , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a set.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   set(const set& x) 
+   set(const set& x)
       : m_tree(x.m_tree)
    {}
 
    //! Effects: Move constructs a set. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   set(BOOST_RV_REF(set) x) 
+   set(BOOST_RV_REF(set) x)
       : m_tree(boost::move(x.m_tree))
    {}
 
+   //! Effects: Copy constructs a set using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   set(const set& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   set(BOOST_RV_REF(set) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
    set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
    set& operator=(BOOST_RV_REF(set) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return m_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const
    { return m_tree.get_stored_allocator(); }
 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator()
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant
-   iterator begin() 
+   iterator begin()
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
    { return m_tree.begin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end()
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const
    { return m_tree.end(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-   { return m_tree.rbegin(); } 
+   reverse_iterator rbegin()
+   { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const
+   { return m_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return m_tree.cbegin(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return m_tree.cend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return m_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const
+   { return m_tree.crbegin(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return m_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(set& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   std::pair insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   std::pair insert(T &x)
-   { return this->insert(const_cast(x)); }
-
-   template
-   std::pair insert(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Move constructs a new value from x if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_unique(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_unique(p, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects:  Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is 
+   //! Effects:  Inserts an object x of type Key constructed with
+   //!   std::forward(args)... if and only if there is
    //!   no element in the container with equivalent value.
    //!   and returns the iterator pointing to the
    //!   newly inserted element.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Throws: If memory allocation throws or
-   //!   T's in-place constructor throws.
+   //!   Key's in-place constructor throws.
    //!
    //! Complexity: Logarithmic.
    template 
    std::pair emplace(Args&&... args)
    {  return m_tree.emplace_unique(boost::forward(args)...); }
 
-   //! Effects:  Inserts an object of type T constructed with
-   //!   std::forward(args)... if and only if there is 
+   //! Effects:  Inserts an object of type Key constructed with
+   //!   std::forward(args)... if and only if there is
    //!   no element in the container with equivalent value.
    //!   p is a hint pointing to where the insert
    //!   should start to search.
@@ -448,14 +403,74 @@ class set
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   std::pair insert(const value_type &x);
+
+   //! Effects: Move constructs a new value from x if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   std::pair insert(value_type &&x);
+   #else
+   private:
+   typedef std::pair insert_return_pair;
+   public:
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_unique(first, last);  }
+
    //! Effects: Erases the element pointed to by p.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p)
    {  return m_tree.erase(p); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -463,7 +478,7 @@ class set
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
    {  return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -471,49 +486,83 @@ class set
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
    {  return m_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(set& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear()
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return m_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.find(x) == m_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -523,25 +572,23 @@ class set
    iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -552,121 +599,130 @@ class set
    friend bool operator< (const set&, const set&);
 
    private:
-   std::pair priv_insert(const T &x) 
-   {  return m_tree.insert_unique(x);  }
-
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_tree.insert_unique(p, x); }
+   template 
+   std::pair priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_unique(::boost::forward(x));  }
 
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_unique(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const set& x, 
-                       const set& y) 
+template 
+inline bool operator==(const set& x,
+                       const set& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const set& x, 
-                      const set& y) 
+template 
+inline bool operator<(const set& x,
+                      const set& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator!=(const set& x,
+                       const set& y)
 {  return !(x == y);   }
 
-template 
-inline bool operator>(const set& x, 
-                      const set& y) 
+template 
+inline bool operator>(const set& x,
+                      const set& y)
 {  return y < x; }
 
-template 
-inline bool operator<=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator<=(const set& x,
+                       const set& y)
 {  return !(y < x); }
 
-template 
-inline bool operator>=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator>=(const set& x,
+                       const set& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(set& x, set& y) 
+template 
+inline void swap(set& x, set& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
-template 
-inline bool operator==(const multiset& x, 
-                       const multiset& y);
+template 
+inline bool operator==(const multiset& x,
+                       const multiset& y);
 
-template 
-inline bool operator<(const multiset& x, 
-                      const multiset& y);
+template 
+inline bool operator<(const multiset& x,
+                      const multiset& y);
 /// @endcond
 
-//! A multiset is a kind of associative container that supports equivalent keys 
-//! (possibly contains multiple copies of the same key value) and provides for 
+//! A multiset is a kind of associative container that supports equivalent keys
+//! (possibly contains multiple copies of the same key value) and provides for
 //! fast retrieval of the keys themselves. Class multiset supports bidirectional iterators.
-//! 
-//! A multiset satisfies all of the requirements of a container and of a reversible 
-//! container, and of an associative container). multiset also provides most operations 
+//!
+//! A multiset satisfies all of the requirements of a container and of a reversible
+//! container, and of an associative container). multiset also provides most operations
 //! described for duplicate keys.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class multiset 
+class multiset
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multiset)
-   typedef container_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Compare, Allocator> tree_t;
    tree_t m_tree;  // red-black tree representing multiset
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef Pred                                    key_compare;
-   typedef Pred                                    value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
+
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Constructs an empty multiset using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
    multiset()
       : m_tree()
@@ -674,308 +730,267 @@ class multiset
 
    //! Effects: Constructs an empty multiset using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit multiset(const Pred& comp,
+   explicit multiset(const Compare& comp,
                      const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
 
    //! Effects: Constructs an empty multiset using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    multiset(InputIterator first, InputIterator last,
-            const Pred& comp = Pred(),
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, false) 
+      : m_tree(false, first, last, comp, a)
    {}
 
-   //! Effects: Constructs an empty multiset using the specified comparison object and 
+   //! Effects: Constructs an empty multiset using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last ). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
-   multiset( ordered_range_t ordered_range, InputIterator first, InputIterator last
-           , const Pred& comp = Pred()
+   multiset( ordered_range_t, InputIterator first, InputIterator last
+           , const Compare& comp = Compare()
            , const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a multiset.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multiset(const multiset& x) 
+   multiset(const multiset& x)
       : m_tree(x.m_tree)
    {}
 
    //! Effects: Move constructs a multiset. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   multiset(BOOST_RV_REF(multiset) x) 
+   multiset(BOOST_RV_REF(multiset) x)
       : m_tree(boost::move(x.m_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a multiset using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x) 
+   multiset(const multiset& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   multiset(BOOST_RV_REF(multiset) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   multiset& operator=(BOOST_RV_REF(multiset) x) 
+   multiset& operator=(BOOST_RV_REF(multiset) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return m_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
-   { return m_tree.get_stored_allocator(); }
-
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator()
    { return m_tree.get_stored_allocator(); }
 
-   //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const
+   { return m_tree.get_stored_allocator(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin()
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
    { return m_tree.begin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end()
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const
    { return m_tree.end(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-   { return m_tree.rbegin(); } 
+   reverse_iterator rbegin()
+   { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const
+   { return m_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return m_tree.cbegin(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return m_tree.cend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return m_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const
+   { return m_tree.crbegin(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return m_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(multiset& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(T &x)
-   { return this->insert(const_cast(x)); }
-
-   template
-   iterator insert(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a copy of x in the container.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_equal(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_equal(p, boost::move(x));  }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_equal(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic.
    template 
    iterator emplace(Args&&... args)
    {  return m_tree.emplace_equal(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)...
    //!
    //! Returns: An iterator pointing to the element with key equivalent
@@ -1005,14 +1020,69 @@ class multiset
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+
+
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const value_type &x);
+
+   //! Effects: Inserts a copy of x in the container.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_equal(first, last);  }
+
    //! Effects: Erases the element pointed to by p.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p)
    {  return m_tree.erase(p); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1020,7 +1090,7 @@ class multiset
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
    {  return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1031,46 +1101,80 @@ class multiset
    iterator erase(const_iterator first, const_iterator last)
    {  return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(multiset& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear()
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return m_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const iterator pointing to an element with the key
+   //! Returns: Allocator const iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.count(x);  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -1080,25 +1184,23 @@ class multiset
    iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -1109,61 +1211,63 @@ class multiset
    friend bool operator< (const multiset&,
                           const multiset&);
    private:
-   iterator priv_insert(const T &x) 
-   {  return m_tree.insert_equal(x);  }
+   template 
+   iterator priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_equal(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_tree.insert_equal(p, x); }
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_equal(p, ::boost::forward(x)); }
 
    /// @endcond
 };
 
-template 
-inline bool operator==(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator==(const multiset& x,
+                       const multiset& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const multiset& x, 
-                      const multiset& y) 
+template 
+inline bool operator<(const multiset& x,
+                      const multiset& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator!=(const multiset& x,
+                       const multiset& y)
 {  return !(x == y);  }
 
-template 
-inline bool operator>(const multiset& x, 
-                      const multiset& y) 
+template 
+inline bool operator>(const multiset& x,
+                      const multiset& y)
 {  return y < x;  }
 
-template 
-inline bool operator<=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator<=(const multiset& x,
+                       const multiset& y)
 {  return !(y < x);  }
 
-template 
-inline bool operator>=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator>=(const multiset& x,
+                       const multiset& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(multiset& x, multiset& y) 
+template 
+inline void swap(multiset& x, multiset& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/slist.hpp b/project/jni/boost/include/boost/container/slist.hpp
index 1cdcdf104..84cccda46 100644
--- a/project/jni/boost/include/boost/container/slist.hpp
+++ b/project/jni/boost/include/boost/container/slist.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-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)
 //
@@ -19,10 +19,12 @@
 #include 
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +34,7 @@
 #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 //Preprocessor library to emulate perfect forwarding
 #else
-#include  
+#include 
 #endif
 
 #include 
@@ -42,16 +44,14 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 
+template 
+class slist;
+
 namespace container_detail {
 
 template
@@ -65,38 +65,18 @@ template 
 struct slist_node
    :  public slist_hook::type
 {
+   private:
+   slist_node();
 
-   slist_node()
-      : m_data()
-   {}
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   slist_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-
-   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                      \
-   template                           \
-   slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))       \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))   \
-   {}                                                                   \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename slist_hook::type hook_type;
    T m_data;
 };
 
-template
+template
 struct intrusive_slist_type
 {
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef boost::container::allocator_traits      allocator_traits_type;
    typedef typename allocator_traits_type::value_type value_type;
    typedef typename boost::intrusive::pointer_traits
       ::template
@@ -115,59 +95,143 @@ struct intrusive_slist_type
    typedef container_type                       type ;
 };
 
+template
+class slist_const_iterator
+   : public std::iterator< std::forward_iterator_tag, T
+                         , typename iiterator_types::difference_type
+                         , typename iiterator_types::const_pointer
+                         , typename iiterator_types::const_reference>
+{
+   protected:
+
+   IIterator m_it;
+
+   public:
+   typedef typename iiterator_types::const_pointer     const_pointer;
+   typedef typename iiterator_types::const_reference   const_reference;
+
+   //Constructors
+   slist_const_iterator()
+      : m_it()
+   {}
+
+   explicit slist_const_iterator(const IIterator &it) 
+      : m_it(it)
+   {}
+
+   //Pointer like operators
+   const_reference operator*() const
+   { return this->m_it->m_data;  }
+
+   const_pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   slist_const_iterator& operator++()      
+   { ++this->m_it;  return *this; }
+
+   slist_const_iterator operator++(int)     
+   { IIterator tmp = this->m_it; ++*this; return slist_const_iterator(tmp);  }
+
+   //Comparison operators
+   friend bool operator== (const slist_const_iterator& l, const slist_const_iterator& r)
+   {  return l.m_it == r.m_it;  }
+
+   friend bool operator!= (const slist_const_iterator& l, const slist_const_iterator& r)
+   {  return l.m_it != r.m_it;  }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
+template
+class slist_iterator
+   : public slist_const_iterator
+{
+   private:
+   typedef slist_const_iterator const_iterator;
+
+   public:
+   typedef typename iiterator_types::pointer           pointer;
+   typedef typename iiterator_types::reference         reference;
+
+   //Constructors
+   slist_iterator()
+      : const_iterator()
+   {}
+
+   explicit slist_iterator(const IIterator &it)
+      :  const_iterator(it)
+   {}
+
+   //Pointer like operators
+   reference operator*()  const
+   {  return  this->m_it->m_data;  }
+
+   pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::to_pointer(this->m_it->m_data); }
+
+   //Increment / Decrement
+   slist_iterator& operator++() 
+   { ++this->m_it; return *this;  }
+
+   slist_iterator operator++(int)
+   { IIterator tmp = this->m_it; ++*this; return slist_iterator(tmp); }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
 }  //namespace container_detail {
 
 /// @endcond
 
-//! An slist is a singly linked list: a list where each element is linked to the next 
-//! element, but not to the previous element. That is, it is a Sequence that 
-//! supports forward but not backward traversal, and (amortized) constant time 
-//! insertion and removal of elements. Slists, like lists, have the important 
-//! property that insertion and splicing do not invalidate iterators to list elements, 
-//! and that even removal invalidates only the iterators that point to the elements 
-//! that are removed. The ordering of iterators may be changed (that is, 
-//! slist::iterator might have a different predecessor or successor after a list 
-//! operation than it did before), but the iterators themselves will not be invalidated 
+//! An slist is a singly linked list: a list where each element is linked to the next
+//! element, but not to the previous element. That is, it is a Sequence that
+//! supports forward but not backward traversal, and (amortized) constant time
+//! insertion and removal of elements. Slists, like lists, have the important
+//! property that insertion and splicing do not invalidate iterators to list elements,
+//! and that even removal invalidates only the iterators that point to the elements
+//! that are removed. The ordering of iterators may be changed (that is,
+//! slist::iterator might have a different predecessor or successor after a list
+//! operation than it did before), but the iterators themselves will not be invalidated
 //! or made to point to different elements unless that invalidation or mutation is explicit.
 //!
-//! The main difference between slist and list is that list's iterators are bidirectional 
-//! iterators, while slist's iterators are forward iterators. This means that slist is 
-//! less versatile than list; frequently, however, bidirectional iterators are 
-//! unnecessary. You should usually use slist unless you actually need the extra 
-//! functionality of list, because singly linked lists are smaller and faster than double 
-//! linked lists. 
-//! 
-//! Important performance note: like every other Sequence, slist defines the member 
-//! functions insert and erase. Using these member functions carelessly, however, can 
-//! result in disastrously slow programs. The problem is that insert's first argument is 
-//! an iterator p, and that it inserts the new element(s) before p. This means that 
-//! insert must find the iterator just before p; this is a constant-time operation 
-//! for list, since list has bidirectional iterators, but for slist it must find that 
-//! iterator by traversing the list from the beginning up to p. In other words: 
+//! The main difference between slist and list is that list's iterators are bidirectional
+//! iterators, while slist's iterators are forward iterators. This means that slist is
+//! less versatile than list; frequently, however, bidirectional iterators are
+//! unnecessary. You should usually use slist unless you actually need the extra
+//! functionality of list, because singly linked lists are smaller and faster than double
+//! linked lists.
+//!
+//! Important performance note: like every other Sequence, slist defines the member
+//! functions insert and erase. Using these member functions carelessly, however, can
+//! result in disastrously slow programs. The problem is that insert's first argument is
+//! an iterator p, and that it inserts the new element(s) before p. This means that
+//! insert must find the iterator just before p; this is a constant-time operation
+//! for list, since list has bidirectional iterators, but for slist it must find that
+//! iterator by traversing the list from the beginning up to p. In other words:
 //! insert and erase are slow operations anywhere but near the beginning of the slist.
-//! 
-//! Slist provides the member functions insert_after and erase_after, which are constant 
-//! time operations: you should always use insert_after and erase_after whenever 
-//! possible. If you find that insert_after and erase_after aren't adequate for your 
-//! needs, and that you often need to use insert and erase in the middle of the list, 
+//!
+//! Slist provides the member functions insert_after and erase_after, which are constant
+//! time operations: you should always use insert_after and erase_after whenever
+//! possible. If you find that insert_after and erase_after aren't adequate for your
+//! needs, and that you often need to use insert and erase in the middle of the list,
 //! then you should probably use list instead of slist.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class slist 
+class slist
    : protected container_detail::node_alloc_holder
-      ::type>
+      ::type>
 {
    /// @cond
-   typedef typename container_detail::
-      move_const_ref_type::type                    insert_const_ref_type;
-   typedef typename 
-      container_detail::intrusive_slist_type::type           Icont;
-   typedef container_detail::node_alloc_holder        AllocHolder;
+   typedef typename
+      container_detail::intrusive_slist_type::type           Icont;
+   typedef container_detail::node_alloc_holder        AllocHolder;
    typedef typename AllocHolder::NodePtr              NodePtr;
-   typedef slist                                ThisType;
    typedef typename AllocHolder::NodeAlloc            NodeAlloc;
    typedef typename AllocHolder::ValAlloc             ValAlloc;
    typedef typename AllocHolder::Node                 Node;
@@ -175,7 +239,7 @@ class slist
    typedef typename AllocHolder::allocator_v1         allocator_v1;
    typedef typename AllocHolder::allocator_v2         allocator_v2;
    typedef typename AllocHolder::alloc_version        alloc_version;
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef boost::container::allocator_traits      allocator_traits_type;
 
    class equal_to_value
    {
@@ -205,141 +269,54 @@ class slist
       bool operator()(const Node &a) const
       {  return static_cast(*this)(a.m_data);  }
    };
-   /// @endcond
-   public:
-   //! The type of object, T, stored in the list
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                                allocator_type;
-   //! Non-standard extension: the stored allocator type
-   typedef NodeAlloc                                        stored_allocator_type;
 
-   /// @cond
-   private:
    BOOST_COPYABLE_AND_MOVABLE(slist)
-   typedef difference_type                         list_difference_type;
-   typedef pointer                                 list_pointer;
-   typedef const_pointer                           list_const_pointer;
-   typedef reference                               list_reference;
-   typedef const_reference                         list_const_reference;
+   typedef container_detail::slist_iterator      iterator_impl;
+   typedef container_detail::slist_const_iteratorconst_iterator_impl;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   //! Const iterator used to iterate through a list. 
-   class const_iterator
-      /// @cond
-      : public std::iterator
-   {
-
-      protected:
-      typename Icont::iterator m_it;
-      explicit const_iterator(typename Icont::iterator it)  : m_it(it){}
-      void prot_incr(){ ++m_it; }
-
-      private:
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class slist;
-      typedef list_difference_type        difference_type;
-
-      //Constructors
-      const_iterator()
-         :  m_it()
-      {}
-
-      //Pointer like operators
-      const_reference operator*() const 
-      { return m_it->m_data;  }
-
-      const_pointer   operator->() const 
-      { return  const_pointer(&m_it->m_data); }
-
-      //Increment / Decrement
-      const_iterator& operator++()       
-      { prot_incr();  return *this; }
-
-      const_iterator operator++(int)      
-      { typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp);  }
-
-      //Comparison operators
-      bool operator==   (const const_iterator& r)  const
-      {  return m_it == r.m_it;  }
-
-      bool operator!=   (const const_iterator& r)  const
-      {  return m_it != r.m_it;  }
-   }
-      /// @endcond
-   ;
-
-   //! Iterator used to iterate through a list
-   class iterator
-      /// @cond
-   : public const_iterator
-   {
-
-      private:
-      explicit iterator(typename Icont::iterator it)
-         :  const_iterator(it)
-      {}
-   
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class slist;
-      typedef list_pointer       pointer;
-      typedef list_reference     reference;
-
-      //Constructors
-      iterator(){}
-
-      //Pointer like operators
-      reference operator*()  const {  return  this->m_it->m_data;  }
-      pointer   operator->() const {  return  pointer(&this->m_it->m_data);  }
-
-      //Increment / Decrement
-      iterator& operator++()  
-         { this->prot_incr(); return *this;  }
-
-      iterator operator++(int)
-         { typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
-   }
-      /// @endcond
-   ;
+   typedef T                                                                  value_type;
+   typedef typename ::boost::container::allocator_traits::pointer          pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference        reference;
+   typedef typename ::boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type        size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                  allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(NodeAlloc)                                  stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                              iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                        const_iterator;
 
    public:
+
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    slist()
       :  AllocHolder()
    {}
 
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit slist(const allocator_type& a)
+   explicit slist(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       :  AllocHolder(a)
    {}
 
@@ -352,11 +329,11 @@ class slist
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit slist(size_type n, const value_type& x, const allocator_type& a = allocator_type())
       :  AllocHolder(a)
-   { this->priv_create_and_insert_nodes(this->before_begin(), n, x); }
+   { this->insert_after(this->cbefore_begin(), n, x); }
 
    //! Effects: Constructs a list that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the list.
@@ -366,35 +343,71 @@ class slist
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   slist(InpIt first, InpIt last,
-         const allocator_type& a =  allocator_type()) 
+   slist(InpIt first, InpIt last, const allocator_type& a =  allocator_type())
       : AllocHolder(a)
-   { this->insert_after(this->before_begin(), first, last); }
+   { this->insert_after(this->cbefore_begin(), first, last); }
 
    //! Effects: Copy constructs a list.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
-   slist(const slist& x) 
+   slist(const slist& x)
       : AllocHolder(x)
-   { this->insert_after(this->before_begin(), x.begin(), x.end()); }
+   { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    slist(BOOST_RV_REF(slist) x)
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   slist(const slist& x, const allocator_type &a)
+      : AllocHolder(a)
+   { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves x's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   slist(BOOST_RV_REF(slist) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
+   //! Effects: Destroys the list. All stored values are destroyed
+   //!   and used memory is deallocated.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements.
+   ~slist() BOOST_CONTAINER_NOEXCEPT
+   {} //AllocHolder clears the slist
+
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -417,8 +430,8 @@ class slist
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -446,38 +459,16 @@ class slist
       return *this;
    }
 
-   //! Effects: Destroys the list. All stored values are destroyed
-   //!   and used memory is deallocated.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements.
-   ~slist() 
-   {} //AllocHolder clears the slist
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const
-   {  return allocator_type(this->node_alloc()); }
-
-   const stored_allocator_type &get_stored_allocator() const 
-   {  return this->node_alloc(); }
-
-   stored_allocator_type &get_stored_allocator()
-   {  return this->node_alloc(); }
-
-   public:
-
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
    void assign(size_type n, const T& val)
-   { this->priv_fill_assign(n, val); }
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->assign(cvalue_iterator(val, n), cvalue_iterator());
+   }
 
    //! Effects: Assigns the range [first, last) to *this.
    //!
@@ -486,327 +477,257 @@ class slist
    //!
    //! Complexity: Linear to n.
    template 
-   void assign(InpIt first, InpIt last) 
+   void assign(InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
+      iterator end_n(this->end());
+      iterator prev(this->before_begin());
+      iterator node(this->begin());
+      while (node != end_n && first != last){
+         *node = *first;
+         prev = node;
+         ++node;
+         ++first;
+      }
+      if (first != last)
+         this->insert_after(prev, first, last);
+      else
+         this->erase_after(prev, end_n);
    }
 
-   //! Effects: Returns an iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a copy of the internal allocator.
+   //!
+   //! Throws: If allocator's copy constructor throws.
+   //!
    //! Complexity: Constant.
-   iterator begin() 
-   { return iterator(this->icont().begin()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return allocator_type(this->node_alloc()); }
 
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   {  return this->cbegin();   }
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
 
-   //! Effects: Returns an iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   iterator end()
-   { return iterator(this->icont().end()); }
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
 
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const
-   {  return this->cend();   }
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns a non-dereferenceable iterator that,
    //! when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! as the argument to insert_after, erase_after, etc.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator before_begin() 
+   iterator before_begin() BOOST_CONTAINER_NOEXCEPT
    {  return iterator(end());  }
 
-   //! Effects: Returns a non-dereferenceable const_iterator 
+   //! Effects: Returns a non-dereferenceable const_iterator
    //! that, when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! as the argument to insert_after, erase_after, etc.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator before_begin() const
+   const_iterator before_begin() const BOOST_CONTAINER_NOEXCEPT
    {  return this->cbefore_begin();  }
 
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
+   //! Effects: Returns an iterator to the first element contained in the list.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().begin()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cbegin();   }
+
+   //! Effects: Returns an iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().end()); }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cend();   }
+
+   //! Effects: Returns a non-dereferenceable const_iterator
+   //! that, when incremented, yields begin().  This iterator may be used
+   //! as the argument to insert_after, erase_after, etc.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbefore_begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(end());  }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
    {  return const_iterator(this->non_const_icont().begin());   }
 
    //! Effects: Returns a const_iterator to the end of the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
    {  return const_iterator(this->non_const_icont().end());   }
 
-   //! Effects: Returns a non-dereferenceable const_iterator 
-   //! that, when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! Returns: The iterator to the element before i in the sequence.
+   //!   Returns the end-iterator, if either i is the begin-iterator or the
+   //!   sequence is empty.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
+   //! Complexity: Linear to the number of elements before i.
+   //!
+   //! Note: Non-standard extension.
+   iterator previous(iterator p) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->icont().previous(p.get())); }
+
+   //! Returns: The const_iterator to the element before i in the sequence.
+   //!   Returns the end-const_iterator, if either i is the begin-const_iterator or
+   //!   the sequence is empty.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements before i.
+   //!
+   //! Note: Non-standard extension.
+   const_iterator previous(const_iterator p)
+   {  return const_iterator(this->icont().previous(p.get())); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the list contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
    //! Complexity: Constant.
-   const_iterator cbefore_begin() const
-   {  return const_iterator(end());  }
+   bool empty() const
+   {  return !this->size();   }
 
    //! Effects: Returns the number of the elements contained in the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    {  return this->icont().size(); }
 
    //! Effects: Returns the largest possible size of the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    {  return AllocHolder::max_size();  }
 
-   //! Effects: Returns true if the list contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const 
-   {  return !this->size();   }
-
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
    //!
-   //! Throws: Nothing.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Complexity: Linear to the number of elements on *this and x.
-   void swap(slist& x)
-   {  AllocHolder::swap(x);   }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front() 
-   {  return *this->begin();  }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const 
-   {  return *this->begin();  }
-
-   //! Effects: Inserts a copy of t in the beginning of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(insert_const_ref_type x)
-   {  return priv_push_front(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   void push_front(T &x) { push_front(const_cast(x)); }
-
-   template
-   void push_front(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_push_front(u); }
-   #endif
-
-   //! Effects: Constructs a new element in the beginning of the list
-   //!   and moves the resources of t to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(BOOST_RV_REF(T) x)
-   {  this->icont().push_front(*this->create_node(boost::move(x)));  }
-
-   //! Effects: Removes the first element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_front()
-   {  this->icont().pop_front_and_dispose(Destroyer(this->node_alloc()));      }
-
-   //! Returns: The iterator to the element before i in the sequence. 
-   //!   Returns the end-iterator, if either i is the begin-iterator or the 
-   //!   sequence is empty. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear to the number of elements before i. 
-   iterator previous(iterator p) 
-   {  return iterator(this->icont().previous(p.get())); }
-
-   //! Returns: The const_iterator to the element before i in the sequence. 
-   //!   Returns the end-const_iterator, if either i is the begin-const_iterator or 
-   //!   the sequence is empty. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear to the number of elements before i. 
-   const_iterator previous(const_iterator p) 
-   {  return const_iterator(this->icont().previous(p.get())); }
-
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts a copy of the value after the p pointed
-   //!    by prev_p.
-   //!
-   //! Returns: An iterator to the inserted element.
-   //! 
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //! 
-   //! Complexity: Amortized constant time.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   iterator insert_after(const_iterator prev_pos, insert_const_ref_type x) 
-   {  return this->priv_insert_after(prev_pos, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert_after(const_iterator position, T &x)
-   { return this->insert_after(position, const_cast(x)); }
-
-   template
-   iterator insert_after( const_iterator position, const U &u
-                        , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert_after(position, u); }
-   #endif
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts a move constructed copy object from the value after the
-   //!    p pointed by prev_pos.
-   //!
-   //! Returns: An iterator to the inserted element.
-   //! 
-   //! Throws: If memory allocation throws.
-   //! 
-   //! Complexity: Amortized constant time.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   iterator insert_after(const_iterator prev_pos, BOOST_RV_REF(value_type) x) 
-   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(boost::move(x)))); }
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x after prev_pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   void insert_after(const_iterator prev_pos, size_type n, const value_type& x)
-   {  this->priv_create_and_insert_nodes(prev_pos, n, x); }
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //! 
-   //! Effects: Inserts the range pointed by [first, last) 
-   //!   after the p prev_pos.
-   //! 
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //! 
-   //! Complexity: Linear to the number of elements inserted.
-   //! 
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   template 
-   void insert_after(const_iterator prev_pos, InIter first, InIter last) 
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
+      const_iterator last_pos;
+      if(!priv_try_shrink(new_size, last_pos)){
+         typedef default_construct_iterator default_iterator;
+         this->insert_after(last_pos, default_iterator(new_size - this->size()), default_iterator());
+      }
    }
 
-   //! Requires: p must be a valid iterator of *this.
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
    //!
-   //! Effects: Insert a copy of x before p.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: Linear to the elements before p.
-   iterator insert(const_iterator position, insert_const_ref_type x) 
-   {  return this->priv_insert(position, x); }
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      const_iterator last_pos;
+      if(!priv_try_shrink(new_size, last_pos)){
+         this->insert_after(last_pos, new_size, x);
+      }
+   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert(position, u); }
-   #endif
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front()
+   {  return *this->begin();  }
 
-   //! Requires: p must be a valid iterator of *this.
+   //! Requires: !empty()
    //!
-   //! Effects: Insert a new element before p with mx's resources.
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements before p.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return this->insert_after(previous(p), boost::move(x)); }
+   //! Complexity: Constant.
+   const_reference front() const
+   {  return *this->begin();  }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x before p.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n plus linear to the elements before p.
-   void insert(const_iterator p, size_type n, const value_type& x) 
-   {  return this->insert_after(previous(p), n, x); }
-      
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before p.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last) plus
-   //!    linear to the elements before p.
-   template 
-   void insert(const_iterator p, InIter first, InIter last) 
-   {  return this->insert_after(previous(p), first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -821,17 +742,6 @@ class slist
    void emplace_front(Args&&... args)
    {  this->emplace_after(this->cbefore_begin(), boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... before p
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's in-place constructor throws.
-   //!
-   //! Complexity: Linear to the elements before p
-   template 
-   iterator emplace(const_iterator p, Args&&... args)
-   {  return this->emplace_after(this->previous(p), boost::forward(args)...);  }
-
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... after prev
    //!
@@ -857,15 +767,6 @@ class slist
    }                                                                                         \
                                                                                              \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   iterator emplace (const_iterator p                                                        \
-                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
-   {                                                                                         \
-      return this->emplace_after                                                             \
-         (this->previous(p)                                                                  \
-          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
-   }                                                                                         \
-                                                                                             \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
    iterator emplace_after(const_iterator prev                                                \
                  BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
    {                                                                                         \
@@ -879,16 +780,149 @@ class slist
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the beginning of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the beginning of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts a copy of the value after the position pointed
+   //!    by prev_p.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, const T &x);
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts a move constructed copy object from the value after the
+   //!    p pointed by prev_pos.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_after, T, iterator, priv_insert_after, const_iterator)
+   #endif
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x after prev_pos.
+   //!
+   //! Returns: an iterator to the last inserted element or prev_pos if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //!
+   //! Complexity: Linear to n.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, size_type n, const value_type& x)
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->insert_after(prev_pos, cvalue_iterator(x, n), cvalue_iterator());
+   }
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts the range pointed by [first, last)
+   //!   after the position prev_pos.
+   //!
+   //! Returns: an iterator to the last inserted element or prev_pos if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to the number of elements inserted.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   template 
+   iterator insert_after(const_iterator prev_pos, InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+          && (container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      #endif
+      )
+   {
+      iterator ret_it(prev_pos.get());
+      for (; first != last; ++first){
+         ret_it = iterator(this->icont().insert_after(ret_it.get(), *this->create_node_from_it(first)));
+      }
+      return ret_it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert_after(const_iterator prev, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !(container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      )
+   {
+      //Optimized allocation and construction
+      insertion_functor func(this->icont(), prev.get());
+      this->allocate_many_and_construct(first, std::distance(first, last), func);
+      return iterator(func.inserted_first());
+   }
+   #endif
+
+   //! Effects: Removes the first element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_front()
+   {  this->icont().pop_front_and_dispose(Destroyer(this->node_alloc()));      }
+
    //! Effects: Erases the element after the element pointed by prev_pos
    //!    of the list.
    //!
    //! Returns: the first element remaining beyond the removed elements,
    //!   or end() if no such element exists.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Does not invalidate iterators or references to non erased elements.
    iterator erase_after(const_iterator prev_pos)
    {
@@ -896,93 +930,43 @@ class slist
    }
 
    //! Effects: Erases the range (before_first, last) from
-   //!   the list. 
+   //!   the list.
    //!
    //! Returns: the first element remaining beyond the removed elements,
    //!   or end() if no such element exists.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Linear to the number of erased elements.
-   //! 
+   //!
    //! Note: Does not invalidate iterators or references to non erased elements.
-   iterator erase_after(const_iterator before_first, const_iterator last) 
+   iterator erase_after(const_iterator before_first, const_iterator last)
    {
       return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
    }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Erases the element at p p.
+   //! Effects: Swaps the contents of *this and x.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the number of elements before p.
-   iterator erase(const_iterator p) 
-   {  return iterator(this->erase_after(previous(p))); }
-
-   //! Requires: first and last must be valid iterator to elements in *this.
-   //!
-   //! Effects: Erases the elements pointed by [first, last).
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the distance between first and last plus
-   //!   linear to the elements before first.
-   iterator erase(const_iterator first, const_iterator last)
-   {  return iterator(this->erase_after(previous(first), last)); }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x)
-   {
-      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
-      while (++(cur_next = cur) != end_n && new_size > 0){
-         --new_size;
-         cur = cur_next;
-      }
-      if (cur_next != end_n) 
-         this->erase_after(const_iterator(cur), const_iterator(end_n));
-      else
-         this->insert_after(const_iterator(cur), new_size, x);
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size)
-   {
-      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
-      size_type len = this->size();
-      size_type left = new_size;
-      
-      while (++(cur_next = cur) != end_n && left > 0){
-         --left;
-         cur = cur_next;
-      }
-      if (cur_next != end_n){
-         this->erase_after(const_iterator(cur), const_iterator(end_n));
-      }
-      else{
-         this->priv_create_and_insert_nodes(const_iterator(cur), new_size - len);
-      }
-   }
+   //! Complexity: Linear to the number of elements on *this and x.
+   void swap(slist& x)
+   {  AllocHolder::swap(x);   }
 
    //! Effects: Erases all the elements of the list.
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the list.
-   void clear() 
+   void clear()
    {  this->icont().clear_and_dispose(Destroyer(this->node_alloc()));  }
 
+   //////////////////////////////////////////////
+   //
+   //              slist operations
+   //
+   //////////////////////////////////////////////
+
    //! Requires: p must point to an element contained
    //!   by the list. x != *this
    //!
@@ -993,274 +977,298 @@ class slist
    //!   are not equal.
    //!
    //! Complexity: Linear to the elements in x.
-   //! 
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos, slist& x)
+   void splice_after(const_iterator prev_pos, slist& x) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after(prev_pos.get(), x.icont());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   after the element pointed by prev_pos.
-   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos, slist& x, const_iterator prev)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after(prev_pos.get(), x.icont(), prev.get());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   before_first and before_last must be valid iterators of x.
-   //!   prev_pos must not be contained in [before_first, before_last) range.
-   //! 
-   //! Effects: Transfers the range [before_first + 1, before_last + 1)
-   //!   from list x to this list, after the element pointed by prev_pos.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear to the number of transferred elements.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos,      slist& x, 
-      const_iterator before_first,  const_iterator before_last)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after
-            (prev_pos.get(), x.icont(), before_first.get(), before_last.get());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   before_first and before_last must be valid iterators of x.
-   //!   prev_pos must not be contained in [before_first, before_last) range.
-   //!   n == std::distance(before_first, before_last)
-   //! 
-   //! Effects: Transfers the range [before_first + 1, before_last + 1)
-   //!   from list x to this list, after the element pointed by prev_pos.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos,      slist& x, 
-                     const_iterator before_first,  const_iterator before_last,
-                     size_type n)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after
-            (prev_pos.get(), x.icont(), before_first.get(), before_last.get(), n);
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
+      BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after(prev_pos.get(), x.icont());
    }
 
    //! Requires: p must point to an element contained
    //!   by the list. x != *this
    //!
-   //! Effects: Transfers all the elements of list x to this list, before the
+   //! Effects: Transfers all the elements of list x to this list, after the
    //!   the element pointed by p. No destructors or copy constructors are called.
    //!
    //! Throws: std::runtime_error if this' allocator and x's allocator
    //!   are not equal.
    //!
-   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
-   //! 
+   //! Complexity: Linear to the elements in x.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType& x) 
-   {  this->splice_after(this->previous(p), x);  }
+   void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x));  }
 
-   //! Requires: p must point to an element contained
-   //!   by this list. i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //!   If p == i or p == ++i, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
-   //! 
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   after the element pointed by prev_pos.
+   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, slist& x, const_iterator i)
-   {  this->splice_after(previous(p), x, i);  }
+   void splice_after(const_iterator prev_pos, slist& x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after(prev_pos.get(), x.icont(), prev.get());
+   }
 
-   //! Requires: p must point to an element contained
-   //!   by this list. first and last must point to elements contained in list x.
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
-   //!   and in distance(first, last).
-   //! 
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   after the element pointed by prev_pos.
+   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, slist& x, const_iterator first, const_iterator last)
-   {  this->splice_after(previous(p), x, previous(first), previous(last));  }
+   void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), prev);  }
 
-   //! Effects: Reverses the order of elements in the list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: This function is linear time.
-   //! 
-   //! Note: Iterators and references are not invalidated
-   void reverse() 
-   {  this->icont().reverse();  }
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of transferred elements.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      slist& x,
+      const_iterator before_first,  const_iterator before_last) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after
+         (prev_pos.get(), x.icont(), before_first.get(), before_last.get());
+   }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of transferred elements.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      BOOST_RV_REF(slist) x,
+      const_iterator before_first,  const_iterator before_last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), before_first, before_last);  }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   n == std::distance(before_first, before_last).
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      slist& x,
+                     const_iterator before_first,  const_iterator before_last,
+                     size_type n) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after
+         (prev_pos.get(), x.icont(), before_first.get(), before_last.get(), n);
+   }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   n == std::distance(before_first, before_last).
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      BOOST_RV_REF(slist) x,
+                     const_iterator before_first,  const_iterator before_last,
+                     size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), before_first, before_last, n);  }
 
    //! Effects: Removes all the elements that compare equal to value.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() comparisons for equality.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void remove(const T& value)
-   {  remove_if(equal_to_value(value));  }
+   {  this->remove_if(equal_to_value(value));  }
 
    //! Effects: Removes all the elements for which a specified
    //!   predicate is satisfied.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() calls to the predicate.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
-   template  
+   template 
    void remove_if(Pred pred)
    {
       typedef ValueCompareToNodeCompare Predicate;
       this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that are equal from the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void unique()
    {  this->unique(value_equal());  }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that satisfy some binary predicate from the list.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
-   //! 
+   //!
+   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
-   template  
+   template 
    void unique(Pred pred)
    {
       typedef ValueCompareToNodeCompare Predicate;
       this->icont().unique_and_dispose(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Requires: The lists x and *this must be distinct. 
+   //! Requires: The lists x and *this must be distinct.
    //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this according to std::less. The merge is stable; 
-   //!   that is, if an element from *this is equivalent to one from x, then the element 
-   //!   from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
    void merge(slist & x)
    {  this->merge(x, value_less()); }
 
-   //! Requires: p must be a comparison function that induces a strict weak
-   //!   ordering and both *this and x must be sorted according to that ordering
-   //!   The lists x and *this must be distinct. 
-   //! 
+   //! Requires: The lists x and *this must be distinct.
+   //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this. The merge is stable; that is, if an element from *this is 
-   //!   equivalent to one from x, then the element from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   //! 
+   void merge(BOOST_RV_REF(slist) x)
+   {  this->merge(static_cast(x)); }
+
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
    //! Note: Iterators and references to *this are not invalidated.
    template 
    void merge(slist& x, StrictWeakOrdering comp)
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().merge(x.icont(),
-            ValueCompareToNodeCompare(comp));
-      }
-      else{
-         throw std::runtime_error("list::merge called with unequal allocators");
-      }
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().merge(x.icont(),
+         ValueCompareToNodeCompare(comp));
    }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
+   //! Note: Iterators and references to *this are not invalidated.
+   template 
+   void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp)
+   {  this->merge(static_cast(x), comp); }
+
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comparison throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    void sort()
    {  this->sort(value_less());  }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comp throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
-   template  
+   template 
    void sort(StrictWeakOrdering comp)
    {
       // nothing if the slist has length 0 or 1.
@@ -1269,42 +1277,264 @@ class slist
       this->icont().sort(ValueCompareToNodeCompare(comp));
    }
 
-   /// @cond
-   private:
-   iterator priv_insert(const_iterator p, const value_type& x) 
-   {  return this->insert_after(previous(p), x); }
+   //! Effects: Reverses the order of elements in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: This function is linear time.
+   //!
+   //! Note: Iterators and references are not invalidated
+   void reverse() BOOST_CONTAINER_NOEXCEPT
+   {  this->icont().reverse();  }
 
-   iterator priv_insert_after(const_iterator prev_pos, const value_type& x) 
-   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(x))); }
+   //////////////////////////////////////////////
+   //
+   //       list compatibility interface
+   //
+   //////////////////////////////////////////////
 
-   void priv_push_front(const value_type &x)
-   {  this->icont().push_front(*this->create_node(x));  }
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end)
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... before p
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's in-place constructor throws.
+   //!
+   //! Complexity: Linear to the elements before p
+   template 
+   iterator emplace(const_iterator p, Args&&... args)
+   {  return this->emplace_after(this->previous(p), boost::forward(args)...);  }
+
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   iterator emplace (const_iterator p                                                        \
+                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
+   {                                                                                         \
+      return this->emplace_after                                                             \
+         (this->previous(p)                                                                  \
+          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
+   }                                                                                         \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before p.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements before p.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before p with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Linear to the elements before p.
+   iterator insert(const_iterator prev_pos, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n == 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n plus linear to the elements before p.
+   iterator insert(const_iterator p, size_type n, const value_type& x)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(prev, beg, end, alloc_version(), ItCat());
+      const_iterator prev(this->previous(p));
+      this->insert_after(prev, n, x);
+      return ++iterator(prev.get());
+   }
+     
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last) plus
+   //!    linear to the elements before p.
+   template 
+   iterator insert(const_iterator p, InIter first, InIter last)
+   {
+      const_iterator prev(this->previous(p));
+      this->insert_after(prev, first, last);
+      return ++iterator(prev.get());
    }
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Erases the element at p p.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements before p.
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->erase_after(previous(p))); }
+
+   //! Requires: first and last must be valid iterator to elements in *this.
+   //!
+   //! Effects: Erases the elements pointed by [first, last).
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the distance between first and last plus
+   //!   linear to the elements before first.
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->erase_after(previous(first), last)); }
+
+   //! Requires: p must point to an element contained
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x);  }
+
+   //! Requires: p must point to an element contained
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x, this->previous(i));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), i);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
+   //!   and in distance(first, last).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x, this->previous(first), this->previous(last));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
+   //!   and in distance(first, last).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last);  }
+
+   /// @cond
+   private:
+
+   void priv_push_front (const T &x)  
+   {  this->insert(this->cbegin(), x);  }
+
+   void priv_push_front (BOOST_RV_REF(T) x)
+   {  this->insert(this->cbegin(), ::boost::move(x));  }
+
+   bool priv_try_shrink(size_type new_size, const_iterator &last_pos)
    {
-      for (; beg != end; ++beg){
-         this->icont().insert_after(prev.get(), *this->create_node_from_it(beg));
-         ++prev;
+      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
+      while (++(cur_next = cur) != end_n && new_size > 0){
+         --new_size;
+         cur = cur_next;
+      }
+      last_pos = const_iterator(cur);
+      if (cur_next != end_n){
+         this->erase_after(last_pos, const_iterator(end_n));
+         return true;
+      }
+      else{
+         return false;
       }
    }
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(prev, beg, end, allocator_v1(), std::input_iterator_tag());
-   }
+   template
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x)
+   {  return this->insert_after(previous(p), ::boost::forward(x)); }
+
+   template
+   iterator priv_insert_after(const_iterator prev_pos, BOOST_FWD_REF(U) x)
+   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(::boost::forward(x)))); }
 
    class insertion_functor;
    friend class insertion_functor;
@@ -1312,97 +1542,25 @@ class slist
    class insertion_functor
    {
       Icont &icont_;
-      typename Icont::const_iterator prev_;
+      typedef typename Icont::iterator       iiterator;
+      typedef typename Icont::const_iterator iconst_iterator;
+      const iconst_iterator prev_;
+      iiterator   ret_;
 
       public:
       insertion_functor(Icont &icont, typename Icont::const_iterator prev)
-         :  icont_(icont), prev_(prev)
+         :  icont_(icont), prev_(prev), ret_(prev.unconst())
       {}
 
       void operator()(Node &n)
-      {  prev_ = this->icont_.insert_after(prev_, n); }
+      {
+         ret_ = this->icont_.insert_after(prev_, n);
+      }
+
+      iiterator inserted_first() const
+      {  return ret_;   }
    };
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      //Optimized allocation and construction
-      this->allocate_many_and_construct
-         (beg, std::distance(beg, end), insertion_functor(this->icont(), prev.get()));
-   }
-
-   //Default constructed version
-   void priv_create_and_insert_nodes(const_iterator prev, size_type n)
-   {
-      typedef default_construct_iterator default_iterator;
-      this->priv_create_and_insert_nodes(prev, default_iterator(n), default_iterator());
-   }
-
-   //Copy constructed version
-   void priv_create_and_insert_nodes(const_iterator prev, size_type n, const T& x)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->priv_create_and_insert_nodes(prev, cvalue_iterator(x, n), cvalue_iterator());
-   }
-
-   //Dispatch to detect iterator range or integer overloads
-   template 
-   void priv_insert_dispatch(const_iterator prev,
-                             InputIter first, InputIter last,
-                             container_detail::false_)
-   {  this->priv_create_and_insert_nodes(prev, first, last);   }
-
-   template
-   void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_) 
-   {  this->priv_create_and_insert_nodes(prev, (size_type)n, x);  }
-
-   void priv_fill_assign(size_type n, const T& val) 
-   {
-      iterator end_n(this->end());
-      iterator prev(this->before_begin());
-      iterator node(this->begin());
-      for ( ; node != end_n && n > 0 ; --n){
-         *node = val;
-         prev = node;
-         ++node;
-      }
-      if (n > 0)
-         this->priv_create_and_insert_nodes(prev, n, val);
-      else
-         this->erase_after(prev, end_n);
-   }
-
-   template 
-   void priv_assign_dispatch(Int n, Int val, container_detail::true_)
-   {  this->priv_fill_assign((size_type) n, (T)val); }
-
-   template 
-   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
-   {
-      iterator end_n(this->end());
-      iterator prev(this->before_begin());
-      iterator node(this->begin());
-      while (node != end_n && first != last){
-         *node = *first;
-         prev = node;
-         ++node;
-         ++first;
-      }
-      if (first != last)
-         this->priv_create_and_insert_nodes(prev, first, last);
-      else
-         this->erase_after(prev, end_n);
-   }
-
-   template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_) 
-   {  this->priv_create_and_insert_nodes(prev_pos, (size_type)n, x);  }
-
-   template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, container_detail::false_) 
-   {  this->priv_create_and_insert_nodes(prev_pos, first, last); }
-
    //Functors for member algorithm defaults
    struct value_less
    {
@@ -1429,14 +1587,14 @@ class slist
    /// @endcond
 };
 
-template 
-inline bool 
-operator==(const slist& x, const slist& y)
+template 
+inline bool
+operator==(const slist& x, const slist& y)
 {
    if(x.size() != y.size()){
       return false;
    }
-   typedef typename slist::const_iterator const_iterator;
+   typedef typename slist::const_iterator const_iterator;
    const_iterator end1 = x.end();
 
    const_iterator i1 = x.begin();
@@ -1448,36 +1606,36 @@ operator==(const slist& x, const slist& y)
    return i1 == end1;
 }
 
-template 
+template 
 inline bool
-operator<(const slist& sL1, const slist& sL2)
+operator<(const slist& sL1, const slist& sL2)
 {
    return std::lexicographical_compare
       (sL1.begin(), sL1.end(), sL2.begin(), sL2.end());
 }
 
-template 
-inline bool 
-operator!=(const slist& sL1, const slist& sL2) 
+template 
+inline bool
+operator!=(const slist& sL1, const slist& sL2)
    {  return !(sL1 == sL2);   }
 
-template 
-inline bool 
-operator>(const slist& sL1, const slist& sL2) 
+template 
+inline bool
+operator>(const slist& sL1, const slist& sL2)
    {  return sL2 < sL1; }
 
-template 
-inline bool 
-operator<=(const slist& sL1, const slist& sL2)
+template 
+inline bool
+operator<=(const slist& sL1, const slist& sL2)
    {  return !(sL2 < sL1); }
 
-template 
-inline bool 
-operator>=(const slist& sL1, const slist& sL2)
+template 
+inline bool
+operator>=(const slist& sL1, const slist& sL2)
    {  return !(sL1 < sL2); }
 
-template 
-inline void swap(slist& x, slist& y) 
+template 
+inline void swap(slist& x, slist& y)
    {  x.swap(y);  }
 
 }}
@@ -1485,15 +1643,14 @@ inline void swap(slist& x, slist& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 namespace container {
 
 /// @endcond
@@ -1505,15 +1662,15 @@ namespace container {
 
 ///@cond
 
-//Ummm, I don't like to define things in namespace std, but 
+//Ummm, I don't like to define things in namespace std, but
 //there is no other way
 namespace std {
 
-template 
-class insert_iterator > 
+template 
+class insert_iterator >
 {
  protected:
-   typedef boost::container::slist Container;
+   typedef boost::container::slist Container;
    Container* container;
    typename Container::iterator iter;
    public:
@@ -1524,14 +1681,14 @@ class insert_iterator >
    typedef void                pointer;
    typedef void                reference;
 
-   insert_iterator(Container& x, 
-                   typename Container::iterator i, 
-                   bool is_previous = false) 
+   insert_iterator(Container& x,
+                   typename Container::iterator i,
+                   bool is_previous = false)
       : container(&x), iter(is_previous ? i : x.previous(i)){ }
 
-   insert_iterator& 
-      operator=(const typename Container::value_type& value) 
-   { 
+   insert_iterator&
+      operator=(const typename Container::value_type& value)
+   {
       iter = container->insert_after(iter, value);
       return *this;
    }
@@ -1546,4 +1703,4 @@ class insert_iterator >
 
 #include 
 
-#endif /* BOOST_CONTAINER_SLIST_HPP */
+#endif // BOOST_CONTAINER_SLIST_HPP
diff --git a/project/jni/boost/include/boost/container/stable_vector.hpp b/project/jni/boost/include/boost/container/stable_vector.hpp
index 851b5f26e..539b2da8e 100644
--- a/project/jni/boost/include/boost/container/stable_vector.hpp
+++ b/project/jni/boost/include/boost/container/stable_vector.hpp
@@ -1,6 +1,6 @@
-//////////////////////////////////////////////////////////////////////////////
+
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -28,18 +28,21 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
+#include  //max
 #include 
 #include 
+#include  //placement new
 
 ///@cond
 
@@ -47,10 +50,6 @@
 
 //#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 
-#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
-#include 
-#endif
-
 ///@endcond
 
 namespace boost {
@@ -60,28 +59,6 @@ namespace container {
 
 namespace stable_vector_detail{
 
-template
-struct smart_ptr_type
-{
-   typedef typename SmartPtr::value_type value_type;
-   typedef value_type *pointer;
-   static pointer get (const SmartPtr &smartptr)
-   {  return smartptr.get();}
-};
-
-template
-struct smart_ptr_type
-{
-   typedef T value_type;
-   typedef value_type *pointer;
-   static pointer get (pointer ptr)
-   {  return ptr;}
-};
-
-template
-inline typename smart_ptr_type::pointer to_raw_pointer(const Ptr &ptr)
-{  return smart_ptr_type::get(ptr);   }
-
 template 
 class clear_on_destroy
 {
@@ -97,7 +74,7 @@ class clear_on_destroy
    {
       if(do_clear_){
          c_.clear();
-         c_.clear_pool();  
+         c_.priv_clear_pool(); 
       }
    }
 
@@ -108,51 +85,42 @@ class clear_on_destroy
    bool do_clear_;
 };
 
-template
-struct node_type_base
-{/*
-   node_type_base(VoidPtr p)
-      : up(p)
-   {}*/
-   node_type_base()
-   {}
-   void set_pointer(VoidPtr p)
-   {  up = p; }
+template
+struct node;
 
-   VoidPtr up;
+template
+struct node_base
+{
+   private:
+   typedef typename boost::intrusive::
+      pointer_traits                   void_ptr_traits;
+   typedef typename void_ptr_traits::
+      template rebind_pointer
+         ::type                      node_base_ptr;
+   typedef typename void_ptr_traits::
+      template rebind_pointer
+         ::type                  node_base_ptr_ptr;
+
+   public:
+   node_base(const node_base_ptr_ptr &n)
+      : up(n)
+   {}
+
+   node_base()
+      : up()
+   {}
+
+   node_base_ptr_ptr up;
 };
 
 template
-struct node_type
-   : public node_type_base
+struct node
+   : public node_base
 {
-   node_type()
-      : value()
-   {}
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   node_type(Args &&...args)
-      : value(boost::forward(args)...)
-   {}
-
-   #else //BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   node_type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                             \
-      : value(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                         \
-   {}                                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//BOOST_CONTAINER_PERFECT_FORWARDING
-   
-   void set_pointer(VoidPointer p)
-   {  node_type_base::set_pointer(p); }
+   private:
+   node();
 
+   public:
    T value;
 };
 
@@ -165,87 +133,78 @@ class iterator
                          , Pointer
                          , Reference>
 {
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type                void_ptr;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type          const_void_ptr;
-   typedef node_type                  node_type_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type         node_type_ptr_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type   const_node_type_ptr_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type            void_ptr_ptr;
+   typedef boost::intrusive::
+      pointer_traits                   ptr_traits;
+   typedef typename ptr_traits::template
+         rebind_pointer::type             void_ptr;
+   typedef node                    node_type;
+   typedef node_base                  node_base_type;
+   typedef typename ptr_traits::template
+         rebind_pointer::type        node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                  node_ptr_traits;
+   typedef typename ptr_traits::template
+         rebind_pointer::type   node_base_ptr;
+   typedef typename ptr_traits::template
+         rebind_pointer::type    node_base_ptr_ptr;
+   typedef typename ptr_traits::template
+      rebind_pointer::type                   friend_iterator_pointer;
 
-   friend class iterator::template rebind_pointer::type>;
+   friend class iterator;
 
    public:
    typedef std::random_access_iterator_tag      iterator_category;
    typedef T                                    value_type;
-   typedef typename boost::intrusive::
-      pointer_traits::difference_type  difference_type;
+   typedef typename ptr_traits::difference_type difference_type;
    typedef Pointer                              pointer;
    typedef Reference                            reference;
 
    iterator()
    {}
 
-   explicit iterator(node_type_ptr_t pn)
-      : pn(pn)
+   explicit iterator(node_ptr p)
+      : pn(p)
    {}
 
-   iterator(const iterator::template rebind_pointer::type>& x)
+   iterator(const iterator& x)
       : pn(x.pn)
    {}
-   
-   private:
-   static node_type_ptr_t node_ptr_cast(const void_ptr &p)
-   {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
 
-   static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
-   {
-      return const_node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
+   node_ptr &node_pointer()
+   {  return pn;  }
 
-   static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
-   {
-      return void_ptr_ptr(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   reference dereference() const
-   {  return pn->value; }
-   bool equal(const iterator& x) const
-   {  return pn==x.pn;  }
-   void increment()
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+1)); }
-   void decrement()
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)-1)); }
-   void advance(difference_type n)
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+n)); }
-   difference_type distance_to(const iterator& x)const
-   {  return void_ptr_ptr_cast(x.pn->up) - void_ptr_ptr_cast(pn->up);   }
+   const node_ptr &node_pointer() const
+   {  return pn;  }
 
    public:
    //Pointer like operators
-   reference operator*()  const {  return  this->dereference();  }
-   pointer   operator->() const {  return  pointer(&this->dereference());  }
+   reference operator*()  const
+   {  return  pn->value;  }
+
+   pointer   operator->() const
+   {  return  ptr_traits::pointer_to(this->operator*());  }
 
    //Increment / Decrement
-   iterator& operator++()  
-   {  this->increment(); return *this;  }
+   iterator& operator++()
+   {
+      if(node_base_ptr_ptr p = this->pn->up){
+         ++p;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
+      return *this;
+   }
 
    iterator operator++(int)
    {  iterator tmp(*this);  ++*this; return iterator(tmp); }
 
    iterator& operator--()
-   {  this->decrement(); return *this;  }
+   {
+      if(node_base_ptr_ptr p = this->pn->up){
+         --p;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
+      return *this;
+   }
 
    iterator operator--(int)
    {  iterator tmp(*this);  --*this; return iterator(tmp);  }
@@ -259,7 +218,10 @@ class iterator
 
    iterator& operator+=(difference_type off)
    {
-      pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+off));
+      if(node_base_ptr_ptr p = this->pn->up){
+         p += off;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
       return *this;
    }
 
@@ -289,7 +251,7 @@ class iterator
 
    friend difference_type operator-(const iterator& left, const iterator& right)
    {
-      return void_ptr_ptr_cast(left.pn->up) - void_ptr_ptr_cast(right.pn->up);
+      return left.pn->up - right.pn->up;
    }
 
    //Comparison operators
@@ -300,232 +262,301 @@ class iterator
    {  return l.pn != r.pn;  }
 
    friend bool operator<    (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) < void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up < r.pn->up;  }
 
    friend bool operator<=   (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) <= void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up <= r.pn->up;  }
 
    friend bool operator>    (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) > void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up > r.pn->up;  }
 
    friend bool operator>=   (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) >= void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up >= r.pn->up;  }
 
-   node_type_ptr_t pn;
+   node_ptr pn;
 };
 
-template
-struct select_multiallocation_chain
+template
+struct index_traits
 {
-   typedef typename A::multiallocation_chain type;
-};
+   typedef boost::intrusive::
+      pointer_traits
+                                             void_ptr_traits;
+   typedef stable_vector_detail::
+      node_base                              node_base_type;
+   typedef typename void_ptr_traits::template
+         rebind_pointer::type         node_base_ptr;
+   typedef typename void_ptr_traits::template
+         rebind_pointer::type          node_base_ptr_ptr;
+   typedef boost::intrusive::
+      pointer_traits                   node_base_ptr_traits;
+   typedef boost::intrusive::
+      pointer_traits               node_base_ptr_ptr_traits;
+   typedef typename allocator_traits::
+         template portable_rebind_alloc
+            ::type                     node_base_ptr_allocator;
+   typedef ::boost::container::vector
+              index_type;
+   typedef typename index_type::iterator              index_iterator;
+   typedef typename index_type::const_iterator        const_index_iterator;
+   typedef typename index_type::size_type             size_type;
 
-template
-struct select_multiallocation_chain
-{
-   typedef typename boost::intrusive::pointer_traits
-      ::pointer>::
-         template rebind_pointer::type                void_ptr;
-   typedef container_detail::basic_multiallocation_chain
-                                                  multialloc_cached_counted;
-   typedef boost::container::container_detail::
-      transform_multiallocation_chain
-         < multialloc_cached_counted
-         , typename allocator_traits::value_type>        type;
+   static const size_type ExtraPointers = 3;
+   //Stable vector stores metadata at the end of the index (node_base_ptr vector) with additional 3 pointers:
+   //    back() is this->index.back() - ExtraPointers;
+   //    end node index is    *(this->index.end() - 3)
+   //    Node cache first is  *(this->index.end() - 2);
+   //    Node cache last is   this->index.back();
+
+   static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n)
+   {  return node_base_ptr_ptr_traits::pointer_to(n);   }
+
+   static void fix_up_pointers(index_iterator first, index_iterator last)
+   {
+      while(first != last){
+         typedef typename index_type::reference node_base_ptr_ref;
+         node_base_ptr_ref nbp = *first;
+         nbp->up = index_traits::ptr_to_node_base_ptr(nbp);
+         ++first;
+      }
+   }
+
+   static index_iterator get_fix_up_end(index_type &index)
+   {  return index.end() - (ExtraPointers - 1); }
+
+   static void fix_up_pointers_from(index_type & index, index_iterator first)
+   {  index_traits::fix_up_pointers(first, index_traits::get_fix_up_end(index));   }
+
+   static void readjust_end_node(index_type &index, node_base_type &end_node)
+   {
+      if(!index.empty()){
+         node_base_ptr &end_node_idx_ref = *(--index_traits::get_fix_up_end(index));
+         end_node_idx_ref = node_base_ptr_traits::pointer_to(end_node);
+         end_node.up      = node_base_ptr_ptr_traits::pointer_to(end_node_idx_ref);
+      }
+      else{
+         end_node.up = node_base_ptr_ptr();
+      }
+   }
+
+   static void initialize_end_node(index_type &index, node_base_type &end_node, const size_type index_capacity_if_empty)
+   {
+      if(index.empty()){
+         index.reserve(index_capacity_if_empty + ExtraPointers);
+         index.resize(ExtraPointers);
+         node_base_ptr &end_node_ref = *index.data();
+         end_node_ref = node_base_ptr_traits::pointer_to(end_node);
+         end_node.up = index_traits::ptr_to_node_base_ptr(end_node_ref);
+      }
+   }
+
+
+   #ifdef STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
+   static bool invariants(index_type &index)
+   {
+      for( index_iterator it = index.begin()
+         , it_end = index_traits::get_fix_up_end(index)
+         ; it != it_end
+         ; ++it){
+         if((*it)->up != index_traits::ptr_to_node_base_ptr(*it)){
+            return false;
+         }
+      }
+      return true;
+   }
+   #endif   //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 };
 
 } //namespace stable_vector_detail
 
 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
+   #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
 
-#define STABLE_VECTOR_CHECK_INVARIANT \
-invariant_checker BOOST_JOIN(check_invariant_,__LINE__)(*this); \
-BOOST_JOIN(check_invariant_,__LINE__).touch();
-#else
+   #define STABLE_VECTOR_CHECK_INVARIANT \
+   invariant_checker BOOST_JOIN(check_invariant_,__LINE__)(*this); \
+   BOOST_JOIN(check_invariant_,__LINE__).touch();
 
-#define STABLE_VECTOR_CHECK_INVARIANT
+   #else //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 
-#endif   //#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
+   #define STABLE_VECTOR_CHECK_INVARIANT
+
+   #endif   //#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
 
 #endif   //#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
 /// @endcond
 
-//!Originally developed by Joaquin M. Lopez Munoz, stable_vector is std::vector
-//!drop-in replacement implemented as a node container, offering iterator and reference
-//!stability.
+//! Originally developed by Joaquin M. Lopez Munoz, stable_vector is a std::vector
+//! drop-in replacement implemented as a node container, offering iterator and reference
+//! stability.
 //!
-//!More details taken the author's blog: ( Introducing stable_vector)
+//! Here are the details taken from the author's blog
+//! (
+//! Introducing stable_vector):
 //!
-//!We present stable_vector, a fully STL-compliant stable container that provides
-//!most of the features of std::vector except element contiguity. 
+//! We present stable_vector, a fully STL-compliant stable container that provides
+//! most of the features of std::vector except element contiguity.
 //!
-//!General properties: stable_vector satisfies all the requirements of a container,
-//!a reversible container and a sequence and provides all the optional operations
-//!present in std::vector. Like std::vector,  iterators are random access.
-//!stable_vector does not provide element contiguity; in exchange for this absence,
-//!the container is stable, i.e. references and iterators to an element of a stable_vector
-//!remain valid as long as the element is not erased, and an iterator that has been
-//!assigned the return value of end() always remain valid until the destruction of
-//!the associated  stable_vector.
+//! General properties: stable_vector satisfies all the requirements of a container,
+//! a reversible container and a sequence and provides all the optional operations
+//! present in std::vector. Like std::vector, iterators are random access.
+//! stable_vector does not provide element contiguity; in exchange for this absence,
+//! the container is stable, i.e. references and iterators to an element of a stable_vector
+//! remain valid as long as the element is not erased, and an iterator that has been
+//! assigned the return value of end() always remain valid until the destruction of
+//! the associated  stable_vector.
 //!
-//!Operation complexity: The big-O complexities of stable_vector operations match
-//!exactly those of std::vector. In general, insertion/deletion is constant time at
-//!the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
-//!does not internally perform any value_type destruction, copy or assignment
-//!operations other than those exactly corresponding to the insertion of new
-//!elements or deletion of stored elements, which can sometimes compensate in terms
-//!of performance for the extra burden of doing more pointer manipulation and an
-//!additional allocation per element.
+//! Operation complexity: The big-O complexities of stable_vector operations match
+//! exactly those of std::vector. In general, insertion/deletion is constant time at
+//! the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
+//! does not internally perform any value_type destruction, copy or assignment
+//! operations other than those exactly corresponding to the insertion of new
+//! elements or deletion of stored elements, which can sometimes compensate in terms
+//! of performance for the extra burden of doing more pointer manipulation and an
+//! additional allocation per element.
 //!
-//!Exception safety: As stable_vector does not internally copy elements around, some
-//!operations provide stronger exception safety guarantees than in std::vector:
+//! Exception safety: As stable_vector does not internally copy elements around, some
+//! operations provide stronger exception safety guarantees than in std::vector.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
 class stable_vector
 {
    ///@cond
-   typedef allocator_traits                        allocator_traits_type;
-   typedef typename container_detail::
-      move_const_ref_type::type                    insert_const_ref_type;
+   typedef allocator_traits                allocator_traits_type;
    typedef typename boost::intrusive::pointer_traits
       ::
          template rebind_pointer::type          void_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type             const_void_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type               void_ptr_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type         const_void_ptr_ptr;
-   typedef stable_vector_detail::node_type
-                                         node_type_t;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type            node_type_ptr_t;
-   typedef stable_vector_detail::node_type_base
-                                            node_type_base_t;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type       node_type_base_ptr_t;
-   typedef ::boost::container::vector::type>                         impl_type;
-   typedef typename impl_type::iterator               impl_iterator;
-   typedef typename impl_type::const_iterator         const_impl_iterator;
+   typedef typename allocator_traits_type::
+      template portable_rebind_alloc
+         ::type                                 void_allocator_type;
+   typedef stable_vector_detail::index_traits
+                       index_traits_type;
+   typedef typename index_traits_type::node_base_type node_base_type;
+   typedef typename index_traits_type::node_base_ptr  node_base_ptr;
+   typedef typename index_traits_type::
+      node_base_ptr_ptr                               node_base_ptr_ptr;
+   typedef typename index_traits_type::
+      node_base_ptr_traits                            node_base_ptr_traits;
+   typedef typename index_traits_type::
+      node_base_ptr_ptr_traits                        node_base_ptr_ptr_traits;
+   typedef typename index_traits_type::index_type     index_type;
+   typedef typename index_traits_type::index_iterator index_iterator;
+   typedef typename index_traits_type::
+      const_index_iterator                            const_index_iterator;
+   typedef boost::intrusive::
+      pointer_traits
+             ptr_traits;
+   typedef stable_vector_detail::node    node_type;
+   typedef typename ptr_traits::template
+      rebind_pointer::type                 node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                        node_ptr_traits;
+   typedef typename ptr_traits::template
+      rebind_pointer::type           const_node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                  const_node_ptr_traits;
+   typedef typename node_ptr_traits::reference        node_reference;
+   typedef typename const_node_ptr_traits::reference  const_node_reference;
 
    typedef ::boost::container::container_detail::
       integral_constant                  allocator_v1;
    typedef ::boost::container::container_detail::
       integral_constant                  allocator_v2;
-   typedef ::boost::container::container_detail::integral_constant 
+   typedef ::boost::container::container_detail::integral_constant
       ::value>                              alloc_version;
+      version::value>                              alloc_version;
    typedef typename allocator_traits_type::
       template portable_rebind_alloc
-         ::type                          node_allocator_type;
+         ::type                            node_allocator_type;
 
-   node_type_ptr_t allocate_one()
-   {  return this->allocate_one(alloc_version());   }
+   typedef ::boost::container::container_detail::
+      allocator_version_traits                    allocator_version_traits_t;
+   typedef typename allocator_version_traits_t::multiallocation_chain  multiallocation_chain;
 
-   template
-   node_type_ptr_t allocate_one(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  return node_alloc().allocate(1);   }
+   node_ptr allocate_one()
+   {  return allocator_version_traits_t::allocate_one(this->priv_node_alloc());   }
 
-   template
-   node_type_ptr_t allocate_one(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  return node_alloc().allocate_one();   }
+   void deallocate_one(const node_ptr &p)
+   {  allocator_version_traits_t::deallocate_one(this->priv_node_alloc(), p);   }
 
-   void deallocate_one(node_type_ptr_t p)
-   {  return this->deallocate_one(p, alloc_version());   }
+   void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m)
+   {  allocator_version_traits_t::allocate_individual(this->priv_node_alloc(), n, m);   }
 
-   template
-   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  node_alloc().deallocate(p, 1);   }
-
-   template
-   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  node_alloc().deallocate_one(p);   }
+   void deallocate_individual(multiallocation_chain &holder)
+   {  allocator_version_traits_t::deallocate_individual(this->priv_node_alloc(), holder);   }
 
    friend class stable_vector_detail::clear_on_destroy;
+   typedef stable_vector_detail::iterator
+      < T
+      , typename allocator_traits::reference
+      , typename allocator_traits::pointer>              iterator_impl;
+   typedef stable_vector_detail::iterator
+      < T
+      , typename allocator_traits::const_reference
+      , typename allocator_traits::const_pointer>        const_iterator_impl;
    ///@endcond
    public:
 
-
-   // types:
-
-   typedef typename allocator_traits_type::reference              reference;
-   typedef typename allocator_traits_type::const_reference        const_reference;
-   typedef typename allocator_traits_type::pointer                pointer;
-   typedef typename allocator_traits_type::const_pointer          const_pointer;
-   typedef stable_vector_detail::iterator
-                                       iterator;
-   typedef stable_vector_detail::iterator
-                           const_iterator;
-   typedef typename impl_type::size_type              size_type;
-   typedef typename iterator::difference_type         difference_type;
-   typedef T                                          value_type;
-   typedef A                                          allocator_type;
-   typedef std::reverse_iterator            reverse_iterator;
-   typedef std::reverse_iterator      const_reverse_iterator;
-   typedef node_allocator_type                        stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef node_allocator_type                                                         stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                       iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                                 const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    ///@cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(stable_vector)
-   static const size_type ExtraPointers = 3;
-   //This container stores metadata at the end of the void_ptr vector with additional 3 pointers:
-   //    back() is impl.back() - ExtraPointers;
-   //    end node index is impl.end()[-3]
-   //    Node cache first is impl.end()[-2];
-   //    Node cache last is  *impl.back();
+   static const size_type ExtraPointers = index_traits_type::ExtraPointers;
 
-   typedef typename stable_vector_detail::
-      select_multiallocation_chain
-      < node_allocator_type
-      , alloc_version::value
-      >::type                                         multiallocation_chain;
+   class insert_rollback;
+   friend class insert_rollback;
+
+   class push_back_rollback;
+   friend class push_back_rollback;
    ///@endcond
+
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs a stable_vector.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    stable_vector()
-      : internal_data(), impl()
+      : internal_data(), index()
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
 
    //! Effects: Constructs a stable_vector taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit stable_vector(const A& al)
-      : internal_data(al),impl(al)
+   explicit stable_vector(const allocator_type& al) BOOST_CONTAINER_NOEXCEPT
+      : internal_data(al), index(al)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
@@ -535,10 +566,10 @@ class stable_vector
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit stable_vector(size_type n)
-      : internal_data(A()),impl(A())
+      : internal_data(), index()
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->resize(n);
@@ -551,13 +582,13 @@ class stable_vector
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   stable_vector(size_type n, const T& t, const A& al=A())
-      : internal_data(al),impl(al)
+   stable_vector(size_type n, const T& t, const allocator_type& al = allocator_type())
+      : internal_data(al), index(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), n, t);
+      this->insert(this->cend(), n, t);
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -570,11 +601,11 @@ class stable_vector
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   stable_vector(InputIterator first,InputIterator last,const A& al=A())
-      : internal_data(al),impl(al)
+   stable_vector(InputIterator first,InputIterator last, const allocator_type& al = allocator_type())
+      : internal_data(al), index(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), first, last);
+      this->insert(this->cend(), first, last);
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -582,16 +613,16 @@ class stable_vector
    //! Effects: Copy constructs a stable_vector.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    stable_vector(const stable_vector& x)
       : internal_data(allocator_traits::
-         select_on_container_copy_construction(x.node_alloc()))
-      , impl(allocator_traits::
-         select_on_container_copy_construction(x.impl.get_stored_allocator()))
+         select_on_container_copy_construction(x.priv_node_alloc()))
+      , index(allocator_traits::
+         select_on_container_copy_construction(x.index.get_stored_allocator()))
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), x.begin(), x.end());
+      this->insert(this->cend(), x.begin(), x.end());
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -599,14 +630,48 @@ class stable_vector
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    stable_vector(BOOST_RV_REF(stable_vector) x)
-      : internal_data(boost::move(x.node_alloc())), impl(boost::move(x.impl))
+      : internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index))
    {
       this->priv_swap_members(x);
    }
 
+   //! Effects: Copy constructs a stable_vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   stable_vector(const stable_vector& x, const allocator_type &a)
+      : internal_data(a), index(a)
+   {
+      stable_vector_detail::clear_on_destroy cod(*this);
+      this->insert(this->cend(), x.begin(), x.end());
+      STABLE_VECTOR_CHECK_INVARIANT;
+      cod.release();
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocator_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise
+   stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a)
+      : internal_data(a), index(a)
+   {
+      if(this->priv_node_alloc() == x.priv_node_alloc()){
+         this->priv_swap_members(x);
+      }
+      else{
+         stable_vector_detail::clear_on_destroy cod(*this);
+         this->insert(this->cend(), x.begin(), x.end());
+         STABLE_VECTOR_CHECK_INVARIANT;
+         cod.release();
+      }
+   }
+
    //! Effects: Destroys the stable_vector. All stored values are destroyed
    //!   and used memory is deallocated.
    //!
@@ -616,13 +681,13 @@ class stable_vector
    ~stable_vector()
    {
       this->clear();
-      clear_pool();  
+      this->priv_clear_pool(); 
    }
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -631,16 +696,16 @@ class stable_vector
    {
       STABLE_VECTOR_CHECK_INVARIANT;
       if (&x != this){
-         node_allocator_type &this_alloc     = this->node_alloc();
-         const node_allocator_type &x_alloc  = x.node_alloc();
+         node_allocator_type &this_alloc     = this->priv_node_alloc();
+         const node_allocator_type &x_alloc  = x.priv_node_alloc();
          container_detail::bool_ flag;
          if(flag && this_alloc != x_alloc){
             this->clear();
             this->shrink_to_fit();
          }
-         container_detail::assign_alloc(this->node_alloc(), x.node_alloc(), flag);
-         container_detail::assign_alloc(this->impl.get_stored_allocator(), x.impl.get_stored_allocator(), flag);
+         container_detail::assign_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
+         container_detail::assign_alloc(this->index.get_stored_allocator(), x.index.get_stored_allocator(), flag);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -657,22 +722,21 @@ class stable_vector
    stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
    {
       if (&x != this){
-         node_allocator_type &this_alloc = this->node_alloc();
-         node_allocator_type &x_alloc    = x.node_alloc();
+         node_allocator_type &this_alloc = this->priv_node_alloc();
+         node_allocator_type &x_alloc    = x.priv_node_alloc();
          //If allocators are equal we can just swap pointers
          if(this_alloc == x_alloc){
             //Destroy objects but retain memory
             this->clear();
-            this->impl = boost::move(x.impl);
+            this->index = boost::move(x.index);
             this->priv_swap_members(x);
             //Move allocator if needed
             container_detail::bool_ flag;
-            container_detail::move_alloc(this->node_alloc(), x.node_alloc(), flag);
+            container_detail::move_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
          }
          //If unequal allocators, then do a one by one move
          else{
-            typedef typename std::iterator_traits::iterator_category ItCat;
             this->assign( boost::make_move_iterator(x.begin())
                         , boost::make_move_iterator(x.end()));
          }
@@ -680,6 +744,18 @@ class stable_vector
       return *this;
    }
 
+
+   //! Effects: Assigns the n copies of val to *this.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   void assign(size_type n, const T& t)
+   {
+      typedef constant_iterator cvalue_iterator;
+      this->assign(cvalue_iterator(t, n), cvalue_iterator());
+   }
+
    //! Effects: Assigns the the range [first, last) to *this.
    //!
    //! Throws: If memory allocation throws or
@@ -687,200 +763,196 @@ class stable_vector
    //!
    //! Complexity: Linear to n.
    template
-   void assign(InputIterator first,InputIterator last)
+   void assign(InputIterator first,InputIterator last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      assign_dispatch(first, last, boost::is_integral());
-   }
-
-
-   //! Effects: Assigns the n copies of val to *this.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void assign(size_type n,const T& t)
-   {
-      typedef constant_iterator cvalue_iterator;
-      return assign_dispatch(cvalue_iterator(t, n), cvalue_iterator(), boost::mpl::false_());
+      STABLE_VECTOR_CHECK_INVARIANT;
+      iterator first1   = this->begin();
+      iterator last1    = this->end();
+      for ( ; first1 != last1 && first != last; ++first1, ++first)
+         *first1 = *first;
+      if (first == last){
+         this->erase(first1, last1);
+      }
+      else{
+         this->insert(last1, first, last);
+      }
    }
 
    //! Effects: Returns a copy of the internal allocator.
-   //! 
+   //!
    //! Throws: If allocator's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator()const  {return node_alloc();}
+   allocator_type get_allocator() const
+   {  return this->priv_node_alloc();  }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return node_alloc(); }
+   {  return this->priv_node_alloc(); }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return node_alloc(); }
+   {  return this->priv_node_alloc(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns an iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator  begin()
-   {   return (impl.empty()) ? end(): iterator(node_ptr_cast(impl.front())) ;   }
+   iterator  begin() BOOST_CONTAINER_NOEXCEPT
+   {   return (this->index.empty()) ? this->end(): iterator(node_ptr_traits::static_cast_from(this->index.front())); }
 
    //! Effects: Returns a const_iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator  begin()const
-   {   return (impl.empty()) ? cend() : const_iterator(node_ptr_cast(impl.front())) ;   }
+   const_iterator  begin() const BOOST_CONTAINER_NOEXCEPT
+   {   return (this->index.empty()) ? this->cend() : const_iterator(node_ptr_traits::static_cast_from(this->index.front())) ;   }
 
    //! Effects: Returns an iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator        end()                {return iterator(get_end_node());}
+   iterator        end() BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->priv_get_end_node());  }
 
    //! Effects: Returns a const_iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator  end()const           {return const_iterator(get_end_node());}
+   const_iterator  end() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->priv_get_end_node());  }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator       rbegin()      {return reverse_iterator(this->end());}
+   reverse_iterator       rbegin() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(this->end());  }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin()const {return const_reverse_iterator(this->end());}
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->end());  }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator       rend()        {return reverse_iterator(this->begin());}
+   reverse_iterator       rend() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(this->begin());   }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend()const   {return const_reverse_iterator(this->begin());}
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->begin());   }
 
    //! Effects: Returns a const_iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator         cbegin()const {return this->begin();}
+   const_iterator         cbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->begin();   }
 
    //! Effects: Returns a const_iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator         cend()const   {return this->end();}
+   const_iterator         cend() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->end();  }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin()const{return this->rbegin();}
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->rbegin();  }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend()const  {return this->rend();}
+   const_reverse_iterator crend()const BOOST_CONTAINER_NOEXCEPT
+   {  return this->rend(); }
 
-   //! Effects: Returns the number of the elements contained in the stable_vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const
-   {  return impl.empty() ? 0 : (impl.size() - ExtraPointers);   }
-
-   //! Effects: Returns the largest possible size of the stable_vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const
-   {  return impl.max_size() - ExtraPointers;  }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const
-   {
-      if(!impl.capacity()){
-         return 0;
-      }
-      else{
-         const size_type num_nodes = this->impl.size() + this->internal_data.pool_size;
-         const size_type num_buck  = this->impl.capacity();
-         return (num_nodes < num_buck) ? num_nodes : num_buck;
-      }
-   }
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the stable_vector contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const
-   {  return impl.empty() || impl.size() == ExtraPointers;  }
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->index.size() <= ExtraPointers;  }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   //! Effects: Returns the number of the elements contained in the stable_vector.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type n, const T& t)
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      if(n > size())
-         this->insert(this->cend(), n - this->size(), t);
-      else if(n < this->size())
-         this->erase(this->cbegin() + n, this->cend());
+      const size_type index_size = this->index.size();
+      return index_size ? (index_size - ExtraPointers) : 0;
    }
 
+   //! Effects: Returns the largest possible size of the stable_vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->index.max_size() - ExtraPointers;  }
+
    //! Effects: Inserts or erases elements at the end such that
    //!   the size becomes n. New elements are default constructed.
    //!
@@ -891,17 +963,49 @@ class stable_vector
    {
       typedef default_construct_iterator default_iterator;
       STABLE_VECTOR_CHECK_INVARIANT;
-      if(n > size())
+      if(n > this->size())
          this->insert(this->cend(), default_iterator(n - this->size()), default_iterator());
       else if(n < this->size())
          this->erase(this->cbegin() + n, this->cend());
    }
 
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type n, const T& t)
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      if(n > this->size())
+         this->insert(this->cend(), n - this->size(), t);
+      else if(n < this->size())
+         this->erase(this->cbegin() + n, this->cend());
+   }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   {
+      const size_type index_size             = this->index.size();
+      BOOST_ASSERT(!index_size || index_size >= ExtraPointers);
+      const size_type bucket_extra_capacity = this->index.capacity()- index_size;
+      const size_type node_extra_capacity   = this->internal_data.pool_size;
+      const size_type extra_capacity        = (bucket_extra_capacity < node_extra_capacity)
+         ? bucket_extra_capacity : node_extra_capacity;
+      return (index_size ? (index_size - ExtraPointers + extra_capacity) : index_size);
+   }
+
    //! Effects: If n is less than or equal to capacity(), this call has no
    //!   effect. Otherwise, it is a request for allocation of additional memory.
    //!   If the request is successful, then capacity() is greater than or equal to
    //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
+   //!
    //! Throws: If memory allocation allocation throws.
    void reserve(size_type n)
    {
@@ -909,221 +1013,161 @@ class stable_vector
       if(n > this->max_size())
          throw std::bad_alloc();
 
-      size_type size = this->size();   
+      size_type sz         = this->size();  
       size_type old_capacity = this->capacity();
       if(n > old_capacity){
-         this->initialize_end_node(n);
-         const void * old_ptr = &impl[0];
-         impl.reserve(n + ExtraPointers);
-         bool realloced = &impl[0] != old_ptr;
+         index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, n);
+         const void * old_ptr = &index[0];
+         this->index.reserve(n + ExtraPointers);
+         bool realloced = &index[0] != old_ptr;
          //Fix the pointers for the newly allocated buffer
          if(realloced){
-            this->align_nodes(impl.begin(), impl.begin()+size+1);
+            index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
          }
          //Now fill pool if data is not enough
-         if((n - size) > this->internal_data.pool_size){
-            this->add_to_pool((n - size) - this->internal_data.pool_size);
+         if((n - sz) > this->internal_data.pool_size){
+            this->priv_increase_pool((n - sz) - this->internal_data.pool_size);
          }
       }
    }
 
-   //! Requires: size() > n.
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the stable_vector is unchanged
    //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n){return value(impl[n]);}
-
-   //! Requires: size() > n.
+   //! Throws: If memory allocation throws.
    //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n)const{return value(impl[n]);}
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n)
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
    {
-      if(n>=size())
-         throw std::out_of_range("invalid subscript at stable_vector::at");
-      return operator[](n);
+      if(this->capacity()){
+         //First empty allocated node pool
+         this->priv_clear_pool();
+         //If empty completely destroy the index, let's recover default-constructed state
+         if(this->empty()){
+            this->index.clear();
+            this->index.shrink_to_fit();
+            this->internal_data.end_node.up = node_base_ptr_ptr();
+         }
+         //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
+         else{
+            const void* old_ptr = &index[0];
+            this->index.shrink_to_fit();
+            bool realloced = &index[0] != old_ptr;
+            //Fix the pointers for the newly allocated buffer
+            if(realloced){
+               index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
+            }
+         }
+      }
    }
 
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n)const
-   {
-      if(n>=size())
-         throw std::out_of_range("invalid subscript at stable_vector::at");
-      return operator[](n);
-   }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a reference to the first
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference front()
-   {  return value(impl.front());   }
+   reference front() BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index.front()).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a const reference to the first
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference front()const
-   {  return value(impl.front());   }
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index.front()).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a reference to the last
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference back()
-   {  return value(*(&impl.back() - ExtraPointers)); }
+   reference back() BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[this->size() - ExtraPointers]).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a const reference to the last
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference back()const
-   {  return value(*(&impl.back() - ExtraPointers)); }
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[this->size() - ExtraPointers]).value;  }
 
-   //! Effects: Inserts a copy of x at the end of the stable_vector.
+   //! Requires: size() > n.
    //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(insert_const_ref_type x) 
-   {  return priv_push_back(x);  }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   void push_back(T &x) { push_back(const_cast(x)); }
-
-   template
-   void push_back(const U &u, typename container_detail::enable_if_c
-                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   { return priv_push_back(u); }
-   #endif
-
-   //! Effects: Constructs a new element in the end of the stable_vector
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(BOOST_RV_REF(T) t) 
-   {  this->insert(end(), boost::move(t));  }
-
-   //! Effects: Removes the last element from the stable_vector.
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Constant time.
-   void pop_back()
-   {  this->erase(this->end()-1);   }
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[n]).value;  }
 
-   //! Requires: position must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert a copy of x before position.
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, insert_const_ref_type x) 
-   {  return this->priv_insert(position, x); }
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[n]).value;   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c
-                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert(position, u); }
-   #endif
-
-   //! Requires: position must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert a new element before position with mx's resources.
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws.
+   //! Throws: std::range_error if n >= size()
    //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, BOOST_RV_REF(T) x) 
+   //! Complexity: Constant.
+   reference at(size_type n)
    {
-      typedef repeat_iterator           repeat_it;
-      typedef boost::move_iterator repeat_move_it;
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position
-         ,repeat_move_it(repeat_it(x, 1))
-         ,repeat_move_it(repeat_it()));
-      return iterator(this->begin() + pos_n);
+      if(n>=this->size())
+         throw std::out_of_range("invalid subscript at stable_vector::at");
+      return operator[](n);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert n copies of x before pos.
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: std::range_error if n >= size()
    //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator position, size_type n, const T& t)
+   //! Complexity: Constant.
+   const_reference at(size_type n)const
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      this->insert_not_iter(position, n, t);
+      if(n>=this->size())
+         throw std::out_of_range("invalid subscript at stable_vector::at");
+      return operator[](n);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before pos.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator position,InputIterator first, InputIterator last)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      this->insert_iter(position,first,last,
-                        boost::mpl::not_ >());
-   }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -1137,7 +1181,7 @@ class stable_vector
    void emplace_back(Args &&...args)
    {
       typedef emplace_functor         EmplaceFunctor;
-      typedef emplace_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
    }
@@ -1157,7 +1201,7 @@ class stable_vector
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
       typedef emplace_functor         EmplaceFunctor;
-      typedef emplace_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
       return iterator(this->begin() + pos_n);
@@ -1172,7 +1216,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1186,7 +1230,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1200,21 +1244,162 @@ class stable_vector
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the stable_vector.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the stable_vector
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before position.
+   //!
+   //! Returns: an iterator to the first inserted element or position if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator position, size_type n, const T& t)
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      typedef constant_iterator cvalue_iterator;
+      return this->insert(position, cvalue_iterator(t, n), cvalue_iterator());
+   }
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or position if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator position, InputIterator first, InputIterator last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      const size_type pos_n = position - this->cbegin();
+      for(; first != last; ++first){
+         this->emplace(position, *first);
+      }
+      return this->begin() + pos_n;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator position, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type num_new = static_cast(std::distance(first, last));
+      const size_type pos     = static_cast(position - this->cbegin());
+      if(num_new){
+         //Fills the node pool and inserts num_new null pointers in pos.
+         //If a new buffer was needed fixes up pointers up to pos so
+         //past-new nodes are not aligned until the end of this function
+         //or in a rollback in case of exception
+         index_iterator it_past_newly_constructed(this->priv_insert_forward_non_templated(pos, num_new));
+         const index_iterator it_past_new(it_past_newly_constructed + num_new);
+         {
+            //Prepare rollback
+            insert_rollback rollback(*this, it_past_newly_constructed, it_past_new);
+            while(first != last){
+               const node_ptr p = this->priv_get_from_pool();
+               BOOST_ASSERT(!!p);
+               //Put it in the index so rollback can return it in pool if construct_in_place throws
+               *it_past_newly_constructed = p;
+               //Constructs and fixes up pointers This can throw
+               this->priv_build_node_from_it(p, it_past_newly_constructed, first);
+               ++first;
+               ++it_past_newly_constructed;
+            }
+            //rollback.~insert_rollback() called in case of exception
+         }
+         //Fix up pointers for past-new nodes (new nodes were fixed during construction) and
+         //nodes before insertion position in priv_insert_forward_non_templated(...)
+         index_traits_type::fix_up_pointers_from(this->index, it_past_newly_constructed);
+      }
+      return this->begin() + pos;
+   }
+   #endif
+
+   //! Effects: Removes the last element from the stable_vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {  this->erase(--this->cend());   }
+
    //! Effects: Erases the element at position pos.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element. Constant if pos is the last element.
-   iterator erase(const_iterator position)
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    {
       STABLE_VECTOR_CHECK_INVARIANT;
-      difference_type d = position - this->cbegin();
-      impl_iterator   it = impl.begin() + d;
-      this->delete_node(*it);
-      it = impl.erase(it);
-      this->align_nodes(it, get_last_align());
-      return this->begin()+d;
+      const size_type d = position - this->cbegin();
+      index_iterator it = this->index.begin() + d;
+      this->priv_delete_node(position.node_pointer());
+      it = this->index.erase(it);
+      index_traits_type::fix_up_pointers_from(this->index, it);
+      return iterator(node_ptr_traits::static_cast_from(*it));
    }
 
    //! Effects: Erases the elements pointed by [first, last).
@@ -1223,8 +1408,31 @@ class stable_vector
    //!
    //! Complexity: Linear to the distance between first and last
    //!   plus linear to the elements between pos and the last element.
-   iterator erase(const_iterator first, const_iterator last)
-   {   return priv_erase(first, last, alloc_version());  }
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      const const_iterator cbeg(this->cbegin());
+      const size_type d1 = static_cast(first - cbeg),
+                      d2 = static_cast(last  - cbeg);
+      size_type d_dif = d2 - d1;
+      if(d_dif){
+         multiallocation_chain holder;
+         const index_iterator it1(this->index.begin() + d1);
+         const index_iterator it2(it1 + d_dif);
+         index_iterator it(it1);
+         while(d_dif--){
+            node_base_ptr &nb = *it;
+            ++it;
+            node_type &n = *node_ptr_traits::static_cast_from(nb);
+            this->priv_destroy_node(n);
+            holder.push_back(node_ptr_traits::pointer_to(n));
+         }
+         this->priv_put_in_pool(holder);
+         const index_iterator e = this->index.erase(it1, it2);
+         index_traits_type::fix_up_pointers_from(this->index, e);
+      }
+      return iterator(last.node_pointer());
+   }
 
    //! Effects: Swaps the contents of *this and x.
    //!
@@ -1235,9 +1443,9 @@ class stable_vector
    {
       STABLE_VECTOR_CHECK_INVARIANT;
       container_detail::bool_ flag;
-      container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
+      container_detail::swap_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
       //vector's allocator is swapped here
-      this->impl.swap(x.impl);
+      this->index.swap(x.index);
       this->priv_swap_members(x);
    }
 
@@ -1246,453 +1454,292 @@ class stable_vector
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the stable_vector.
-   void clear()
+   void clear() BOOST_CONTAINER_NOEXCEPT
    {   this->erase(this->cbegin(),this->cend()); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the stable_vector is unchanged
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
+   /// @cond
+
+   private:
+
+   class insert_rollback
    {
-      if(this->capacity()){
-         //First empty allocated node pool
-         this->clear_pool();
-         //If empty completely destroy the index, let's recover default-constructed state
-         if(this->empty()){
-            this->impl.clear();
-            this->impl.shrink_to_fit();
-            this->internal_data.set_end_pointer_to_default_constructed();
-         }
-         //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
-         else{
-            const size_type size = this->size();
-            const void* old_ptr = &impl[0];
-            this->impl.shrink_to_fit();
-            bool realloced = &impl[0] != old_ptr;
-            //Fix the pointers for the newly allocated buffer
-            if(realloced){
-               this->align_nodes(impl.begin(), impl.begin()+size+1);
-            }
+      public:
+
+      insert_rollback(stable_vector &sv, index_iterator &it_past_constructed, const index_iterator &it_past_new)
+         : m_sv(sv), m_it_past_constructed(it_past_constructed), m_it_past_new(it_past_new)
+      {}
+
+      ~insert_rollback()
+      {
+         if(m_it_past_constructed != m_it_past_new){
+            m_sv.priv_put_in_pool(node_ptr_traits::static_cast_from(*m_it_past_constructed));
+            index_iterator e = m_sv.index.erase(m_it_past_constructed, m_it_past_new);
+            index_traits_type::fix_up_pointers_from(m_sv.index, e);
          }
       }
+
+      private:
+      stable_vector &m_sv;
+      index_iterator &m_it_past_constructed;
+      const index_iterator &m_it_past_new;
+   };
+
+   class push_back_rollback
+   {
+      public:
+      push_back_rollback(stable_vector &sv, const node_ptr &p)
+         : m_sv(sv), m_p(p)
+      {}
+
+      ~push_back_rollback()
+      {
+         if(m_p){
+            m_sv.priv_put_in_pool(m_p);
+         }
+      }
+
+      void release()
+      {  m_p = node_ptr();  }
+
+      private:
+      stable_vector &m_sv;
+      node_ptr m_p;
+   };
+
+   index_iterator priv_insert_forward_non_templated(size_type pos, size_type num_new)
+   {
+      index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, num_new);
+
+      //Now try to fill the pool with new data
+      if(this->internal_data.pool_size < num_new){
+         this->priv_increase_pool(num_new - this->internal_data.pool_size);
+      }
+
+      //Now try to make room in the vector
+      const node_base_ptr_ptr old_buffer = this->index.data();
+      this->index.insert(this->index.begin() + pos, num_new, node_ptr());
+      bool new_buffer = this->index.data() != old_buffer;
+
+      //Fix the pointers for the newly allocated buffer
+      const index_iterator index_beg = this->index.begin();
+      if(new_buffer){
+         index_traits_type::fix_up_pointers(index_beg, index_beg + pos);
+      }
+      return index_beg + pos;
    }
 
-   /// @cond
+   bool priv_capacity_bigger_than_size() const
+   {
+      return this->index.capacity() > this->index.size() &&
+             this->internal_data.pool_size > 0;
+   }
+
+   template 
+   void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
+   {
+      if(this->priv_capacity_bigger_than_size()){
+         //Enough memory in the pool and in the index
+         const node_ptr p = this->priv_get_from_pool();
+         BOOST_ASSERT(!!p);
+         {
+            push_back_rollback rollback(*this, p);
+            //This might throw
+            this->priv_build_node_from_convertible(p, ::boost::forward(x));
+            rollback.release();
+         }
+         //This can't throw as there is room for a new elements in the index
+         index_iterator new_index = this->index.insert(this->index.end() - ExtraPointers, p);
+         index_traits_type::fix_up_pointers_from(this->index, new_index);
+      }
+      else{
+         this->insert(this->cend(), ::boost::forward(x));
+      }
+   }
 
    iterator priv_insert(const_iterator position, const value_type &t)
    {
       typedef constant_iterator cvalue_iterator;
-      return this->insert_iter(position, cvalue_iterator(t, 1), cvalue_iterator(), std::forward_iterator_tag());
+      return this->insert(position, cvalue_iterator(t, 1), cvalue_iterator());
    }
 
-   void priv_push_back(const value_type &t)
-   {  this->insert(end(), t);  }
-
-   template
-   void clear_pool(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
+   iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
    {
-      if(!impl.empty() && impl.back()){
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
+      typedef repeat_iterator  repeat_it;
+      typedef boost::move_iterator      repeat_move_it;
+      //Just call more general insert(pos, size, value) and return iterator
+      return this->insert(position, repeat_move_it(repeat_it(x, 1)), repeat_move_it(repeat_it()));
+   }
+
+   void priv_clear_pool()
+   {
+      if(!this->index.empty() && this->index.back()){
+         node_base_ptr &pool_first_ref = *(this->index.end() - 2);
+         node_base_ptr &pool_last_ref  = this->index.back();
 
          multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, this->internal_data.pool_size);
-         while(!holder.empty()){
-            node_type_ptr_t n = holder.front();
-            holder.pop_front();
-            this->deallocate_one(n);
-         }
+         holder.incorporate_after( holder.before_begin()
+                                 , node_ptr_traits::static_cast_from(pool_first_ref)
+                                 , node_ptr_traits::static_cast_from(pool_last_ref)
+                                 , internal_data.pool_size);
+         this->deallocate_individual(holder);
          pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
    }
 
-   template
-   void clear_pool(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
+   void priv_increase_pool(size_type n)
    {
-      if(!impl.empty() && impl.back()){
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
-         multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-         node_alloc().deallocate_individual(boost::move(holder));
-         pool_first_ref = pool_last_ref = 0;
-         this->internal_data.pool_size = 0;
-      }
-   }
-
-   void clear_pool()
-   {
-      this->clear_pool(alloc_version());
-   }
-
-   void add_to_pool(size_type n)
-   {
-      this->add_to_pool(n, alloc_version());
-   }
-
-   template
-   void add_to_pool(size_type n, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      size_type remaining = n;
-      while(remaining--){
-         this->put_in_pool(this->allocate_one());
-      }
-   }
-
-   template
-   void add_to_pool(size_type n, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      void_ptr &pool_first_ref = impl.end()[-2];
-      void_ptr &pool_last_ref = impl.back();
+      node_base_ptr &pool_first_ref = *(this->index.end() - 2);
+      node_base_ptr &pool_last_ref  = this->index.back();
       multiallocation_chain holder;
-      holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-      //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled::value == true));
-      multiallocation_chain m (node_alloc().allocate_individual(n));
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      multiallocation_chain m;
+      this->allocate_individual(n, m);
       holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n);
       this->internal_data.pool_size += n;
-      std::pair data(holder.extract_data());
+      std::pair data(holder.extract_data());
       pool_first_ref = data.first;
       pool_last_ref = data.second;
    }
 
-   void put_in_pool(node_type_ptr_t p)
+   void priv_put_in_pool(const node_ptr &p)
    {
-      void_ptr &pool_first_ref = impl.end()[-2];
-      void_ptr &pool_last_ref = impl.back();
+      node_base_ptr &pool_first_ref = *(this->index.end()-2);
+      node_base_ptr &pool_last_ref  = this->index.back();
       multiallocation_chain holder;
-      holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
       holder.push_front(p);
       ++this->internal_data.pool_size;
-      std::pair ret(holder.extract_data());
+      std::pair ret(holder.extract_data());
       pool_first_ref = ret.first;
-      pool_last_ref = ret.second;
+      pool_last_ref  = ret.second;
    }
 
-   node_type_ptr_t get_from_pool()
+   void priv_put_in_pool(multiallocation_chain &ch)
    {
-      if(!impl.back()){
-         return node_type_ptr_t(0);
+      node_base_ptr &pool_first_ref = *(this->index.end()-(ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = this->index.back();
+      ch.incorporate_after( ch.before_begin()
+                          , node_ptr_traits::static_cast_from(pool_first_ref)
+                          , node_ptr_traits::static_cast_from(pool_last_ref)
+                          , internal_data.pool_size);
+      this->internal_data.pool_size = ch.size();
+      const std::pair ret(ch.extract_data());
+      pool_first_ref = ret.first;
+      pool_last_ref  = ret.second;
+   }
+
+   node_ptr priv_get_from_pool()
+   {
+      //Precondition: index is not empty
+      BOOST_ASSERT(!this->index.empty());
+      node_base_ptr &pool_first_ref = *(this->index.end() - (ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = this->index.back();
+      multiallocation_chain holder;
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      node_ptr ret = holder.pop_front();
+      --this->internal_data.pool_size;
+      if(!internal_data.pool_size){
+         pool_first_ref = pool_last_ref = node_ptr();
       }
       else{
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
-         multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-         node_type_ptr_t ret = holder.front();
-         holder.pop_front();
-         --this->internal_data.pool_size;
-         if(!internal_data.pool_size){
-            pool_first_ref = pool_last_ref = void_ptr(0);
-         }
-         else{
-            std::pair data(holder.extract_data());
-            pool_first_ref = data.first;
-            pool_last_ref = data.second;
-         }
-         return ret;
+         const std::pair data(holder.extract_data());
+         pool_first_ref = data.first;
+         pool_last_ref  = data.second;
       }
+      return ret;
    }
 
-   void insert_iter_prolog(size_type n, difference_type d)
+   node_ptr priv_get_end_node() const
    {
-      initialize_end_node(n);
-      const void* old_ptr = &impl[0];
-      //size_type old_capacity = capacity();
-      //size_type old_size = size();
-      impl.insert(impl.begin()+d, n, 0);
-      bool realloced = &impl[0] != old_ptr;
-      //Fix the pointers for the newly allocated buffer
-      if(realloced){
-         align_nodes(impl.begin(), impl.begin()+d);
-      }
+      return node_ptr_traits::pointer_to
+         (static_cast(const_cast(this->internal_data.end_node)));
    }
 
-   template
-   void assign_dispatch(InputIterator first, InputIterator last, boost::mpl::false_)
+   void priv_destroy_node(const node_type &n)
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      iterator first1   = this->begin();
-      iterator last1    = this->end();
-      for ( ; first1 != last1 && first != last; ++first1, ++first)
-         *first1 = *first;
-      if (first == last){
-         this->erase(first1, last1);
-      }
-      else{
-         this->insert(last1, first, last);
-      }
-   }
-
-   template
-   void assign_dispatch(Integer n, Integer t, boost::mpl::true_)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->assign_dispatch(cvalue_iterator(t, n), cvalue_iterator(), boost::mpl::false_());
-   }
-
-   iterator priv_erase(const_iterator first, const_iterator last, allocator_v1)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      difference_type d1 = first - this->cbegin(), d2 = last - this->cbegin();
-      if(d1 != d2){
-         impl_iterator it1(impl.begin() + d1), it2(impl.begin() + d2);
-         for(impl_iterator it = it1; it != it2; ++it)
-            this->delete_node(*it);
-         impl_iterator e = impl.erase(it1, it2);
-         this->align_nodes(e, get_last_align());
-      }
-      return iterator(this->begin() + d1);
-   }
-
-   impl_iterator get_last_align()
-   {
-      return impl.end() - (ExtraPointers - 1);
-   }
-
-   const_impl_iterator get_last_align() const
-   {
-      return impl.cend() - (ExtraPointers - 1);
-   }
-
-   template
-   iterator priv_erase(const_iterator first, const_iterator last, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      return priv_erase(first, last, allocator_v1());
-   }
-
-   static node_type_ptr_t node_ptr_cast(const void_ptr &p)
-   {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
-   {
-      return node_type_base_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   static value_type& value(const void_ptr &p)
-   {
-      return node_ptr_cast(p)->value;
-   }
-
-   void initialize_end_node(size_type impl_capacity = 0)
-   {
-      if(impl.empty()){
-         impl.reserve(impl_capacity + ExtraPointers);
-         impl.resize (ExtraPointers, void_ptr(0));
-         impl[0] = &this->internal_data.end_node;
-         this->internal_data.end_node.up = &impl[0];
-      }
-   }
-
-   void readjust_end_node()
-   {
-      if(!this->impl.empty()){
-         void_ptr &end_node_ref = *(this->get_last_align()-1);
-         end_node_ref = this->get_end_node();
-         this->internal_data.end_node.up = &end_node_ref;
-      }
-      else{
-         this->internal_data.end_node.up = void_ptr(&this->internal_data.end_node.up);
-      }
-   }
-
-   node_type_ptr_t get_end_node() const
-   {
-      const node_type_base_t* cp = &this->internal_data.end_node;
-      node_type_base_t* p = const_cast(cp);
-      return node_ptr_cast(p);
-   }
-
-   template
-   void_ptr new_node(const void_ptr &up, Iter it)
-   {
-      node_type_ptr_t p = this->allocate_one();
-      try{
-         boost::container::construct_in_place(this->node_alloc(), &*p, it);
-         p->set_pointer(up);
-      }
-      catch(...){
-         this->deallocate_one(p);
-         throw;
-      }
-      return p;
-   }
-
-   void delete_node(const void_ptr &p)
-   {
-      node_type_ptr_t n(node_ptr_cast(p));
       allocator_traits::
-         destroy(this->node_alloc(), container_detail::to_raw_pointer(n));
-      this->put_in_pool(n);
+         destroy(this->priv_node_alloc(), container_detail::addressof(n.value));
+      static_cast(&n)->~node_base_type();
    }
 
-   static void align_nodes(impl_iterator first, impl_iterator last)
+   void priv_delete_node(const node_ptr &n)
    {
-      while(first!=last){
-         node_ptr_cast(*first)->up = void_ptr(&*first);
-         ++first;
-      }
+      this->priv_destroy_node(*n);
+      this->priv_put_in_pool(n);
    }
 
-   void insert_not_iter(const_iterator position, size_type n, const T& t)
+   template
+   void priv_build_node_from_it(const node_ptr &p, const index_iterator &up_index, const Iterator &it)
    {
-      typedef constant_iterator cvalue_iterator;
-      this->insert_iter(position, cvalue_iterator(t, n), cvalue_iterator(), std::forward_iterator_tag());
+      //This can throw
+      boost::container::construct_in_place
+         ( this->priv_node_alloc()
+         , container_detail::addressof(p->value)
+         , it);
+      //This does not throw
+      ::new(static_cast(container_detail::to_raw_pointer(p)))
+         node_base_type(index_traits_type::ptr_to_node_base_ptr(*up_index));
    }
 
-   template 
-   void insert_iter(const_iterator position,InputIterator first,InputIterator last, boost::mpl::true_)
+   template
+   void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible)
    {
-      typedef typename std::iterator_traits::iterator_category category;
-      this->insert_iter(position, first, last, category());
+      //This can throw
+      boost::container::allocator_traits::construct
+         ( this->priv_node_alloc()
+         , container_detail::addressof(p->value)
+         , ::boost::forward(value_convertible));
+      //This does not throw
+      ::new(static_cast(container_detail::to_raw_pointer(p))) node_base_type;
    }
 
-   template 
-   void insert_iter(const_iterator position,InputIterator first,InputIterator last,std::input_iterator_tag)
+   void priv_swap_members(stable_vector &x)
    {
-      for(; first!=last; ++first){
-         this->insert(position, *first);
-      }    
-   }
-
-   template 
-   iterator insert_iter(const_iterator position, InputIterator first, InputIterator last, std::forward_iterator_tag)
-   {
-      size_type       n = (size_type)std::distance(first,last);
-      difference_type d = position-this->cbegin();
-      if(n){
-         this->insert_iter_prolog(n, d);
-         const impl_iterator it(impl.begin() + d);
-         this->insert_iter_fwd(it, first, last, n);
-         //Fix the pointers for the newly allocated buffer
-         this->align_nodes(it + n, get_last_align());
-      }
-      return this->begin() + d;
-   }
-
-   template 
-   void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v1)
-   {
-      size_type i=0;
-      try{
-         while(first!=last){
-            it[i] = this->new_node(void_ptr_ptr(&it[i]), first);
-            ++first;
-            ++i;
-         }
-      }
-      catch(...){
-         impl_iterator e = impl.erase(it + i, it + n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v2)
-   {
-      multiallocation_chain mem(node_alloc().allocate_individual(n));
-
-      size_type i = 0;
-      node_type_ptr_t p = 0;
-      try{
-         while(first != last){
-            p = mem.front();
-            mem.pop_front();
-            //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
-            p->set_pointer(void_ptr_ptr(&it[i]));
-            ++first;
-            it[i] = p;
-            ++i;
-         }
-      }
-      catch(...){
-         node_alloc().deallocate_one(p);
-         node_alloc().deallocate_many(boost::move(mem));
-         impl_iterator e = impl.erase(it+i, it+n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter_fwd(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n)
-   {
-      size_type i = 0;
-      node_type_ptr_t p = 0;
-      try{
-         while(first != last){
-            p = this->get_from_pool();
-            if(!p){
-               insert_iter_fwd_alloc(it+i, first, last, n-i, alloc_version());
-               break;
-            }
-            //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
-            p->set_pointer(void_ptr_ptr(&it[i]));
-            ++first;
-            it[i]=p;
-            ++i;
-         }
-      }
-      catch(...){
-         put_in_pool(p);
-         impl_iterator e = impl.erase(it+i, it+n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter(const_iterator position, InputIterator first, InputIterator last, boost::mpl::false_)
-   {
-      this->insert_not_iter(position, first, last);
+      container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
+      index_traits_type::readjust_end_node(this->index, this->internal_data.end_node);
+      index_traits_type::readjust_end_node(x.index, x.internal_data.end_node);
    }
 
    #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
-   bool invariant()const
+   bool priv_invariant()const
    {
-      if(impl.empty())
-         return !capacity() && !size();
-      if(get_end_node() != *(impl.end() - ExtraPointers)){
+      index_type & index_ref =  const_cast(this->index);
+
+      if(index.empty())
+         return !this->capacity() && !this->size();
+      if(this->priv_get_end_node() != *(index.end() - ExtraPointers)){
          return false;
       }
-      for(const_impl_iterator it = impl.begin(), it_end = get_last_align(); it != it_end; ++it){
-         if(const_void_ptr(node_ptr_cast(*it)->up) != 
-               const_void_ptr(const_void_ptr_ptr(&*it)))
-            return false;
+
+      if(!index_traits_type::invariants(index_ref)){
+         return false;
       }
-      size_type n = capacity()-size();
-      const void_ptr &pool_head = impl.back();
+
+      size_type n = this->capacity() - this->size();
+      node_base_ptr &pool_first_ref = *(index_ref.end() - (ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = index_ref.back();
+      multiallocation_chain holder;
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      typename multiallocation_chain::iterator beg(holder.begin()), end(holder.end());
       size_type num_pool = 0;
-      node_type_ptr_t p = node_ptr_cast(pool_head);
-      while(p){
+      while(beg != end){
          ++num_pool;
-         p = node_ptr_cast(p->up);
+         ++beg;
       }
-      return n >= num_pool;
+      return n >= num_pool && num_pool == internal_data.pool_size;
    }
 
    class invariant_checker
@@ -1703,7 +1750,7 @@ class stable_vector
 
       public:
       invariant_checker(const stable_vector& v):p(&v){}
-      ~invariant_checker(){BOOST_ASSERT(p->invariant());}
+      ~invariant_checker(){BOOST_ASSERT(p->priv_invariant());}
       void touch(){}
    };
    #endif
@@ -1713,94 +1760,72 @@ class stable_vector
    {
       private:
       BOOST_MOVABLE_BUT_NOT_COPYABLE(ebo_holder)
+
       public:
-/*
-      explicit ebo_holder(BOOST_RV_REF(ebo_holder) x)
-         : node_allocator_type(boost::move(static_cast(x)))
-         , pool_size(0)
-         , end_node()
-      {}
-*/
       template
       explicit ebo_holder(BOOST_FWD_REF(AllocatorRLValue) a)
          : node_allocator_type(boost::forward(a))
          , pool_size(0)
          , end_node()
-      {
-         this->set_end_pointer_to_default_constructed();
-      }
+      {}
 
       ebo_holder()
          : node_allocator_type()
          , pool_size(0)
          , end_node()
-      {
-         this->set_end_pointer_to_default_constructed();
-      }
-
-      void set_end_pointer_to_default_constructed()
-      {
-         end_node.set_pointer(void_ptr(&end_node.up));
-      }
+      {}
 
       size_type pool_size;
-      node_type_base_t end_node;
+      node_base_type end_node;
    } internal_data;
 
-   void priv_swap_members(stable_vector &x)
-   {
-      container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
-      this->readjust_end_node();
-      x.readjust_end_node();
-   }
+   node_allocator_type &priv_node_alloc()              { return internal_data;  }
+   const node_allocator_type &priv_node_alloc() const  { return internal_data;  }
 
-   node_allocator_type &node_alloc()              { return internal_data;  }
-   const node_allocator_type &node_alloc() const  { return internal_data;  }
-
-   impl_type                           impl;
+   index_type                           index;
    /// @endcond
 };
 
-template 
-bool operator==(const stable_vector& x,const stable_vector& y)
+template 
+bool operator==(const stable_vector& x,const stable_vector& y)
 {
    return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin());
 }
 
-template 
-bool operator< (const stable_vector& x,const stable_vector& y)
+template 
+bool operator< (const stable_vector& x,const stable_vector& y)
 {
    return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
 }
 
-template 
-bool operator!=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator!=(const stable_vector& x,const stable_vector& y)
 {
    return !(x==y);
 }
 
-template 
-bool operator> (const stable_vector& x,const stable_vector& y)
+template 
+bool operator> (const stable_vector& x,const stable_vector& y)
 {
    return y
-bool operator>=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator>=(const stable_vector& x,const stable_vector& y)
 {
    return !(x
-bool operator<=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator<=(const stable_vector& x,const stable_vector& y)
 {
    return !(x>y);
 }
 
 // specialized algorithms:
 
-template 
-void swap(stable_vector& x,stable_vector& y)
+template 
+void swap(stable_vector& x,stable_vector& y)
 {
    x.swap(y);
 }
@@ -1811,6 +1836,17 @@ void swap(stable_vector& x,stable_vector& y)
 
 /// @endcond
 
+/*
+
+//!has_trivial_destructor_after_move<> == true_type
+//!specialization for optimizations
+template 
+struct has_trivial_destructor_after_move >
+   : public has_trivial_destructor_after_move::value
+{};
+
+*/
+
 }}
 
 #include 
diff --git a/project/jni/boost/include/boost/container/string.hpp b/project/jni/boost/include/boost/container/string.hpp
index 3a9c55a3c..40b2397a7 100644
--- a/project/jni/boost/include/boost/container/string.hpp
+++ b/project/jni/boost/include/boost/container/string.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -43,15 +43,19 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
-#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
-#include       
-#include   
+#include      
+#include  
 #include 
 #include 
 #include 
@@ -67,39 +71,34 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 namespace container_detail {
 // ------------------------------------------------------------
-// Class basic_string_base.  
+// Class basic_string_base. 
 
 // basic_string_base is a helper class that makes it it easier to write
 // an exception-safe version of basic_string.  The constructor allocates,
 // but does not initialize, a block of memory.  The destructor
 // deallocates, but does not destroy elements within, a block of
-// memory.  The destructor assumes that the memory either is the internal buffer, 
-// or else points to a block of memory that was allocated using _String_base's 
+// memory. The destructor assumes that the memory either is the internal buffer,
+// or else points to a block of memory that was allocated using string_base's
 // allocator and whose size is this->m_storage.
-template 
+template 
 class basic_string_base
 {
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
 
-   typedef allocator_traits allocator_traits_type;
+   typedef allocator_traits allocator_traits_type;
  public:
-   typedef A allocator_type;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
+   typedef Allocator                                  allocator_type;
+   typedef allocator_type                              stored_allocator_type;
    typedef typename allocator_traits_type::pointer     pointer;
    typedef typename allocator_traits_type::value_type  value_type;
    typedef typename allocator_traits_type::size_type   size_type;
+   typedef ::boost::intrusive::pointer_traits pointer_traits;
 
    basic_string_base()
       : members_()
@@ -111,32 +110,29 @@ class basic_string_base
 
    basic_string_base(const allocator_type& a, size_type n)
       : members_(a)
-   {  
-      this->init(); 
+   { 
+      this->init();
       this->allocate_initial_block(n);
    }
 
    basic_string_base(BOOST_RV_REF(basic_string_base) b)
       :  members_(boost::move(b.alloc()))
-   {  
+   { 
       this->init();
-      this->swap_data(b); 
+      this->swap_data(b);
    }
 
-   ~basic_string_base() 
-   {  
+   ~basic_string_base()
+   { 
       if(!this->is_short()){
-         this->deallocate_block(); 
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , static_cast(static_cast(&this->members_.m_repr.r))
-            );
+         this->deallocate_block();
+         this->is_short(true);
       }
    }
 
    private:
 
-   //This is the structure controlling a long string 
+   //This is the structure controlling a long string
    struct long_t
    {
       size_type      is_short  : 1;
@@ -175,8 +171,8 @@ class basic_string_base
 
    //This type has the same alignment and size as long_t but it's POD
    //so, unlike long_t, it can be placed in a union
-   
-   typedef typename boost::aligned_storage< sizeof(long_t), 
+  
+   typedef typename boost::aligned_storage< sizeof(long_t),
        container_detail::alignment_of::value>::type   long_raw_t;
 
    protected:
@@ -187,13 +183,13 @@ class basic_string_base
       container_detail::ct_rounded_size::value;
    static const size_type  ZeroCostInternalBufferChars =
       (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
-   static const size_type  UnalignedFinalInternalBufferChars = 
+   static const size_type  UnalignedFinalInternalBufferChars =
       (ZeroCostInternalBufferChars > MinInternalBufferChars) ?
                 ZeroCostInternalBufferChars : MinInternalBufferChars;
 
    struct short_t
    {
-      short_header   h; 
+      short_header   h;
       value_type     data[UnalignedFinalInternalBufferChars];
    };
 
@@ -202,32 +198,38 @@ class basic_string_base
       long_raw_t  r;
       short_t     s;
 
-      short_t &short_repr() const
-      {  return *const_cast(&s);  }
+      const short_t &short_repr() const
+      {  return s;  }
 
-      long_t &long_repr() const
-      {  return *const_cast(reinterpret_cast(&r));  }
+      const long_t &long_repr() const
+      {  return *static_cast(static_cast(&r));  }
+
+      short_t &short_repr()
+      {  return s;  }
+
+      long_t &long_repr()
+      {  return *static_cast(static_cast(&r));  }
    };
 
    struct members_holder
-      :  public A
+      :  public Allocator
    {
       members_holder()
-         : A()
+         : Allocator()
       {}
 
       template
       explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
-         :  A(boost::forward(a))
+         :  Allocator(boost::forward(a))
       {}
 
       repr_t m_repr;
    } members_;
 
-   const A &alloc() const
+   const Allocator &alloc() const
    {  return members_;  }
 
-   A &alloc()
+   Allocator &alloc()
    {  return members_;  }
 
    static const size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
@@ -241,20 +243,22 @@ class basic_string_base
    {  return static_cast(this->members_.m_repr.s.h.is_short != 0);  }
 
    void is_short(bool yes)
-   {  
-      if(yes && !this->is_short()){
+   {
+      const bool was_short = this->is_short();
+      if(yes && !was_short){
          allocator_traits_type::destroy
             ( this->alloc()
             , static_cast(static_cast(&this->members_.m_repr.r))
             );
+         this->members_.m_repr.s.h.is_short = true;
       }
-      else{
+      else if(!yes && was_short){
          allocator_traits_type::construct
             ( this->alloc()
             , static_cast(static_cast(&this->members_.m_repr.r))
             );
+         this->members_.m_repr.s.h.is_short = false;
       }
-      this->members_.m_repr.s.h.is_short = yes;
    }
 
    private:
@@ -269,55 +273,27 @@ class basic_string_base
    typedef container_detail::integral_constant      allocator_v1;
    typedef container_detail::integral_constant      allocator_v2;
    typedef container_detail::integral_constant::value> alloc_version;
+      boost::container::container_detail::version::value> alloc_version;
 
    std::pair
       allocation_command(allocation_type command,
-                         size_type limit_size, 
+                         size_type limit_size,
                          size_type preferred_size,
                          size_type &received_size, pointer reuse = 0)
    {
       if(this->is_short() && (command & (expand_fwd | expand_bwd)) ){
-         reuse = pointer(0);
+         reuse = pointer();
          command &= ~(expand_fwd | expand_bwd);
       }
-      return this->allocation_command
-         (command, limit_size, preferred_size, received_size, reuse, alloc_version());
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v1)
-   {
-      (void)limit_size;
-      (void)reuse;
-      if(!(command & allocate_new))
-         return std::pair(pointer(0), false);
-      received_size = preferred_size;
-      return std::make_pair(this->alloc().allocate(received_size), false);
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         pointer reuse,
-                         allocator_v2)
-   {
-      return this->alloc().allocation_command(command, limit_size, preferred_size, 
-                                              received_size, reuse);
+      return container_detail::allocator_version_traits::allocation_command
+         (this->alloc(), command, limit_size, preferred_size, received_size, reuse);
    }
 
    size_type next_capacity(size_type additional_objects) const
    {  return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects);  }
 
-   void deallocate(pointer p, size_type n) 
-   {  
+   void deallocate(pointer p, size_type n)
+   { 
       if (p && (n > InternalBufferChars))
          this->alloc().deallocate(p, n);
    }
@@ -333,11 +309,9 @@ class basic_string_base
 
    void destroy(pointer p, size_type n)
    {
-      for(; n--; ++p){
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(p)
-            );
+      value_type *raw_p = container_detail::to_raw_pointer(p);
+      for(; n--; ++raw_p){
+         allocator_traits_type::destroy( this->alloc(), raw_p);
       }
    }
 
@@ -357,7 +331,7 @@ class basic_string_base
             pointer p = this->allocation_command(allocate_new, n, new_cap, new_cap).first;
             this->is_short(false);
             this->priv_long_addr(p);
-            this->priv_size(0);
+            this->priv_long_size(0);
             this->priv_storage(new_cap);
          }
       }
@@ -365,9 +339,9 @@ class basic_string_base
          throw_length_error();
    }
 
-   void deallocate_block() 
+   void deallocate_block()
    {  this->deallocate(this->priv_addr(), this->priv_storage());  }
-      
+     
    size_type max_size() const
    {  return allocator_traits_type::max_size(this->alloc()) - 1; }
 
@@ -383,13 +357,26 @@ class basic_string_base
    { return this->priv_storage() - 1; }
 
    pointer priv_short_addr() const
-   {  return pointer(&this->members_.m_repr.short_repr().data[0]);  }
+   {  return pointer_traits::pointer_to(const_cast(this->members_.m_repr.short_repr().data[0]));  }
 
    pointer priv_long_addr() const
    {  return this->members_.m_repr.long_repr().start;  }
 
    pointer priv_addr() const
-   {  return this->is_short() ? pointer(&this->members_.m_repr.short_repr().data[0]) : this->members_.m_repr.long_repr().start;  }
+   {
+      return this->is_short()
+         ? priv_short_addr()
+         : priv_long_addr()
+         ;
+   }
+
+   pointer priv_end_addr() const
+   {
+      return this->is_short()
+         ? this->priv_short_addr() + this->priv_short_size()
+         : this->priv_long_addr()  + this->priv_long_size()
+         ;
+   }
 
    void priv_long_addr(pointer addr)
    {  this->members_.m_repr.long_repr().start = addr;  }
@@ -404,18 +391,18 @@ class basic_string_base
    {  return this->members_.m_repr.long_repr().storage;  }
 
    void priv_storage(size_type storage)
-   {  
+   { 
       if(!this->is_short())
          this->priv_long_storage(storage);
    }
 
    void priv_long_storage(size_type storage)
-   {  
+   { 
       this->members_.m_repr.long_repr().storage = storage;
    }
 
    size_type priv_size() const
-   {  return this->is_short() ? priv_short_size() : priv_long_size();  }
+   {  return this->is_short() ? this->priv_short_size() : this->priv_long_size();  }
 
    size_type priv_short_size() const
    {  return this->members_.m_repr.short_repr().h.length;  }
@@ -424,7 +411,7 @@ class basic_string_base
    {  return this->members_.m_repr.long_repr().length;  }
 
    void priv_size(size_type sz)
-   {  
+   { 
       if(this->is_short())
          this->priv_short_size(sz);
       else
@@ -432,13 +419,13 @@ class basic_string_base
    }
 
    void priv_short_size(size_type sz)
-   {  
+   { 
       this->members_.m_repr.s.h.length = (unsigned char)sz;
    }
 
    void priv_long_size(size_type sz)
-   {  
-      this->members_.m_repr.long_repr().length = static_cast(sz);
+   { 
+      this->members_.m_repr.long_repr().length = sz;
    }
 
    void swap_data(basic_string_base& other)
@@ -448,16 +435,22 @@ class basic_string_base
             container_detail::do_swap(this->members_.m_repr, other.members_.m_repr);
          }
          else{
-            repr_t copied(this->members_.m_repr);
-            this->members_.m_repr.long_repr() = other.members_.m_repr.long_repr();
-            other.members_.m_repr = copied;
+            short_t short_backup(this->members_.m_repr.short_repr());
+            long_t  long_backup (other.members_.m_repr.long_repr());
+            other.members_.m_repr.long_repr().~long_t();
+            ::new(&this->members_.m_repr.long_repr()) long_t;
+            this->members_.m_repr.long_repr()  = long_backup;
+            other.members_.m_repr.short_repr() = short_backup;
          }
       }
       else{
          if(other.is_short()){
-            repr_t copied(other.members_.m_repr);
-            other.members_.m_repr.long_repr() = this->members_.m_repr.long_repr();
-            this->members_.m_repr = copied;
+            short_t short_backup(other.members_.m_repr.short_repr());
+            long_t  long_backup (this->members_.m_repr.long_repr());
+            this->members_.m_repr.long_repr().~long_t();
+            ::new(&other.members_.m_repr.long_repr()) long_t;
+            other.members_.m_repr.long_repr()  = long_backup;
+            this->members_.m_repr.short_repr() = short_backup;
          }
          else{
             container_detail::do_swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
@@ -470,51 +463,51 @@ class basic_string_base
 
 /// @endcond
 
-//! The basic_string class represents a Sequence of characters. It contains all the 
-//! usual operations of a Sequence, and, additionally, it contains standard string 
+//! The basic_string class represents a Sequence of characters. It contains all the
+//! usual operations of a Sequence, and, additionally, it contains standard string
 //! operations such as search and concatenation.
 //!
-//! The basic_string class is parameterized by character type, and by that type's 
+//! The basic_string class is parameterized by character type, and by that type's
 //! Character Traits.
-//! 
-//! This class has performance characteristics very much like vector<>, meaning, 
+//!
+//! This class has performance characteristics very much like vector<>, meaning,
 //! for example, that it does not perform reference-count or copy-on-write, and that
-//! concatenation of two strings is an O(N) operation. 
-//! 
-//! Some of basic_string's member functions use an unusual method of specifying positions 
-//! and ranges. In addition to the conventional method using iterators, many of 
-//! basic_string's member functions use a single value pos of type size_type to represent a 
-//! position (in which case the position is begin() + pos, and many of basic_string's 
-//! member functions use two values, pos and n, to represent a range. In that case pos is 
-//! the beginning of the range and n is its size. That is, the range is 
-//! [begin() + pos, begin() + pos + n). 
-//! 
-//! Note that the C++ standard does not specify the complexity of basic_string operations. 
-//! In this implementation, basic_string has performance characteristics very similar to 
-//! those of vector: access to a single character is O(1), while copy and concatenation 
+//! concatenation of two strings is an O(N) operation.
+//!
+//! Some of basic_string's member functions use an unusual method of specifying positions
+//! and ranges. In addition to the conventional method using iterators, many of
+//! basic_string's member functions use a single value pos of type size_type to represent a
+//! position (in which case the position is begin() + pos, and many of basic_string's
+//! member functions use two values, pos and n, to represent a range. In that case pos is
+//! the beginning of the range and n is its size. That is, the range is
+//! [begin() + pos, begin() + pos + n).
+//!
+//! Note that the C++ standard does not specify the complexity of basic_string operations.
+//! In this implementation, basic_string has performance characteristics very similar to
+//! those of vector: access to a single character is O(1), while copy and concatenation
 //! are O(N).
-//! 
-//! In this implementation, begin(), 
+//!
+//! In this implementation, begin(),
 //! end(), rbegin(), rend(), operator[], c_str(), and data() do not invalidate iterators.
 //! In this implementation, iterators are only invalidated by member functions that
-//! explicitly change the string's contents. 
+//! explicitly change the string's contents.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class basic_string
-   :  private container_detail::basic_string_base 
+   :  private container_detail::basic_string_base
 {
    /// @cond
    private:
-   typedef allocator_traits allocator_traits_type;
+   typedef allocator_traits allocator_traits_type;
    BOOST_COPYABLE_AND_MOVABLE(basic_string)
-   typedef container_detail::basic_string_base base_t;
+   typedef container_detail::basic_string_base base_t;
    static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
 
    protected:
-   // A helper class to use a char_traits as a function object.
+   // Allocator helper class to use a char_traits as a function object.
 
    template 
    struct Eq_traits
@@ -535,49 +528,38 @@ class basic_string
       const Pointer m_first;
       const Pointer m_last;
 
-      Not_within_traits(Pointer f, Pointer l) 
+      Not_within_traits(Pointer f, Pointer l)
          : m_first(f), m_last(l) {}
 
-      bool operator()(const typename Tr::char_type& x) const 
+      bool operator()(const typename Tr::char_type& x) const
       {
-         return std::find_if(m_first, m_last, 
+         return std::find_if(m_first, m_last,
                         std::bind1st(Eq_traits(), x)) == m_last;
       }
    };
    /// @endcond
 
    public:
-
-   //! The allocator type
-   typedef A                                       allocator_type;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
-   //! The type of object, CharT, stored in the string
-   typedef CharT                                   value_type;
-   //! The second template parameter Traits
-   typedef Traits                                  traits_type;
-   //! Pointer to CharT
-   typedef typename allocator_traits_type::pointer pointer;
-   //! Const pointer to CharT 
-   typedef typename allocator_traits_type::const_pointer               const_pointer;
-   //! Reference to CharT 
-   typedef typename allocator_traits_type::reference                   reference;
-   //! Const reference to CharT 
-   typedef typename allocator_traits_type::const_reference             const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type                   size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type             difference_type;
-   //! Iterator used to iterate through a string. It's a Random Access Iterator
-   typedef pointer                                 iterator;
-   //! Const iterator used to iterate through a string. It's a Random Access Iterator
-   typedef const_pointer                           const_iterator;
-   //! Iterator used to iterate backwards through a string
-   typedef std::reverse_iterator       reverse_iterator;
-   //! Const iterator used to iterate backwards through a string
-   typedef std::reverse_iterator const_reverse_iterator;
-   //! The largest possible value of type size_type. That is, size_type(-1). 
-   static const size_type npos;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Traits                                                                      traits_type;
+   typedef CharT                                                                       value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(allocator_type)                                      stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(pointer)                                             iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_pointer)                                       const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
+   static const size_type npos = size_type(-1);
 
    /// @cond
    private:
@@ -585,9 +567,15 @@ class basic_string
    typedef typename base_t::allocator_v1  allocator_v1;
    typedef typename base_t::allocator_v2  allocator_v2;
    typedef typename base_t::alloc_version  alloc_version;
+   typedef ::boost::intrusive::pointer_traits pointer_traits;
    /// @endcond
 
    public:                         // Constructor, destructor, assignment.
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
    /// @cond
    struct reserve_t {};
 
@@ -602,7 +590,7 @@ class basic_string
    /// @endcond
 
    //! Effects: Default constructs a basic_string.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
    basic_string()
       : base_t()
@@ -610,78 +598,112 @@ class basic_string
 
 
    //! Effects: Constructs a basic_string taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   explicit basic_string(const allocator_type& a)
+   //!
+   //! Throws: Nothing
+   explicit basic_string(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    { this->priv_terminate_string(); }
 
    //! Effects: Copy constructs a basic_string.
    //!
    //! Postcondition: x == *this.
-   //! 
-   //! Throws: If allocator_type's default constructor or copy constructor throws.
-   basic_string(const basic_string& s) 
-      :  base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
-   { this->priv_range_initialize(s.begin(), s.end()); }
-
-   //! Effects: Move constructor. Moves mx's resources to *this.
    //!
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   basic_string(const basic_string& s)
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
+   {
+      this->priv_terminate_string();
+      this->assign(s.begin(), s.end());
+   }
+
+   //! Effects: Move constructor. Moves s's resources to *this.
+   //!
+   //! Throws: Nothing.
+   //!
    //! Complexity: Constant.
-   basic_string(BOOST_RV_REF(basic_string) s) 
+   basic_string(BOOST_RV_REF(basic_string) s) BOOST_CONTAINER_NOEXCEPT
       : base_t(boost::move((base_t&)s))
    {}
 
-   //! Effects: Constructs a basic_string taking the allocator as parameter,
-   //!   and is initialized by a specific number of characters of the s string. 
-   basic_string(const basic_string& s, size_type pos, size_type n = npos,
-               const allocator_type& a = allocator_type()) 
-      : base_t(a) 
+   //! Effects: Copy constructs a basic_string using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocation throws.
+   basic_string(const basic_string& s, const allocator_type &a)
+      :  base_t(a)
    {
+      this->priv_terminate_string();
+      this->assign(s.begin(), s.end());
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves s's resources to *this.
+   //!
+   //! Throws: If allocation throws.
+   //!
+   //! Complexity: Constant if a == s.get_allocator(), linear otherwise.
+   basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      if(a == this->alloc()){
+         this->swap_data(s);
+      }
+      else{
+         this->assign(s.begin(), s.end());
+      }
+   }
+
+   //! Effects: Constructs a basic_string taking the allocator as parameter,
+   //!   and is initialized by a specific number of characters of the s string.
+   basic_string(const basic_string& s, size_type pos, size_type n = npos,
+                const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
       if (pos > s.size())
          this->throw_out_of_range();
       else
-         this->priv_range_initialize
+         this->assign
             (s.begin() + pos, s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by a specific number of characters of the s c-string.
-   basic_string(const CharT* s, size_type n,
-               const allocator_type& a = allocator_type()) 
-      : base_t(a) 
-   { this->priv_range_initialize(s, s + n); }
+   basic_string(const CharT* s, size_type n, const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      this->assign(s, s + n);
+   }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by the null-terminated s c-string.
-   basic_string(const CharT* s,
-                const allocator_type& a = allocator_type())
-      : base_t(a) 
-   { this->priv_range_initialize(s, s + Traits::length(s)); }
+   basic_string(const CharT* s, const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      this->assign(s, s + Traits::length(s));
+   }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by n copies of c.
-   basic_string(size_type n, CharT c,
-                const allocator_type& a = allocator_type())
+   basic_string(size_type n, CharT c, const allocator_type& a = allocator_type())
       : base_t(a)
-   {  
-      this->priv_range_initialize(cvalue_iterator(c, n),
-                                  cvalue_iterator());
+   {
+      this->priv_terminate_string();
+      this->assign(n, c);
    }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and a range of iterators.
    template 
-   basic_string(InputIterator f, InputIterator l,
-               const allocator_type& a = allocator_type())
+   basic_string(InputIterator f, InputIterator l, const allocator_type& a = allocator_type())
       : base_t(a)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_initialize_dispatch(f, l, Result());
+      this->priv_terminate_string();
+      this->assign(f, l);
    }
 
    //! Effects: Destroys the basic_string. All used memory is deallocated.
@@ -689,13 +711,13 @@ class basic_string
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   ~basic_string() 
+   ~basic_string() BOOST_CONTAINER_NOEXCEPT
    {}
-      
+     
    //! Effects: Copy constructs a string.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) x)
    {
@@ -708,8 +730,8 @@ class basic_string
             if(!this->is_short()){
                this->deallocate_block();
                this->is_short(true);
-               Traits::assign(*this->priv_addr(), this->priv_null());
-               this->priv_size(0);
+               Traits::assign(*this->priv_addr(), CharT(0));
+               this->priv_short_size(0);
             }
          }
          container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
@@ -721,9 +743,9 @@ class basic_string
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   basic_string& operator=(BOOST_RV_REF(basic_string) x)
+   basic_string& operator=(BOOST_RV_REF(basic_string) x) BOOST_CONTAINER_NOEXCEPT
    {
       if (&x != this){
          allocator_type &this_alloc = this->alloc();
@@ -747,165 +769,185 @@ class basic_string
    }
 
    //! Effects: Assignment from a null-terminated c-string.
-   basic_string& operator=(const CharT* s) 
+   basic_string& operator=(const CharT* s)
    { return this->assign(s, s + Traits::length(s)); }
 
    //! Effects: Assignment from character.
    basic_string& operator=(CharT c)
    { return this->assign(static_cast(1), c); }
 
-   //! Effects: Returns an iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin()
-   { return this->priv_addr(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const
-   { return this->priv_addr(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const
-   { return this->priv_addr(); }
-
-   //! Effects: Returns an iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end()
-   { return this->priv_addr() + this->priv_size(); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const 
-   { return this->priv_addr() + this->priv_size(); }  
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const 
-   { return this->priv_addr() + this->priv_size(); }  
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin()             
-   { return reverse_iterator(this->priv_addr() + this->priv_size()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return this->crbegin(); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return const_reverse_iterator(this->priv_addr() + this->priv_size()); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend()               
-   { return reverse_iterator(this->priv_addr()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend()   const 
-   { return this->crend(); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend()   const 
-   { return const_reverse_iterator(this->priv_addr()); }
-
    //! Effects: Returns a copy of the internal allocator.
-   //! 
+   //!
    //! Throws: If allocator's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return this->alloc(); }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    {  return this->alloc(); }
 
-   //! Effects: Returns the number of the elements contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   size_type size() const    
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns an iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin()  BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->priv_end_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend()  BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->priv_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->priv_end_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->priv_addr()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the vector contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return !this->priv_size(); }
+
+   //! Effects: Returns the number of the elements contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const    BOOST_CONTAINER_NOEXCEPT
    { return this->priv_size(); }
 
    //! Effects: Returns the number of the elements contained in the vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type length() const
+   size_type length() const BOOST_CONTAINER_NOEXCEPT
    { return this->size(); }
 
    //! Effects: Returns the largest possible size of the vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return base_t::max_size(); }
 
    //! Effects: Inserts or erases elements at the end such that
@@ -916,7 +958,7 @@ class basic_string
    //! Complexity: Linear to the difference between size() and new_size.
    void resize(size_type n, CharT c)
    {
-      if (n <= size())
+      if (n <= this->size())
          this->erase(this->begin() + n, this->end());
       else
          this->append(n - this->size(), c);
@@ -929,18 +971,28 @@ class basic_string
    //!
    //! Complexity: Linear to the difference between size() and new_size.
    void resize(size_type n)
-   { resize(n, this->priv_null()); }
+   { resize(n, CharT()); }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_capacity(); }
 
    //! Effects: If n is less than or equal to capacity(), this call has no
    //!   effect. Otherwise, it is a request for allocation of additional memory.
    //!   If the request is successful, then capacity() is greater than or equal to
    //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
+   //!
    //! Throws: If memory allocation allocation throws
    void reserve(size_type res_arg)
    {
-      if (res_arg > this->max_size())
+      if (res_arg > this->max_size()){
          this->throw_length_error();
+      }
 
       if (this->capacity() < res_arg){
          size_type n = container_detail::max_value(res_arg, this->size()) + 1;
@@ -949,39 +1001,18 @@ class basic_string
             (allocate_new, n, new_cap, new_cap).first;
          size_type new_length = 0;
 
+         const pointer addr = this->priv_addr();
          new_length += priv_uninitialized_copy
-            (this->priv_addr(), this->priv_addr() + this->priv_size(), new_start);
+            (addr, addr + this->priv_size(), new_start);
          this->priv_construct_null(new_start + new_length);
          this->deallocate_block();
          this->is_short(false);
          this->priv_long_addr(new_start);
-         this->priv_size(new_length);
+         this->priv_long_size(new_length);
          this->priv_storage(new_cap);
       }
    }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const
-   { return this->priv_capacity(); }
-
-   //! Effects: Erases all the elements of the vector.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements in the vector.
-   void clear()
-   {
-      if (!empty()) {
-         Traits::assign(*this->priv_addr(), this->priv_null());
-         this->priv_size(0);
-      }
-   }
-
    //! Effects: Tries to deallocate the excess of memory created
    //!   with previous allocations. The size of the string is unchanged
    //!
@@ -994,7 +1025,7 @@ class basic_string
       if(this->priv_storage() > InternalBufferChars){
          //Check if we should pass from dynamically allocated buffer
          //to the internal storage
-         if(this->priv_size() < (InternalBufferChars)){
+         if(this->priv_size() < InternalBufferChars){
             //Dynamically allocated buffer attributes
             pointer   long_addr    = this->priv_long_addr();
             size_type long_storage = this->priv_long_storage();
@@ -1013,64 +1044,69 @@ class basic_string
       }
    }
 
-   //! Effects: Returns true if the vector contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const
-   { return !this->priv_size(); }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a reference to the nth element 
+   //! Effects: Returns a reference to the nth element
    //!   from the beginning of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference operator[](size_type n)
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
       { return *(this->priv_addr() + n); }
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a const reference to the nth element 
+   //! Effects: Returns a const reference to the nth element
    //!   from the beginning of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference operator[](size_type n) const
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
       { return *(this->priv_addr() + n); }
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a reference to the nth element 
+   //! Effects: Returns a reference to the nth element
    //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n) {
-      if (n >= size())
-      this->throw_out_of_range();
-      return *(this->priv_addr() + n);
-   }
-
-   //! Requires: size() > n.
    //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
    //! Throws: std::range_error if n >= size()
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference at(size_type n) const {
-      if (n >= size())
+   reference at(size_type n)
+   {
+      if (n >= this->size())
          this->throw_out_of_range();
       return *(this->priv_addr() + n);
    }
 
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const {
+      if (n >= this->size())
+         this->throw_out_of_range();
+      return *(this->priv_addr() + n);
+   }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Calls append(str.data, str.size()).
    //!
    //! Returns: *this
@@ -1092,12 +1128,12 @@ class basic_string
    //! Effects: Calls append(str.data(), str.size()).
    //!
    //! Returns: *this
-   basic_string& append(const basic_string& s) 
+   basic_string& append(const basic_string& s)
    {  return this->append(s.begin(), s.end());  }
 
    //! Requires: pos <= str.size()
    //!
-   //! Effects: Determines the effective length rlen of the string to append 
+   //! Effects: Determines the effective length rlen of the string to append
    //! as the smaller of n and str.size() - pos and calls append(str.data() + pos, rlen).
    //!
    //! Throws: If memory allocation throws and out_of_range if pos > str.size()
@@ -1121,7 +1157,7 @@ class basic_string
    //! Throws: If memory allocation throws length_error if size() + n > max_size().
    //!
    //! Returns: *this
-   basic_string& append(const CharT* s, size_type n) 
+   basic_string& append(const CharT* s, size_type n)
    {  return this->append(s, s + n);  }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1129,7 +1165,7 @@ class basic_string
    //! Effects: Calls append(s, traits::length(s)).
    //!
    //! Returns: *this
-   basic_string& append(const CharT* s) 
+   basic_string& append(const CharT* s)
    {  return this->append(s, s + Traits::length(s));  }
 
    //! Effects: Equivalent to append(basic_string(n, c)).
@@ -1150,31 +1186,33 @@ class basic_string
    //! Effects: Equivalent to append(static_cast(1), c).
    void push_back(CharT c)
    {
-      if (this->priv_size() < this->capacity()){
-         this->priv_construct_null(this->priv_addr() + (this->priv_size() + 1));
-         Traits::assign(this->priv_addr()[this->priv_size()], c);
-         this->priv_size(this->priv_size()+1);
+      const size_type old_size = this->priv_size();
+      if (old_size < this->capacity()){
+         const pointer addr = this->priv_addr();
+         this->priv_construct_null(addr + old_size + 1);
+         Traits::assign(addr[old_size], c);
+         this->priv_size(old_size+1);
       }
       else{
          //No enough memory, insert a new object at the end
-         this->append((size_type)1, c);
+         this->append(size_type(1), c);
       }
    }
 
    //! Effects: Equivalent to assign(str, 0, npos).
    //!
    //! Returns: *this
-   basic_string& assign(const basic_string& s) 
+   basic_string& assign(const basic_string& s)
    {  return this->operator=(s); }
 
    //! Effects: The function replaces the string controlled by *this
-   //!    with a string of length str.size() whose elements are a copy of the string 
+   //!    with a string of length str.size() whose elements are a copy of the string
    //!   controlled by str. Leaves str in a valid but unspecified state.
    //!
    //! Throws: Nothing
    //!
    //! Returns: *this
-   basic_string& assign(BOOST_RV_REF(basic_string) ms) 
+   basic_string& assign(BOOST_RV_REF(basic_string) ms) BOOST_CONTAINER_NOEXCEPT
    {  return this->swap_data(ms), *this;  }
 
    //! Requires: pos <= str.size()
@@ -1185,11 +1223,11 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > str.size().
    //!
    //! Returns: *this
-   basic_string& assign(const basic_string& s, 
-                        size_type pos, size_type n) {
+   basic_string& assign(const basic_string& s, size_type pos, size_type n)
+   {
       if (pos > s.size())
       this->throw_out_of_range();
-      return this->assign(s.begin() + pos, 
+      return this->assign(s.begin() + pos,
                           s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
@@ -1199,7 +1237,7 @@ class basic_string
    //! length n whose elements are a copy of those pointed to by s.
    //!
    //! Throws: If memory allocation throws or length_error if n > max_size().
-   //!    
+   //!   
    //! Returns: *this
    basic_string& assign(const CharT* s, size_type n)
    {  return this->assign(s, s + n);   }
@@ -1222,12 +1260,29 @@ class basic_string
    //!
    //! Returns: *this
    template 
-   basic_string& assign(InputIter first, InputIter last) 
+   basic_string& assign(InputIter first, InputIter last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      return this->priv_assign_dispatch(first, last, Result());
+      size_type cur = 0;
+      const pointer addr = this->priv_addr();
+      CharT *ptr = container_detail::to_raw_pointer(addr);
+      const size_type old_size = this->priv_size();
+      while (first != last && cur != old_size) {
+         Traits::assign(*ptr, *first);
+         ++first;
+         ++cur;
+         ++ptr;
+      }
+      if (first == last)
+         this->erase(addr + cur, addr + old_size);
+      else
+         this->append(first, last);
+      return *this;
    }
 
    //! Requires: pos <= size().
@@ -1237,11 +1292,12 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const basic_string& s) 
+   basic_string& insert(size_type pos, const basic_string& s)
    {
-      if (pos > size())
+      const size_type sz = this->size();
+      if (pos > sz)
          this->throw_out_of_range();
-      if (this->size() > this->max_size() - s.size())
+      if (sz > this->max_size() - s.size())
          this->throw_length_error();
       this->insert(this->priv_addr() + pos, s.begin(), s.end());
       return *this;
@@ -1255,13 +1311,14 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos1 > size() or pos2 > str.size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos1, const basic_string& s,
-                        size_type pos2, size_type n) 
+   basic_string& insert(size_type pos1, const basic_string& s, size_type pos2, size_type n)
    {
-      if (pos1 > this->size() || pos2 > s.size())
+      const size_type sz = this->size();
+      const size_type str_size = s.size();
+      if (pos1 > sz || pos2 > str_size)
          this->throw_out_of_range();
-      size_type len = container_detail::min_value(n, s.size() - pos2);
-      if (this->size() > this->max_size() - len)
+      size_type len = container_detail::min_value(n, str_size - pos2);
+      if (sz > this->max_size() - len)
          this->throw_length_error();
       const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2;
       const CharT *end_ptr = beg_ptr + len;
@@ -1280,7 +1337,7 @@ class basic_string
    //!   length_error if size() + n > max_size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const CharT* s, size_type n) 
+   basic_string& insert(size_type pos, const CharT* s, size_type n)
    {
       if (pos > this->size())
          this->throw_out_of_range();
@@ -1298,9 +1355,9 @@ class basic_string
    //!   length_error if size() > max_size() - Traits::length(s)
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const CharT* s) 
+   basic_string& insert(size_type pos, const CharT* s)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
       size_type len = Traits::length(s);
       if (this->size() > this->max_size() - len)
@@ -1315,7 +1372,7 @@ class basic_string
    //!   length_error if size() > max_size() - n
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, size_type n, CharT c) 
+   basic_string& insert(size_type pos, size_type n, CharT c)
    {
       if (pos > this->size())
          this->throw_out_of_range();
@@ -1330,9 +1387,9 @@ class basic_string
    //! Effects: inserts a copy of c before the character referred to by p.
    //!
    //! Returns: An iterator which refers to the copy of the inserted character.
-   iterator insert(const_iterator p, CharT c) 
+   iterator insert(const_iterator p, CharT c)
    {
-      size_type new_offset = p - this->priv_addr() + 1;
+      size_type new_offset = p - this->priv_addr();
       this->insert(p, cvalue_iterator(c, 1), cvalue_iterator());
       return this->priv_addr() + new_offset;
    }
@@ -1342,28 +1399,144 @@ class basic_string
    //!
    //! Effects: Inserts n copies of c before the character referred to by p.
    //!
-   //! Returns: An iterator which refers to the copy of the first
-   //!   inserted character, or p if n == 0.
-   void insert(const_iterator p, size_type n, CharT c)
-   {
-      this->insert(p, cvalue_iterator(c, n), cvalue_iterator());
-   }
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   iterator insert(const_iterator p, size_type n, CharT c)
+   {  return this->insert(p, cvalue_iterator(c, n), cvalue_iterator());  }
 
    //! Requires: p is a valid iterator on *this. [first,last) is a valid range.
    //!
    //! Effects: Equivalent to insert(p - begin(), basic_string(first, last)).
    //!
-   //! Returns: An iterator which refers to the copy of the first
-   //!   inserted character, or p if first == last.
+   //! Returns: an iterator to the first inserted element or p if first == last.
    template 
-   void insert(const_iterator p, InputIter first, InputIter last) 
+   iterator insert(const_iterator p, InputIter first, InputIter last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(p, first, last, Result());
+      const size_type n_pos = p - this->cbegin();
+      for ( ; first != last; ++first, ++p) {
+         p = this->insert(p, *first);
+      }
+      return this->begin() + n_pos; 
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, ForwardIter first, ForwardIter last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type n_pos = p - this->cbegin();
+      if (first != last) {
+         const size_type n = std::distance(first, last);
+         const size_type old_size = this->priv_size();
+         const size_type remaining = this->capacity() - old_size;
+         const pointer old_start = this->priv_addr();
+         bool enough_capacity = false;
+         std::pair allocation_ret;
+         size_type new_cap = 0;
+
+         //Check if we have enough capacity
+         if (remaining >= n){
+            enough_capacity = true;           
+         }
+         else {
+            //Otherwise expand current buffer or allocate new storage
+            new_cap  = this->next_capacity(n);
+            allocation_ret = this->allocation_command
+                  (allocate_new | expand_fwd | expand_bwd, old_size + n + 1,
+                     new_cap, new_cap, old_start);
+
+            //Check forward expansion
+            if(old_start == allocation_ret.first){
+               enough_capacity = true;
+               this->priv_storage(new_cap);
+            }
+         }
+
+         //Reuse same buffer
+         if(enough_capacity){
+            const size_type elems_after = old_size - (p - old_start);
+            const size_type old_length = old_size;
+            if (elems_after >= n) {
+               const pointer pointer_past_last = old_start + old_size + 1;
+               priv_uninitialized_copy(old_start + (old_size - n + 1),
+                                       pointer_past_last, pointer_past_last);
+
+               this->priv_size(old_size+n);
+               Traits::move(const_cast(container_detail::to_raw_pointer(p + n)),
+                           container_detail::to_raw_pointer(p),
+                           (elems_after - n) + 1);
+               this->priv_copy(first, last, const_cast(container_detail::to_raw_pointer(p)));
+            }
+            else {
+               ForwardIter mid = first;
+               std::advance(mid, elems_after + 1);
+
+               priv_uninitialized_copy(mid, last, old_start + old_size + 1);
+               const size_type newer_size = old_size + (n - elems_after);
+               this->priv_size(newer_size);
+               priv_uninitialized_copy
+                  (p, const_iterator(old_start + old_length + 1),
+                  old_start + newer_size);
+               this->priv_size(newer_size + elems_after);
+               this->priv_copy(first, mid, const_cast(container_detail::to_raw_pointer(p)));
+            }
+         }
+         else{
+            pointer new_start = allocation_ret.first;
+            if(!allocation_ret.second){
+               //Copy data to new buffer
+               size_type new_length = 0;
+               //This can't throw, since characters are POD
+               new_length += priv_uninitialized_copy
+                              (const_iterator(old_start), p, new_start);
+               new_length += priv_uninitialized_copy
+                              (first, last, new_start + new_length);
+               new_length += priv_uninitialized_copy
+                              (p, const_iterator(old_start + old_size),
+                              new_start + new_length);
+               this->priv_construct_null(new_start + new_length);
+
+               this->deallocate_block();
+               this->is_short(false);
+               this->priv_long_addr(new_start);
+               this->priv_long_size(new_length);
+               this->priv_long_storage(new_cap);
+            }
+            else{
+               //value_type is POD, so backwards expansion is much easier
+               //than with vector
+               value_type * const oldbuf     = container_detail::to_raw_pointer(old_start);
+               value_type * const newbuf     = container_detail::to_raw_pointer(new_start);
+               const value_type *const pos   = container_detail::to_raw_pointer(p);
+               const size_type before  = pos - oldbuf;
+
+               //First move old data
+               Traits::move(newbuf, oldbuf, before);
+               Traits::move(newbuf + before + n, pos, old_size - before);
+               //Now initialize the new data
+               priv_uninitialized_copy(first, last, new_start + before);
+               this->priv_construct_null(new_start + (old_size + n));
+               this->is_short(false);
+               this->priv_long_addr(new_start);
+               this->priv_long_size(old_size + n);
+               this->priv_long_storage(new_cap);
+            }
+         }
+      }
+      return this->begin() + n_pos;
+   }
+   #endif
+
    //! Requires: pos <= size()
    //!
    //! Effects: Determines the effective length xlen of the string to be removed as the smaller of n and size() - pos.
@@ -1375,13 +1548,14 @@ class basic_string
    //! Throws: out_of_range if pos > size().
    //!
    //! Returns: *this
-   basic_string& erase(size_type pos = 0, size_type n = npos) 
+   basic_string& erase(size_type pos = 0, size_type n = npos)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      erase(this->priv_addr() + pos, this->priv_addr() + pos + container_detail::min_value(n, size() - pos));
+      const pointer addr = this->priv_addr();
+      erase(addr + pos, addr + pos + container_detail::min_value(n, this->size() - pos));
       return *this;
-   }  
+   } 
 
    //! Effects: Removes the character referred to by p.
    //!
@@ -1389,14 +1563,15 @@ class basic_string
    //!
    //! Returns: An iterator which points to the element immediately following p prior to the element being
    //!    erased. If no such element exists, end() is returned.
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
    {
       // The move includes the terminating null.
-      CharT *ptr = const_cast(container_detail::to_raw_pointer(p));
+      CharT * const ptr = const_cast(container_detail::to_raw_pointer(p));
+      const size_type old_size = this->priv_size();
       Traits::move(ptr,
-                   container_detail::to_raw_pointer(p + 1), 
-                   this->priv_size() - (p - this->priv_addr()));
-      this->priv_size(this->priv_size()-1);
+                   container_detail::to_raw_pointer(p + 1),
+                   old_size - (p - this->priv_addr()));
+      this->priv_size(old_size-1);
       return iterator(ptr);
    }
 
@@ -1408,15 +1583,16 @@ class basic_string
    //!
    //! Returns: An iterator which points to the element pointed to by last prior to
    //!   the other elements being erased. If no such element exists, end() is returned.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
       CharT * f = const_cast(container_detail::to_raw_pointer(first));
       if (first != last) { // The move includes the terminating null.
-         size_type num_erased = last - first;
+         const size_type num_erased = last - first;
+         const size_type old_size = this->priv_size();
          Traits::move(f,
-                      container_detail::to_raw_pointer(last), 
-                      (this->priv_size() + 1)-(last - this->priv_addr()));
-         size_type new_length = this->priv_size() - num_erased;
+                      container_detail::to_raw_pointer(last),
+                      (old_size + 1)-(last - this->priv_addr()));
+         const size_type new_length = old_size - num_erased;
          this->priv_size(new_length);
       }
       return iterator(f);
@@ -1427,10 +1603,24 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Effects: Equivalent to erase(size() - 1, 1).
-   void pop_back()
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
-      Traits::assign(this->priv_addr()[this->priv_size()-1], this->priv_null());
-      this->priv_size(this->priv_size()-1);;
+      const size_type old_size = this->priv_size();
+      Traits::assign(this->priv_addr()[old_size-1], CharT(0));
+      this->priv_size(old_size-1);;
+   }
+
+   //! Effects: Erases all the elements of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements in the vector.
+   void clear() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (!this->empty()) {
+         Traits::assign(*this->priv_addr(), CharT(0));
+         this->priv_size(0);
+      }
    }
 
    //! Requires: pos1 <= size().
@@ -1440,15 +1630,17 @@ class basic_string
    //! Throws: if memory allocation throws or out_of_range if pos1 > size().
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1, const basic_string& str) 
+   basic_string& replace(size_type pos1, size_type n1, const basic_string& str)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
       if (this->size() - len >= this->max_size() - str.size())
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, 
-                           str.begin(), str.end());
+      const pointer addr = this->priv_addr();
+      return this->replace( const_iterator(addr + pos1)
+                          , const_iterator(addr + pos1 + len)
+                          , str.begin(), str.end());
    }
 
    //! Requires: pos1 <= size() and pos2 <= str.size().
@@ -1461,42 +1653,43 @@ class basic_string
    //!
    //! Returns: *this
    basic_string& replace(size_type pos1, size_type n1,
-                         const basic_string& str, size_type pos2, size_type n2) 
+                         const basic_string& str, size_type pos2, size_type n2)
    {
-      if (pos1 > size() || pos2 > str.size())
+      if (pos1 > this->size() || pos2 > str.size())
          this->throw_out_of_range();
-      const size_type len1 = container_detail::min_value(n1, size() - pos1);
+      const size_type len1 = container_detail::min_value(n1, this->size() - pos1);
       const size_type len2 = container_detail::min_value(n2, str.size() - pos2);
       if (this->size() - len1 >= this->max_size() - len2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len1,
-                     str.priv_addr() + pos2, str.priv_addr() + pos2 + len2);
+      const pointer addr    = this->priv_addr();
+      const pointer straddr = str.priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len1,
+                     straddr + pos2, straddr + pos2 + len2);
    }
 
    //! Requires: pos1 <= size() and s points to an array of at least n2 elements of CharT.
    //!
-   //! Effects: Determines the effective length xlen of the string to be removed as the 
-   //!   smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error. 
-   //!   Otherwise, the function replaces the string controlled by *this with a string of 
-   //!   length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements 
-   //!   of the original string controlled by *this, whose next n2 elements are a copy of the 
-   //!   initial n2 elements of s, and whose remaining elements are a copy of the elements of 
+   //! Effects: Determines the effective length xlen of the string to be removed as the
+   //!   smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error.
+   //!   Otherwise, the function replaces the string controlled by *this with a string of
+   //!   length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements
+   //!   of the original string controlled by *this, whose next n2 elements are a copy of the
+   //!   initial n2 elements of s, and whose remaining elements are a copy of the elements of
    //!   the original string controlled by *this beginning at position pos + xlen.
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the  resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1,
-                        const CharT* s, size_type n2) 
+   basic_string& replace(size_type pos1, size_type n1, const CharT* s, size_type n2)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
-                     s, s + n2);
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len, s, s + n2);
    }
 
    //! Requires: pos1 <= size() and s points to an array of at least n2 elements of CharT.
@@ -1509,19 +1702,20 @@ class basic_string
    //! remaining elements are a copy of the elements of the original string controlled by *this
    //! beginning at position pos + xlen.
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos, size_type n1, const CharT* s) 
+   basic_string& replace(size_type pos, size_type n1, const CharT* s)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos);
+      const size_type len = container_detail::min_value(n1, this->size() - pos);
       const size_type n2 = Traits::length(s);
-      if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
+      if (n2 > this->max_size() || this->size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos, this->priv_addr() + pos + len,
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos, addr + pos + len,
                      s, s + Traits::length(s));
    }
 
@@ -1529,18 +1723,19 @@ class basic_string
    //!
    //! Effects: Equivalent to replace(pos1, n1, basic_string(n2, c)).
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the  resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c) 
+   basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
-      if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
+      if (n2 > this->max_size() || this->size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, n2, c);
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len, n2, c);
    }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges.
@@ -1550,10 +1745,10 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str)
    { return this->replace(i1, i2, str.begin(), str.end()); }
 
-   //! Requires: [begin(),i1) and [i1,i2) are valid ranges and 
+   //! Requires: [begin(),i1) and [i1,i2) are valid ranges and
    //!   s points to an array of at least n elements
    //!
    //! Effects: Calls replace(i1 - begin(), i2 - i1, s, n).
@@ -1561,7 +1756,7 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n)
    { return this->replace(i1, i2, s, s + n); }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges and s points to an
@@ -1572,7 +1767,7 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s)
    {  return this->replace(i1, i2, s, s + Traits::length(s));   }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges.
@@ -1604,35 +1799,72 @@ class basic_string
    //!
    //! Returns: *this
    template 
-   basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2) 
+   basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      return this->priv_replace_dispatch(i1, i2, j1, j2,  Result());
+      for ( ; i1 != i2 && j1 != j2; ++i1, ++j1){
+         Traits::assign(*const_cast(container_detail::to_raw_pointer(i1)), *j1);
+      }
+
+      if (j1 == j2)
+         this->erase(i1, i2);
+      else
+         this->insert(i2, j1, j2);
+      return *this;
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   basic_string& replace(const_iterator i1, const_iterator i2, ForwardIter j1, ForwardIter j2
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      difference_type n = std::distance(j1, j2);
+      const difference_type len = i2 - i1;
+      if (len >= n) {
+         this->priv_copy(j1, j2, const_cast(container_detail::to_raw_pointer(i1)));
+         this->erase(i1 + n, i2);
+      }
+      else {
+         ForwardIter m = j1;
+         std::advance(m, len);
+         this->priv_copy(j1, m, const_cast(container_detail::to_raw_pointer(i1)));
+         this->insert(i2, m, j2);
+      }
+      return *this;
+   }
+   #endif
+
    //! Requires: pos <= size()
    //!
    //! Effects: Determines the effective length rlen of the string to copy as the
    //!   smaller of n and size() - pos. s shall designate an array of at least rlen elements.
-   //!   The function then replaces the string designated by s with a string of length rlen 
+   //!   The function then replaces the string designated by s with a string of length rlen
    //!   whose elements are a copy of the string controlled by *this beginning at position pos.
    //!   The function does not append a null object to the string designated by s.
    //!
    //! Throws: if memory allocation throws, out_of_range if pos > size().
    //!
    //! Returns: rlen
-   size_type copy(CharT* s, size_type n, size_type pos = 0) const 
+   size_type copy(CharT* s, size_type n, size_type pos = 0) const
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n, size() - pos);
+      const size_type len = container_detail::min_value(n, this->size() - pos);
       Traits::copy(s, container_detail::to_raw_pointer(this->priv_addr() + pos), len);
       return len;
    }
 
-   //! Effects: *this contains the same sequence of characters that was in s, 
+   //! Effects: *this contains the same sequence of characters that was in s,
    //!   s contains the same sequence of characters that was in *this.
    //!
    //! Throws: Nothing
@@ -1643,30 +1875,42 @@ class basic_string
       container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
+   //////////////////////////////////////////////
+   //
+   //                 data access
+   //
+   //////////////////////////////////////////////
+
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
-   //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
+   //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
    //!
    //! Complexity: constant time.
-   const CharT* c_str() const 
+   const CharT* c_str() const BOOST_CONTAINER_NOEXCEPT
    {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
-   //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
+   //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
    //!
    //! Complexity: constant time.
-   const CharT* data()  const 
+   const CharT* data()  const BOOST_CONTAINER_NOEXCEPT
    {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
-   //! Effects: Determines the lowest position xpos, if possible, such that both 
+   //////////////////////////////////////////////
+   //
+   //             string operations
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Determines the lowest position xpos, if possible, such that both
    //!   of the following conditions obtain: 19 pos <= xpos and xpos + str.size() <= size();
    //!   2) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
    //!
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find(const basic_string& s, size_type pos = 0) const 
+   size_type find(const basic_string& s, size_type pos = 0) const
    { return find(s.c_str(), pos, s.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1676,12 +1920,13 @@ class basic_string
    //! Returns: find(basic_string(s,n),pos).
    size_type find(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos + n > size())
+      if (pos + n > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
+         const pointer addr = this->priv_addr();
+         pointer finish = addr + this->priv_size();
          const const_iterator result =
-            std::search(container_detail::to_raw_pointer(this->priv_addr() + pos), 
+            std::search(container_detail::to_raw_pointer(addr + pos),
                    container_detail::to_raw_pointer(finish),
                    s, s + n, Eq_traits());
          return result != finish ? result - begin() : npos;
@@ -1693,26 +1938,28 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find(basic_string(s), pos).
-   size_type find(const CharT* s, size_type pos = 0) const 
-   { return find(s, pos, Traits::length(s)); }
+   size_type find(const CharT* s, size_type pos = 0) const
+   { return this->find(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
    //!
    //! Returns: find(basic_string(1,c), pos).
    size_type find(CharT c, size_type pos = 0) const
    {
-      if (pos >= size())
+      const size_type sz = this->size();
+      if (pos >= sz)
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
+         const pointer addr    = this->priv_addr();
+         pointer finish = addr + sz;
          const const_iterator result =
-            std::find_if(this->priv_addr() + pos, finish,
+            std::find_if(addr + pos, finish,
                   std::bind2nd(Eq_traits(), c));
          return result != finish ? result - begin() : npos;
       }
    }
 
-   //! Effects: Determines the highest position xpos, if possible, such 
+   //! Effects: Determines the highest position xpos, if possible, such
    //!   that both of the following conditions obtain:
    //!   a) xpos <= pos and xpos + str.size() <= size();
    //!   b) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
@@ -1720,7 +1967,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type rfind(const basic_string& str, size_type pos = npos) const 
+   size_type rfind(const basic_string& str, size_type pos = npos) const
       { return rfind(str.c_str(), pos, str.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1730,7 +1977,7 @@ class basic_string
    //! Returns: rfind(basic_string(s, n), pos).
    size_type rfind(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (n > len)
          return npos;
@@ -1745,13 +1992,13 @@ class basic_string
       }
    }
 
-   //! Requires: pos <= size() and s points to an array of at least 
+   //! Requires: pos <= size() and s points to an array of at least
    //!   traits::length(s) + 1 elements of CharT.
    //!
    //! Throws: Nothing
    //!
    //! Returns: rfind(basic_string(s), pos).
-   size_type rfind(const CharT* s, size_type pos = npos) const 
+   size_type rfind(const CharT* s, size_type pos = npos) const
       { return rfind(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
@@ -1759,7 +2006,7 @@ class basic_string
    //! Returns: rfind(basic_string(1,c),pos).
    size_type rfind(CharT c, size_type pos = npos) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
@@ -1779,7 +2026,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find_first_of(const basic_string& s, size_type pos = 0) const 
+   size_type find_first_of(const basic_string& s, size_type pos = 0) const
       { return find_first_of(s.c_str(), pos, s.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1789,14 +2036,15 @@ class basic_string
    //! Returns: find_first_of(basic_string(s, n), pos).
    size_type find_first_of(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos >= size())
+      const size_type sz = this->size();
+      if (pos >= sz)
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result = std::find_first_of(this->priv_addr() + pos, finish,
-                                                    s, s + n,
-                                                    Eq_traits());
-         return result != finish ? result - begin() : npos;
+         const pointer addr    = this->priv_addr();
+         pointer finish = addr + sz;
+         const_iterator result = std::find_first_of
+            (addr + pos, finish, s, s + n, Eq_traits());
+         return result != finish ? result - this->begin() : npos;
       }
    }
 
@@ -1805,7 +2053,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_of(basic_string(s), pos).
-   size_type find_first_of(const CharT* s, size_type pos = 0) const 
+   size_type find_first_of(const CharT* s, size_type pos = 0) const
       { return find_first_of(s, pos, Traits::length(s)); }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1813,10 +2061,10 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_of(basic_string(1,c), pos).
-   size_type find_first_of(CharT c, size_type pos = 0) const 
+   size_type find_first_of(CharT c, size_type pos = 0) const
     { return find(c, pos); }
 
-   //! Effects: Determines the highest position xpos, if possible, such that both of 
+   //! Effects: Determines the highest position xpos, if possible, such that both of
    //!   the following conditions obtain: a) xpos <= pos and xpos < size(); b)
    //!   traits::eq(at(xpos), str.at(I)) for some element I of the string controlled by str.
    //!
@@ -1833,17 +2081,17 @@ class basic_string
    //! Returns: find_last_of(basic_string(s, n), pos).
    size_type find_last_of(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = this->priv_addr() + container_detail::min_value(len - 1, pos) + 1;
+         const pointer addr    = this->priv_addr();
+         const const_iterator last = addr + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_first_of(const_reverse_iterator(last), rend(),
-                               s, s + n,
-                               Eq_traits());
-         return rresult != rend() ? (rresult.base() - 1) - this->priv_addr() : npos;
+                               s, s + n, Eq_traits());
+         return rresult != rend() ? (rresult.base() - 1) - addr : npos;
       }
    }
 
@@ -1852,16 +2100,16 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_last_of(basic_string(1,c),pos).
-   size_type find_last_of(const CharT* s, size_type pos = npos) const 
+   size_type find_last_of(const CharT* s, size_type pos = npos) const
       { return find_last_of(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
    //!
    //! Returns: find_last_of(basic_string(s), pos).
-   size_type find_last_of(CharT c, size_type pos = npos) const 
+   size_type find_last_of(CharT c, size_type pos = npos) const
       {  return rfind(c, pos);   }
 
-   //! Effects: Determines the lowest position xpos, if possible, such that 
+   //! Effects: Determines the lowest position xpos, if possible, such that
    //!   both of the following conditions obtain:
    //!   a) pos <= xpos and xpos < size(); b) traits::eq(at(xpos), str.at(I)) for no
    //!   element I of the string controlled by str.
@@ -1869,7 +2117,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find_first_not_of(const basic_string& str, size_type pos = 0) const 
+   size_type find_first_not_of(const basic_string& str, size_type pos = 0) const
       { return find_first_not_of(str.c_str(), pos, str.size()); }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1879,13 +2127,14 @@ class basic_string
    //! Returns: find_first_not_of(basic_string(s, n), pos).
    size_type find_first_not_of(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos > size())
+      if (pos > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result = std::find_if(this->priv_addr() + pos, finish,
-                                    Not_within_traits(s, s + n));
-         return result != finish ? result - this->priv_addr() : npos;
+         const pointer addr   = this->priv_addr();
+         const pointer finish = addr + this->priv_size();
+         const const_iterator result = std::find_if
+            (addr + pos, finish, Not_within_traits(s, s + n));
+         return result != finish ? result - addr : npos;
       }
    }
 
@@ -1894,7 +2143,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_not_of(basic_string(s), pos).
-   size_type find_first_not_of(const CharT* s, size_type pos = 0) const 
+   size_type find_first_not_of(const CharT* s, size_type pos = 0) const
       { return find_first_not_of(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
@@ -1902,19 +2151,20 @@ class basic_string
    //! Returns: find_first_not_of(basic_string(1, c), pos).
    size_type find_first_not_of(CharT c, size_type pos = 0) const
    {
-      if (pos > size())
+      if (pos > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result
-            = std::find_if(this->priv_addr() + pos, finish,
+         const pointer addr   = this->priv_addr();
+         const pointer finish = addr + this->priv_size();
+         const const_iterator result
+            = std::find_if(addr + pos, finish,
                      std::not1(std::bind2nd(Eq_traits(), c)));
          return result != finish ? result - begin() : npos;
       }
    }
 
    //! Effects: Determines the highest position xpos, if possible, such that
-   //!   both of the following conditions obtain: a) xpos <= pos and xpos < size(); 
+   //!   both of the following conditions obtain: a) xpos <= pos and xpos < size();
    //!   b) traits::eq(at(xpos), str.at(I)) for no element I of the string controlled by str.
    //!
    //! Throws: Nothing
@@ -1930,7 +2180,7 @@ class basic_string
    //! Returns: find_last_not_of(basic_string(s, n), pos).
    size_type find_last_not_of(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
@@ -1956,13 +2206,13 @@ class basic_string
    //! Returns: find_last_not_of(basic_string(1, c), pos).
    size_type find_last_not_of(CharT c, size_type pos = npos) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
       else {
          const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
-         const_reverse_iterator rresult =
+         const const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::not1(std::bind2nd(Eq_traits(), c)));
          return rresult != rend() ? (rresult.base() - 1) - begin() : npos;
@@ -1977,12 +2227,13 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > size().
    //!
    //! Returns: basic_string(data()+pos,rlen).
-   basic_string substr(size_type pos = 0, size_type n = npos) const 
+   basic_string substr(size_type pos = 0, size_type n = npos) const
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      return basic_string(this->priv_addr() + pos, 
-                          this->priv_addr() + pos + container_detail::min_value(n, size() - pos), this->alloc());
+      const pointer addr = this->priv_addr();
+      return basic_string(addr + pos,
+                          addr + pos + container_detail::min_value(n, size() - pos), this->alloc());
    }
 
    //! Effects: Determines the effective length rlen of the string to copy as
@@ -1994,8 +2245,12 @@ class basic_string
    //! Returns: The nonzero result if the result of the comparison is nonzero.
    //!   Otherwise, returns a value < 0 if size() < str.size(), a 0 value if size() == str.size(),
    //!   and value > 0 if size() > str.size()
-   int compare(const basic_string& str) const 
-   { return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), str.priv_addr(), str.priv_addr() + str.priv_size()); }
+   int compare(const basic_string& str) const
+   {
+      const pointer addr     = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr, addr + this->priv_size(), str_addr, str_addr + str.priv_size());
+   }
 
    //! Requires: pos1 <= size()
    //!
@@ -2005,16 +2260,18 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns:basic_string(*this,pos1,n1).compare(str).
-   int compare(size_type pos1, size_type n1, const basic_string& str) const 
+   int compare(size_type pos1, size_type n1, const basic_string& str) const
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
-                        str.priv_addr(), str.priv_addr() + str.priv_size());
+      const pointer addr    = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
+                        str_addr, str_addr + str.priv_size());
    }
 
-   //! Requires: pos1 <= size() and pos2 <= str.size() 
+   //! Requires: pos1 <= size() and pos2 <= str.size()
    //!
    //! Effects: Determines the effective length rlen of the string to copy as
    //!   the smaller of
@@ -2022,21 +2279,26 @@ class basic_string
    //! Throws: out_of_range if pos1 > size() or pos2 > str.size()
    //!
    //! Returns: basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2)).
-   int compare(size_type pos1, size_type n1, 
-               const basic_string& str, size_type pos2, size_type n2) const {
-      if (pos1 > size() || pos2 > str.size())
+   int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2) const
+   {
+      if (pos1 > this->size() || pos2 > str.size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
-                        str.priv_addr() + pos2, 
-                        str.priv_addr() + pos2 + container_detail::min_value(n2, size() - pos2));
+      const pointer addr     = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
+                        str_addr + pos2,
+                        str_addr + pos2 + container_detail::min_value(n2, str.size() - pos2));
    }
 
    //! Throws: Nothing
    //!
    //! Returns: compare(basic_string(s)).
-   int compare(const CharT* s) const 
-   {  return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), s, s + Traits::length(s));   }
+   int compare(const CharT* s) const
+   {
+      const pointer addr = this->priv_addr();
+      return s_compare(addr, addr + this->priv_size(), s, s + Traits::length(s));
+   }
 
 
    //! Requires: pos1 > size() and s points to an array of at least n2 elements of CharT.
@@ -2044,13 +2306,13 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
-   int compare(size_type pos1, size_type n1,
-               const CharT* s, size_type n2) const 
+   int compare(size_type pos1, size_type n1, const CharT* s, size_type n2) const
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
+      const pointer addr = this->priv_addr();
+      return s_compare( addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
                         s, s + n2);
    }
 
@@ -2059,18 +2321,18 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
-   int compare(size_type pos1, size_type n1, const CharT* s) const 
+   int compare(size_type pos1, size_type n1, const CharT* s) const
    {  return this->compare(pos1, n1, s, Traits::length(s)); }
 
    /// @cond
    private:
    static int s_compare(const_pointer f1, const_pointer l1,
-                        const_pointer f2, const_pointer l2) 
+                        const_pointer f2, const_pointer l2)
    {
       const difference_type n1 = l1 - f1;
       const difference_type n2 = l2 - f2;
-      const int cmp = Traits::compare(container_detail::to_raw_pointer(f1), 
-                                      container_detail::to_raw_pointer(f2), 
+      const int cmp = Traits::compare(container_detail::to_raw_pointer(f1),
+                                      container_detail::to_raw_pointer(f2),
                                       container_detail::min_value(n1, n2));
       return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
    }
@@ -2082,12 +2344,12 @@ class basic_string
    {
       //Allocate a new buffer.
       size_type real_cap = 0;
-      pointer   long_addr    = this->priv_long_addr();
-      size_type long_size    = this->priv_long_size();
-      size_type long_storage = this->priv_long_storage();
+      const pointer   long_addr    = this->priv_long_addr();
+      const size_type long_size    = this->priv_long_size();
+      const size_type long_storage = this->priv_long_storage();
       //We can make this nothrow as chars are always NoThrowCopyables
-      try{
-         std::pair ret = this->allocation_command
+      BOOST_TRY{
+         const std::pair ret = this->allocation_command
                (allocate_new, long_size+1, long_size+1, real_cap, long_addr);
          //Copy and update
          Traits::copy( container_detail::to_raw_pointer(ret.first)
@@ -2098,14 +2360,15 @@ class basic_string
          //And release old buffer
          this->alloc().deallocate(long_addr, long_storage);
       }
-      catch(...){
+      BOOST_CATCH(...){
          return;
       }
+      BOOST_CATCH_END
    }
 
    template
    void priv_shrink_to_fit_dynamic_buffer
-      ( AllocVersion 
+      ( AllocVersion
       , typename container_detail::enable_if >::type* = 0)
    {
       size_type received_size;
@@ -2118,56 +2381,13 @@ class basic_string
    }
 
    void priv_construct_null(pointer p)
-   {  this->construct(p, 0);  }
-
-   static CharT priv_null()
-   {  return (CharT) 0; }
+   {  this->construct(p, CharT(0));  }
 
    // Helper functions used by constructors.  It is a severe error for
    // any of them to be called anywhere except from within constructors.
-   void priv_terminate_string() 
-   {  this->priv_construct_null(this->priv_addr() + this->priv_size());  }
+   void priv_terminate_string()
+   {  this->priv_construct_null(this->priv_end_addr());  }
 
-   template 
-   void priv_range_initialize(InputIter f, InputIter l,
-                              std::input_iterator_tag)
-   {
-      this->allocate_initial_block(InternalBufferChars);
-      this->priv_construct_null(this->priv_addr() + this->priv_size());
-      this->append(f, l);
-   }
-
-   template 
-   void priv_range_initialize(ForwardIter f, ForwardIter l, 
-                              std::forward_iterator_tag)
-   {
-      difference_type n = std::distance(f, l);
-      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
-      priv_uninitialized_copy(f, l, this->priv_addr());
-      this->priv_size(n);
-      this->priv_terminate_string();
-   }
-
-   template 
-   void priv_range_initialize(InputIter f, InputIter l)
-   {
-      typedef typename std::iterator_traits::iterator_category Category;
-      this->priv_range_initialize(f, l, Category());
-   }
-
-   template 
-   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
-   {
-      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
-      priv_uninitialized_fill_n(this->priv_addr(), n, x);
-      this->priv_size(n);
-      this->priv_terminate_string();
-   }
-
-   template 
-   void priv_initialize_dispatch(InputIter f, InputIter l, container_detail::false_)
-   {  this->priv_range_initialize(f, l);  }
- 
    template inline
    void priv_uninitialized_fill_n(FwdIt first, Count count, const CharT val)
    {
@@ -2214,154 +2434,6 @@ class basic_string
       return (constructed);
    }
 
-   template 
-   basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_) 
-   {  return this->assign((size_type) n, (CharT) x);   }
-
-   template 
-   basic_string& priv_assign_dispatch(InputIter f, InputIter l,
-                                      container_detail::false_)
-   {
-      size_type cur = 0;
-      CharT *ptr = container_detail::to_raw_pointer(this->priv_addr());
-      while (f != l && cur != this->priv_size()) {
-         Traits::assign(*ptr, *f);
-         ++f;
-         ++cur;
-         ++ptr;
-      }
-      if (f == l)
-         this->erase(this->priv_addr() + cur, this->priv_addr() + this->priv_size());
-      else
-         this->append(f, l);
-      return *this;
-   }
-
-   template 
-   void priv_insert(const_iterator p, InputIter first, InputIter last, std::input_iterator_tag)
-   {
-      for ( ; first != last; ++first, ++p) {
-         p = this->insert(p, *first);
-      }
-   }
-
-   template 
-   void priv_insert(const_iterator position, ForwardIter first, 
-                    ForwardIter last,  std::forward_iterator_tag)
-   {
-      if (first != last) {
-         size_type n = std::distance(first, last);
-         size_type remaining = this->capacity() - this->priv_size();
-         const size_type old_size = this->size();
-         pointer old_start = this->priv_addr();
-         bool enough_capacity = false;
-         std::pair allocation_ret;
-         size_type new_cap = 0;
-
-         //Check if we have enough capacity
-         if (remaining >= n){
-            enough_capacity = true;            
-         }
-         else {
-            //Otherwise expand current buffer or allocate new storage
-            new_cap  = this->next_capacity(n);
-            allocation_ret = this->allocation_command
-                  (allocate_new | expand_fwd | expand_bwd, old_size + n + 1, 
-                     new_cap, new_cap, old_start);
-
-            //Check forward expansion
-            if(old_start == allocation_ret.first){
-               enough_capacity = true;
-               this->priv_storage(new_cap);
-            }
-         }
-
-         //Reuse same buffer
-         if(enough_capacity){
-            const size_type elems_after =
-               this->priv_size() - (position - this->priv_addr());
-            size_type old_length = this->priv_size();
-            if (elems_after >= n) {
-               pointer pointer_past_last = this->priv_addr() + this->priv_size() + 1;
-               priv_uninitialized_copy(this->priv_addr() + (this->priv_size() - n + 1),
-                                       pointer_past_last, pointer_past_last);
-
-               this->priv_size(this->priv_size()+n);
-               Traits::move(const_cast(container_detail::to_raw_pointer(position + n)),
-                           container_detail::to_raw_pointer(position),
-                           (elems_after - n) + 1);
-               this->priv_copy(first, last, const_cast(container_detail::to_raw_pointer(position)));
-            }
-            else {
-               ForwardIter mid = first;
-               std::advance(mid, elems_after + 1);
-
-               priv_uninitialized_copy(mid, last, this->priv_addr() + this->priv_size() + 1);
-               this->priv_size(this->priv_size() + (n - elems_after));
-               priv_uninitialized_copy
-                  (position, const_iterator(this->priv_addr() + old_length + 1),
-                  this->priv_addr() + this->priv_size());
-               this->priv_size(this->priv_size() + elems_after);
-               this->priv_copy(first, mid, const_cast(container_detail::to_raw_pointer(position)));
-            }
-         }
-         else{
-            pointer new_start = allocation_ret.first;
-            if(!allocation_ret.second){
-               //Copy data to new buffer
-               size_type new_length = 0;
-               //This can't throw, since characters are POD
-               new_length += priv_uninitialized_copy
-                              (const_iterator(this->priv_addr()), position, new_start);
-               new_length += priv_uninitialized_copy
-                              (first, last, new_start + new_length);
-               new_length += priv_uninitialized_copy
-                              (position, const_iterator(this->priv_addr() + this->priv_size()),
-                              new_start + new_length);
-               this->priv_construct_null(new_start + new_length);
-
-               this->deallocate_block();
-               this->is_short(false);
-               this->priv_long_addr(new_start);
-               this->priv_long_size(new_length);
-               this->priv_long_storage(new_cap);
-            }
-            else{
-               //value_type is POD, so backwards expansion is much easier 
-               //than with vector
-               value_type *oldbuf = container_detail::to_raw_pointer(old_start);
-               value_type *newbuf = container_detail::to_raw_pointer(new_start);
-               const value_type *pos    = container_detail::to_raw_pointer(position);
-               size_type  before  = pos - oldbuf;
-
-               //First move old data
-               Traits::move(newbuf, oldbuf, before);
-               Traits::move(newbuf + before + n, pos, old_size - before);
-               //Now initialize the new data
-               priv_uninitialized_copy(first, last, new_start + before);
-               this->priv_construct_null(new_start + (old_size + n));
-               this->is_short(false);
-               this->priv_long_addr(new_start);
-               this->priv_long_size(old_size + n);
-               this->priv_long_storage(new_cap);
-            }
-         }
-      }
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator p, Integer n, Integer x,
-                           container_detail::true_) 
-   {  insert(p, (size_type) n, (CharT) x);   }
-
-   template 
-   void priv_insert_dispatch(const_iterator p, InputIter first, InputIter last,
-                           container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category Category;
-      priv_insert(p, first, last, Category());
-   }
-
    template 
    void priv_copy(InputIterator first, InputIterator last, OutIterator result)
    {
@@ -2369,58 +2441,24 @@ class basic_string
          Traits::assign(*result, *first);
    }
 
-   void priv_copy(const CharT* first, const CharT* last, CharT* result) 
+   void priv_copy(const CharT* first, const CharT* last, CharT* result)
    {  Traits::copy(result, first, last - first);  }
 
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        Integer n, Integer x,
-                                       container_detail::true_) 
+                                       container_detail::true_)
    {  return this->replace(first, last, (size_type) n, (CharT) x);   }
 
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        InputIter f, InputIter l,
-                                       container_detail::false_) 
+                                       container_detail::false_)
    {
       typedef typename std::iterator_traits::iterator_category Category;
       return this->priv_replace(first, last, f, l, Category());
    }
 
-
-   template 
-   basic_string& priv_replace(const_iterator first, const_iterator last,
-                              InputIter f, InputIter l, std::input_iterator_tag)
-   {
-      for ( ; first != last && f != l; ++first, ++f)
-         Traits::assign(*first, *f);
-
-      if (f == l)
-         this->erase(first, last);
-      else
-         this->insert(last, f, l);
-      return *this;
-   }
-
-   template 
-   basic_string& priv_replace(const_iterator first, const_iterator last,
-                              ForwardIter f, ForwardIter l, 
-                              std::forward_iterator_tag)
-   {
-      difference_type n = std::distance(f, l);
-      const difference_type len = last - first;
-      if (len >= n) {
-         this->priv_copy(f, l, const_cast(container_detail::to_raw_pointer(first)));
-         this->erase(first + n, last);
-      }
-      else {
-         ForwardIter m = f;
-         std::advance(m, len);
-         this->priv_copy(f, m, const_cast(container_detail::to_raw_pointer(first)));
-         this->insert(last, m, l);
-      }
-      return *this;
-   }
    /// @endcond
 };
 
@@ -2440,291 +2478,221 @@ typedef basic_string
    ,std::allocator >
 wstring;
 
-/// @cond
-
-template  
-const typename basic_string::size_type 
-basic_string::npos 
-  = (typename basic_string::size_type) -1;
-
-/// @endcond
-
 // ------------------------------------------------------------
 // Non-member functions.
 
 // Operator+
 
-template 
-inline basic_string
-operator+(const basic_string& x,
-          const basic_string& y)
+template  inline 
+   basic_string
+   operator+(const basic_string& x
+            ,const basic_string& y)
 {
-   typedef basic_string str_t;
+   typedef basic_string str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
    str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
    result.append(x);
    result.append(y);
-   return boost::move(result);
+   return result;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(
-   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-   , BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline
+   basic_string operator+
+      ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END mx
+      , BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END my)
 {
    mx += my;
    return boost::move(mx);
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(
-   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-   , const basic_string& y)
+template  inline
+   basic_string operator+
+      ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END mx
+      , const basic_string& y)
 {
    mx += y;
    return boost::move(mx);
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(const basic_string& x,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline
+   basic_string operator+
+      (const basic_string& x
+      ,BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END my)
 {
-   typedef typename basic_string::size_type size_type;
-   my.replace(size_type(0), size_type(0), x);
+   my.insert(my.begin(), x.begin(), x.end());
    return boost::move(my);
 }
 
-template 
-inline basic_string
-operator+(const CharT* s, const basic_string& y) 
+template  inline
+   basic_string operator+
+      (const CharT* s, basic_string y)
 {
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   const typename str_t::size_type n = Traits::length(s);
-   str_t result(reserve, n + y.size());
-   result.append(s, s + n);
-   result.append(y);
-   return boost::move(result);
+   y.insert(y.begin(), s, s + Traits::length(s));
+   return y;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(const CharT* s,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline 
+   basic_string operator+
+      (basic_string x, const CharT* s)
 {
-   typedef typename basic_string::size_type size_type;
-   return boost::move(my.replace(size_type(0), size_type(0), s));
+   x += s;
+   return x;
 }
 
-template 
-inline basic_string
-operator+(CharT c, const basic_string& y) 
+template  inline
+   basic_string operator+
+      (CharT c, basic_string y)
 {
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   str_t result(reserve, 1 + y.size());
-   result.push_back(c);
-   result.append(y);
-   return boost::move(result);
+   y.insert(y.begin(), c);
+   return y;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(CharT c,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline 
+   basic_string operator+
+      (basic_string x, const CharT c)
 {
-   typedef typename basic_string::size_type size_type;
-   return boost::move(my.replace(size_type(0), size_type(0), &c, &c + 1));
-}
-
-template 
-inline basic_string
-operator+(const basic_string& x, const CharT* s) 
-{
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   const typename str_t::size_type n = Traits::length(s);
-   str_t result(reserve, x.size() + n, x.get_stored_allocator());
-   result.append(x);
-   result.append(s, s + n);
-   return boost::move(result);
-}
-
-template 
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-         , const CharT* s)
-{
-   mx += s;
-   return boost::move(mx);
-}
-
-template 
-inline basic_string
-operator+(const basic_string& x, const CharT c) 
-{
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   str_t result(reserve, x.size() + 1, x.get_stored_allocator());
-   result.append(x);
-   result.push_back(c);
-   return boost::move(result);
-}
-
-template 
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+( BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-         , const CharT c)
-{
-   mx += c;
-   return boost::move(mx);
+   x += c;
+   return x;
 }
 
 // Operator== and operator!=
 
-template 
+template 
 inline bool
-operator==(const basic_string& x,
-           const basic_string& y) 
+operator==(const basic_string& x,
+           const basic_string& y)
 {
    return x.size() == y.size() &&
           Traits::compare(x.data(), y.data(), x.size()) == 0;
 }
 
-template 
+template 
 inline bool
-operator==(const CharT* s, const basic_string& y) 
+operator==(const CharT* s, const basic_string& y)
 {
-   typename basic_string::size_type n = Traits::length(s);
+   typename basic_string::size_type n = Traits::length(s);
    return n == y.size() && Traits::compare(s, y.data(), n) == 0;
 }
 
-template 
+template 
 inline bool
-operator==(const basic_string& x, const CharT* s) 
+operator==(const basic_string& x, const CharT* s)
 {
-   typename basic_string::size_type n = Traits::length(s);
+   typename basic_string::size_type n = Traits::length(s);
    return x.size() == n && Traits::compare(x.data(), s, n) == 0;
 }
 
-template 
+template 
 inline bool
-operator!=(const basic_string& x,
-           const basic_string& y) 
+operator!=(const basic_string& x,
+           const basic_string& y)
    {  return !(x == y);  }
 
-template 
+template 
 inline bool
-operator!=(const CharT* s, const basic_string& y) 
+operator!=(const CharT* s, const basic_string& y)
    {  return !(s == y); }
 
-template 
+template 
 inline bool
-operator!=(const basic_string& x, const CharT* s) 
+operator!=(const basic_string& x, const CharT* s)
    {  return !(x == s);   }
 
 
 // Operator< (and also >, <=, and >=).
 
-template 
+template 
 inline bool
-operator<(const basic_string& x, const basic_string& y) 
+operator<(const basic_string& x, const basic_string& y)
 {
    return x.compare(y) < 0;
-//   return basic_string
+//   return basic_string
 //      ::s_compare(x.begin(), x.end(), y.begin(), y.end()) < 0;
 }
 
-template 
+template 
 inline bool
-operator<(const CharT* s, const basic_string& y) 
+operator<(const CharT* s, const basic_string& y)
 {
    return y.compare(s) > 0;
-//   basic_string::size_type n = Traits::length(s);
-//   return basic_string
+//   basic_string::size_type n = Traits::length(s);
+//   return basic_string
 //          ::s_compare(s, s + n, y.begin(), y.end()) < 0;
 }
 
-template 
+template 
 inline bool
-operator<(const basic_string& x,
-          const CharT* s) 
+operator<(const basic_string& x,
+          const CharT* s)
 {
    return x.compare(s) < 0;
-//   basic_string::size_type n = Traits::length(s);
-//   return basic_string
+//   basic_string::size_type n = Traits::length(s);
+//   return basic_string
 //      ::s_compare(x.begin(), x.end(), s, s + n) < 0;
 }
 
-template 
+template 
 inline bool
-operator>(const basic_string& x,
-          const basic_string& y) {
+operator>(const basic_string& x,
+          const basic_string& y) {
    return y < x;
 }
 
-template 
+template 
 inline bool
-operator>(const CharT* s, const basic_string& y) {
+operator>(const CharT* s, const basic_string& y) {
    return y < s;
 }
 
-template 
+template 
 inline bool
-operator>(const basic_string& x, const CharT* s) 
+operator>(const basic_string& x, const CharT* s)
 {
    return s < x;
 }
 
-template 
+template 
 inline bool
-operator<=(const basic_string& x,
-           const basic_string& y) 
+operator<=(const basic_string& x,
+           const basic_string& y)
 {
   return !(y < x);
 }
 
-template 
+template 
 inline bool
-operator<=(const CharT* s, const basic_string& y) 
+operator<=(const CharT* s, const basic_string& y)
    {  return !(y < s);  }
 
-template 
+template 
 inline bool
-operator<=(const basic_string& x, const CharT* s) 
+operator<=(const basic_string& x, const CharT* s)
    {  return !(s < x);  }
 
-template 
+template 
 inline bool
-operator>=(const basic_string& x,
-           const basic_string& y) 
+operator>=(const basic_string& x,
+           const basic_string& y)
    {  return !(x < y);  }
 
-template 
+template 
 inline bool
-operator>=(const CharT* s, const basic_string& y) 
+operator>=(const CharT* s, const basic_string& y)
    {  return !(s < y);  }
 
-template 
+template 
 inline bool
-operator>=(const basic_string& x, const CharT* s) 
+operator>=(const basic_string& x, const CharT* s)
    {  return !(x < s);  }
 
 // Swap.
-template 
-inline void swap(basic_string& x, basic_string& y) 
+template 
+inline void swap(basic_string& x, basic_string& y)
 {  x.swap(y);  }
 
 /// @cond
-// I/O.  
+// I/O. 
 namespace container_detail {
 
 template 
@@ -2745,28 +2713,28 @@ string_fill(std::basic_ostream& os,
 }  //namespace container_detail {
 /// @endcond
 
-template 
+template 
 std::basic_ostream&
-operator<<(std::basic_ostream& os, const basic_string& s)
+operator<<(std::basic_ostream& os, const basic_string& s)
 {
    typename std::basic_ostream::sentry sentry(os);
    bool ok = false;
 
    if (sentry) {
       ok = true;
-      typename basic_string::size_type n = s.size();
-      typename basic_string::size_type pad_len = 0;
+      typename basic_string::size_type n = s.size();
+      typename basic_string::size_type pad_len = 0;
       const bool left = (os.flags() & std::ios::left) != 0;
       const std::size_t w = os.width(0);
       std::basic_streambuf* buf = os.rdbuf();
 
       if (w != 0 && n < w)
          pad_len = w - n;
-       
+      
       if (!left)
-         ok = container_detail::string_fill(os, buf, pad_len);    
+         ok = container_detail::string_fill(os, buf, pad_len);   
 
-      ok = ok && 
+      ok = ok &&
             buf->sputn(s.data(), std::streamsize(n)) == std::streamsize(n);
 
       if (left)
@@ -2780,9 +2748,9 @@ operator<<(std::basic_ostream& os, const basic_string
-std::basic_istream& 
-operator>>(std::basic_istream& is, basic_string& s)
+template 
+std::basic_istream&
+operator>>(std::basic_istream& is, basic_string& s)
 {
    typename std::basic_istream::sentry sentry(is);
 
@@ -2816,7 +2784,7 @@ operator>>(std::basic_istream& is, basic_string&
                s.push_back(c);
          }
       }
-      
+     
       // If we have read no characters, then set failbit.
       if (s.size() == 0)
          is.setstate(std::ios_base::failbit);
@@ -2827,11 +2795,11 @@ operator>>(std::basic_istream& is, basic_string&
    return is;
 }
 
-template     
-std::basic_istream& 
-getline(std::istream& is, basic_string& s,CharT delim)
+template    
+std::basic_istream&
+getline(std::istream& is, basic_string& s,CharT delim)
 {
-   typename basic_string::size_type nread = 0;
+   typename basic_string::size_type nread = 0;
    typename std::basic_istream::sentry sentry(is, true);
    if (sentry) {
       std::basic_streambuf* buf = is.rdbuf();
@@ -2846,7 +2814,7 @@ getline(std::istream& is, basic_string& s,CharT delim)
          else {
             ++nread;
             CharT c = Traits::to_char_type(c1);
-            if (!Traits::eq(c, delim)) 
+            if (!Traits::eq(c, delim))
                s.push_back(c);
             else
                break;              // Character is extracted but not appended.
@@ -2859,15 +2827,15 @@ getline(std::istream& is, basic_string& s,CharT delim)
    return is;
 }
 
-template     
-inline std::basic_istream& 
-getline(std::basic_istream& is, basic_string& s)
+template    
+inline std::basic_istream&
+getline(std::basic_istream& is, basic_string& s)
 {
    return getline(is, s, '\n');
 }
 
-template 
-inline std::size_t hash_value(basic_string, A> const& v)
+template 
+inline std::size_t hash_value(basic_string, Allocator> const& v)
 {
    return hash_range(v.begin(), v.end());
 }
@@ -2877,15 +2845,14 @@ inline std::size_t hash_value(basic_string, A> const& v
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 }
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/vector.hpp b/project/jni/boost/include/boost/container/vector.hpp
index 742d00d37..3c4c9c50e 100644
--- a/project/jni/boost/include/boost/container/vector.hpp
+++ b/project/jni/boost/include/boost/container/vector.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -32,20 +32,23 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
@@ -54,7 +57,7 @@ namespace container {
 
 namespace container_detail {
 
-//! Const vector_iterator used to iterate through a vector. 
+//! Const vector_iterator used to iterate through a vector.
 template 
 class vector_const_iterator
 {
@@ -81,20 +84,20 @@ class vector_const_iterator
    vector_const_iterator() : m_ptr(0){}
 
    //Pointer like operators
-   reference operator*()   const  
+   reference operator*()   const 
    {  return *m_ptr;  }
 
-   const value_type * operator->()  const  
-   {  return  container_detail::to_raw_pointer(m_ptr);  }
+   const value_type * operator->()  const 
+   {  return container_detail::to_raw_pointer(m_ptr);  }
 
    reference operator[](difference_type off) const
    {  return m_ptr[off];   }
 
    //Increment / Decrement
-   vector_const_iterator& operator++()       
+   vector_const_iterator& operator++()      
    { ++m_ptr;  return *this; }
 
-   vector_const_iterator operator++(int)      
+   vector_const_iterator operator++(int)     
    {  Pointer tmp = m_ptr; ++*this; return vector_const_iterator(tmp);  }
 
    vector_const_iterator& operator--()
@@ -164,22 +167,22 @@ class vector_iterator
    {}
 
    //Pointer like operators
-   reference operator*()  const  
+   reference operator*()  const 
    {  return *this->m_ptr;  }
 
-   value_type* operator->() const  
+   value_type* operator->() const 
    {  return  container_detail::to_raw_pointer(this->m_ptr);  }
 
-   reference operator[](difference_type off) const 
+   reference operator[](difference_type off) const
    {  return this->m_ptr[off];   }
 
    //Increment / Decrement
-   vector_iterator& operator++()  
+   vector_iterator& operator++() 
    {  ++this->m_ptr; return *this;  }
 
    vector_iterator operator++(int)
    {  pointer tmp = this->m_ptr; ++*this; return vector_iterator(tmp);  }
-   
+  
    vector_iterator& operator--()
    {  --this->m_ptr; return *this;  }
 
@@ -206,14 +209,13 @@ class vector_iterator
    {  return static_cast&>(*this) - right;   }
 };
 
-template 
+template 
 struct vector_value_traits
 {
    typedef T value_type;
-   typedef A allocator_type;
+   typedef Allocator allocator_type;
    static const bool trivial_dctr = boost::has_trivial_destructor::value;
-   static const bool trivial_dctr_after_move = trivial_dctr;
-      //::boost::has_trivial_destructor_after_move::value || trivial_dctr;
+   static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move::value;
    //static const bool trivial_copy = has_trivial_copy::value;
    //static const bool nothrow_copy = has_nothrow_copy::value;
    //static const bool trivial_assign = has_trivial_assign::value;
@@ -228,37 +230,37 @@ struct vector_value_traits
    //to deallocate values already constructed
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   OldArrayDestructor;
    //This is the anti-exception array destructor
    //to destroy objects created with copy construction
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   ArrayDestructor;
    //This is the anti-exception array deallocator
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_array_deallocator
+      ,container_detail::null_scoped_array_deallocator
+      ,container_detail::scoped_array_deallocator
       >::type   ArrayDeallocator;
 };
 
 //!This struct deallocates and allocated memory
-template 
-struct vector_alloc_holder 
+template 
+struct vector_alloc_holder
 {
-   typedef boost::container::allocator_traits         allocator_traits_type;
+   typedef boost::container::allocator_traits allocator_traits_type;
    typedef typename allocator_traits_type::pointer       pointer;
    typedef typename allocator_traits_type::size_type     size_type;
    typedef typename allocator_traits_type::value_type    value_type;
-   typedef vector_value_traits            value_traits;
+   typedef vector_value_traits    value_traits;
 
    //Constructor, does not throw
    vector_alloc_holder()
-      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
       : members_()
    {}
 
@@ -278,53 +280,28 @@ struct vector_alloc_holder
    typedef container_detail::integral_constant      allocator_v1;
    typedef container_detail::integral_constant      allocator_v2;
    typedef container_detail::integral_constant::value> alloc_version;
+      boost::container::container_detail::version::value> alloc_version;
    std::pair
       allocation_command(allocation_type command,
-                         size_type limit_size, 
+                         size_type limit_size,
                          size_type preferred_size,
                          size_type &received_size, const pointer &reuse = 0)
    {
-      return allocation_command(command, limit_size, preferred_size,
-                               received_size, reuse, alloc_version());
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v1)
-   {
-      (void)limit_size;
-      (void)reuse;
-      if(!(command & allocate_new))
-         return std::pair(pointer(0), false);
-      received_size = preferred_size;
-      return std::make_pair(this->alloc().allocate(received_size), false);
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v2)
-   {
-      return this->alloc().allocation_command
-         (command, limit_size, preferred_size, received_size, reuse);
+      return allocator_version_traits::allocation_command
+         (this->alloc(), command, limit_size, preferred_size, received_size, reuse);
    }
 
    size_type next_capacity(size_type additional_objects) const
    {
+      std::size_t num_objects   = this->members_.m_size + additional_objects;
+      std::size_t next_cap = this->members_.m_capacity + this->members_.m_capacity/2;
+      return num_objects > next_cap ? num_objects : next_cap;/*
       return get_next_capacity( allocator_traits_type::max_size(this->alloc())
-                              , this->members_.m_capacity, additional_objects);
+                              , this->members_.m_capacity, additional_objects);*/
    }
 
    struct members_holder
-      : public A
+      : public Allocator
    {
       private:
       members_holder(const members_holder&);
@@ -332,11 +309,11 @@ struct vector_alloc_holder
       public:
       template
       explicit members_holder(BOOST_FWD_REF(Alloc) alloc)
-         :  A(boost::forward(alloc)), m_start(0), m_size(0), m_capacity(0)
+         :  Allocator(boost::forward(alloc)), m_start(0), m_size(0), m_capacity(0)
       {}
 
       members_holder()
-         :  A(), m_start(0), m_size(0), m_capacity(0)
+         :  Allocator(), m_start(0), m_size(0), m_capacity(0)
       {}
 
       pointer     m_start;
@@ -351,10 +328,10 @@ struct vector_alloc_holder
       container_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
    }
 
-   A &alloc()
+   Allocator &alloc()
    {  return members_;  }
 
-   const A &alloc() const
+   const Allocator &alloc() const
    {  return members_;  }
 
    protected:
@@ -393,88 +370,79 @@ struct vector_alloc_holder
 /// @endcond
 
 //! \class vector
-//! A vector is a sequence that supports random access to elements, constant 
-//! time insertion and removal of elements at the end, and linear time insertion 
-//! and removal of elements at the beginning or in the middle. The number of 
+//! A vector is a sequence that supports random access to elements, constant
+//! time insertion and removal of elements at the end, and linear time insertion
+//! and removal of elements at the beginning or in the middle. The number of
 //! elements in a vector may vary dynamically; memory management is automatic.
 //! boost::container::vector is similar to std::vector but it's compatible
 //! with shared memory and memory mapped files.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class vector : private container_detail::vector_alloc_holder
+class vector : private container_detail::vector_alloc_holder
 {
    /// @cond
-   typedef vector                   self_t;
-   typedef container_detail::vector_alloc_holder base_t;
-   typedef allocator_traits            allocator_traits_type;
+   typedef container_detail::vector_alloc_holder base_t;
+   typedef allocator_traits            allocator_traits_type;
    /// @endcond
    public:
-   //! The type of object, T, stored in the vector
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                       allocator_type;
-   //! The random access iterator
-   typedef container_detail::vector_iterator        iterator;
-   //! The random access const_iterator
-   typedef container_detail::vector_const_iterator  const_iterator;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   //! Iterator used to iterate backwards through a vector. 
-   typedef std::reverse_iterator   
-      reverse_iterator;
-   //! Const iterator used to iterate backwards through a vector. 
-   typedef std::reverse_iterator                 
-      const_reverse_iterator;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef Allocator                                                                   stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_iterator)          iterator;
+   typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_const_iterator)    const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(vector)
-   typedef container_detail::advanced_insert_aux_int    advanced_insert_aux_int_t;
-   typedef container_detail::vector_value_traits value_traits;
+   typedef container_detail::vector_value_traits value_traits;
 
    typedef typename base_t::allocator_v1           allocator_v1;
    typedef typename base_t::allocator_v2           allocator_v2;
    typedef typename base_t::alloc_version          alloc_version;
 
    typedef constant_iterator   cvalue_iterator;
-   typedef repeat_iterator     repeat_it;
-   typedef boost::move_iterator         repeat_move_it;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Constructs a vector taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    vector()
-      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
       : base_t()
    {}
 
    //! Effects: Constructs a vector taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
+   explicit vector(const Allocator& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    {}
 
@@ -483,62 +451,22 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Throws: If allocator_type's default constructor or allocation
    //!   throws or T's default constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit vector(size_type n)
       :  base_t()
-   {
-      //Allocate
-      size_type real_cap;
-      std::pair ret =
-         this->allocation_command(allocate_new, n, n, real_cap, this->members_.m_start);
-      T *new_mem = container_detail::to_raw_pointer(ret.first);
-      //Anti-exception rollback
-      typename value_traits::ArrayDeallocator scoped_alloc(new_mem, this->alloc(), real_cap);
-      //Default constructor
-      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-      proxy.uninitialized_copy_remaining_to(new_mem);
-      //All ok, commit
-      this->members_.m_start = ret.first;
-      this->members_.m_size  = n;
-      this->members_.m_capacity = real_cap;
-      scoped_alloc.release();
-   }
+   {  this->resize(n);  }
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts n copies of value.
    //!
    //! Throws: If allocator_type's default constructor or allocation
    //!   throws or T's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   vector(size_type n, const T& value, const allocator_type& a = allocator_type()) 
+   vector(size_type n, const T& value, const allocator_type& a = allocator_type())
       :  base_t(a)
-   {  this->insert(this->cend(), n, value); }
-
-   //! Effects: Copy constructs a vector.
-   //!
-   //! Postcondition: x == *this.
-   //! 
-   //! Throws: If allocator_type's default constructor or allocation
-   //!   throws or T's copy constructor throws.
-   //! 
-   //! Complexity: Linear to the elements x contains.
-   vector(const vector &x) 
-      :  base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
-   {
-      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
-                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
-   }
-
-   //! Effects: Move constructor. Moves mx's resources to *this.
-   //!
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
-      :  base_t(boost::move(mx.alloc()))
-   {  this->swap_members(mx);   }
+   {  this->resize(n, value); }
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the vector.
@@ -552,6 +480,64 @@ class vector : private container_detail::vector_alloc_holder
       :  base_t(a)
    {  this->assign(first, last); }
 
+   //! Effects: Copy constructs a vector.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   vector(const vector &x)
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
+   {
+      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+   }
+
+   //! Effects: Move constructor. Moves mx's resources to *this.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
+      :  base_t(boost::move(mx.alloc()))
+   {  this->swap_members(mx);   }
+
+   //! Effects: Copy constructs a vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   vector(const vector &x, const allocator_type &a)
+      :  base_t(a)
+   {
+      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   vector(BOOST_RV_REF(vector) mx, const allocator_type &a)
+      :  base_t(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         this->assign( container_detail::to_raw_pointer(mx.members_.m_start)
+                     , container_detail::to_raw_pointer(mx.members_.m_start) + mx.members_.m_size);
+      }
+   }
+
    //! Effects: Destroys the vector. All stored values are destroyed
    //!   and used memory is deallocated.
    //!
@@ -561,340 +547,10 @@ class vector : private container_detail::vector_alloc_holder
    ~vector() BOOST_CONTAINER_NOEXCEPT
    {} //vector_alloc_holder clears the data
 
-   //! Effects: Returns an iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin() BOOST_CONTAINER_NOEXCEPT
-   { return iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start); }
-
-   //! Effects: Returns an iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end() BOOST_CONTAINER_NOEXCEPT
-   { return iterator(this->members_.m_start + this->members_.m_size); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
-   { return this->cend(); }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
-   { return reverse_iterator(this->end());      }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return this->crbegin(); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
-   { return reverse_iterator(this->begin());       }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
-   { return this->crend(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start + this->members_.m_size); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_reverse_iterator(this->end());}
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
-   { return const_reverse_iterator(this->begin()); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference         front() BOOST_CONTAINER_NOEXCEPT
-   { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference   front() const BOOST_CONTAINER_NOEXCEPT
-   { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference         back() BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[this->members_.m_size - 1]; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference   back()  const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[this->members_.m_size - 1]; }
-
-   //! Returns: A pointer such that [data(),data() + size()) is a valid range.
-   //!   For a non-empty vector, data() == &front().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   pointer data() BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start; }
-
-   //! Returns: A pointer such that [data(),data() + size()) is a valid range.
-   //!   For a non-empty vector, data() == &front().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_pointer data()  const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start; }
-
-   //! Effects: Returns the number of the elements contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_size; }
-
-   //! Effects: Returns the largest possible size of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
-   { return allocator_traits_type::max_size(this->alloc()); }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_capacity; }
-
-   //! Effects: Returns true if the vector contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const BOOST_CONTAINER_NOEXCEPT
-   { return !this->members_.m_size; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n)         
-   { return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n) 
-   { this->priv_check_range(n); return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n) const
-   { this->priv_check_range(n); return this->members_.m_start[n]; }
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
-   { return this->alloc();  }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy/move constructor throws.
-   void reserve(size_type new_cap)
-   {
-      if (this->capacity() < new_cap){
-         //There is not enough memory, allocate a new
-         //buffer or expand the old one.
-         bool same_buffer_start;
-         size_type real_cap = 0;
-         std::pair ret =
-            this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  new_cap, new_cap, real_cap, this->members_.m_start);
-
-         //Check for forward expansion
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-            ++this->num_expand_fwd;
-            #endif
-            this->members_.m_capacity  = real_cap;
-         }
-
-         //If there is no forward expansion, move objects
-         else{
-            //We will reuse insert code, so create a dummy input iterator
-            T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
-            container_detail::advanced_insert_aux_proxy, T*>
-               proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
-            //Backwards (and possibly forward) expansion
-            if(ret.second){
-               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-               ++this->num_expand_bwd;
-               #endif
-               this->priv_range_insert_expand_backwards
-                  ( container_detail::to_raw_pointer(ret.first)
-                  , real_cap
-                  , container_detail::to_raw_pointer(this->members_.m_start)
-                  , 0
-                  , proxy);
-            }
-            //New buffer
-            else{
-               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-               ++this->num_alloc;
-               #endif
-               this->priv_range_insert_new_allocation
-                  ( container_detail::to_raw_pointer(ret.first)
-                  , real_cap
-                  , container_detail::to_raw_pointer(this->members_.m_start)
-                  , 0
-                  , proxy);
-            }
-         }
-      }
-   }
-
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
@@ -951,6 +607,38 @@ class vector : private container_detail::vector_alloc_holder
       return *this;
    }
 
+   //! Effects: Assigns the the range [first, last) to *this.
+   //!
+   //! Throws: If memory allocation throws or T's copy/move constructor/assignment or
+   //!   T's constructor/assignment from dereferencing InpIt throws.
+   //!
+   //! Complexity: Linear to n.
+   template 
+   void assign(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            //&& container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      //Overwrite all elements we can from [first, last)
+      iterator cur = this->begin();
+      for ( ; first != last && cur != end(); ++cur, ++first){
+         *cur = *first;
+      }
+
+      if (first == last){
+         //There are no more elements in the sequence, erase remaining
+         this->erase(cur, this->cend());
+      }
+      else{
+         //There are more elements in the range, insert the remaining ones
+         this->insert(this->cend(), first, last);
+      }
+   }
+
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or
@@ -960,21 +648,494 @@ class vector : private container_detail::vector_alloc_holder
    void assign(size_type n, const value_type& val)
    {  this->assign(cvalue_iterator(val, n), cvalue_iterator());   }
 
-   //! Effects: Assigns the the range [first, last) to *this.
+   //! Effects: Returns a copy of the internal allocator.
    //!
-   //! Throws: If memory allocation throws or T's copy/move constructor/assignment or
-   //!   T's constructor/assignment from dereferencing InpIt throws.
+   //! Throws: If allocator's copy constructor throws.
    //!
-   //! Complexity: Linear to n.
-   template 
-   void assign(InIt first, InIt last) 
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   { return this->alloc();  }
+
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start); }
+
+   //! Effects: Returns an iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->members_.m_start + this->members_.m_size); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->end());      }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->begin());       }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start + this->members_.m_size); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->end());}
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->begin()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the vector contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return !this->members_.m_size; }
+
+   //! Effects: Returns the number of the elements contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_size; }
+
+   //! Effects: Returns the largest possible size of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   { return allocator_traits_type::max_size(this->alloc()); }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
+      if (new_size < this->size()){
+         //Destroy last elements
+         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
+      }
+      else{
+         const size_type n = new_size - this->size();
+         this->reserve(new_size);
+         container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+         this->priv_forward_range_insert(this->cend().get_ptr(), n, proxy);
+      }
    }
 
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      pointer finish = this->members_.m_start + this->members_.m_size;
+      if (new_size < size()){
+         //Destroy last elements
+         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
+      }
+      else{
+         //Insert new elements at the end
+         this->insert(const_iterator(finish), new_size - this->size(), x);
+      }
+   }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_capacity; }
+
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+   //!
+   //! Throws: If memory allocation allocation throws or T's copy/move constructor throws.
+   void reserve(size_type new_cap)
+   {
+      if (this->capacity() < new_cap){
+         //There is not enough memory, allocate a new
+         //buffer or expand the old one.
+         bool same_buffer_start;
+         size_type real_cap = 0;
+         std::pair ret =
+            this->allocation_command
+               (allocate_new | expand_fwd | expand_bwd,
+                  new_cap, new_cap, real_cap, this->members_.m_start);
+
+         //Check for forward expansion
+         same_buffer_start = ret.second && this->members_.m_start == ret.first;
+         if(same_buffer_start){
+            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+            ++this->num_expand_fwd;
+            #endif
+            this->members_.m_capacity  = real_cap;
+         }
+
+         //If there is no forward expansion, move objects
+         else{
+            //We will reuse insert code, so create a dummy input iterator
+            container_detail::insert_range_proxy, T*>
+               proxy(this->alloc(), ::boost::make_move_iterator((T *)0));
+            //Backwards (and possibly forward) expansion
+            if(alloc_version::value > 1 && ret.second){
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_expand_bwd;
+               #endif
+               this->priv_range_insert_expand_backwards
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap
+                  , container_detail::to_raw_pointer(this->members_.m_start)
+                  , 0
+                  , proxy);
+            }
+            //New buffer
+            else{
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_alloc;
+               #endif
+               this->priv_range_insert_new_allocation
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap
+                  , container_detail::to_raw_pointer(this->members_.m_start)
+                  , 0
+                  , proxy);
+            }
+         }
+      }
+   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or T's copy/move constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+   {  this->priv_shrink_to_fit(alloc_version());   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference         front() BOOST_CONTAINER_NOEXCEPT
+   { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference   front() const BOOST_CONTAINER_NOEXCEPT
+   { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference         back() BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[this->members_.m_size - 1]; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference   back()  const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[this->members_.m_size - 1]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   reference at(size_type n)
+   { this->priv_check_range(n); return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const
+   { this->priv_check_range(n); return this->members_.m_start[n]; }
+
+   //////////////////////////////////////////////
+   //
+   //                 data access
+   //
+   //////////////////////////////////////////////
+
+   //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range.
+   //!   For a non-empty vector, data() == &front().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   T* data() BOOST_CONTAINER_NOEXCEPT
+   { return container_detail::to_raw_pointer(this->members_.m_start); }
+
+   //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range.
+   //!   For a non-empty vector, data() == &front().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const T * data()  const BOOST_CONTAINER_NOEXCEPT
+   { return container_detail::to_raw_pointer(this->members_.m_start); }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... in the end of the vector.
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   template
+   void emplace_back(Args &&...args)
+   {
+      T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+      if (this->members_.m_size < this->members_.m_capacity){
+         //There is more memory, just construct a new object at the end
+         allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward(args)...);
+         ++this->members_.m_size;
+      }
+      else{
+         typedef container_detail::insert_emplace_proxy type;
+         this->priv_forward_range_insert
+            (back_pos, 1, type(this->alloc(), ::boost::forward(args)...));
+      }
+   }
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... before position
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor/assignment throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   template
+   iterator emplace(const_iterator position, Args && ...args)
+   {
+      //Just call more general insert(pos, size, value) and return iterator
+      typedef container_detail::insert_emplace_proxy type;
+      return this->priv_forward_range_insert
+         (position.get_ptr(), 1, type(this->alloc(), ::boost::forward(args)...));
+   }
+
+   #else
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
+   {                                                                                            \
+      T* back_pos = container_detail::to_raw_pointer                                            \
+         (this->members_.m_start) + this->members_.m_size;                                      \
+      if (this->members_.m_size < this->members_.m_capacity){                                   \
+         allocator_traits_type::construct (this->alloc()                                        \
+            , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );        \
+         ++this->members_.m_size;                                                               \
+      }                                                                                         \
+      else{                                                                                     \
+         container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                            \
+             proxy                           \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
+         this->priv_forward_range_insert(back_pos, 1, proxy);                                   \
+      }                                                                                         \
+   }                                                                                            \
+                                                                                                \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   iterator emplace(const_iterator pos                                                          \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
+   {                                                                                            \
+      container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                               \
+          proxy                              \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
+      return this->priv_forward_range_insert                                                    \
+         (container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy);                           \
+   }                                                                                            \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: Inserts a copy of x at the end of the vector.
    //!
@@ -995,104 +1156,7 @@ class vector : private container_detail::vector_alloc_holder
    #else
    BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
    #endif
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the end of the vector.
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws or
-   //!   T's move constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   template
-   void emplace_back(Args &&...args)
-   {
-      T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
-      if (this->members_.m_size < this->members_.m_capacity){
-         //There is more memory, just construct a new object at the end
-         allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward(args)...);
-         ++this->members_.m_size;
-      }
-      else{
-         typedef container_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(this->alloc(), ::boost::forward(args)...);
-         priv_range_insert(back_pos, 1, proxy);
-      }
-   }
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... before position
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws or
-   //!   T's move constructor/assignment throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   template
-   iterator emplace(const_iterator position, Args && ...args)
-   {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      typedef container_detail::advanced_insert_aux_emplace type;
-      type &&proxy = type(this->alloc(), ::boost::forward(args)...);
-      priv_range_insert(position.get_ptr(), 1, proxy);
-      return iterator(this->members_.m_start + pos_n);
-   }
-
-   #else
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
-   {                                                                                            \
-      T* back_pos = container_detail::to_raw_pointer                                            \
-         (this->members_.m_start) + this->members_.m_size;                                      \
-      if (this->members_.m_size < this->members_.m_capacity){                                   \
-         allocator_traits_type::construct (this->alloc()                                        \
-            , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );        \
-         ++this->members_.m_size;                                                               \
-      }                                                                                         \
-      else{                                                                                     \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)      \
-             proxy                                   \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
-         priv_range_insert(back_pos, 1, proxy);                                                 \
-      }                                                                                         \
-   }                                                                                            \
-                                                                                                \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
-   iterator emplace(const_iterator pos                                                          \
-                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
-   {                                                                                            \
-      size_type pos_n = pos - cbegin();                                                         \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)      \
-             proxy                                   \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
-      priv_range_insert(container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy);             \
-      return iterator(this->members_.m_start + pos_n);                                          \
-   }                                                                                            \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-  
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(vector& x)
-   {
-      //Just swap internals
-      this->swap_members(x);
-      //And now the allocator
-      container_detail::bool_ flag;
-      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
-   }
-
+ 
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Requires: position must be a valid iterator of *this.
    //!
@@ -1117,39 +1181,70 @@ class vector : private container_detail::vector_alloc_holder
    BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
    #endif
 
-   //! Requires: pos must be a valid iterator of *this.
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator p, size_type n, const T& x)
+   {
+      container_detail::insert_n_copies_proxy proxy(this->alloc(), x);
+      return this->priv_forward_range_insert(p.get_ptr(), n, proxy);
+   }
+
+   //! Requires: p must be a valid iterator of *this.
    //!
    //! Effects: Insert a copy of the [first, last) range before pos.
    //!
+   //! Returns: an iterator to the first inserted element or pos if first == last.
+   //!
    //! Throws: If memory allocation throws, T's constructor from a
    //!   dereferenced InpIt throws or T's copy/move constructor/assignment throws.
    //!
    //! Complexity: Linear to std::distance [first, last).
    template 
-   void insert(const_iterator pos, InIt first, InIt last)
+   iterator insert(const_iterator pos, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(pos, first, last, Result());
+      const size_type n_pos = pos - this->cbegin();
+      iterator it(pos.get_ptr());
+      for(;first != last; ++first){
+         it = this->emplace(it, *first);
+         ++it;
+      }
+      return iterator(this->members_.m_start + n_pos);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert n copies of x before pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator p, size_type n, const T& x)
-   {  this->insert(p, cvalue_iterator(x, n), cvalue_iterator());  }
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator pos, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      container_detail::insert_range_proxy proxy(this->alloc(), first);
+      return this->priv_forward_range_insert(pos.get_ptr(), std::distance(first, last), proxy);
+   }
+   #endif
 
    //! Effects: Removes the last element from the vector.
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant time.
-   void pop_back() 
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
       //Destroy last element
       --this->members_.m_size;
@@ -1160,12 +1255,12 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element. Constant if pos is the last element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
    {
-      T *pos = container_detail::to_raw_pointer(position.get_ptr());
-      T *beg = container_detail::to_raw_pointer(this->members_.m_start);
+      T *const pos = container_detail::to_raw_pointer(position.get_ptr());
+      T *const beg = container_detail::to_raw_pointer(this->members_.m_start);
       ::boost::move(pos + 1, beg + this->members_.m_size, pos);
       --this->members_.m_size;
       //Destroy last element
@@ -1179,59 +1274,34 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Complexity: Linear to the distance between first and last
    //!   plus linear to the elements between pos and the last element.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
    {
-      if (first != last){   // worth doing, copy down over hole
+      if (first != last){
          T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
          T* ptr = container_detail::to_raw_pointer(boost::move
             (container_detail::to_raw_pointer(last.get_ptr())
             ,end_pos
             ,container_detail::to_raw_pointer(first.get_ptr())
             ));
-         size_type destroyed = (end_pos - ptr);
+         const size_type destroyed = (end_pos - ptr);
          this->destroy_n(ptr, destroyed);
          this->members_.m_size -= destroyed;
       }
       return iterator(first.get_ptr());
    }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   //! Effects: Swaps the contents of *this and x.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x) 
+   //! Complexity: Constant.
+   void swap(vector& x)
    {
-      pointer finish = this->members_.m_start + this->members_.m_size;
-      if (new_size < size()){
-         //Destroy last elements
-         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
-      }
-      else{
-         //Insert new elements at the end
-         this->insert(const_iterator(finish), new_size - this->size(), x);
-      }
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size) 
-   {
-      if (new_size < this->size()){
-         //Destroy last elements
-         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
-      }
-      else{
-         size_type n = new_size - this->size();
-         this->reserve(new_size);
-         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-         priv_range_insert(this->cend().get_ptr(), n, proxy);
-      }
+      //Just swap internals
+      this->swap_members(x);
+      //And now the allocator
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
    //! Effects: Erases all the elements of the vector.
@@ -1242,38 +1312,33 @@ class vector : private container_detail::vector_alloc_holder
    void clear() BOOST_CONTAINER_NOEXCEPT
    {  this->prot_destroy_all();  }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the vector is unchanged
-   //!
-   //! Throws: If memory allocation throws, or T's copy/move constructor throws.
-   //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-   {  priv_shrink_to_fit(alloc_version());   }
-
    /// @cond
 
-   private:
-   iterator priv_insert(const_iterator position, const T &x) 
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
    {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position, (size_type)1, x);
-      return iterator(this->members_.m_start + pos_n);
+      const size_type *dummy = 0;
+      this->priv_insert_ordered_at(element_count, last_position_it, false, &dummy[0], last_value_it);
    }
 
-   iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x) 
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
    {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position
-                  ,repeat_move_it(repeat_it(x, 1))
-                  ,repeat_move_it(repeat_it()));
-      return iterator(this->members_.m_start + pos_n);
+      this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it);
+   }
+
+   private:
+   template
+   iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x)
+   {
+      return this->priv_forward_range_insert
+         (p.get_ptr(), 1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
    }
 
    template 
-   void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
+   void priv_push_back(BOOST_FWD_REF(U) x)
    {
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
@@ -1284,17 +1349,14 @@ class vector : private container_detail::vector_alloc_holder
          ++this->members_.m_size;
       }
       else{
-         this->insert(this->cend(), ::boost::forward(x));
+         this->priv_insert(this->cend(), ::boost::forward(x));
       }
    }
 
-   template
-   void priv_shrink_to_fit( AllocVersion
-                          , typename container_detail::enable_if_c<
-                              container_detail::is_same::value >::type * = 0)
+   void priv_shrink_to_fit(allocator_v1)
    {
       if(this->members_.m_capacity){
-         if(!size()){
+         if(!this->size()){
             this->prot_deallocate();
          }
          else{
@@ -1305,9 +1367,8 @@ class vector : private container_detail::vector_alloc_holder
                   (allocate_new, this->size(), this->size(), real_cap, this->members_.m_start);
             if(real_cap < this->capacity()){
                //We will reuse insert code, so create a dummy input iterator
-               T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
-               container_detail::advanced_insert_aux_proxy, T*>
-                  proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+               container_detail::insert_range_proxy, T*>
+                  proxy(this->alloc(), ::boost::make_move_iterator((T *)0));
                #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
@@ -1325,10 +1386,7 @@ class vector : private container_detail::vector_alloc_holder
       }
    }
 
-   template
-   void priv_shrink_to_fit(AllocVersion
-                          , typename container_detail::enable_if_c<
-                              !container_detail::is_same::value >::type * = 0)
+   void priv_shrink_to_fit(allocator_v2)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1336,7 +1394,7 @@ class vector : private container_detail::vector_alloc_holder
          }
          else{
             size_type received_size;
-            if(this->alloc().allocation_command
+            if(this->allocation_command
                ( shrink_in_place | nothrow_allocation
                , this->capacity(), this->size()
                , received_size,   this->members_.m_start).first){
@@ -1349,94 +1407,245 @@ class vector : private container_detail::vector_alloc_holder
       }
    }
 
-   template 
-   void priv_range_insert(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      if(first != last){        
-         const size_type n = std::distance(first, last);
-         container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
-         priv_range_insert(pos.get_ptr(), n, proxy);
-      }
-   }
-
-   template 
-   void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
-   {
-      for(;first != last; ++first){
-         this->emplace(pos, *first);
-      }
-   }
-
-   void priv_range_insert(pointer pos, const size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_forward_range_insert
+      (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy)
    {
       //Check if we have enough memory or try to expand current memory
-      size_type remaining = this->members_.m_capacity - this->members_.m_size;
-      bool same_buffer_start;
-      std::pair ret;
-      size_type real_cap = this->members_.m_capacity;
+      const size_type remaining = this->members_.m_capacity - this->members_.m_size;
+      const size_type n_pos = pos - this->members_.m_start;
+      T *const raw_pos = container_detail::to_raw_pointer(pos);
 
       //Check if we already have room
-      if (n <= remaining){
-         same_buffer_start = true;
-      }
-      else{
-         //There is not enough memory, allocate a new
-         //buffer or expand the old one.
-         size_type new_cap = this->next_capacity(n);
-         ret = this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  this->members_.m_size + n, new_cap, real_cap, this->members_.m_start);
+      if(alloc_version::value > 1){   //Version 2 allocator, compile time check
+         bool same_buffer_start = n <= remaining;
+         if (!same_buffer_start){
+            size_type real_cap = 0;
+            //There is not enough memory, allocate a new
+            //buffer or expand the old one.
+            std::pair ret = (this->allocation_command
+                  (allocate_new | expand_fwd | expand_bwd,
+                     this->members_.m_size + n, this->next_capacity(n), real_cap, this->members_.m_start));
 
-         //Check for forward expansion
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            this->members_.m_capacity  = real_cap;
+            //Buffer reallocated
+            if(ret.second){
+               //Forward expansion, delay insertion
+               if(this->members_.m_start == ret.first){
+                  #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+                  ++this->num_expand_fwd;
+                  #endif
+                  this->members_.m_capacity = real_cap;
+                  //Expand forward
+                  this->priv_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+               }
+               //Backwards (and possibly forward) expansion
+               else{
+                  #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+                  ++this->num_expand_bwd;
+                  #endif
+                  this->priv_range_insert_expand_backwards
+                     ( container_detail::to_raw_pointer(ret.first)
+                     , real_cap, raw_pos, n, insert_range_proxy);
+               }
+            }
+            //New buffer
+            else{
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_alloc;
+               #endif
+               this->priv_range_insert_new_allocation
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap, raw_pos, n, insert_range_proxy);
+            }
+         }
+         else{
+            //Expand forward
+            this->priv_range_insert_expand_forward
+               (raw_pos, n, insert_range_proxy);
          }
       }
-      
-      //If we had room or we have expanded forward
-      if (same_buffer_start){
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_expand_fwd;
-         #endif
-         this->priv_range_insert_expand_forward
-            (container_detail::to_raw_pointer(pos), n, interf);
+      else{ //Version 1 allocator
+         if (n <= remaining){
+            this->priv_range_insert_expand_forward
+               (raw_pos, n, insert_range_proxy);
+         }
+         else{
+            const size_type new_cap = this->next_capacity(n);
+            T * new_buf = container_detail::to_raw_pointer(this->alloc().allocate(new_cap));
+            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+            ++this->num_alloc;
+            #endif
+            this->priv_range_insert_new_allocation
+               ( new_buf, new_cap, raw_pos, n, insert_range_proxy);
+         }
       }
-      //Backwards (and possibly forward) expansion
-      else if(ret.second){
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_expand_bwd;
-         #endif
-         this->priv_range_insert_expand_backwards
-            ( container_detail::to_raw_pointer(ret.first)
-            , real_cap
-            , container_detail::to_raw_pointer(pos)
-            , n
-            , interf);
-      }
-      //New buffer
-      else{
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_alloc;
-         #endif
-         this->priv_range_insert_new_allocation
-            ( container_detail::to_raw_pointer(ret.first)
-            , real_cap
-            , container_detail::to_raw_pointer(pos)
-            , n
-            , interf);
+      return iterator(this->members_.m_start + n_pos);
+   }
+
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void priv_insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
+                              , bool do_skip, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
+   {
+      const size_type old_size_pos = this->size();
+      this->reserve(old_size_pos + element_count);
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+      size_type insertions_left = element_count;
+      size_type next_pos = old_size_pos;
+      size_type hole_size = element_count;
+
+      //Exception rollback. If any copy throws before the hole is filled, values
+      //already inserted/copied at the end of the buffer will be destroyed.
+      typename value_traits::ArrayDestructor past_hole_values_destroyer
+         (begin_ptr + old_size_pos + element_count, this->alloc(), size_type(0u));
+      //Loop for each insertion backwards, first moving the elements after the insertion point,
+      //then inserting the element.
+      while(insertions_left){
+         if(do_skip){
+            size_type n = *(--last_skip_it);
+            std::advance(last_value_it, -difference_type(n));
+         }
+         const size_type pos = static_cast(*(--last_position_it));
+         BOOST_ASSERT(pos <= old_size_pos);
+         //If needed shift the range after the insertion point and the previous insertion point.
+         //Function will take care if the shift crosses the size() boundary, using copy/move
+         //or uninitialized copy/move if necessary.
+         size_type new_hole_size = (pos != next_pos)
+            ? priv_insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left)
+            : hole_size
+            ;
+         if(new_hole_size > 0){
+            //The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
+            past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
+            //Insert the new value in the hole
+            allocator_traits_type::construct(this->alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it));
+            --new_hole_size;
+            if(new_hole_size == 0){
+               //Hole was just filled, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            else{
+               //The hole was reduced by the new insertion by one
+               past_hole_values_destroyer.increment_size_backwards(size_type(1u));
+            }
+         }
+         else{
+            if(hole_size){
+               //Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            //Insert the new value in the already constructed range
+            begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
+         }
+         --insertions_left;
+         hole_size = new_hole_size;
+         next_pos = pos;
       }
    }
 
-   void priv_range_insert_expand_forward(T* pos, size_type n, advanced_insert_aux_int_t &interf)
+   //Takes the range pointed by [first_pos, last_pos) and shifts it to the right
+   //by 'shift_count'. 'limit_pos' marks the end of constructed elements.
+   //
+   //Precondition: first_pos <= last_pos <= limit_pos
+   //
+   //The shift operation might cross limit_pos so elements to moved beyond limit_pos
+   //are uninitialized_moved with an allocator. Other elements are moved.
+   //
+   //The shift operation might left uninitialized elements after limit_pos
+   //and the number of uninitialized elements is returned by the function.
+   //
+   //Old situation:
+   //       first_pos   last_pos         old_limit
+   //             |       |                  | 
+   // ____________V_______V__________________V_____________
+   //|   prefix   | range |     suffix       |raw_mem      ~
+   //|____________|_______|__________________|_____________~
+   //
+   //New situation in Case Allocator (hole_size == 0):
+   // range is moved through move assignments
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V_____________
+   //|   prefix'  |       |  | range |suffix'|raw_mem      ~
+   //|________________+______|___^___|_______|_____________~
+   //                 |          |
+   //                 |_>_>_>_>_>^                    
+   //
+   //
+   //New situation in Case B (hole_size > 0):
+   // range is moved through uninitialized moves
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V________________
+   //|    prefix' |       |                  | [hole] | range |
+   //|_______________________________________|________|___^___|
+   //                 |                                   |
+   //                 |_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_^
+   //
+   //New situation in Case C (hole_size == 0):
+   // range is moved through move assignments and uninitialized moves
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V___
+   //|   prefix'  |       |              | range |
+   //|___________________________________|___^___|
+   //                 |                      |
+   //                 |_>_>_>_>_>_>_>_>_>_>_>^
+   size_type priv_insert_ordered_at_shift_range
+      (size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
+   {
+      BOOST_ASSERT(first_pos <= last_pos);
+      BOOST_ASSERT(last_pos <= limit_pos);
+      //
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+      T* const first_ptr = begin_ptr + first_pos;
+      T* const last_ptr  = begin_ptr + last_pos;
+
+      size_type hole_size = 0;
+      //Case Allocator:
+      if((last_pos + shift_count) <= limit_pos){
+         //All move assigned
+         boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count);
+      }
+      //Case B:
+      else if((first_pos + shift_count) >= limit_pos){
+         //All uninitialized_moved
+         ::boost::container::uninitialized_move_alloc(this->alloc(), first_ptr, last_ptr, first_ptr + shift_count);
+         hole_size = last_pos + shift_count - limit_pos;
+      }
+      //Case C:
+      else{
+         //Some uninitialized_moved
+         T* const limit_ptr    = begin_ptr + limit_pos;
+         T* const boundary_ptr = limit_ptr - shift_count;
+         ::boost::container::uninitialized_move_alloc(this->alloc(), boundary_ptr, last_ptr, limit_ptr);
+         //The rest is move assigned
+         boost::move_backward(first_ptr, boundary_ptr, limit_ptr);
+      }
+      return hole_size;
+   }
+
+   private:
+   template 
+   void priv_range_insert_expand_forward(T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can't be 0, because there is nothing to do in that case
       if(!n) return;
       //There is enough memory
-      T* old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+      T* const old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       const size_type elems_after = old_finish - pos;
 
-      if (elems_after >= n){
+      if (!elems_after){
+         //Copy first new elements in pos
+         insert_range_proxy.uninitialized_copy_n_and_update(pos, n);
+         this->members_.m_size += n;
+      }
+      else if (elems_after >= n){
          //New elements can be just copied.
          //Move to uninitialized memory last objects
          ::boost::container::uninitialized_move_alloc
@@ -1445,24 +1654,31 @@ class vector : private container_detail::vector_alloc_holder
          //Copy previous to last objects to the initialized end
          boost::move_backward(pos, old_finish - n, old_finish);
          //Insert new objects in the pos
-         interf.copy_remaining_to(pos);
+         insert_range_proxy.copy_n_and_update(pos, n);
       }
       else {
-         //The new elements don't fit in the [pos, end()) range. Copy
-         //to the beginning of the unallocated zone the last new elements.
-         interf.uninitialized_copy_some_and_update(old_finish, elems_after, false);
-         this->members_.m_size += n - elems_after;
-         //Copy old [pos, end()) elements to the uninitialized memory
-         ::boost::container::uninitialized_move_alloc
-            (this->alloc(), pos, old_finish, container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
-         this->members_.m_size += elems_after;
-         //Copy first new elements in pos
-         interf.copy_remaining_to(pos);
+         //The new elements don't fit in the [pos, end()) range.
+
+         //Copy old [pos, end()) elements to the uninitialized memory (a gap is created)
+         ::boost::container::uninitialized_move_alloc(this->alloc(), pos, old_finish, pos + n);
+         BOOST_TRY{
+            //Copy first new elements in pos (gap is still there)
+            insert_range_proxy.copy_n_and_update(pos, elems_after);
+            //Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
+            insert_range_proxy.uninitialized_copy_n_and_update(old_finish, n - elems_after);
+            this->members_.m_size += n;
+         }
+         BOOST_CATCH(...){
+            this->destroy_n(pos + n, elems_after);
+            BOOST_RETHROW
+         }
+         BOOST_CATCH_END
       }
    }
 
+   template 
    void priv_range_insert_new_allocation
-      (T* new_start, size_type new_cap, T* pos, size_type n, advanced_insert_aux_int_t &interf)
+      (T* const new_start, size_type new_cap, T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can be zero, if we want to reallocate!
       T *new_finish = new_start;
@@ -1471,7 +1687,7 @@ class vector : private container_detail::vector_alloc_holder
       typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
       typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
 
-      //Initialize with [begin(), pos) old buffer 
+      //Initialize with [begin(), pos) old buffer
       //the start of the new buffer
       T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
       if(old_buffer){
@@ -1480,10 +1696,10 @@ class vector : private container_detail::vector_alloc_holder
          constructed_values_destroyer.increment_size(new_finish - old_finish);
       }
       //Initialize new objects, starting from previous point
-      interf.uninitialized_copy_remaining_to(old_finish = new_finish);
+      insert_range_proxy.uninitialized_copy_n_and_update(old_finish = new_finish, n);
       new_finish += n;
       constructed_values_destroyer.increment_size(new_finish - old_finish);
-      //Initialize from the rest of the old buffer, 
+      //Initialize from the rest of the old buffer,
       //starting from previous point
       if(old_buffer){
          new_finish = ::boost::container::uninitialized_move_alloc
@@ -1491,7 +1707,7 @@ class vector : private container_detail::vector_alloc_holder
          //Destroy and deallocate old elements
          //If there is allocated memory, destroy and deallocate
          if(!value_traits::trivial_dctr_after_move)
-            this->destroy_n(old_buffer, this->members_.m_size); 
+            this->destroy_n(old_buffer, this->members_.m_size);
          this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
       }
       this->members_.m_start     = new_start;
@@ -1502,19 +1718,21 @@ class vector : private container_detail::vector_alloc_holder
       scoped_alloc.release();
    }
 
+   template 
    void priv_range_insert_expand_backwards
-         (T* new_start, size_type new_capacity,
-          T* pos, const size_type n, advanced_insert_aux_int_t &interf)
+         (T* const new_start, const size_type new_capacity,
+          T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can be zero to just expand capacity
       //Backup old data
-      T* old_start  = container_detail::to_raw_pointer(this->members_.m_start);
-      T* old_finish = old_start + this->members_.m_size;
-      size_type old_size = this->members_.m_size;
+      T* const old_start  = container_detail::to_raw_pointer(this->members_.m_start);
+      T* const old_finish = old_start + this->members_.m_size;
+      const size_type old_size = this->members_.m_size;
 
       //We can have 8 possibilities:
-      const size_type elemsbefore   = (size_type)(pos - old_start);
-      const size_type s_before      = (size_type)(old_start - new_start);
+      const size_type elemsbefore = static_cast(pos - old_start);
+      const size_type s_before    = static_cast(old_start - new_start);
+      const size_type before_plus_new = elemsbefore + n;
 
       //Update the vector buffer information to a safe state
       this->members_.m_start      = new_start;
@@ -1525,15 +1743,16 @@ class vector : private container_detail::vector_alloc_holder
       //all the old objects to fulfill previous vector state
       typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
       //Check if s_before is big enough to hold the beginning of old data + new data
-      if(difference_type(s_before) >= difference_type(elemsbefore + n)){
+      if(s_before >= before_plus_new){
          //Copy first old values before pos, after that the new objects
-         ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
+         T *const new_elem_pos = ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
          this->members_.m_size = elemsbefore;
-         interf.uninitialized_copy_remaining_to(new_start + elemsbefore);
+         insert_range_proxy.uninitialized_copy_n_and_update(new_elem_pos, n);
          this->members_.m_size += n;
          //Check if s_before is so big that even copying the old data + new data
          //there is a gap between the new data and the old data
-         if(s_before >= (old_size + n)){
+         const size_type new_size = old_size + n;
+         if(s_before >= new_size){
             //Old situation:
             // _________________________________________________________
             //|            raw_mem                | old_begin | old_end |
@@ -1546,9 +1765,9 @@ class vector : private container_detail::vector_alloc_holder
             //
             //Now initialize the rest of memory with the last old values
             ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, old_finish, new_start + elemsbefore + n);
+               (this->alloc(), pos, old_finish, new_start + before_plus_new);
             //All new elements correctly constructed, avoid new element destruction
-            this->members_.m_size = old_size + n;
+            this->members_.m_size = new_size;
             //Old values destroyed automatically with "old_values_destroyer"
             //when "old_values_destroyer" goes out of scope unless the have trivial
             //destructor after move.
@@ -1569,17 +1788,17 @@ class vector : private container_detail::vector_alloc_holder
             //
             //Now initialize the rest of memory with the last old values
             //All new elements correctly constructed, avoid new element destruction
-            size_type raw_gap = s_before - (elemsbefore + n);
+            const size_type raw_gap = s_before - before_plus_new;
             //Now initialize the rest of s_before memory with the
             //first of elements after new values
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, pos + raw_gap, new_start + elemsbefore + n);
+            ::boost::container::uninitialized_move_alloc_n
+               (this->alloc(), pos, raw_gap, new_start + before_plus_new);
             //Update size since we have a contiguous buffer
             this->members_.m_size = old_size + s_before;
             //All new elements correctly constructed, avoid old element destruction
             old_values_destroyer.release();
             //Now copy remaining last objects in the old buffer begin
-            T *to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
+            T * const to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
             //Now destroy redundant elements except if they were moved and
             //they have trivial destructor after move
             size_type n_destroy =  old_finish - to_destroy;
@@ -1608,7 +1827,7 @@ class vector : private container_detail::vector_alloc_holder
          //| old_begin + new + old_end  |  raw_mem           |
          //|____________________________|____________________|
          //
-         bool do_after    = n > s_before;
+         const bool do_after = n > s_before;
 
          //Now we can have two situations: the raw_mem of the
          //beginning divides the old_begin, or the new elements:
@@ -1637,28 +1856,26 @@ class vector : private container_detail::vector_alloc_holder
             //|___________|_____|_________|_____________________|
             //
             //Copy the first part of old_begin to raw_mem
-            T *start_n = old_start + difference_type(s_before); 
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), old_start, start_n, new_start);
+            ::boost::container::uninitialized_move_alloc_n
+               (this->alloc(), old_start, s_before, new_start);
             //The buffer is all constructed until old_end,
             //release destroyer and update size
             old_values_destroyer.release();
             this->members_.m_size = old_size + s_before;
-            //Now copy the second part of old_begin overwriting himself
-            T* next = ::boost::move(start_n, pos, old_start);
+            //Now copy the second part of old_begin overwriting itself
+            T *const next = ::boost::move(old_start + s_before, pos, old_start);
             if(do_after){
                //Now copy the new_beg elements
-               interf.copy_some_and_update(next, s_before, true);
+               insert_range_proxy.copy_n_and_update(next, s_before);
             }
             else{
                //Now copy the all the new elements
-               interf.copy_remaining_to(next);
-               T* move_start = next + n;
+               insert_range_proxy.copy_n_and_update(next, n);
                //Now displace old_end elements
-               T* move_end   = ::boost::move(pos, old_finish, move_start);
+               T* const move_end   = ::boost::move(pos, old_finish, next + n);
                //Destroy remaining moved elements from old_end except if
                //they have trivial destructor after being moved
-               difference_type n_destroy = s_before - n;
+               const size_type n_destroy = s_before - n;
                if(!value_traits::trivial_dctr_after_move)
                   this->destroy_n(move_end, n_destroy);
                this->members_.m_size -= n_destroy;
@@ -1691,30 +1908,30 @@ class vector : private container_detail::vector_alloc_holder
             //|___________|_____|_________|__________________________|
             //
             //First copy whole old_begin and part of new to raw_mem
-            ::boost::container::uninitialized_move_alloc
+            T * const new_pos = ::boost::container::uninitialized_move_alloc
                (this->alloc(), old_start, pos, new_start);
             this->members_.m_size = elemsbefore;
-
-            const size_type mid_n = difference_type(s_before) - elemsbefore;
-            interf.uninitialized_copy_some_and_update(new_start + elemsbefore, mid_n, true);
-            this->members_.m_size = old_size + s_before;
+            const size_type mid_n = s_before - elemsbefore;
+            insert_range_proxy.uninitialized_copy_n_and_update(new_pos, mid_n);
             //The buffer is all constructed until old_end,
-            //release destroyer and update size
+            //release destroyer
+            this->members_.m_size = old_size + s_before;
             old_values_destroyer.release();
 
             if(do_after){
                //Copy new_beg part
-               interf.copy_some_and_update(old_start, s_before - mid_n, true);
+               insert_range_proxy.copy_n_and_update(old_start, elemsbefore);
             }
             else{
                //Copy all new elements
-               interf.copy_remaining_to(old_start);
-               T* move_start = old_start + (n-mid_n);
+               const size_type rest_new = n - mid_n;
+               insert_range_proxy.copy_n_and_update(old_start, rest_new);
+               T* move_start = old_start + rest_new;
                //Displace old_end
                T* move_end = ::boost::move(pos, old_finish, move_start);
                //Destroy remaining moved elements from old_end except if they
                //have trivial destructor after being moved
-               difference_type n_destroy = s_before - n;
+               size_type n_destroy = s_before - n;
                if(!value_traits::trivial_dctr_after_move)
                   this->destroy_n(move_end, n_destroy);
                this->members_.m_size -= n_destroy;
@@ -1722,9 +1939,6 @@ class vector : private container_detail::vector_alloc_holder
          }
 
          //This is only executed if two phase construction is needed
-         //This can be executed without exception handling since we
-         //have to just copy and append in raw memory and
-         //old_values_destroyer has been released in phase 1.
          if(do_after){
             //The raw memory divides the new elements
             //
@@ -1743,11 +1957,11 @@ class vector : private container_detail::vector_alloc_holder
             //| old_begin      +       new            | old_end |raw |
             //|_______________________________________|_________|____|
             //
-            const size_type n_after  = n - s_before;
-            const difference_type elemsafter = old_size - elemsbefore;
+            const size_type n_after    = n - s_before;
+            const size_type elemsafter = old_size - elemsbefore;
 
             //We can have two situations:
-            if (elemsafter > difference_type(n_after)){
+            if (elemsafter >= n_after){
                //The raw_mem from end will divide displaced old_end
                //
                //Old situation:
@@ -1761,7 +1975,7 @@ class vector : private container_detail::vector_alloc_holder
                //|__________________________|_________|________|_________|
                //
                //First copy the part of old_end raw_mem
-               T* finish_n = old_finish - difference_type(n_after);
+               T* finish_n = old_finish - n_after;
                ::boost::container::uninitialized_move_alloc
                   (this->alloc(), finish_n, old_finish, old_finish);
                this->members_.m_size += n_after;
@@ -1769,7 +1983,7 @@ class vector : private container_detail::vector_alloc_holder
                boost::move_backward(pos, finish_n, old_finish);
                //Now overwrite with new_end
                //The new_end part is [first + (n - n_after), last)
-               interf.copy_remaining_to(pos);
+               insert_range_proxy.copy_n_and_update(pos, n_after);
             }
             else {
                //The raw_mem from end will divide new_end part
@@ -1784,188 +1998,47 @@ class vector : private container_detail::vector_alloc_holder
                //| old_begin   +   new_beg  |     new_end   |old_end | raw_mem |
                //|__________________________|_______________|________|_________|
                //
+
+               const size_type mid_last_dist = n_after - elemsafter;
+               //First initialize data in raw memory
+
+               //Copy to the old_end part to the uninitialized zone leaving a gap.
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
+
+               BOOST_TRY{
+                  //Copy the first part to the already constructed old_end zone
+                  insert_range_proxy.copy_n_and_update(pos, elemsafter);
+                  //Copy the rest to the uninitialized zone filling the gap
+                  insert_range_proxy.uninitialized_copy_n_and_update(old_finish, mid_last_dist);
+                  this->members_.m_size += n_after;
+               }
+               BOOST_CATCH(...){
+                  this->destroy_n(pos, mid_last_dist);
+                  BOOST_RETHROW
+               }
+               BOOST_CATCH_END
+/*
                size_type mid_last_dist = n_after - elemsafter;
                //First initialize data in raw memory
+
                //The new_end part is [first + (n - n_after), last)
-               interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
+               insert_range_proxy.uninitialized_copy_last_and_update(old_finish, elemsafter);
                this->members_.m_size += mid_last_dist;
                ::boost::container::uninitialized_move_alloc
                   (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
                this->members_.m_size += n_after - mid_last_dist;
                //Now copy the part of new_end over constructed elements
-               interf.copy_remaining_to(pos);
+               insert_range_proxy.copy_remaining_to(pos);*/
             }
          }
       }
    }
 
-   template 
-   void priv_assign_aux(InIt first, InIt last, std::input_iterator_tag)
-   {
-      //Overwrite all elements we can from [first, last)
-      iterator cur = begin();
-      for ( ; first != last && cur != end(); ++cur, ++first){
-         *cur = *first;
-      }
-
-      if (first == last){
-         //There are no more elements in the sequence, erase remaining
-         this->erase(cur, cend());
-      }
-      else{
-         //There are more elements in the range, insert the remaining ones
-         this->insert(this->cend(), first, last);
-      }
-   }
-
-   template 
-   void priv_assign_aux(FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      size_type n = std::distance(first, last);
-      if(!n){
-         this->prot_destroy_all();
-         return;
-      }
-      //Check if we have enough memory or try to expand current memory
-      size_type remaining = this->members_.m_capacity - this->members_.m_size;
-      bool same_buffer_start;
-      std::pair ret;
-      size_type real_cap = this->members_.m_capacity;
-
-      if (n <= remaining){
-         same_buffer_start = true;
-      }
-      else{
-         //There is not enough memory, allocate a new buffer
-         size_type new_cap = this->next_capacity(n);
-         ret = this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  this->size() + n, new_cap, real_cap, this->members_.m_start);
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            this->members_.m_capacity  = real_cap;
-         }
-      }
-      
-      if(same_buffer_start){
-         T *start = container_detail::to_raw_pointer(this->members_.m_start);
-         if (this->size() >= n){
-            //There is memory, but there are more old elements than new ones
-            //Overwrite old elements with new ones
-            std::copy(first, last, start);
-            //Destroy remaining old elements
-            this->destroy_n(start + n, this->members_.m_size - n);
-            this->members_.m_size = n;
-         }
-         else{
-            //There is memory, but there are less old elements than new ones
-            //First overwrite some old elements with new ones
-            FwdIt mid = first;
-            std::advance(mid, this->size());
-            // iG T *end = std::copy(first, mid, start);
-            T *end = std::copy(first, mid, start);
-            //Initialize the remaining new elements in the uninitialized memory
-            ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), mid, last, end);
-            this->members_.m_size = n;
-         }
-      }
-      else if(!ret.second){
-         typename value_traits::ArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
-         ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), first, last, container_detail::to_raw_pointer(ret.first));
-         scoped_alloc.release();
-         //Destroy and deallocate old buffer
-         if(this->members_.m_start != 0){
-            this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size); 
-            this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
-         }
-         this->members_.m_start     = ret.first;
-         this->members_.m_size      = n;
-         this->members_.m_capacity  = real_cap;
-      }
-      else{
-         //Backwards expansion
-         //If anything goes wrong, this object will destroy old objects
-         T *old_start         = container_detail::to_raw_pointer(this->members_.m_start);
-         size_type old_size   = this->members_.m_size;
-         typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
-         //If something goes wrong size will be 0
-         //but holding the whole buffer
-         this->members_.m_size  = 0;
-         this->members_.m_start = ret.first;
-         this->members_.m_capacity = real_cap;
-         
-         //Backup old buffer data
-         size_type old_offset    = old_start - container_detail::to_raw_pointer(ret.first);
-         size_type first_count   = container_detail::min_value(n, old_offset);
-
-         FwdIt mid = first;
-         std::advance(mid, first_count);
-         ::boost::container::uninitialized_copy_or_move_alloc
-            (this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
-
-         if(old_offset > n){
-            //All old elements will be destroyed by "old_values_destroyer" 
-            this->members_.m_size = n;
-         }
-         else{
-            //We have constructed objects from the new begin until
-            //the old end so release the rollback destruction
-            old_values_destroyer.release();
-            this->members_.m_start  = ret.first;
-            this->members_.m_size   = first_count + old_size;
-            //Now overwrite the old values
-            size_type second_count = container_detail::min_value(old_size, n - first_count);
-            FwdIt mid2 = mid;
-            std::advance(mid2, second_count);
-            // iG std::copy(mid, mid2, old_start);
-            std::copy(mid, mid2, old_start);
-            
-            //Check if we still have to append elements in the
-            //uninitialized end
-            if(second_count == old_size){
-               // iG std::copy(mid2, last, old_start + old_size);
-               std::copy(mid2, last, old_start + old_size);
-            }
-            else{
-               //We have to destroy some old values
-               this->destroy_n
-                  (old_start + second_count, old_size - second_count);
-               this->members_.m_size = n;
-            }
-            this->members_.m_size = n;                        
-         }
-      }
-   }
-
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-   { this->assign((size_type) n, (value_type)val); }
-
-   template 
-   void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
-   { 
-      //Dispatch depending on integer/iterator
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_assign_aux(first, last, ItCat()); 
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_) 
-   {  this->insert(pos, (size_type)n, (T)val);  }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, InIt first, 
-                             InIt last,      container_detail::false_)
-   {
-      //Dispatch depending on integer/iterator
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_range_insert(pos, first, last, ItCat());
-   }
-
-   void priv_check_range(size_type n) const 
+   void priv_check_range(size_type n) const
    {
       //If n is out of range, throw an out_of_range exception
-      if (n >= size())
+      if (n >= this->size())
          throw std::out_of_range("vector::at");
    }
 
@@ -1981,31 +2054,31 @@ class vector : private container_detail::vector_alloc_holder
    /// @endcond
 };
 
-template 
-inline bool 
-operator==(const vector& x, const vector& y)
+template 
+inline bool
+operator==(const vector& x, const vector& y)
 {
    //Check first size and each element if needed
    return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator!=(const vector& x, const vector& y)
+template 
+inline bool
+operator!=(const vector& x, const vector& y)
 {
    //Check first size and each element if needed
   return x.size() != y.size() || !std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const vector& x, const vector& y)
+template 
+inline bool
+operator<(const vector& x, const vector& y)
 {
    return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline void swap(vector& x, vector& y)
+template 
+inline void swap(vector& x, vector& y)
 {  x.swap(y);  }
 
 }}
@@ -2014,17 +2087,14 @@ inline void swap(vector& x, vector& y)
 
 namespace boost {
 
-/*
 
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
 
-*/
 
 }
 
diff --git a/project/jni/boost/include/boost/context/all.hpp b/project/jni/boost/include/boost/context/all.hpp
new file mode 100644
index 000000000..6bf7e8f19
--- /dev/null
+++ b/project/jni/boost/include/boost/context/all.hpp
@@ -0,0 +1,12 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_ALL_H
+#define BOOST_CONTEXT_ALL_H
+
+#include 
+
+#endif // BOOST_CONTEXT_ALL_H
diff --git a/project/jni/boost/include/boost/context/detail/config.hpp b/project/jni/boost/include/boost/context/detail/config.hpp
new file mode 100644
index 000000000..0d7b7fce6
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/config.hpp
@@ -0,0 +1,42 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_CONFIG_H
+#define BOOST_CONTEXT_DETAIL_CONFIG_H
+
+#include 
+#include 
+
+#ifdef BOOST_CONTEXT_DECL
+# undef BOOST_CONTEXT_DECL
+#endif
+
+#if defined(BOOST_HAS_DECLSPEC)
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+#  if ! defined(BOOST_DYN_LINK)
+#   define BOOST_DYN_LINK
+#  endif
+#  if defined(BOOST_CONTEXT_SOURCE)
+#   define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT
+#  else 
+#   define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT
+#  endif
+# endif
+#endif
+
+#if ! defined(BOOST_CONTEXT_DECL)
+# define BOOST_CONTEXT_DECL
+#endif
+
+#if ! defined(BOOST_CONTEXT_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_CONTEXT_NO_LIB)
+# define BOOST_LIB_NAME boost_context
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+#  define BOOST_DYN_LINK
+# endif
+# include 
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_CONFIG_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp b/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp
new file mode 100644
index 000000000..8b88ccfdd
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp
@@ -0,0 +1,68 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[16];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[11];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp b/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp
new file mode 100644
index 000000000..2e0132355
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp
@@ -0,0 +1,59 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL __attribute__((cdecl))
+
+struct stack_t
+{
+    void            *   sp;
+    std::size_t         size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[6];
+    stack_t             fc_stack;
+    boost::uint32_t     fc_freg[2];
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_freg()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp b/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp
new file mode 100644
index 000000000..4a5ee39e2
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp
@@ -0,0 +1,86 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4351)
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL __cdecl
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+    void    *   limit;
+
+    stack_t() :
+        sp( 0), size( 0), limit( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[2];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[6];
+    stack_t             fc_stack;
+    void            *   fc_excpt_lst;
+    void            *   fc_local_storage;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_excpt_lst( 0),
+        fc_local_storage( 0),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp b/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp
new file mode 100644
index 000000000..d3cd60de4
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp
@@ -0,0 +1,70 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+// on MIPS we assume 64bit regsiters - even for 32bit ABIs
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint64_t     fc_freg[6];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[12];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp b/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp
new file mode 100644
index 000000000..6cb019f54
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp
@@ -0,0 +1,72 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint64_t     fc_freg[19];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+# if defined(__powerpc64__)
+    boost::uint64_t     fc_greg[23];
+# else
+    boost::uint32_t     fc_greg[23];
+# endif
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp b/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp
new file mode 100644
index 000000000..6e8d93c0c
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp
@@ -0,0 +1,68 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[2];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint64_t     fc_greg[8];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp b/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp
new file mode 100644
index 000000000..833e3d01b
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp
@@ -0,0 +1,75 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4351)
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+    void    *   limit;
+
+    stack_t() :
+        sp( 0), size( 0), limit( 0)
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint64_t     fc_greg[10];
+    stack_t             fc_stack;
+    void            *   fc_local_storage;
+    boost::uint64_t     fc_fp[24];
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_local_storage( 0),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
diff --git a/project/jni/boost/include/boost/context/fcontext.hpp b/project/jni/boost/include/boost/context/fcontext.hpp
new file mode 100644
index 000000000..47b29c33a
--- /dev/null
+++ b/project/jni/boost/include/boost/context/fcontext.hpp
@@ -0,0 +1,81 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_FCONTEXT_H
+#define BOOST_CONTEXT_FCONTEXT_H
+
+#if defined(__PGI)
+#include 
+#endif
+
+#if defined(_WIN32_WCE)
+typedef int intptr_t;
+#endif
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+    || defined(__amd64__) || defined(__amd64) \
+    || defined(_M_X64) || defined(_M_AMD64)
+# if defined(BOOST_WINDOWS)
+#  include 
+# else
+#  include 
+# endif
+// i386
+#elif defined(i386) || defined(__i386__) || defined(__i386) \
+    || defined(__i486__) || defined(__i586__) || defined(__i686__) \
+    || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \
+    || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \
+    || defined(_M_IX86) || defined(_I86_)
+# if defined(BOOST_WINDOWS)
+#  include 
+# else
+#  include 
+# endif
+// arm
+#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \
+    || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM)
+# include 
+// mips
+#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \
+    || defined(_R3000)
+# include 
+// powerpc
+#elif defined(__powerpc) || defined(__powerpc__) || defined(__ppc) \
+    || defined(__ppc__) || defined(_ARCH_PPC) || defined(__POWERPC__) \
+    || defined(__PPCGECKO__) || defined(__PPCBROADWAY) || defined(_XENON)
+# include 
+#else
+# error "platform not supported"
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" BOOST_CONTEXT_DECL
+intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true);
+extern "C" BOOST_CONTEXT_DECL
+fcontext_t * BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( intptr_t) );
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_FCONTEXT_H
+
diff --git a/project/jni/boost/include/boost/coroutine/all.hpp b/project/jni/boost/include/boost/coroutine/all.hpp
new file mode 100644
index 000000000..d80ca206b
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/all.hpp
@@ -0,0 +1,15 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_ALL_H
+#define BOOST_COROUTINES_ALL_H
+
+#include 
+#include 
+#include 
+#include 
+
+#endif // BOOST_COROUTINES_ALL_H
diff --git a/project/jni/boost/include/boost/coroutine/attributes.hpp b/project/jni/boost/include/boost/coroutine/attributes.hpp
new file mode 100644
index 000000000..285508242
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/attributes.hpp
@@ -0,0 +1,85 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_ATTRIBUTES_H
+#define BOOST_COROUTINES_ATTRIBUTES_H
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+
+struct attributes
+{
+    std::size_t     size;
+    flag_unwind_t   do_unwind;
+    flag_fpu_t      preserve_fpu;
+
+    attributes() BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( stack_unwind),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( std::size_t size_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( stack_unwind),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( do_unwind_),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( stack_unwind),
+        preserve_fpu( preserve_fpu_)
+    {}
+
+    explicit attributes(
+            std::size_t size_,
+            flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( do_unwind_),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes(
+            std::size_t size_,
+            flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( stack_unwind),
+        preserve_fpu( preserve_fpu_)
+    {}
+
+    explicit attributes(
+            flag_unwind_t do_unwind_,
+            flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( do_unwind_),
+        preserve_fpu( preserve_fpu_)
+    {}
+};
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_ATTRIBUTES_H
diff --git a/project/jni/boost/include/boost/coroutine/coroutine.hpp b/project/jni/boost/include/boost/coroutine/coroutine.hpp
new file mode 100644
index 000000000..b6196edfb
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/coroutine.hpp
@@ -0,0 +1,1405 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_COROUTINE_H
+#define BOOST_COROUTINES_COROUTINE_H
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result = typename function_traits< Signature >::result_type,
+    int arity = function_traits< Signature >::arity
+>
+struct caller;
+
+template<
+    typename Signature,
+    template< class, int > class C
+>
+struct caller< Signature, C, void, 0 >
+{ typedef C< void(), 0 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result
+>
+struct caller< Signature, C, Result, 0 >
+{ typedef C< void( Result), 1 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    int arity
+>
+struct caller< Signature, C, void, arity >
+{ typedef C< typename detail::arg< Signature >::type(), 0 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result, int arity
+>
+struct caller
+{ typedef C< typename detail::arg< Signature >::type( Result), 1 > type; };
+
+}
+
+template< typename Signature, int arity = function_traits< Signature >::arity >
+class coroutine;
+
+template< typename Signature >
+class coroutine< Signature, 0 > : public detail::coroutine_op<
+                                        Signature,
+                                        coroutine< Signature >,
+                                        typename function_traits< Signature >::result_type,
+                                        function_traits< Signature >::arity
+                                  >,
+                                  public detail::coroutine_get<
+                                        coroutine< Signature >,
+                                        typename function_traits< Signature >::result_type,
+                                        function_traits< Signature >::arity
+                                  >
+{
+private:
+    typedef detail::coroutine_base< Signature >                 base_t;
+    typedef typename base_t::ptr_t                              ptr_t;
+
+    template< typename X, typename Y, int >
+    friend struct detail::coroutine_get;
+    template< typename X, typename Y, typename Z, int >
+    friend struct detail::coroutine_op;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class detail::coroutine_object;
+
+    struct dummy
+    { void nonnull() {} };
+
+    typedef void ( dummy::*safe_bool)();
+
+    ptr_t  impl_;
+
+    BOOST_MOVABLE_BUT_NOT_COPYABLE( coroutine);
+
+    template< typename Allocator >
+    coroutine( context::fcontext_t * callee,
+               bool unwind, bool preserve_fpu,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_caller<
+                Signature, Allocator
+        >                               caller_t;
+        typename caller_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) caller_t(
+                callee, unwind, preserve_fpu, a) );
+    }
+
+public:
+    typedef typename detail::caller<
+            Signature,
+            boost::coroutines::coroutine
+    >::type                                                     caller_type;
+
+    coroutine() BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {}
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_MSVC
+    typedef void ( * coroutine_fn) ( caller_type &);
+
+    explicit coroutine( coroutine_fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+       typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator, typename Allocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+#endif
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+#else
+    template< typename Fn >
+    explicit coroutine( Fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+#endif
+
+    coroutine( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    { swap( other); }
+
+    coroutine & operator=( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT
+    {
+        coroutine tmp( boost::move( other) );
+        swap( tmp);
+        return * this;
+    }
+
+    bool empty() const BOOST_NOEXCEPT
+    { return ! impl_; }
+
+    operator safe_bool() const BOOST_NOEXCEPT
+    { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+
+    bool operator!() const BOOST_NOEXCEPT
+    { return empty() || impl_->is_complete(); }
+
+    void swap( coroutine & other) BOOST_NOEXCEPT
+    { impl_.swap( other.impl_); }
+};
+
+template< typename Signature, int arity >
+class coroutine : public detail::coroutine_op<
+                        Signature,
+                        coroutine< Signature >,
+                        typename function_traits< Signature >::result_type,
+                        function_traits< Signature >::arity
+                  >,
+                  public detail::coroutine_get<
+                        coroutine< Signature >,
+                        typename function_traits< Signature >::result_type,
+                        function_traits< Signature >::arity
+                  >
+{
+private:
+    typedef detail::coroutine_base< Signature >                 base_t;
+    typedef typename base_t::ptr_t                              ptr_t;
+
+    template< typename X, typename Y, int >
+    friend struct detail::coroutine_get;
+    template< typename X, typename Y, typename Z, int >
+    friend struct detail::coroutine_op;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class detail::coroutine_object;
+
+    struct dummy
+    { void nonnull() {} };
+
+    typedef void ( dummy::*safe_bool)();
+
+    ptr_t  impl_;
+
+    BOOST_MOVABLE_BUT_NOT_COPYABLE( coroutine);
+
+    template< typename Allocator >
+    coroutine( context::fcontext_t * callee,
+               bool unwind, bool preserve_fpu,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_caller<
+                Signature, Allocator
+            >                               caller_t;
+        typename caller_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) caller_t(
+                callee, unwind, preserve_fpu, a) );
+    }
+
+public:
+    typedef typename detail::caller<
+        Signature,
+        boost::coroutines::coroutine
+    >::type                                                     caller_type;
+    typedef typename detail::arg< Signature >::type             arguments;
+
+    coroutine() BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {}
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_MSVC
+    typedef void ( * coroutine_fn) ( caller_type &);
+
+    explicit coroutine( coroutine_fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    explicit coroutine( coroutine_fn fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+       typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator, typename Allocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+        >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+#endif
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+#else
+    template< typename Fn >
+    explicit coroutine( Fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( Fn fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+#endif
+
+    coroutine( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    { swap( other); }
+
+    coroutine & operator=( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT
+    {
+        coroutine tmp( boost::move( other) );
+        swap( tmp);
+        return * this;
+    }
+
+    bool empty() const BOOST_NOEXCEPT
+    { return ! impl_; }
+
+    operator safe_bool() const BOOST_NOEXCEPT
+    { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+
+    bool operator!() const BOOST_NOEXCEPT
+    { return empty() || impl_->is_complete(); }
+
+    void swap( coroutine & other) BOOST_NOEXCEPT
+    { impl_.swap( other.impl_); }
+};
+
+template< typename Signature >
+void swap( coroutine< Signature > & l, coroutine< Signature > & r) BOOST_NOEXCEPT
+{ l.swap( r); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::iterator
+range_begin( coroutine< Signature > & c)
+{ return typename coroutine< Signature >::iterator( & c); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::const_iterator
+range_begin( coroutine< Signature > const& c)
+{ return typename coroutine< Signature >::const_iterator( & c); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::iterator
+range_end( coroutine< Signature > & c)
+{ return typename coroutine< Signature >::iterator(); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::const_iterator
+range_end( coroutine< Signature > const& c)
+{ return typename coroutine< Signature >::const_iterator(); }
+
+}
+
+template< typename Signature >
+struct range_mutable_iterator< coroutines::coroutine< Signature > >
+{ typedef typename coroutines::coroutine< Signature >::iterator type; };
+
+template< typename Signature >
+struct range_const_iterator< coroutines::coroutine< Signature > >
+{ typedef typename coroutines::coroutine< Signature >::const_iterator type; };
+
+}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_COROUTINE_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/arg.hpp b/project/jni/boost/include/boost/coroutine/detail/arg.hpp
new file mode 100644
index 000000000..f3d35c564
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/arg.hpp
@@ -0,0 +1,61 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_COROUTINES_DETAIL_ARG_H
+#define BOOST_COROUTINES_DETAIL_ARG_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename Signature,
+    int arity = function_traits< Signature >::arity >
+struct arg;
+
+template< typename Signature >
+struct arg< Signature, 1 >
+{
+    typedef typename function_traits< Signature >::arg1_type    type;
+};
+
+#define BOOST_CONTEXT_TUPLE_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_CONTEXT_TUPLE_TYPE(z,n,unused) \
+    BOOST_CONTEXT_TUPLE_COMMA(n) typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_CONTEXT_TUPLE_TYPES(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_CONTEXT_TUPLE_TYPE,~)
+#define BOOST_CONTEXT_TUPLE(z,n,unused) \
+template< typename Signature > \
+struct arg< Signature, n > \
+{ \
+    typedef tuple< BOOST_CONTEXT_TUPLE_TYPES(n) >   type; \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_CONTEXT_TUPLE,~)
+#undef BOOST_CONTEXT_TUPLE
+#undef BOOST_CONTEXT_TUPLE_TYPES
+#undef BOOST_CONTEXT_TUPLE_TYPE
+#undef BOOST_CONTEXT_TUPLE_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_ARG_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/config.hpp b/project/jni/boost/include/boost/coroutine/detail/config.hpp
new file mode 100644
index 000000000..c08a9a3b2
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/config.hpp
@@ -0,0 +1,42 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_CONFIG_H
+#define BOOST_COROUTINES_DETAIL_CONFIG_H
+
+#include 
+#include 
+
+#ifdef BOOST_COROUTINES_DECL
+# undef BOOST_COROUTINES_DECL
+#endif
+
+#if defined(BOOST_HAS_DECLSPEC)
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COROUTINES_DYN_LINK)
+#  if ! defined(BOOST_DYN_LINK)
+#   define BOOST_DYN_LINK
+#  endif
+#  if defined(BOOST_COROUTINES_SOURCE)
+#   define BOOST_COROUTINES_DECL BOOST_SYMBOL_EXPORT
+#  else 
+#   define BOOST_COROUTINES_DECL BOOST_SYMBOL_IMPORT
+#  endif
+# endif
+#endif
+
+#if ! defined(BOOST_COROUTINES_DECL)
+# define BOOST_COROUTINES_DECL
+#endif
+
+#if ! defined(BOOST_COROUTINES_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_COROUTINES_NO_LIB)
+# define BOOST_LIB_NAME boost_context
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COROUTINES_DYN_LINK)
+#  define BOOST_DYN_LINK
+# endif
+# include 
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_CONFIG_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp
new file mode 100644
index 000000000..8f649c54f
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp
@@ -0,0 +1,103 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature >
+class coroutine_base : private noncopyable,
+                       public coroutine_base_resume<
+                            Signature,
+                            coroutine_base< Signature >,
+                            typename function_traits< Signature >::result_type,
+                            function_traits< Signature >::arity
+                       >
+{
+public:
+    typedef intrusive_ptr< coroutine_base >     ptr_t;
+
+private:
+    template< typename X, typename Y, typename Z, int >
+    friend class coroutine_base_resume;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class coroutine_object;
+
+    unsigned int            use_count_;
+    context::fcontext_t     caller_;
+    context::fcontext_t *   callee_;
+    int                     flags_;
+    exception_ptr           except_;
+
+protected:
+    virtual void deallocate_object() = 0;
+
+public:
+    coroutine_base( context::fcontext_t * callee, bool unwind, bool preserve_fpu) :
+        coroutine_base_resume<
+            Signature,
+            coroutine_base< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        use_count_( 0),
+        caller_(),
+        callee_( callee),
+        flags_( 0),
+        except_()
+    {
+        if ( unwind) flags_ |= flag_force_unwind;
+        if ( preserve_fpu) flags_ |= flag_preserve_fpu;
+    }
+
+    virtual ~coroutine_base()
+    {}
+
+    bool force_unwind() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_force_unwind); }
+
+    bool unwind_requested() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_unwind_stack); }
+
+    bool preserve_fpu() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_preserve_fpu); }
+
+    bool is_complete() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_complete); }
+
+    friend inline void intrusive_ptr_add_ref( coroutine_base * p) BOOST_NOEXCEPT
+    { ++p->use_count_; }
+
+    friend inline void intrusive_ptr_release( coroutine_base * p) BOOST_NOEXCEPT
+    { if ( --p->use_count_ == 0) p->deallocate_object(); }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp
new file mode 100644
index 000000000..83a398835
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp
@@ -0,0 +1,237 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename D, typename Result, int arity >
+class coroutine_base_resume;
+
+template< typename Signature, typename D >
+class coroutine_base_resume< Signature, D, void, 0 >
+{
+public:
+    void resume()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+class coroutine_base_resume< Signature, D, Result, 0 >
+{
+public:
+    void resume()
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        result_ = hldr_from->data;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+
+protected:
+    template< typename X, typename Y, int >
+    friend struct coroutine_get;
+
+    optional< Result >  result_;
+};
+
+template< typename Signature, typename D >
+class coroutine_base_resume< Signature, D, void, 1 >
+{
+public:
+    typedef typename arg< Signature >::type     arg_type;
+
+    void resume( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+class coroutine_base_resume< Signature, D, Result, 1 >
+{
+public:
+    typedef typename arg< Signature >::type     arg_type;
+
+    void resume( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        context::fcontext_t caller;
+        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        result_ = hldr_from->data;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+
+protected:
+    template< typename X, typename Y, int >
+    friend struct coroutine_get;
+
+    optional< Result >  result_;
+};
+
+#define BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_COROUTINE_BASE_RESUME_VAL(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_BASE_RESUME_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_VAL,~)
+#define BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) \
+    typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_COROUTINE_BASE_RESUME_ARG(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_BASE_RESUME_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_ARG,~)
+#define BOOST_COROUTINE_BASE_RESUME(z,n,unused) \
+template< typename Signature, typename D > \
+class coroutine_base_resume< Signature, D, void, n > \
+{ \
+public: \
+    typedef typename arg< Signature >::type     arg_type; \
+\
+    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
+        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
+\
+        holder< arg_type > hldr_to( \
+            & static_cast< D * >( this)->caller_, \
+            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
+        holder< void > * hldr_from( \
+            reinterpret_cast< holder< void > * >( context::jump_fcontext( \
+                hldr_to.ctx, \
+                static_cast< D * >( this)->callee_, \
+                reinterpret_cast< intptr_t >( & hldr_to), \
+                static_cast< D * >( this)->preserve_fpu() ) ) ); \
+        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
+        if ( hldr_from->force_unwind) throw forced_unwind(); \
+        if ( static_cast< D * >( this)->except_) \
+            rethrow_exception( static_cast< D * >( this)->except_); \
+    } \
+}; \
+\
+template< typename Signature, typename D, typename Result > \
+class coroutine_base_resume< Signature, D, Result, n > \
+{ \
+public: \
+    typedef typename arg< Signature >::type     arg_type; \
+\
+    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
+        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
+\
+        holder< arg_type > hldr_to( \
+            & static_cast< D * >( this)->caller_, \
+            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
+        holder< Result > * hldr_from( \
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext( \
+                hldr_to.ctx, \
+                static_cast< D * >( this)->callee_, \
+                reinterpret_cast< intptr_t >( & hldr_to), \
+                static_cast< D * >( this)->preserve_fpu() ) ) ); \
+        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
+        result_ = hldr_from->data; \
+        if ( hldr_from->force_unwind) throw forced_unwind(); \
+        if ( static_cast< D * >( this)->except_) \
+            rethrow_exception( static_cast< D * >( this)->except_); \
+    } \
+\
+protected: \
+    template< typename X, typename Y, int > \
+    friend struct coroutine_get; \
+\
+    optional< Result >  result_; \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_BASE_RESUME,~)
+#undef BOOST_COROUTINE_BASE_RESUME
+#undef BOOST_COROUTINE_BASE_RESUME_ARGS
+#undef BOOST_COROUTINE_BASE_RESUME_ARG
+#undef BOOST_COROUTINE_BASE_RESUME_ARG_TYPE
+#undef BOOST_COROUTINE_BASE_RESUME_VALS
+#undef BOOST_COROUTINE_BASE_RESUME_VAL
+#undef BOOST_COROUTINE_BASE_RESUME_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_coroutine_base_resume_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp
new file mode 100644
index 000000000..067aff875
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp
@@ -0,0 +1,57 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
+
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename Allocator >
+class coroutine_caller : public  coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_caller< Signature, Allocator >
+    >::other   allocator_t;
+
+    coroutine_caller( context::fcontext_t * callee, bool unwind, bool preserve_fpu,
+                    allocator_t const& alloc) BOOST_NOEXCEPT :
+        coroutine_base< Signature >( callee, unwind, preserve_fpu),
+        alloc_( alloc)
+    {}
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+
+private:
+    allocator_t   alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_caller * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp
new file mode 100644
index 000000000..c2a333909
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp
@@ -0,0 +1,54 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename D,
+    typename Result, int arity
+>
+struct coroutine_get;
+
+template< typename D, int arity >
+struct coroutine_get< D, void, arity >
+{};
+
+template< typename D, typename Result, int arity >
+struct coroutine_get
+{
+    bool has_result() const
+    { return static_cast< D const* >( this)->impl_->result_; }
+
+    typename param< Result >::type get() const
+    {
+        BOOST_ASSERT( static_cast< D const* >( this)->impl_->result_);
+        return static_cast< D const* >( this)->impl_->result_.get();
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp
new file mode 100644
index 000000000..219be5295
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp
@@ -0,0 +1,79 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Coroutine >
+void trampoline1( intptr_t vp)
+{
+    BOOST_ASSERT( vp);
+
+    reinterpret_cast< Coroutine * >( vp)->run();
+}
+
+template< typename Coroutine, typename Arg >
+void trampoline2( intptr_t vp)
+{
+    BOOST_ASSERT( vp);
+
+    tuple< Coroutine *, Arg > * tpl(
+        reinterpret_cast< tuple< Coroutine *, Arg > * >( vp) );
+    Coroutine * coro( get< 0 >( * tpl) );
+    Arg arg( get< 1 >( * tpl) );
+
+    coro->run( arg);
+}
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object;
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp
new file mode 100644
index 000000000..1186b0d69
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp
@@ -0,0 +1,409 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp
new file mode 100644
index 000000000..5042ccb69
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp
@@ -0,0 +1,553 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp
new file mode 100644
index 000000000..975365ed8
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp
@@ -0,0 +1,553 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp
new file mode 100644
index 000000000..1fad47d8d
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp
@@ -0,0 +1,403 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp
new file mode 100644
index 000000000..76cac246f
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp
@@ -0,0 +1,546 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn,
+                      typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn,
+                      typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp
new file mode 100644
index 000000000..0f0eeeb2a
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp
@@ -0,0 +1,547 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp
new file mode 100644
index 000000000..4bab16f0c
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp
@@ -0,0 +1,312 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename D, typename Result, int arity >
+struct coroutine_op;
+
+template< typename Signature, typename D >
+struct coroutine_op< Signature, D, void, 0 >
+{
+    D & operator()()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume();
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+struct coroutine_op< Signature, D, Result, 0 >
+{
+    class iterator : public std::iterator< std::input_iterator_tag, typename remove_reference< Result >::type >
+    {
+    private:
+        D               *   dp_;
+        optional< Result >  val_;
+
+        void fetch_()
+        {
+            BOOST_ASSERT( dp_);
+
+            if ( ! dp_->has_result() )
+            {
+                dp_ = 0;
+                val_ = none;
+                return;
+            }
+            val_ = dp_->get();
+        }
+
+        void increment_()
+        {
+            BOOST_ASSERT( dp_);
+            BOOST_ASSERT( * dp_);
+
+            ( * dp_)();
+            fetch_();
+        }
+
+    public:
+        typedef typename std::iterator_traits< iterator >::pointer      pointer_t;
+        typedef typename std::iterator_traits< iterator >::reference    reference_t;
+
+        iterator() :
+            dp_( 0), val_()
+        {}
+
+        explicit iterator( D * dp) :
+            dp_( dp), val_()
+        { fetch_(); }
+
+        iterator( iterator const& other) :
+            dp_( other.dp_), val_( other.val_)
+        {}
+
+        iterator & operator=( iterator const& other)
+        {
+            if ( this == & other) return * this;
+            dp_ = other.dp_;
+            val_ = other.val_;
+            return * this;
+        }
+
+        bool operator==( iterator const& other)
+        { return other.dp_ == dp_ && other.val_ == val_; }
+
+        bool operator!=( iterator const& other)
+        { return other.dp_ != dp_ || other.val_ != val_; }
+
+        iterator & operator++()
+        {
+            increment_();
+            return * this;
+        }
+
+        reference_t operator*() const
+        { return const_cast< optional< Result > & >( val_).get(); }
+
+        pointer_t operator->() const
+        { return const_cast< optional< Result > & >( val_).get_ptr(); }
+    };
+
+    class const_iterator : public std::iterator< std::input_iterator_tag, typename remove_reference< const Result >::type >
+    {
+    private:
+        D                       *   dp_;
+        optional< const Result >    val_;
+
+        void fetch_()
+        {
+            BOOST_ASSERT( dp_);
+
+            if ( ! dp_->has_result() )
+            {
+                dp_ = 0;
+                val_ = none;
+                return;
+            }
+            val_ = dp_->get();
+        }
+
+        void increment_()
+        {
+            BOOST_ASSERT( dp_);
+            BOOST_ASSERT( * dp_);
+
+            ( * dp_)();
+            fetch_();
+        }
+
+    public:
+        typedef typename std::iterator_traits< iterator >::pointer      pointer_t;
+        typedef typename std::iterator_traits< iterator >::reference    reference_t;
+
+        const_iterator() :
+            dp_( 0), val_()
+        {}
+
+        explicit const_iterator( D * dp) :
+            dp_( dp), val_()
+        { fetch_(); }
+
+        const_iterator( const_iterator const& other) :
+            dp_( other.dp_), val_( other.val_)
+        {}
+
+        const_iterator & operator=( const_iterator const& other)
+        {
+            if ( this == & other) return * this;
+            dp_ = other.dp_;
+            val_ = other.val_;
+            return * this;
+        }
+
+        bool operator==( const_iterator const& other)
+        { return other.dp_ == dp_ && other.val_ == val_; }
+
+        bool operator!=( const_iterator const& other)
+        { return other.dp_ != dp_ || other.val_ != val_; }
+
+        const_iterator & operator++()
+        {
+            increment_();
+            return * this;
+        }
+
+        reference_t operator*() const
+        { return val_.get(); }
+
+        pointer_t operator->() const
+        { return val_.get_ptr(); }
+    };
+
+    D & operator()()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume();
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D >
+struct coroutine_op< Signature, D, void, 1 >
+{
+    typedef typename arg< Signature >::type   arg_type;
+
+    class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void >
+    {
+    private:
+       D    *   dp_;
+
+    public:
+        iterator() :
+           dp_( 0)
+        {}
+
+        explicit iterator( D * dp) :
+            dp_( dp)
+        {}
+
+        iterator & operator=( arg_type a1)
+        {
+            BOOST_ASSERT( dp_);
+            if ( ! ( * dp_)( a1) ) dp_ = 0;
+            return * this;
+        }
+
+        bool operator==( iterator const& other)
+        { return other.dp_ == dp_; }
+
+        bool operator!=( iterator const& other)
+        { return other.dp_ != dp_; }
+
+        iterator & operator*()
+        { return * this; }
+
+        iterator & operator++()
+        { return * this; }
+    };
+
+    struct const_iterator;
+
+    D & operator()( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume( a1);
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+struct coroutine_op< Signature, D, Result, 1 >
+{
+    typedef typename arg< Signature >::type   arg_type;
+
+    D & operator()( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume( a1);
+
+        return * static_cast< D * >( this);
+    }
+};
+
+#define BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_COROUTINE_OP_VAL(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_OP_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_VAL,~)
+#define BOOST_COROUTINE_OP_ARG_TYPE(n) \
+    typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_COROUTINE_OP_ARG(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_COROUTINE_OP_ARG_TYPE(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_OP_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_ARG,~)
+#define BOOST_COROUTINE_OP(z,n,unused) \
+template< typename Signature, typename D, typename Result > \
+struct coroutine_op< Signature, D, Result, n > \
+{ \
+    D & operator()( BOOST_COROUTINE_OP_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)->impl_); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() ); \
+\
+        static_cast< D * >( this)->impl_->resume(BOOST_COROUTINE_OP_VALS(n)); \
+\
+        return * static_cast< D * >( this); \
+    } \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_OP,~)
+#undef BOOST_COROUTINE_OP
+#undef BOOST_COROUTINE_OP_ARGS
+#undef BOOST_COROUTINE_OP_ARG
+#undef BOOST_COROUTINE_OP_ARG_TYPE
+#undef BOOST_COROUTINE_OP_VALS
+#undef BOOST_COROUTINE_OP_VAL
+#undef BOOST_COROUTINE_OP_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp b/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp
new file mode 100644
index 000000000..39f385407
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp
@@ -0,0 +1,28 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
+#define BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+struct forced_unwind {};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/flags.hpp b/project/jni/boost/include/boost/coroutine/detail/flags.hpp
new file mode 100644
index 000000000..33f2142f7
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/flags.hpp
@@ -0,0 +1,34 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_FLAGS_H
+#define BOOST_COROUTINES_DETAIL_FLAGS_H
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+enum flag_t
+{
+    flag_complete       = 1 << 1,
+    flag_unwind_stack   = 1 << 2,
+    flag_force_unwind   = 1 << 3,
+    flag_preserve_fpu   = 1 << 4
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_FLAGS_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/holder.hpp b/project/jni/boost/include/boost/coroutine/detail/holder.hpp
new file mode 100644
index 000000000..f72115859
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/holder.hpp
@@ -0,0 +1,88 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_HOLDER_H
+#define BOOST_COROUTINES_DETAIL_HOLDER_H
+
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Data >
+struct holder
+{
+    context::fcontext_t *   ctx;
+    optional< Data >        data;
+    bool                    force_unwind;
+
+    holder( context::fcontext_t * ctx_) :
+        ctx( ctx_), data(), force_unwind( false)
+    { BOOST_ASSERT( ctx); }
+
+    holder( context::fcontext_t * ctx_, Data data_) :
+        ctx( ctx_), data( data_), force_unwind( false)
+    { BOOST_ASSERT( ctx); }
+
+    holder( context::fcontext_t * ctx_, bool force_unwind_) :
+        ctx( ctx_), data(), force_unwind( force_unwind_)
+    {
+        BOOST_ASSERT( ctx);
+        BOOST_ASSERT( force_unwind);
+    }
+
+    holder( holder const& other) :
+        ctx( other.ctx), data( other.data),
+        force_unwind( other.force_unwind)
+    {}
+
+    holder & operator=( holder const& other)
+    {
+        if ( this == & other) return * this;
+        ctx = other.ctx;
+        data = other.data;
+        force_unwind = other.force_unwind;
+        return * this;
+    }
+};
+
+template<>
+struct holder< void >
+{
+    context::fcontext_t *   ctx;
+    bool                    force_unwind;
+
+    holder( context::fcontext_t * ctx_, bool force_unwind_ = false) :
+        ctx( ctx_), force_unwind( force_unwind_)
+    { BOOST_ASSERT( ctx); }
+
+    holder( holder const& other) :
+        ctx( other.ctx), force_unwind( other.force_unwind)
+    {}
+
+    holder & operator=( holder const& other)
+    {
+        if ( this == & other) return * this;
+        ctx = other.ctx;
+        force_unwind = other.force_unwind;
+        return * this;
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_HOLDER_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/param.hpp b/project/jni/boost/include/boost/coroutine/detail/param.hpp
new file mode 100644
index 000000000..4e8f1fecb
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/param.hpp
@@ -0,0 +1,46 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_PARAM_H
+#define BOOST_COROUTINES_DETAIL_PARAM_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename T >
+struct param : 
+    public mpl::eval_if<
+        mpl::or_<
+            is_scalar< T >,
+            is_stateless< T >,
+            is_reference< T >
+        >,
+        mpl::identity< T >,
+        add_reference< T >
+    >
+{};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_PARAM_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp
new file mode 100644
index 000000000..2dac80108
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp
@@ -0,0 +1,165 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+
+#include 
+
+extern "C" {
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+}
+
+//#if _POSIX_C_SOURCE >= 200112L
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#if !defined (SIGSTKSZ)
+# define SIGSTKSZ (8 * 1024)
+# define UDEF_SIGSTKSZ
+#endif
+
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+inline
+std::size_t pagesize()
+{
+    // conform to POSIX.1-2001
+    static std::size_t size = ::sysconf( _SC_PAGESIZE);
+    return size;
+}
+
+inline
+rlimit stacksize_limit_()
+{
+    rlimit limit;
+    // conforming to POSIX.1-2001
+    const int result = ::getrlimit( RLIMIT_STACK, & limit);
+    BOOST_ASSERT( 0 == result);
+    return limit;
+}
+
+inline
+rlimit stacksize_limit()
+{
+    static rlimit limit = stacksize_limit_();
+    return limit;
+}
+
+inline
+std::size_t page_count( std::size_t stacksize)
+{
+    return static_cast< std::size_t >( 
+        std::ceil(
+            static_cast< float >( stacksize) / pagesize() ) );
+}
+
+class stack_allocator
+{
+public:
+    static bool is_stack_unbound()
+    { return RLIM_INFINITY == stacksize_limit().rlim_max; }
+
+    static std::size_t default_stacksize()
+    {
+        std::size_t size = 8 * minimum_stacksize();
+        if ( is_stack_unbound() ) return size;
+        
+        BOOST_ASSERT( maximum_stacksize() >= minimum_stacksize() );
+        return maximum_stacksize() == size
+            ? size
+            : (std::min)( size, maximum_stacksize() );
+    }
+
+    static std::size_t minimum_stacksize()
+    { return SIGSTKSZ + sizeof( context::fcontext_t) + 15; }
+
+    static std::size_t maximum_stacksize()
+    {
+        BOOST_ASSERT( ! is_stack_unbound() );
+        return static_cast< std::size_t >( stacksize_limit().rlim_max);
+    }
+
+    void * allocate( std::size_t size) const
+    {
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages( page_count( size) + 1); // add one guard page
+        const std::size_t size_( pages * pagesize() );
+        BOOST_ASSERT( 0 < size && 0 < size_);
+
+        const int fd( ::open("/dev/zero", O_RDONLY) );
+        BOOST_ASSERT( -1 != fd);
+        // conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
+        void * limit =
+# if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+        ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+# else
+        ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+# endif
+        ::close( fd);
+        if ( ! limit) throw std::bad_alloc();
+
+        std::memset( limit, size_, '\0');
+
+        // conforming to POSIX.1-2001
+        const int result( ::mprotect( limit, pagesize(), PROT_NONE) );
+        BOOST_ASSERT( 0 == result);
+
+        return static_cast< char * >( limit) + size_;
+    }
+
+    void deallocate( void * vp, std::size_t size) const
+    {
+        BOOST_ASSERT( vp);
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages = page_count( size) + 1;
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+        void * limit = static_cast< char * >( vp) - size_;
+        // conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
+        ::munmap( limit, size_);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#ifdef UDEF_SIGSTKSZ
+# undef SIGSTKSZ
+#endif
+
+//#endif
+
+#endif // BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp
new file mode 100644
index 000000000..7cbdcbe5b
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp
@@ -0,0 +1,158 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+
+#include 
+
+extern "C" {
+#include 
+}
+
+//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+# if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable:4244 4267)
+# endif
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+    || defined(__amd64__) || defined(__amd64) \
+    || defined(_M_X64) || defined(_M_AMD64)
+
+// Windows seams not to provide a constant or function
+// telling the minimal stacksize
+# define MIN_STACKSIZE  8 * 1024
+#else
+# define MIN_STACKSIZE  4 * 1024
+#endif
+
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+inline
+SYSTEM_INFO system_info_()
+{
+    SYSTEM_INFO si;
+    ::GetSystemInfo( & si);
+    return si;
+}
+
+inline
+SYSTEM_INFO system_info()
+{
+    static SYSTEM_INFO si = system_info_();
+    return si;
+}
+
+inline
+std::size_t pagesize()
+{ return static_cast< std::size_t >( system_info().dwPageSize); }
+
+inline
+std::size_t page_count( std::size_t stacksize)
+{
+    return static_cast< std::size_t >(
+        std::ceil(
+            static_cast< float >( stacksize) / pagesize() ) );
+}
+
+class stack_allocator
+{
+public:
+    // Windows seams not to provide a limit for the stacksize
+    static bool is_stack_unbound()
+    { return true; }
+
+    static std::size_t default_stacksize()
+    {
+        std::size_t size = 64 * 1024; // 64 kB
+        if ( is_stack_unbound() )
+            return (std::max)( size, minimum_stacksize() );
+
+        BOOST_ASSERT( maximum_stacksize() >= minimum_stacksize() );
+        return maximum_stacksize() == minimum_stacksize()
+            ? minimum_stacksize()
+            : ( std::min)( size, maximum_stacksize() );
+    }
+
+    // because Windows seams not to provide a limit for minimum stacksize
+    static std::size_t minimum_stacksize()
+    { return MIN_STACKSIZE; }
+
+    // because Windows seams not to provide a limit for maximum stacksize
+    // maximum_stacksize() can never be called (pre-condition ! is_stack_unbound() )
+    static std::size_t maximum_stacksize()
+    {
+        BOOST_ASSERT( ! is_stack_unbound() );
+        return  1 * 1024 * 1024 * 1024; // 1GB
+    }
+
+    void * allocate( std::size_t size) const
+    {
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages( page_count( size) + 1); // add one guard page
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+
+        void * limit = ::VirtualAlloc( 0, size_, MEM_COMMIT, PAGE_READWRITE);
+        if ( ! limit) throw std::bad_alloc();
+
+        std::memset( limit, size_, '\0');
+
+        DWORD old_options;
+        const BOOL result = ::VirtualProtect(
+            limit, pagesize(), PAGE_READWRITE | PAGE_GUARD /*PAGE_NOACCESS*/, & old_options);
+        BOOST_ASSERT( FALSE != result);
+
+        return static_cast< char * >( limit) + size_;
+    }
+
+    void deallocate( void * vp, std::size_t size) const
+    {
+        BOOST_ASSERT( vp);
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages = page_count( size) + 1;
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+        void * limit = static_cast< char * >( vp) - size_;
+        ::VirtualFree( limit, 0, MEM_RELEASE);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+//#endif
+
+#endif // BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/coroutine/flags.hpp b/project/jni/boost/include/boost/coroutine/flags.hpp
new file mode 100644
index 000000000..a8194c60e
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/flags.hpp
@@ -0,0 +1,27 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_FLAGS_H
+#define BOOST_COROUTINES_FLAGS_H
+
+namespace boost {
+namespace coroutines {
+
+enum flag_unwind_t
+{
+    stack_unwind = 0,
+    no_stack_unwind
+};
+
+enum flag_fpu_t
+{
+    fpu_preserved = 0,
+    fpu_not_preserved
+};
+
+}}
+
+#endif // BOOST_COROUTINES_FLAGS_H
diff --git a/project/jni/boost/include/boost/coroutine/stack_allocator.hpp b/project/jni/boost/include/boost/coroutine/stack_allocator.hpp
new file mode 100644
index 000000000..6d8058342
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/stack_allocator.hpp
@@ -0,0 +1,23 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_STACK_ALLOCATOR_H
+
+#include 
+
+#if defined (BOOST_WINDOWS)
+#include 
+#else
+#include 
+#endif
+
+namespace boost {
+namespace coroutines {
+using detail::stack_allocator;
+}}
+
+#endif // BOOST_COROUTINES_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/date_time.hpp b/project/jni/boost/include/boost/date_time.hpp
index c9666222e..07715262c 100644
--- a/project/jni/boost/include/boost/date_time.hpp
+++ b/project/jni/boost/include/boost/date_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
  
  //  See www.boost.org/libs/date_time for documentation.
diff --git a/project/jni/boost/include/boost/date_time/adjust_functors.hpp b/project/jni/boost/include/boost/date_time/adjust_functors.hpp
index 7854ae4b7..dde8ca859 100644
--- a/project/jni/boost/include/boost/date_time/adjust_functors.hpp
+++ b/project/jni/boost/include/boost/date_time/adjust_functors.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/date.hpp"
diff --git a/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp b/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
index f8025828f..45e96d3af 100644
--- a/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
+++ b/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 /*! @file c_local_time_adjustor.hpp
diff --git a/project/jni/boost/include/boost/date_time/c_time.hpp b/project/jni/boost/include/boost/date_time/c_time.hpp
index f19e78576..f7e116b2d 100644
--- a/project/jni/boost/include/boost/date_time/c_time.hpp
+++ b/project/jni/boost/include/boost/date_time/c_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/compiler_config.hpp b/project/jni/boost/include/boost/date_time/compiler_config.hpp
index 304748f25..1aa1330f6 100644
--- a/project/jni/boost/include/boost/date_time/compiler_config.hpp
+++ b/project/jni/boost/include/boost/date_time/compiler_config.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2011-07-26 13:40:21 -0400 (Tue, 26 Jul 2011) $
+ * $Date: 2011-07-26 10:40:21 -0700 (Tue, 26 Jul 2011) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/constrained_value.hpp b/project/jni/boost/include/boost/date_time/constrained_value.hpp
index b273dd5aa..7338105e2 100644
--- a/project/jni/boost/include/boost/date_time/constrained_value.hpp
+++ b/project/jni/boost/include/boost/date_time/constrained_value.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date.hpp b/project/jni/boost/include/boost/date_time/date.hpp
index 1056fb6a7..f77ae29d5 100644
--- a/project/jni/boost/include/boost/date_time/date.hpp
+++ b/project/jni/boost/include/boost/date_time/date.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -191,8 +191,8 @@ namespace date_time {
       dates.  It is not exposed to users since that would require class
       users to understand the inner workings of the date class.
     */
-    explicit date(date_int_type days) : days_(days) {};
-    explicit date(date_rep_type days) : days_(days.as_number()) {};
+    explicit date(date_int_type days) : days_(days) {}
+    explicit date(date_rep_type days) : days_(days.as_number()) {}
     date_int_type days_;
 
   };
diff --git a/project/jni/boost/include/boost/date_time/date_clock_device.hpp b/project/jni/boost/include/boost/date_time/date_clock_device.hpp
index 6ccb26e25..6202f6c58 100644
--- a/project/jni/boost/include/boost/date_time/date_clock_device.hpp
+++ b/project/jni/boost/include/boost/date_time/date_clock_device.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/c_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_defs.hpp b/project/jni/boost/include/boost/date_time/date_defs.hpp
index bc25b56c0..ae7e4c5a0 100644
--- a/project/jni/boost/include/boost/date_time/date_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/date_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_duration.hpp b/project/jni/boost/include/boost/date_time/date_duration.hpp
index 3871aac0c..c57394457 100644
--- a/project/jni/boost/include/boost/date_time/date_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/date_duration.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_DURATION__
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -26,14 +26,14 @@ namespace date_time {
             , boost::subtractable1< date_duration< duration_rep_traits >
             , boost::dividable2< date_duration< duration_rep_traits >, int
             > > > > >
-  { 
+  {
   public:
     typedef typename duration_rep_traits::int_type duration_rep_type;
     typedef typename duration_rep_traits::impl_type duration_rep;
-    
+
     //! Construct from a day count
-    explicit date_duration(duration_rep day_count) : days_(day_count) {};
-    
+    explicit date_duration(duration_rep day_count) : days_(day_count) {}
+
     /*! construct from special_values - only works when
      * instantiated with duration_traits_adapted */
     date_duration(special_values sv) :
@@ -125,7 +125,7 @@ namespace date_time {
   {
     typedef long int_type;
     typedef long impl_type;
-    static int_type as_number(impl_type i) { return i; };
+    static int_type as_number(impl_type i) { return i; }
   };
 
   /*! Struct for instantiating date_duration WITH special values
@@ -135,9 +135,9 @@ namespace date_time {
   {
     typedef long int_type;
     typedef boost::date_time::int_adapter impl_type;
-    static int_type as_number(impl_type i) { return i.as_number(); };
+    static int_type as_number(impl_type i) { return i.as_number(); }
   };
-  
+
 
 } } //namspace date_time
 
diff --git a/project/jni/boost/include/boost/date_time/date_duration_types.hpp b/project/jni/boost/include/boost/date_time/date_duration_types.hpp
index 1512c0ef2..e44c59fff 100644
--- a/project/jni/boost/include/boost/date_time/date_duration_types.hpp
+++ b/project/jni/boost/include/boost/date_time/date_duration_types.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
                                                                                 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_facet.hpp b/project/jni/boost/include/boost/date_time/date_facet.hpp
index 3eda4c7d0..fc2ddc246 100644
--- a/project/jni/boost/include/boost/date_time/date_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/date_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author:  Martin Andrian, Jeff Garland, Bart Garst
- * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include 
@@ -208,7 +208,8 @@ namespace boost { namespace date_time {
       //  return do_put_special(next, a_ios, fill_char, d.as_special());
       //}
       //The following line of code required the date to support a to_tm function
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_mon = m - 1;
       return do_put_tm(next, a_ios, fill_char, dtm, m_month_format);
     }
@@ -219,7 +220,8 @@ namespace boost { namespace date_time {
                 char_type fill_char,
                 const day_type& day) const
     {
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_mday = day.as_number();
       char_type tmp[3] = {'%','d'};
       string_type temp_format(tmp);
@@ -235,7 +237,8 @@ namespace boost { namespace date_time {
       //  return do_put_special(next, a_ios, fill_char, d.as_special());
       //}
       //The following line of code required the date to support a to_tm function
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_wday = dow;
       return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format);
     }
diff --git a/project/jni/boost/include/boost/date_time/date_format_simple.hpp b/project/jni/boost/include/boost/date_time/date_format_simple.hpp
index be21ce4a5..05119c441 100644
--- a/project/jni/boost/include/boost/date_time/date_format_simple.hpp
+++ b/project/jni/boost/include/boost/date_time/date_format_simple.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/parse_format_base.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_formatting.hpp b/project/jni/boost/include/boost/date_time/date_formatting.hpp
index f9721a3d8..06709bc5e 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/iso_format.hpp"
@@ -54,7 +54,9 @@ namespace date_time {
           os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
           break;
         }
-     
+        default:
+          break;
+          
       }
       return os;
     } // format_month
diff --git a/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp b/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
index 38fee07b9..5721473ba 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/iso_format.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp b/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
index 4ac9c4e40..e3aec4967 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp b/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
index 88cd7e1ab..159cf36eb 100644
--- a/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_generator_parser.hpp b/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
index f11eb42d5..7cff9ca36 100644
--- a/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_generators.hpp b/project/jni/boost/include/boost/date_time/date_generators.hpp
index 1f1a34a66..6d3a4ac0b 100644
--- a/project/jni/boost/include/boost/date_time/date_generators.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generators.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_GENERATORS_HPP__
 
 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
- * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * Author: Jeff Garland, Bart Garst
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 /*! @file date_generators.hpp
@@ -34,16 +34,16 @@ namespace date_time {
   public:
     typedef typename date_type::calendar_type calendar_type;
     typedef typename calendar_type::year_type        year_type;
-    year_based_generator() {};
-    virtual ~year_based_generator() {};
+    year_based_generator() {}
+    virtual ~year_based_generator() {}
     virtual date_type get_date(year_type y) const = 0;
     //! Returns a string for use in a POSIX time_zone string
     virtual std::string to_string() const =0;
   };
-  
+
   //! Generates a date by applying the year to the given month and day.
   /*!
-    Example usage: 
+    Example usage:
     @code
     partial_date pd(1, Jan);
     partial_date pd2(70);
@@ -123,9 +123,9 @@ namespace date_time {
      //months are equal
      return (day_ < rhs.day_);
    }
-   
+
    // added for streaming purposes
-   month_type month() const 
+   month_type month() const
    {
      return month_;
    }
@@ -135,15 +135,15 @@ namespace date_time {
    }
 
    //! Returns string suitable for use in POSIX time zone string
-   /*! Returns string formatted with up to 3 digits: 
-    * Jan-01 == "0" 
+   /*! Returns string formatted with up to 3 digits:
+    * Jan-01 == "0"
     * Feb-29 == "58"
     * Dec-31 == "365" */
    virtual std::string to_string() const
    {
      std::ostringstream ss;
      date_type d(2004, month_, day_);
-     unsigned short c = d.day_of_year();     
+     unsigned short c = d.day_of_year();
      c--; // numbered 0-365 while day_of_year is 1 based...
      ss << c;
      return ss.str();
@@ -161,7 +161,7 @@ namespace date_time {
   /*! Based on the idea in Cal. Calc. for finding holidays that are
    *  the 'first Monday of September'. When instantiated with
    *  'fifth' kday of month, the result will be the last kday of month
-   *  which can be the fourth or fifth depending on the structure of 
+   *  which can be the fourth or fifth depending on the structure of
    *  the month.
    *
    *  The algorithm here basically guesses for the first
@@ -169,8 +169,8 @@ namespace date_time {
    *  type.  That is, if the first of the month is a Tuesday
    *  and it needs Wenesday then we simply increment by a day
    *  and then we can add the length of a week until we get
-   *  to the 'nth kday'.  There are probably more efficient 
-   *  algorithms based on using a mod 7, but this one works 
+   *  to the 'nth kday'.  There are probably more efficient
+   *  algorithms based on using a mod 7, but this one works
    *  reasonably well for basic applications.
    *  \ingroup date_alg
    */
@@ -233,7 +233,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
      std::ostringstream ss;
-     ss << 'M' 
+     ss << 'M'
        << static_cast(month_) << '.'
        << static_cast(wn_) << '.'
        << static_cast(dow_);
@@ -244,7 +244,7 @@ namespace date_time {
     week_num wn_;
     day_of_week_type dow_;
   };
-  
+
   //! Useful generator functor for finding holidays and daylight savings
   /*! Similar to nth_kday_of_month, but requires less paramters
    *  \ingroup date_alg
@@ -290,7 +290,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
      std::ostringstream ss;
-     ss << 'M' 
+     ss << 'M'
        << static_cast(month_) << '.'
        << 1 << '.'
        << static_cast(dow_);
@@ -300,9 +300,9 @@ namespace date_time {
     month_type month_;
     day_of_week_type dow_;
   };
-  
-  
-  
+
+
+
   //! Calculate something like Last Sunday of January
   /*! Useful generator functor for finding holidays and daylight savings
    *  Get the last day of the month and then calculate the difference
@@ -351,7 +351,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
       std::ostringstream ss;
-      ss << 'M' 
+      ss << 'M'
          << static_cast(month_) << '.'
          << 5 << '.'
          << static_cast(dow_);
@@ -361,8 +361,8 @@ namespace date_time {
     month_type month_;
     day_of_week_type dow_;
    };
-  
-  
+
+
   //! Calculate something like "First Sunday after Jan 1,2002
   /*! Date generator that takes a date and finds kday after
    *@code
@@ -400,7 +400,7 @@ namespace date_time {
   private:
     day_of_week_type dow_;
   };
-  
+
   //! Calculate something like "First Sunday before Jan 1,2002
   /*! Date generator that takes a date and finds kday after
    *@code
@@ -438,10 +438,10 @@ namespace date_time {
   private:
     day_of_week_type dow_;
   };
-  
+
   //! Calculates the number of days until the next weekday
   /*! Calculates the number of days until the next weekday.
-   * If the date given falls on a Sunday and the given weekday 
+   * If the date given falls on a Sunday and the given weekday
    * is Tuesday the result will be 2 days */
   template
   inline
@@ -458,8 +458,8 @@ namespace date_time {
 
   //! Calculates the number of days since the previous weekday
   /*! Calculates the number of days since the previous weekday
-   * If the date given falls on a Sunday and the given weekday 
-   * is Tuesday the result will be 5 days. The answer will be a positive 
+   * If the date given falls on a Sunday and the given weekday
+   * is Tuesday the result will be 5 days. The answer will be a positive
    * number because Tuesday is 5 days before Sunday, not -5 days before. */
   template
   inline
@@ -477,9 +477,9 @@ namespace date_time {
   }
 
   //! Generates a date object representing the date of the following weekday from the given date
-  /*! Generates a date object representing the date of the following 
-   * weekday from the given date. If the date given is 2004-May-9 
-   * (a Sunday) and the given weekday is Tuesday then the resulting date 
+  /*! Generates a date object representing the date of the following
+   * weekday from the given date. If the date given is 2004-May-9
+   * (a Sunday) and the given weekday is Tuesday then the resulting date
    * will be 2004-May-11. */
   template
   inline
@@ -489,9 +489,9 @@ namespace date_time {
   }
 
   //! Generates a date object representing the date of the previous weekday from the given date
-  /*! Generates a date object representing the date of the previous 
-   * weekday from the given date. If the date given is 2004-May-9 
-   * (a Sunday) and the given weekday is Tuesday then the resulting date 
+  /*! Generates a date object representing the date of the previous
+   * weekday from the given date. If the date given is 2004-May-9
+   * (a Sunday) and the given weekday is Tuesday then the resulting date
    * will be 2004-May-4. */
   template
   inline
diff --git a/project/jni/boost/include/boost/date_time/date_iterator.hpp b/project/jni/boost/include/boost/date_time/date_iterator.hpp
index 284dc749d..c8ec50eeb 100644
--- a/project/jni/boost/include/boost/date_time/date_iterator.hpp
+++ b/project/jni/boost/include/boost/date_time/date_iterator.hpp
@@ -2,11 +2,11 @@
 #define DATE_ITERATOR_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -32,7 +32,7 @@ namespace date_time {
   template
   class date_itr_base {
   // works, but benefit unclear at the moment
-  //   class date_itr_base : public std::iterator{
   public:
     typedef typename date_type::duration_type duration_type;
@@ -40,31 +40,31 @@ namespace date_time {
     typedef std::input_iterator_tag iterator_category;
 
     date_itr_base(date_type d) : current_(d) {}
-    virtual ~date_itr_base() {};
-    date_itr_base& operator++() 
+    virtual ~date_itr_base() {}
+    date_itr_base& operator++()
     {
       current_ = current_ + get_offset(current_);
       return *this;
     }
-    date_itr_base& operator--() 
+    date_itr_base& operator--()
     {
       current_ = current_ + get_neg_offset(current_);
       return *this;
     }
     virtual duration_type get_offset(const date_type& current) const=0;
     virtual duration_type get_neg_offset(const date_type& current) const=0;
-    date_type operator*() {return current_;};
-    date_type* operator->() {return ¤t_;};
+    date_type operator*() {return current_;}
+    date_type* operator->() {return ¤t_;}
     bool operator<  (const date_type& d) {return current_ < d;}
     bool operator<= (const date_type& d) {return current_ <= d;}
     bool operator>  (const date_type& d) {return current_ > d;}
     bool operator>= (const date_type& d) {return current_ >= d;}
     bool operator== (const date_type& d) {return current_ == d;}
-    bool operator!= (const date_type& d) {return current_ != d;}    
+    bool operator!= (const date_type& d) {return current_ != d;}
   private:
     date_type current_;
   };
-  
+
   //! Overrides the base date iterator providing hook for functors
   /*
    *  offset_functor
@@ -77,9 +77,9 @@ namespace date_time {
   class date_itr : public date_itr_base {
   public:
     typedef typename date_type::duration_type duration_type;
-    date_itr(date_type d, int factor=1) : 
-      date_itr_base(d), 
-      of_(factor) 
+    date_itr(date_type d, int factor=1) :
+      date_itr_base(d),
+      of_(factor)
     {}
   private:
     virtual duration_type get_offset(const date_type& current) const
@@ -92,9 +92,9 @@ namespace date_time {
     }
     offset_functor of_;
   };
-  
 
-  
+
+
 } } //namespace date_time
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_names_put.hpp b/project/jni/boost/include/boost/date_time/date_names_put.hpp
index c6f0ce2a6..32aeb36f5 100644
--- a/project/jni/boost/include/boost/date_time/date_names_put.hpp
+++ b/project/jni/boost/include/boost/date_time/date_names_put.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_NAMES_PUT_HPP___
 
 /* Copyright (c) 2002-2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
- * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * Author: Jeff Garland, Bart Garst
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -27,22 +27,22 @@ namespace date_time {
     //! Output facet base class for gregorian dates.
     /*! This class is a base class for date facets used to localize the
      *  names of months and the names of days in the week.
-     * 
+     *
      * Requirements of Config
-     *  - define an enumeration month_enum that enumerates the months. 
+     *  - define an enumeration month_enum that enumerates the months.
      *    The enumeration should be '1' based eg: Jan==1
      *  - define as_short_string and as_long_string
      *
      * (see langer & kreft p334).
-     * 
+     *
      */
     template >
     class date_names_put : public std::locale::facet
     {
     public:
-      date_names_put() {};
+      date_names_put() {}
       typedef OutputIterator iter_type;
       typedef typename Config::month_type month_type;
       typedef typename Config::month_enum month_enum;
@@ -118,7 +118,7 @@ namespace date_time {
         put_string(oitr, gm.as_short_string(c));
       }
       //! Default facet implementation uses month_type defaults
-      virtual void do_put_month_long(iter_type& oitr, 
+      virtual void do_put_month_long(iter_type& oitr,
                                      month_enum moy) const
       {
         month_type gm(moy);
@@ -160,7 +160,7 @@ namespace date_time {
         string_type s(separator); //put in '-'
         put_string(oitr, s);
       }
-      //! Default for date order 
+      //! Default for date order
       virtual ymd_order_spec do_date_order() const
       {
         return ymd_order_iso;
@@ -186,27 +186,27 @@ namespace date_time {
         }
       }
     };
-    
+
     template
-    const typename date_names_put::char_type 
-    date_names_put::default_special_value_names[3][17] = { 
+    const typename date_names_put::char_type
+    date_names_put::default_special_value_names[3][17] = {
       {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
       {'-','i','n','f','i','n','i','t','y'},
       {'+','i','n','f','i','n','i','t','y'} };
 
     template
-    const typename date_names_put::char_type 
-    date_names_put::separator[2] = 
+    const typename date_names_put::char_type
+    date_names_put::separator[2] =
       {'-', '\0'} ;
-    
 
-    //! Generate storage location for a std::locale::id 
+
+    //! Generate storage location for a std::locale::id
     template
     std::locale::id date_names_put::id;
 
     //! A date name output facet that takes an array of char* to define strings
     template >
     class all_date_names_put : public date_names_put
     {
@@ -230,29 +230,29 @@ namespace date_time {
         separator_char_[0] = separator_char;
         separator_char_[1] = '\0';
 
-      };
+      }
       typedef OutputIterator iter_type;
       typedef typename Config::month_enum month_enum;
       typedef typename Config::weekday_enum weekday_enum;
       typedef typename Config::special_value_enum special_value_enum;
 
-      const charT* const* get_short_month_names() const 
+      const charT* const* get_short_month_names() const
       {
         return month_short_names_;
       }
-      const charT* const* get_long_month_names() const 
+      const charT* const* get_long_month_names() const
       {
         return month_long_names_;
       }
-      const charT* const* get_special_value_names() const 
+      const charT* const* get_special_value_names() const
       {
         return special_value_names_;
       }
-      const charT* const* get_short_weekday_names()const  
+      const charT* const* get_short_weekday_names()const
       {
         return weekday_short_names_;
       }
-      const charT* const* get_long_weekday_names()const 
+      const charT* const* get_long_weekday_names()const
       {
         return weekday_long_names_;
       }
@@ -263,7 +263,7 @@ namespace date_time {
       {
         this->put_string(oitr, month_short_names_[moy-1]);
       }
-      //! Long month names 
+      //! Long month names
       virtual void do_put_month_long(iter_type& oitr, month_enum moy) const
       {
         this->put_string(oitr, month_long_names_[moy-1]);
@@ -310,7 +310,7 @@ namespace date_time {
       const charT* const* weekday_long_names_;
       charT separator_char_[2];
       ymd_order_spec order_spec_;
-      month_format_spec month_format_spec_;      
+      month_format_spec month_format_spec_;
     };
 
 } } //namespace boost::date_time
diff --git a/project/jni/boost/include/boost/date_time/date_parsing.hpp b/project/jni/boost/include/boost/date_time/date_parsing.hpp
index f361bc809..35ec8e43c 100644
--- a/project/jni/boost/include/boost/date_time/date_parsing.hpp
+++ b/project/jni/boost/include/boost/date_time/date_parsing.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include 
@@ -148,6 +148,7 @@ namespace date_time {
             day = boost::lexical_cast(*beg);
             break;
           }
+          default: break;
         } //switch
       }
       return date_type(year, month, day);
@@ -180,6 +181,7 @@ namespace date_time {
         case 0: y = i; break;
         case 1: m = i; break;
         case 2: d = i; break;
+        default:       break;
         }
         pos++;
       }
diff --git a/project/jni/boost/include/boost/date_time/dst_rules.hpp b/project/jni/boost/include/boost/date_time/dst_rules.hpp
index 20cb40b67..cf65c1622 100644
--- a/project/jni/boost/include/boost/date_time/dst_rules.hpp
+++ b/project/jni/boost/include/boost/date_time/dst_rules.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 /*! @file dst_rules.hpp
@@ -371,7 +371,7 @@ namespace boost {
         return is_not_in_dst;
       }
 
-      static bool is_dst_boundary_day(date_type d)
+      static bool is_dst_boundary_day(date_type /*d*/)
       {
         return false;
       }
diff --git a/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp b/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
index 6c4da1c3c..16c1fd636 100644
--- a/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
+++ b/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
@@ -18,7 +18,7 @@ namespace date_time {
     {
     public:
       typedef typename date_type::year_type year_type;
-      virtual ~dst_day_calc_rule() {};
+      virtual ~dst_day_calc_rule() {}
       virtual date_type start_day(year_type y) const=0;
       virtual std::string start_rule_as_string() const=0;
       virtual date_type end_day(year_type y) const=0;
diff --git a/project/jni/boost/include/boost/date_time/filetime_functions.hpp b/project/jni/boost/include/boost/date_time/filetime_functions.hpp
index 03f63f85d..3c7f13f38 100644
--- a/project/jni/boost/include/boost/date_time/filetime_functions.hpp
+++ b/project/jni/boost/include/boost/date_time/filetime_functions.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 /*! @file filetime_functions.hpp
diff --git a/project/jni/boost/include/boost/date_time/format_date_parser.hpp b/project/jni/boost/include/boost/date_time/format_date_parser.hpp
index a4a4d0dfb..0c3503f85 100644
--- a/project/jni/boost/include/boost/date_time/format_date_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/format_date_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 
@@ -256,7 +256,6 @@ class format_date_parser
     
     // skip leading whitespace
     while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } 
-    charT current_char = *sitr;
 
     short year(0), month(0), day(0), day_of_year(0);// wkday(0); 
     /* Initialized the following to their minimum values. These intermediate 
@@ -290,7 +289,6 @@ class format_date_parser
               }
               wkday = mr.current_match;
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -310,7 +308,6 @@ class format_date_parser
               }
               wkday = mr.current_match;
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -326,7 +323,6 @@ class format_date_parser
               }
               t_month = month_type(mr.current_match);
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -342,7 +338,6 @@ class format_date_parser
               }
               t_month = month_type(mr.current_match);
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -438,7 +433,6 @@ class format_date_parser
         itr++;
         if (use_current_char) {
           use_current_char = false;
-          current_char = *sitr;
         }
         else {
           sitr++;
diff --git a/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp b/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
index c505bddf5..33f6856bf 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $
+ * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp b/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
index 786e79f2c..eda7dc34b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/compiler_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp b/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
index 4531ebec1..8dfd2d0c6 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
index 483ead501..e9c1852e0 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
index ad67c0ce2..860a407c9 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
index 92ea6ab07..4ea829fbe 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
index 36b22c2b7..2f8874d2b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
index fd7554201..a9c0c171b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
index 3d1ce6218..8328ca303 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
@@ -5,7 +5,7 @@
  * Subject to Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
index 9c3877ed0..9efc61951 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $
+ * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
index fc9c86148..b48a8a891 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
index e427a48a2..2cfad93c4 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-11-11 15:19:38 -0500 (Thu, 11 Nov 2010) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
@@ -22,6 +22,7 @@
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period)
+BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_year)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday)
@@ -87,7 +88,7 @@ void load(Archive & ar,
 
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 ::boost::gregorian::date* dp, 
                                 const unsigned int /*file_version*/)
 {
@@ -116,7 +117,7 @@ void load(Archive & ar, gregorian::date_duration & dd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_duration* dd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration* dd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(dd) gregorian::date_duration(gregorian::not_a_date_time);
@@ -142,7 +143,7 @@ void load(Archive & ar, gregorian::date_duration::duration_rep & dr, unsigned in
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_duration::duration_rep* dr, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration::duration_rep* dr, 
                                 const unsigned int /*file_version*/)
 {
   ::new(dr) gregorian::date_duration::duration_rep(0);
@@ -178,7 +179,7 @@ void load(Archive & ar, gregorian::date_period& dp, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_period* dp, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_period* dp, 
                                 const unsigned int /*file_version*/)
 {
   gregorian::date d(gregorian::not_a_date_time);
@@ -186,6 +187,32 @@ inline void load_construct_data(Archive & ar, gregorian::date_period* dp,
   ::new(dp) gregorian::date_period(d,dd);
 }
 
+/**** greg_year ****/
+
+//! Function to save gregorian::greg_year objects using serialization lib
+template
+void save(Archive & ar, const gregorian::greg_year& gy, 
+          unsigned int /*version*/)
+{
+  unsigned short us = gy;
+  ar & make_nvp("greg_year", us);
+}
+//! Function to load gregorian::greg_year objects using serialization lib
+template
+void load(Archive & ar, gregorian::greg_year& gy, unsigned int /*version*/)
+{
+  unsigned short us;
+  ar & make_nvp("greg_year", us);
+  gy = gregorian::greg_year(us);
+}
+//!override needed b/c no default constructor
+template
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_year* gy, 
+                                const unsigned int /*file_version*/)
+{
+  ::new(gy) gregorian::greg_year(1900);
+}
+
 /**** greg_month ****/
 
 //! Function to save gregorian::greg_month objects using serialization lib
@@ -206,7 +233,7 @@ void load(Archive & ar, gregorian::greg_month& gm, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_month* gm, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_month* gm, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gm) gregorian::greg_month(1);
@@ -232,7 +259,7 @@ void load(Archive & ar, gregorian::greg_day& gd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_day* gd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_day* gd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gd) gregorian::greg_day(1);
@@ -258,7 +285,7 @@ void load(Archive & ar, gregorian::greg_weekday& gd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_weekday* gd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_weekday* gd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gd) gregorian::greg_weekday(1);
@@ -296,7 +323,7 @@ void load(Archive & ar, gregorian::partial_date& pd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::partial_date* pd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::partial_date* pd, 
                                 const unsigned int /*file_version*/)
 {
   gregorian::greg_month gm(1);
@@ -339,7 +366,7 @@ void load(Archive & ar, gregorian::nth_kday_of_month& nkd, unsigned int /*versio
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::nth_kday_of_month* nkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -379,7 +406,7 @@ void load(Archive & ar, gregorian::first_kday_of_month& fkd, unsigned int /*vers
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_of_month* fkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -418,7 +445,7 @@ void load(Archive & ar, gregorian::last_kday_of_month& lkd, unsigned int /*versi
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::last_kday_of_month* lkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -447,7 +474,7 @@ void load(Archive & ar, gregorian::first_kday_before& fkdb, unsigned int /*versi
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_before* fkdb, 
                                 const unsigned int /*file_version*/)
 {
@@ -476,7 +503,7 @@ void load(Archive & ar, gregorian::first_kday_after& fkda, unsigned int /*versio
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_after* fkda, 
                                 const unsigned int /*file_version*/)
 {
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
index 9b566c440..ab68fcd19 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
index ef1735f42..322f40d0d 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
index 086e73df4..e7d441efe 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/year_month_day.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
index bfafa1b03..becbc0681 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file gregorian.hpp
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
index 62a759f55..e6ba01fe5 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
index 0c74857a2..3f4b92fd8 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file gregorian_types.hpp
diff --git a/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp b/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
index 95d4f23de..a2fa4e1da 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp b/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
index c27c09e76..b645aa49b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp b/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
index 19622fe8e..af19394f3 100644
--- a/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
+++ b/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
@@ -3,7 +3,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #ifndef NO_BOOST_DATE_TIME_INLINE
diff --git a/project/jni/boost/include/boost/date_time/int_adapter.hpp b/project/jni/boost/include/boost/date_time/int_adapter.hpp
index fc98fc127..d1246e7b5 100644
--- a/project/jni/boost/include/boost/date_time/int_adapter.hpp
+++ b/project/jni/boost/include/boost/date_time/int_adapter.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/iso_format.hpp b/project/jni/boost/include/boost/date_time/iso_format.hpp
index 8262fa211..1f9e73d67 100644
--- a/project/jni/boost/include/boost/date_time/iso_format.hpp
+++ b/project/jni/boost/include/boost/date_time/iso_format.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/parse_format_base.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/conversion.hpp b/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
index 13e4d3eb5..a530de422 100644
--- a/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2009-06-04 01:24:49 -0700 (Thu, 04 Jun 2009) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp b/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
index a6c1d4205..84c59a3a0 100644
--- a/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
@@ -2,10 +2,10 @@
 #define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__
 
 /* Copyright (c) 2003-2005 CrystalClear Software, Inc.
- * Subject to the Boost Software License, Version 1.0. 
+ * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include "boost/date_time/time_zone_base.hpp"
@@ -34,8 +34,8 @@ namespace local_time {
     typedef typename base_type::stringstream_type stringstream_type;
     typedef date_time::time_zone_names_base time_zone_names;
     typedef CharT char_type;
-    
-    custom_time_zone_base(const time_zone_names& zone_names,   
+
+    custom_time_zone_base(const time_zone_names& zone_names,
                      const time_duration_type& utc_offset,
                      const dst_adjustment_offsets& dst_shift,
                      boost::shared_ptr calc_rule) :
@@ -43,8 +43,8 @@ namespace local_time {
       base_utc_offset_(utc_offset),
       dst_offsets_(dst_shift),
       dst_calc_rules_(calc_rule)
-    {};
-    virtual ~custom_time_zone_base() {};
+    {}
+    virtual ~custom_time_zone_base() {}
     virtual string_type dst_zone_abbrev() const
     {
       return zone_names_.dst_zone_abbrev();
diff --git a/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp b/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
index ee870227a..b4c325df0 100644
--- a/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/greg_duration_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp b/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
index 3d6cfbacf..d82731c08 100644
--- a/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp b/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
index 9c9f62340..96b291583 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -208,7 +208,7 @@ namespace local_time {
     }
 
     //! Simple destructor, releases time zone if last referrer
-    ~local_date_time_base() {};
+    ~local_date_time_base() {}
 
     //! Copy constructor
     local_date_time_base(const local_date_time_base& rhs) :
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
index f7d4cc68e..162cac5b3 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
index c161ff7e2..b5e3c3f1b 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
index ed58b8018..5e04422e8 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/local_time/local_date_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp b/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
index 2a0199fca..ee1b553ee 100644
--- a/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-10 13:24:38 -0400 (Thu, 10 Jun 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -115,7 +115,7 @@ namespace local_time{
         calc_rules(dst_begin, dst_end);
       }
     }
-    virtual ~posix_time_zone_base() {};
+    virtual ~posix_time_zone_base() {}
     //!String for the zone when not in daylight savings (eg: EST)
     virtual string_type std_zone_abbrev()const
     {
diff --git a/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp b/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
index 4cfca45c1..aceda9391 100644
--- a/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp b/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
index eea4d37ae..13251a2cf 100644
--- a/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 /*! @file local_time_adjustor.hpp
diff --git a/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp b/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
index fd6d3c2fa..b56278ed2 100644
--- a/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include "boost/date_time/dst_rules.hpp"
diff --git a/project/jni/boost/include/boost/date_time/locale_config.hpp b/project/jni/boost/include/boost/date_time/locale_config.hpp
index d01e008fe..194d5dd37 100644
--- a/project/jni/boost/include/boost/date_time/locale_config.hpp
+++ b/project/jni/boost/include/boost/date_time/locale_config.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 // This file configures whether the library will support locales and hence
diff --git a/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp b/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
index 9396579d3..177811ee6 100644
--- a/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
+++ b/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-05-10 05:15:48 -0400 (Mon, 10 May 2010) $
+ * $Date: 2010-05-10 02:15:48 -0700 (Mon, 10 May 2010) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/parse_format_base.hpp b/project/jni/boost/include/boost/date_time/parse_format_base.hpp
index b17a5c8e7..087baf953 100644
--- a/project/jni/boost/include/boost/date_time/parse_format_base.hpp
+++ b/project/jni/boost/include/boost/date_time/parse_format_base.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/date_time/period.hpp b/project/jni/boost/include/boost/date_time/period.hpp
index c67bc36c6..3e34def32 100644
--- a/project/jni/boost/include/boost/date_time/period.hpp
+++ b/project/jni/boost/include/boost/date_time/period.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! \file period.hpp
diff --git a/project/jni/boost/include/boost/date_time/period_formatter.hpp b/project/jni/boost/include/boost/date_time/period_formatter.hpp
index 08082e10f..b6ddc8217 100644
--- a/project/jni/boost/include/boost/date_time/period_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/period_formatter.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -114,10 +114,10 @@ namespace boost { namespace date_time {
     {
       m_range_option = option;
     }
-    void delimiter_strings(const string_type& separator,
-                           const string_type& start_delim,
-                           const string_type& open_end_delim,
-                           const string_type& closed_end_delim)
+    void delimiter_strings(const string_type& ,
+                           const string_type& ,
+                           const string_type& ,
+                           const string_type& )
     {
       m_period_separator;
       m_period_start_delimeter;
diff --git a/project/jni/boost/include/boost/date_time/period_parser.hpp b/project/jni/boost/include/boost/date_time/period_parser.hpp
index 9cd57e18c..84b9d1378 100644
--- a/project/jni/boost/include/boost/date_time/period_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/period_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp b/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
index 3fb21d79e..83ccf6006 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $
+ * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp b/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
index e6899ba0a..6846a7781 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/greg_duration_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
index 4e9294c42..3b85ff46f 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 /*!@file posix_time.hpp Global header file to get all of posix time types 
  */
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
index 60c3f7ee3..d0b76536e 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include  //for MCW 7.2 std::abs(long long)
@@ -81,7 +81,7 @@ namespace posix_time {
     {}
     //Give duration access to ticks constructor -- hide from users
     friend class date_time::time_duration;
-  private:
+  protected:
     explicit time_duration(impl_type tick_count) :
       date_time::time_duration(tick_count)
     {}
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
index db3b85fec..9778fd7f3 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
index 9a80737a4..fb63a9165 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
index f5b20a8f8..fcc3fac1d 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file posix_time_pre133_operators.hpp
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
index 3d44e0ff0..13626e9ba 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp b/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
index 2abc02d31..3f1cb0473 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time_system.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
index 466331b0a..534b9525b 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
index d0e959e91..8d2ebdce5 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
index 8a352f6e2..3dc02b18a 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
index cb7bf07f4..11f812073 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/period.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
index f096da441..c9038f19a 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/posix_time/posix_time.hpp"
@@ -184,7 +184,7 @@ void load(Archive & ar,
 
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 boost::posix_time::time_period* tp, 
                                 const unsigned int /*file_version*/)
 {
diff --git a/project/jni/boost/include/boost/date_time/special_defs.hpp b/project/jni/boost/include/boost/date_time/special_defs.hpp
index 56eb6fea1..661814ec1 100644
--- a/project/jni/boost/include/boost/date_time/special_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/special_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/date_time/special_values_formatter.hpp b/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
index 33542b6e4..53fe98452 100644
--- a/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/string_convert.hpp b/project/jni/boost/include/boost/date_time/string_convert.hpp
index 54a979c70..a3cc86c2d 100644
--- a/project/jni/boost/include/boost/date_time/string_convert.hpp
+++ b/project/jni/boost/include/boost/date_time/string_convert.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/compiler_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/string_parse_tree.hpp b/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
index 0d515ff82..d67bf6b7d 100644
--- a/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
+++ b/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/strings_from_facet.hpp b/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
index d782c54fb..7c0765bf8 100644
--- a/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time.hpp b/project/jni/boost/include/boost/date_time/time.hpp
index 6a6cbe1f8..8b21144b6 100644
--- a/project/jni/boost/include/boost/date_time/time.hpp
+++ b/project/jni/boost/include/boost/date_time/time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_clock.hpp b/project/jni/boost/include/boost/date_time/time_clock.hpp
index 1ea5d2e8b..9aa2ff0e3 100644
--- a/project/jni/boost/include/boost/date_time/time_clock.hpp
+++ b/project/jni/boost/include/boost/date_time/time_clock.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file time_clock.hpp
diff --git a/project/jni/boost/include/boost/date_time/time_defs.hpp b/project/jni/boost/include/boost/date_time/time_defs.hpp
index 55fe42a59..d74631d5e 100644
--- a/project/jni/boost/include/boost/date_time/time_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/time_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_duration.hpp b/project/jni/boost/include/boost/date_time/time_duration.hpp
index 2fd259012..fc3660b7c 100644
--- a/project/jni/boost/include/boost/date_time/time_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/time_duration.hpp
@@ -2,15 +2,16 @@
 #define DATE_TIME_TIME_DURATION_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -179,7 +180,7 @@ namespace date_time {
       return duration_type(ticks_);
     }
     //! Division operations on a duration with an integer.
-    duration_type operator/=(int divisor) 
+    duration_type operator/=(int divisor)
     {
       ticks_ = ticks_ / divisor;
       return duration_type(ticks_);
@@ -251,7 +252,7 @@ namespace date_time {
     }
 
   protected:
-    explicit time_duration(impl_type in) : ticks_(in) {};
+    explicit time_duration(impl_type in) : ticks_(in) {}
     impl_type ticks_;
   };
 
@@ -265,10 +266,20 @@ namespace date_time {
   class subsecond_duration : public base_duration
   {
   public:
+    typedef typename base_duration::impl_type impl_type;
     typedef typename base_duration::traits_type traits_type;
+
+  private:
+    // To avoid integer overflow we precompute the duration resolution conversion coefficient (ticket #3471)
+    BOOST_STATIC_ASSERT_MSG((traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second % frac_of_second : frac_of_second % traits_type::ticks_per_second) == 0,\
+      "The base duration resolution must be a multiple of the subsecond duration resolution");
+    BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second));
+
+  public:
     explicit subsecond_duration(boost::int64_t ss) :
-      base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second)
-    {}
+      base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio))
+    {
+    }
   };
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_facet.hpp b/project/jni/boost/include/boost/date_time/time_facet.hpp
index f6408b017..8346ca300 100644
--- a/project/jni/boost/include/boost/date_time/time_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/time_facet.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author:  Martin Andrian, Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp b/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
index 3537c103c..2d07d344e 100644
--- a/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
+++ b/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time_iterator.hpp b/project/jni/boost/include/boost/date_time/time_iterator.hpp
index 2258a3308..4c33f39e9 100644
--- a/project/jni/boost/include/boost/date_time/time_iterator.hpp
+++ b/project/jni/boost/include/boost/date_time/time_iterator.hpp
@@ -2,50 +2,50 @@
 #define DATE_TIME_TIME_ITERATOR_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
 namespace boost {
 namespace date_time {
-  
+
 
   //! Simple time iterator skeleton class
   template
   class time_itr {
   public:
     typedef typename time_type::time_duration_type time_duration_type;
-    time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {};
-    time_itr& operator++() 
+    time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}
+    time_itr& operator++()
     {
       current_ = current_ + offset_;
       return *this;
     }
-    time_itr& operator--() 
+    time_itr& operator--()
     {
       current_ = current_ - offset_;
       return *this;
     }
-    time_type operator*() {return current_;};
-    time_type* operator->() {return ¤t_;};
-    bool operator<  (const time_type& t) {return current_ < t;};
-    bool operator<= (const time_type& t) {return current_ <= t;};
-    bool operator!=  (const time_type& t) {return current_ != t;};
-    bool operator== (const time_type& t) {return current_ == t;};
-    bool operator>  (const time_type& t) {return current_ > t;};
-    bool operator>= (const time_type& t) {return current_ >= t;};
-    
+    time_type operator*() {return current_;}
+    time_type* operator->() {return ¤t_;}
+    bool operator<  (const time_type& t) {return current_ < t;}
+    bool operator<= (const time_type& t) {return current_ <= t;}
+    bool operator!=  (const time_type& t) {return current_ != t;}
+    bool operator== (const time_type& t) {return current_ == t;}
+    bool operator>  (const time_type& t) {return current_ > t;}
+    bool operator>= (const time_type& t) {return current_ >= t;}
+
   private:
     time_type current_;
     time_duration_type offset_;
   };
-  
 
-  
+
+
 } }//namespace date_time
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_parsing.hpp b/project/jni/boost/include/boost/date_time/time_parsing.hpp
index dfccf6a1d..7b71de0da 100644
--- a/project/jni/boost/include/boost/date_time/time_parsing.hpp
+++ b/project/jni/boost/include/boost/date_time/time_parsing.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include "boost/tokenizer.hpp"
@@ -116,6 +116,7 @@ namespace date_time {
         
         break;
       }
+      default: break;
       }//switch
       pos++;
     }
@@ -153,9 +154,10 @@ namespace date_time {
         std::string& first,
         std::string& second)
   {
-    int sep_pos = static_cast(s.find(sep));
+    std::string::size_type sep_pos = s.find(sep);
     first = s.substr(0,sep_pos);
-    second = s.substr(sep_pos+1);
+    if (sep_pos!=std::string::npos)
+        second = s.substr(sep_pos+1);
     return true;
   }
 
@@ -280,6 +282,7 @@ namespace date_time {
             
             break;
           }
+          default: break;
       };
       pos++;
     }
diff --git a/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp b/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
index 658f3d207..903830c76 100644
--- a/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
+++ b/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $
+ * $Date: 2009-06-06 04:25:55 -0700 (Sat, 06 Jun 2009) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_system_counted.hpp b/project/jni/boost/include/boost/date_time/time_system_counted.hpp
index fa883907e..5425f62af 100644
--- a/project/jni/boost/include/boost/date_time/time_system_counted.hpp
+++ b/project/jni/boost/include/boost/date_time/time_system_counted.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_system_split.hpp b/project/jni/boost/include/boost/date_time/time_system_split.hpp
index 08ea1ec2d..6fc4a336b 100644
--- a/project/jni/boost/include/boost/date_time/time_system_split.hpp
+++ b/project/jni/boost/include/boost/date_time/time_system_split.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_zone_base.hpp b/project/jni/boost/include/boost/date_time/time_zone_base.hpp
index 0d3cb903e..f239d545a 100644
--- a/project/jni/boost/include/boost/date_time/time_zone_base.hpp
+++ b/project/jni/boost/include/boost/date_time/time_zone_base.hpp
@@ -2,10 +2,10 @@
 #define _DATE_TIME_TIME_ZONE_BASE__
 
 /* Copyright (c) 2003-2005 CrystalClear Software, Inc.
- * Subject to the Boost Software License, Version 1.0. 
+ * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -26,9 +26,9 @@ namespace date_time {
    *  would be to convert from POSIX timezone strings.  Regardless of
    *  the construction technique, this is the interface that these
    *  time zone types must provide.
-   * 
+   *
    * Note that this class is intended to be used as a shared
-   * resource (hence the derivation from boost::counted_base.  
+   * resource (hence the derivation from boost::counted_base.
    */
   template
   class time_zone_base  {
@@ -39,8 +39,8 @@ namespace date_time {
     typedef typename time_type::date_type::year_type year_type;
     typedef typename time_type::time_duration_type time_duration_type;
 
-    time_zone_base() {};
-    virtual ~time_zone_base() {};
+    time_zone_base() {}
+    virtual ~time_zone_base() {}
     //!String for the timezone when in daylight savings (eg: EDT)
     virtual string_type dst_zone_abbrev() const=0;
     //!String for the zone when not in daylight savings (eg: EST)
@@ -61,9 +61,9 @@ namespace date_time {
     virtual time_duration_type dst_offset() const=0;
     //! Returns a POSIX time_zone string for this object
     virtual string_type to_posix_string() const =0;
-    
+
   private:
-    
+
   };
 
 
@@ -82,7 +82,7 @@ namespace date_time {
       dst_start_offset_(dst_start_offset),
       dst_end_offset_(dst_end_offset)
     {}
-    
+
     //! Amount DST adjusts the clock eg: plus one hour
     time_duration_type dst_adjust_;
     //! Time past midnight on start transition day that dst starts
diff --git a/project/jni/boost/include/boost/date_time/time_zone_names.hpp b/project/jni/boost/include/boost/date_time/time_zone_names.hpp
index 05260c716..a56502704 100644
--- a/project/jni/boost/include/boost/date_time/time_zone_names.hpp
+++ b/project/jni/boost/include/boost/date_time/time_zone_names.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/tz_db_base.hpp b/project/jni/boost/include/boost/date_time/tz_db_base.hpp
index c125b966c..a6d8ea9e0 100644
--- a/project/jni/boost/include/boost/date_time/tz_db_base.hpp
+++ b/project/jni/boost/include/boost/date_time/tz_db_base.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/wrapping_int.hpp b/project/jni/boost/include/boost/date_time/wrapping_int.hpp
index 969b078ac..e6f87d52c 100644
--- a/project/jni/boost/include/boost/date_time/wrapping_int.hpp
+++ b/project/jni/boost/include/boost/date_time/wrapping_int.hpp
@@ -2,11 +2,11 @@
 #define _DATE_TIME_WRAPPING_INT_HPP__
 
 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -16,15 +16,15 @@ namespace date_time {
 //! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type)
 /*! In composite date and time types this type is used to
  *  wrap at the day boundary.
- *  Ex: 
- *  A wrapping_int will roll over after nine, and 
+ *  Ex:
+ *  A wrapping_int will roll over after nine, and
  *  roll under below zero. This gives a range of [0,9]
  *
- * NOTE: it is strongly recommended that wrapping_int2 be used 
- * instead of wrapping_int as wrapping_int is to be depricated 
+ * NOTE: it is strongly recommended that wrapping_int2 be used
+ * instead of wrapping_int as wrapping_int is to be depricated
  * at some point soon.
  *
- * Also Note that warnings will occur if instantiated with an 
+ * Also Note that warnings will occur if instantiated with an
  * unsigned type. Only a signed type should be used!
  */
 template
@@ -34,17 +34,17 @@ public:
   //typedef overflow_type_ overflow_type;
   static int_type wrap_value() {return wrap_val;}
   //!Add, return true if wrapped
-  wrapping_int(int_type v) : value_(v) {};
+  wrapping_int(int_type v) : value_(v) {}
   //! Explicit converion method
   int_type as_int()   const   {return value_;}
   operator int_type() const   {return value_;}
   //!Add, return number of wraps performed
-  /*! The sign of the returned value will indicate which direction the 
+  /*! The sign of the returned value will indicate which direction the
    * wraps went. Ex: add a negative number and wrapping under could occur,
-   * this would be indicated by a negative return value. If wrapping over 
+   * this would be indicated by a negative return value. If wrapping over
    * took place, a positive value would be returned */
   template< typename IntT >
-  IntT add(IntT v) 
+  IntT add(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_val));
     IntT overflow = static_cast(v / (wrap_val));
@@ -53,12 +53,12 @@ public:
   }
   //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps)
   /*! The sign of the returned value will indicate which direction the
-   * wraps went (positive indicates wrap under, negative indicates wrap over). 
-   * Ex: subtract a negative number and wrapping over could 
-   * occur, this would be indicated by a negative return value. If 
+   * wraps went (positive indicates wrap under, negative indicates wrap over).
+   * Ex: subtract a negative number and wrapping over could
+   * occur, this would be indicated by a negative return value. If
    * wrapping under took place, a positive value would be returned. */
   template< typename IntT >
-  IntT subtract(IntT v) 
+  IntT subtract(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_val));
     IntT underflow = static_cast(-(v / (wrap_val)));
@@ -71,19 +71,19 @@ private:
   template< typename IntT >
   IntT calculate_wrap(IntT wrap)
   {
-    if ((value_) >= wrap_val) 
+    if ((value_) >= wrap_val)
     {
       ++wrap;
       value_ -= (wrap_val);
     }
-    else if(value_ < 0) 
+    else if(value_ < 0)
     {
       --wrap;
       value_ += (wrap_val);
     }
     return wrap;
   }
-                  
+
 };
 
 
@@ -113,12 +113,12 @@ public:
   int_type as_int()   const   {return value_;}
   operator int_type() const {return value_;}
   //!Add, return number of wraps performed
-  /*! The sign of the returned value will indicate which direction the 
+  /*! The sign of the returned value will indicate which direction the
    * wraps went. Ex: add a negative number and wrapping under could occur,
-   * this would be indicated by a negative return value. If wrapping over 
+   * this would be indicated by a negative return value. If wrapping over
    * took place, a positive value would be returned */
   template< typename IntT >
-  IntT add(IntT v) 
+  IntT add(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_max - wrap_min + 1));
     IntT overflow = static_cast(v / (wrap_max - wrap_min + 1));
@@ -127,30 +127,30 @@ public:
   }
   //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps)
   /*! The sign of the returned value will indicate which direction the
-   * wraps went. Ex: subtract a negative number and wrapping over could 
-   * occur, this would be indicated by a positive return value. If 
+   * wraps went. Ex: subtract a negative number and wrapping over could
+   * occur, this would be indicated by a positive return value. If
    * wrapping under took place, a negative value would be returned */
   template< typename IntT >
-  IntT subtract(IntT v) 
+  IntT subtract(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_max - wrap_min + 1));
     IntT underflow = static_cast(-(v / (wrap_max - wrap_min + 1)));
     value_ = static_cast(value_ - remainder);
     return calculate_wrap(underflow);
   }
-            
+
 private:
   int_type value_;
 
   template< typename IntT >
   IntT calculate_wrap(IntT wrap)
   {
-    if ((value_) > wrap_max) 
+    if ((value_) > wrap_max)
     {
       ++wrap;
       value_ -= (wrap_max - wrap_min + 1);
     }
-    else if((value_) < wrap_min) 
+    else if((value_) < wrap_min)
     {
       --wrap;
       value_ += (wrap_max - wrap_min + 1);
diff --git a/project/jni/boost/include/boost/date_time/year_month_day.hpp b/project/jni/boost/include/boost/date_time/year_month_day.hpp
index 802ce42eb..9340e53f5 100644
--- a/project/jni/boost/include/boost/date_time/year_month_day.hpp
+++ b/project/jni/boost/include/boost/date_time/year_month_day.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/detail/call_traits.hpp b/project/jni/boost/include/boost/detail/call_traits.hpp
index 6ad646ec6..36dea0003 100644
--- a/project/jni/boost/include/boost/detail/call_traits.hpp
+++ b/project/jni/boost/include/boost/detail/call_traits.hpp
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -43,20 +44,26 @@ struct ct_imp2
    typedef const T param_type;
 };
 
-template 
+template 
 struct ct_imp
 {
    typedef const T& param_type;
 };
 
-template 
-struct ct_imp
+template 
+struct ct_imp
 {
    typedef typename ct_imp2::param_type param_type;
 };
 
-template 
-struct ct_imp
+template 
+struct ct_imp
+{
+   typedef typename ct_imp2::param_type param_type;
+};
+
+template 
+struct ct_imp
 {
    typedef const T param_type;
 };
@@ -79,7 +86,8 @@ public:
    typedef typename boost::detail::ct_imp<
       T,
       ::boost::is_pointer::value,
-      ::boost::is_arithmetic::value
+      ::boost::is_arithmetic::value,
+      ::boost::is_enum::value
    >::param_type param_type;
 };
 
diff --git a/project/jni/boost/include/boost/detail/container_fwd.hpp b/project/jni/boost/include/boost/detail/container_fwd.hpp
index 7df7ccbb9..ef1749806 100644
--- a/project/jni/boost/include/boost/detail/container_fwd.hpp
+++ b/project/jni/boost/include/boost/detail/container_fwd.hpp
@@ -21,10 +21,17 @@
 // Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to      //
 // forward declare standard containers.                                       //
 //                                                                            //
+// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it //
+// normally doesn't.                                                          //
+//                                                                            //
+// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD.        //
+//                                                                            //
 ////////////////////////////////////////////////////////////////////////////////
 
 #if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
-#  if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#  if defined(BOOST_DETAIL_CONTAINER_FWD)
+     // Force forward declarations.
+#  elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
      // STLport
 #    define BOOST_DETAIL_NO_CONTAINER_FWD
 #  elif defined(__LIBCOMO__)
@@ -76,11 +83,6 @@
 #  endif
 #endif
 
-// BOOST_DETAIL_TEST_* macros are for testing only
-// and shouldn't be relied upon. But you can use
-// BOOST_DETAIL_NO_CONTAINER_FWD to prevent forward
-// declaration of containers.
-
 #if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
 
 #if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \
@@ -118,6 +120,7 @@ namespace std
     template  class basic_string;
 
 #if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+
     template  struct string_char_traits;
 #else
     template  struct char_traits;
diff --git a/project/jni/boost/include/boost/detail/interlocked.hpp b/project/jni/boost/include/boost/detail/interlocked.hpp
index 1802e3411..75e5a3061 100644
--- a/project/jni/boost/include/boost/detail/interlocked.hpp
+++ b/project/jni/boost/include/boost/detail/interlocked.hpp
@@ -33,6 +33,21 @@
 
 #elif defined(_WIN32_WCE)
 
+#if _WIN32_WCE >= 0x600
+
+extern "C" long __cdecl _InterlockedIncrement( long volatile * );
+extern "C" long __cdecl _InterlockedDecrement( long volatile * );
+extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
+extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
+extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+
+#else
 // under Windows CE we still have old-style Interlocked* functions
 
 extern "C" long __cdecl InterlockedIncrement( long* );
@@ -47,6 +62,8 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
 # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
 # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
 
+#endif
+
 # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
     ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
 # define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
diff --git a/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp b/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
index e695a2085..d266e0e33 100644
--- a/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
+++ b/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
@@ -1,56 +1,337 @@
 //  scoped_enum_emulation.hpp  ---------------------------------------------------------//
 
 //  Copyright Beman Dawes, 2009
+//  Copyright (C) 2011-2012 Vicente J. Botet Escriba
+//  Copyright (C) 2012 Anthony Williams
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
-//  Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
-//  scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
-//  macro is used to detect feature support.
-//
-//  See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
-//  description of the scoped enum feature. Note that the committee changed the name
-//  from strongly typed enum to scoped enum.  
-//
-//  Caution: only the syntax is emulated; the semantics are not emulated and
-//  the syntax emulation doesn't include being able to specify the underlying
-//  representation type.
-//
-//  The emulation is via struct rather than namespace to allow use within classes.
-//  Thanks to Andrey Semashev for pointing that out.
-//
-//  Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
-//  Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
-//  Botet, and Daniel James. 
-//
-//  Sample usage:
-//
-//     BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
-//     ...
-//     BOOST_SCOPED_ENUM(algae) sample( algae::red );
-//     void foo( BOOST_SCOPED_ENUM(algae) color );
-//     ...
-//     sample = algae::green;
-//     foo( algae::cyan );
+/*
+[section:scoped_enums Scoped Enums]
+
+Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
+scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_CXX11_SCOPED_ENUMS
+macro is used to detect feature support.
+
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
+description of the scoped enum feature. Note that the committee changed the name
+from strongly typed enum to scoped enum.
+
+Some of the enumerations defined in the standard library are scoped enums.
+
+  enum class future_errc
+  {
+      broken_promise,
+      future_already_retrieved,
+      promise_already_satisfied,
+      no_state
+  };
+
+On compilers that don't support them, the library provides two emulations:
+
+[heading Strict]
+
+* Able to specify the underlying type.
+* explicit conversion to/from underlying type.
+* The wrapper is not a C++03 enum type.
+
+The user can declare  declare these types as
+
+  BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc)
+  {
+      broken_promise,
+      future_already_retrieved,
+      promise_already_satisfied,
+      no_state
+  }
+  BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
+
+These macros allows to use 'future_errc' in almost all the cases as an scoped enum.
+
+  future_errc err = future_errc::no_state;
+
+There are however some limitations:
+
+* The type is not a C++ enum, so 'is_enum' will be false_type.
+* The emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some macros.
+
+Instead of
+
+        switch (ev)
+        {
+        case future_errc::broken_promise:
+  // ...
+
+use
+
+        switch (boost::native_value(ev))
+        {
+        case future_errc::broken_promise:
+
+And instead of
+
+    #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+    template <>
+    struct BOOST_SYMBOL_VISIBLE is_error_code_enum : public true_type { };
+    #endif
+
+use
+
+    #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+    template <>
+    struct BOOST_SYMBOL_VISIBLE is_error_code_enum : public true_type { };
+    #endif
+
+
+Sample usage:
+
+     BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(algae, char) { green, red, cyan }; BOOST_SCOPED_ENUM_DECLARE_END(algae)
+     ...
+     algae sample( algae::red );
+     void foo( algae color );
+     ...
+     sample = algae::green;
+     foo( algae::cyan );
+
+ Light
+  Caution: only the syntax is emulated; the semantics are not emulated and
+  the syntax emulation doesn't include being able to specify the underlying
+  representation type.
+
+  The literal scoped emulation is via struct rather than namespace to allow use within classes.
+  Thanks to Andrey Semashev for pointing that out.
+  However the type is an real C++03 enum and so convertible implicitly to an int.
+
+  Sample usage:
+
+     BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
+     ...
+     BOOST_SCOPED_ENUM(algae) sample( algae::red );
+     void foo( BOOST_SCOPED_ENUM(algae) color );
+     ...
+     sample = algae::green;
+     foo( algae::cyan );
+
+  Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
+  Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vicente
+  Botet, and Daniel James.
+
+[endsect]
+*/
+
 
 #ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
 #define BOOST_SCOPED_ENUM_EMULATION_HPP
 
 #include 
+#include 
 
-#ifdef BOOST_NO_SCOPED_ENUMS
+namespace boost
+{
 
-# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
-# define BOOST_SCOPED_ENUM_END };
-# define BOOST_SCOPED_ENUM(name) name::enum_type
+#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+  /**
+   * Meta-function to get the underlying type of a scoped enum.
+   *
+   * Requires EnumType must be an enum type or the emulation of a scoped enum
+   */
+  template 
+  struct underlying_type
+  {
+    /**
+     * The member typedef type names the underlying type of EnumType. It is EnumType::underlying_type when the EnumType is an emulated scoped enum,
+     * std::underlying_type::type when the standard library std::underlying_type is provided.
+     *
+     * The user will need to specialize it when the compiler supports scoped enums but don't provides std::underlying_type.
+     */
+    typedef typename EnumType::underlying_type type;
+  };
+
+  /**
+   * Meta-function to get the native enum type associated to an enum class or its emulation.
+   */
+  template 
+  struct native_type
+  {
+    /**
+     * The member typedef type names the native enum type associated to the scoped enum,
+     * which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum.
+     */
+    typedef typename EnumType::enum_type type;
+  };
+
+  /**
+   * Casts a scoped enum to its underlying type.
+   *
+   * This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type.
+   * @param v A scoped enum.
+   * @returns The underlying type.
+   * @throws No-throws.
+   */
+  template 
+  UnderlyingType underlying_cast(EnumType v)
+  {
+    return v.get_underlying_value_();
+  }
+
+  /**
+   * Casts a scoped enum to its native enum type.
+   *
+   * This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can.
+   *
+   * EnumType the scoped enum type
+   *
+   * @param v A scoped enum.
+   * @returns The native enum value.
+   * @throws No-throws.
+   */
+  template 
+  inline
+  typename EnumType::enum_type native_value(EnumType e)
+  {
+    return e.native_value_();
+  }
+
+#else  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+  template 
+  struct underlying_type
+  {
+    //typedef typename std::underlying_type::type type;
+  };
+
+  template 
+  struct native_type
+  {
+    typedef EnumType type;
+  };
+
+  template 
+  UnderlyingType underlying_cast(EnumType v)
+  {
+    return static_cast(v);
+  }
+
+  template 
+  inline
+  EnumType native_value(EnumType e)
+  {
+    return e;
+ }
+
+#endif
+}
+
+
+#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+
+#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+
+#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
+     explicit operator underlying_type() const { return get_underlying_value_(); }
 
 #else
 
-# define BOOST_SCOPED_ENUM_START(name) enum class name
-# define BOOST_SCOPED_ENUM_END
-# define BOOST_SCOPED_ENUM(name) name
+#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR
 
 #endif
 
+/**
+ * Start a declaration of a scoped enum.
+ *
+ * @param EnumType The new scoped enum.
+ * @param UnderlyingType The underlying type.
+ */
+#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType)    \
+    struct EnumType {                                                   \
+        typedef UnderlyingType underlying_type;                         \
+        EnumType() BOOST_NOEXCEPT {}                                    \
+        explicit EnumType(underlying_type v) : v_(v) {}                 \
+        underlying_type get_underlying_value_() const { return v_; }               \
+        BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR                \
+    private:                                                            \
+        underlying_type v_;                                             \
+        typedef EnumType self_type;                                     \
+    public:                                                             \
+        enum enum_type
+
+#define BOOST_SCOPED_ENUM_DECLARE_END2() \
+        enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
+        operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); } \
+        friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
+        friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
+        friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
+        friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
+        friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
+        friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
+        friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
+        friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
+        friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
+        friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
+        friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
+        friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
+    };
+
+#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \
+    ; \
+    EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {}                 \
+    BOOST_SCOPED_ENUM_DECLARE_END2()
+
+/**
+ * Starts a declaration of a scoped enum with the default int underlying type.
+ *
+ * @param EnumType The new scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \
+  BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int)
+
+/**
+ * Name of the native enum type.
+ *
+ * @param NT The new scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type
+/**
+ * Forward declares an scoped enum.
+ *
+ * @param NT The scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType
+
+#else  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType
+#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType
+#define BOOST_SCOPED_ENUM_DECLARE_END2()
+#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ;
+
+#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType
+#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType
+
+#endif  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name)
+#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2()
+#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name)
+
+//#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+//
+//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
+//# define BOOST_SCOPED_ENUM_END };
+//# define BOOST_SCOPED_ENUM(name) name::enum_type
+//
+//#else
+//
+//# define BOOST_SCOPED_ENUM_START(name) enum class name
+//# define BOOST_SCOPED_ENUM_END
+//# define BOOST_SCOPED_ENUM(name) name
+//
+//#endif
 #endif  // BOOST_SCOPED_ENUM_EMULATION_HPP
diff --git a/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp b/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp
new file mode 100644
index 000000000..064fdaf58
--- /dev/null
+++ b/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp
@@ -0,0 +1,285 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// utf8_codecvt_facet.ipp
+
+// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
+// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). 
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Please see the comments in  to
+// learn how this file should be used.
+
+#include 
+
+#include  // for multi-byte converson routines
+#include 
+
+#include 
+#include 
+
+// If we don't have wstring, then Unicode support 
+// is not available anyway, so we don't need to even
+// compiler this file. This also fixes the problem
+// with mingw, which can compile this file, but will
+// generate link error when building DLL.
+#ifndef BOOST_NO_STD_WSTRING
+
+BOOST_UTF8_BEGIN_NAMESPACE
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// implementation for wchar_t
+
+// Translate incoming UTF-8 into UCS-4
+std::codecvt_base::result utf8_codecvt_facet::do_in(
+    std::mbstate_t& /*state*/, 
+    const char * from,
+    const char * from_end, 
+    const char * & from_next,
+    wchar_t * to, 
+    wchar_t * to_end, 
+    wchar_t * & to_next
+) const {
+    // Basic algorithm:  The first octet determines how many
+    // octets total make up the UCS-4 character.  The remaining
+    // "continuing octets" all begin with "10". To convert, subtract
+    // the amount that specifies the number of octets from the first
+    // octet.  Subtract 0x80 (1000 0000) from each continuing octet,
+    // then mash the whole lot together.  Note that each continuing
+    // octet only uses 6 bits as unique values, so only shift by
+    // multiples of 6 to combine.
+    while (from != from_end && to != to_end) {
+
+        // Error checking   on the first octet
+        if (invalid_leading_octet(*from)){
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        // The first octet is   adjusted by a value dependent upon 
+        // the number   of "continuing octets" encoding the character
+        const   int cont_octet_count = get_cont_octet_count(*from);
+        const   wchar_t octet1_modifier_table[] =   {
+            0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+        };
+
+        // The unsigned char conversion is necessary in case char is
+        // signed   (I learned this the hard way)
+        wchar_t ucs_result = 
+            (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count];
+
+        // Invariants   : 
+        //   1) At the start of the loop,   'i' continuing characters have been
+        //    processed 
+        //   2) *from   points to the next continuing character to be processed.
+        int i   = 0;
+        while(i != cont_octet_count && from != from_end) {
+
+            // Error checking on continuing characters
+            if (invalid_continuing_octet(*from)) {
+                from_next   = from;
+                to_next =   to;
+                return std::codecvt_base::error;
+            }
+
+            ucs_result *= (1 << 6); 
+
+            // each continuing character has an extra (10xxxxxx)b attached to 
+            // it that must be removed.
+            ucs_result += (unsigned char)(*from++) - 0x80;
+            ++i;
+        }
+
+        // If   the buffer ends with an incomplete unicode character...
+        if (from == from_end && i   != cont_octet_count) {
+            // rewind "from" to before the current character translation
+            from_next = from - (i+1); 
+            to_next = to;
+            return std::codecvt_base::partial;
+        }
+        *to++   = ucs_result;
+    }
+    from_next = from;
+    to_next = to;
+
+    // Were we done converting or did we run out of destination space?
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+std::codecvt_base::result utf8_codecvt_facet::do_out(
+    std::mbstate_t& /*state*/, 
+    const wchar_t *   from,
+    const wchar_t * from_end, 
+    const wchar_t * & from_next,
+    char * to, 
+    char * to_end, 
+    char * & to_next
+) const
+{
+    // RG - consider merging this table with the other one
+    const wchar_t octet1_modifier_table[] = {
+        0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+    };
+
+    wchar_t max_wchar = (std::numeric_limits::max)();
+    while (from != from_end && to != to_end) {
+
+        // Check for invalid UCS-4 character
+        if (*from  > max_wchar) {
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        int cont_octet_count = get_cont_octet_out_count(*from);
+
+        // RG  - comment this formula better
+        int shift_exponent = (cont_octet_count) *   6;
+
+        // Process the first character
+        *to++ = static_cast(octet1_modifier_table[cont_octet_count] +
+            (unsigned char)(*from / (1 << shift_exponent)));
+
+        // Process the continuation characters 
+        // Invariants: At   the start of the loop:
+        //   1) 'i' continuing octets   have been generated
+        //   2) '*to'   points to the next location to place an octet
+        //   3) shift_exponent is   6 more than needed for the next octet
+        int i   = 0;
+        while   (i != cont_octet_count && to != to_end) {
+            shift_exponent -= 6;
+            *to++ = static_cast(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6)));
+            ++i;
+        }
+        // If   we filled up the out buffer before encoding the character
+        if(to   == to_end && i != cont_octet_count) {
+            from_next = from;
+            to_next = to - (i+1);
+            return std::codecvt_base::partial;
+        }
+        ++from;
+    }
+    from_next = from;
+    to_next = to;
+    // Were we done or did we run out of destination space
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+// How many char objects can I process to get <= max_limit
+// wchar_t objects?
+int utf8_codecvt_facet::do_length(
+    BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
+    const char * from,
+    const char * from_end, 
+    std::size_t max_limit
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+) const throw()
+#else
+) const
+#endif
+{ 
+    // RG - this code is confusing!  I need a better way to express it.
+    // and test cases.
+
+    // Invariants:
+    // 1) last_octet_count has the size of the last measured character
+    // 2) char_count holds the number of characters shown to fit
+    // within the bounds so far (no greater than max_limit)
+    // 3) from_next points to the octet 'last_octet_count' before the
+    // last measured character.  
+    int last_octet_count=0;
+    std::size_t char_count = 0;
+    const char* from_next = from;
+    // Use "<" because the buffer may represent incomplete characters
+    while (from_next+last_octet_count <= from_end && char_count <= max_limit) {
+        from_next += last_octet_count;
+        last_octet_count = (get_octet_count(*from_next));
+        ++char_count;
+    }
+    return static_cast(from_next-from_end);
+}
+
+unsigned int utf8_codecvt_facet::get_octet_count(
+    unsigned char   lead_octet
+){
+    // if the 0-bit (MSB) is 0, then 1 character
+    if (lead_octet <= 0x7f) return 1;
+
+    // Otherwise the count number of consecutive 1 bits starting at MSB
+//    assert(0xc0 <= lead_octet && lead_octet <= 0xfd);
+
+    if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2;
+    else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
+    else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
+    else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
+    else return 6;
+}
+BOOST_UTF8_END_NAMESPACE
+
+namespace {
+template
+int get_cont_octet_out_count_impl(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+    return 2;
+}
+
+template<>
+int get_cont_octet_out_count_impl<4>(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+
+    // Note that the following code will generate warnings on some platforms
+    // where wchar_t is defined as UCS2.  The warnings are superfluous as the
+    // specialization is never instantitiated with such compilers, but this
+    // can cause problems if warnings are being treated as errors, so we guard
+    // against that.  Including  as we do
+    // should be enough to get WCHAR_MAX defined.
+#if !defined(WCHAR_MAX)
+#   error WCHAR_MAX not defined!
+#endif
+    // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
+#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
+    return 2;
+#elif WCHAR_MAX > 0x10000
+    
+   if (word < 0x10000) {
+        return 2;
+    }
+    if (word < 0x200000) {
+        return 3;
+    }
+    if (word < 0x4000000) {
+        return 4;
+    }
+    return 5;
+    
+#else
+    return 2;
+#endif
+}
+
+} // namespace anonymous
+
+BOOST_UTF8_BEGIN_NAMESPACE
+// How many "continuing octets" will be needed for this word
+// ==   total octets - 1.
+int utf8_codecvt_facet::get_cont_octet_out_count(
+    wchar_t word
+) const {
+    return get_cont_octet_out_count_impl(word);
+}
+BOOST_UTF8_END_NAMESPACE
+
+#endif
diff --git a/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp b/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
index f6a0b5903..ae9f031ef 100644
--- a/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
+++ b/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
@@ -9,7 +9,7 @@
 #if defined(_MSC_VER)
 #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
 #elif defined(__GNUC__)
-#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
+#define BOOST_ATTRIBUTE_NORETURN __attribute__((__noreturn__))
 #else
 #define BOOST_ATTRIBUTE_NORETURN
 #endif
diff --git a/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp b/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
index 883d313a9..a8d1aa79d 100644
--- a/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
+++ b/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
@@ -30,6 +30,7 @@ boost
 
             protected:
 
+            virtual
             ~error_info_base() throw()
                 {
                 }
diff --git a/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp b/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
index b6ccf7e18..5e5a2679b 100644
--- a/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
+++ b/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace
 boost
@@ -457,7 +457,12 @@ boost
         BOOST_ASSERT(p);
         p.ptr_->rethrow();
         BOOST_ASSERT(0);
-        std::abort();
+        #if defined(UNDER_CE)
+            // some CE platforms don't define ::abort()
+            exit(-1);
+        #else
+            abort();
+        #endif
         }
 
     inline
diff --git a/project/jni/boost/include/boost/exception/error_info.hpp b/project/jni/boost/include/boost/exception/error_info.hpp
index 2e6832a33..03b3da8e3 100644
--- a/project/jni/boost/include/boost/exception/error_info.hpp
+++ b/project/jni/boost/include/boost/exception/error_info.hpp
@@ -3,4 +3,7 @@
 //Distributed under the Boost Software License, Version 1.0. (See accompanying
 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#ifndef UUID_EE7ECCA0433B11E1923E37064924019B
+#define UUID_EE7ECCA0433B11E1923E37064924019B
 namespace boost { template  class error_info; }
+#endif
diff --git a/project/jni/boost/include/boost/exception/exception.hpp b/project/jni/boost/include/boost/exception/exception.hpp
index 9cdfd5c6e..42d278712 100644
--- a/project/jni/boost/include/boost/exception/exception.hpp
+++ b/project/jni/boost/include/boost/exception/exception.hpp
@@ -310,6 +310,11 @@ boost
     namespace
     exception_detail
         {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility push (default)
+# endif
+#endif
         template 
         struct
         error_info_injector:
@@ -326,6 +331,11 @@ boost
                 {
                 }
             };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility pop
+# endif
+#endif
 
         struct large_size { char c[256]; };
         large_size dispatch_boost_exception( exception const * );
@@ -373,6 +383,11 @@ boost
     namespace
     exception_detail
         {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility push (default)
+# endif
+#endif
         class
         clone_base
             {
@@ -386,6 +401,11 @@ boost
                 {
                 }
             };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility pop
+# endif
+#endif
 
         inline
         void
@@ -410,8 +430,15 @@ boost
         class
         clone_impl:
             public T,
-            public clone_base
+            public virtual clone_base
             {
+            struct clone_tag { };
+            clone_impl( clone_impl const & x, clone_tag ):
+                T(x)
+                {
+                copy_boost_exception(this,&x);
+                }
+
             public:
 
             explicit
@@ -430,7 +457,7 @@ boost
             clone_base const *
             clone() const
                 {
-                return new clone_impl(*this);
+                return new clone_impl(*this,clone_tag());
                 }
 
             void
diff --git a/project/jni/boost/include/boost/exception/info.hpp b/project/jni/boost/include/boost/exception/info.hpp
index 553074622..7b56076d7 100644
--- a/project/jni/boost/include/boost/exception/info.hpp
+++ b/project/jni/boost/include/boost/exception/info.hpp
@@ -97,7 +97,7 @@ boost
                     {
                     shared_ptr const & p = i->second;
 #ifndef BOOST_NO_RTTI
-                    BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
+                    BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ );
 #endif
                     return p;
                     }
diff --git a/project/jni/boost/include/boost/exception/info_tuple.hpp b/project/jni/boost/include/boost/exception/info_tuple.hpp
index 34afe421b..bf1be15da 100644
--- a/project/jni/boost/include/boost/exception/info_tuple.hpp
+++ b/project/jni/boost/include/boost/exception/info_tuple.hpp
@@ -18,6 +18,30 @@
 namespace
 boost
     {
+    template <
+        class E >
+    inline
+    E const &
+    operator<<(
+        E const & x,
+        tuple< > const & v )
+        {
+        return x;
+        }
+
+    template <
+        class E,
+        class Tag1,class T1 >
+    inline
+    E const &
+    operator<<(
+        E const & x,
+        tuple<
+            error_info > const & v )
+        {
+        return x << v.template get<0>();
+        }
+
     template <
         class E,
         class Tag1,class T1,
diff --git a/project/jni/boost/include/boost/filesystem.hpp b/project/jni/boost/include/boost/filesystem.hpp
index d64d760c0..1a753026c 100644
--- a/project/jni/boost/include/boost/filesystem.hpp
+++ b/project/jni/boost/include/boost/filesystem.hpp
@@ -12,30 +12,9 @@
 #ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP
 #define BOOST_FILESYSTEM_FILESYSTEM_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-#  include 
-#  include 
-#  include 
-
-# else
-#  include 
-#  include 
-#  include 
-#  include 
-
-# endif
+#  include 
+#  include 
+#  include 
+#  include 
 
 #endif  // BOOST_FILESYSTEM_FILESYSTEM_HPP 
diff --git a/project/jni/boost/include/boost/filesystem/config.hpp b/project/jni/boost/include/boost/filesystem/config.hpp
index c813bf5c0..ca695f411 100644
--- a/project/jni/boost/include/boost/filesystem/config.hpp
+++ b/project/jni/boost/include/boost/filesystem/config.hpp
@@ -1,6 +1,6 @@
-//  boost/filesystem/config.hpp  -------------------------------------------------------//
+//  boost/filesystem/v3/config.hpp  ----------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2003
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
@@ -9,27 +9,101 @@
 
 //--------------------------------------------------------------------------------------// 
 
-#ifndef BOOST_FILESYSTEM_CONFIGX_HPP
-#define BOOST_FILESYSTEM_CONFIGX_HPP
+#ifndef BOOST_FILESYSTEM3_CONFIG_HPP
+#define BOOST_FILESYSTEM3_CONFIG_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
+#   error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
 # endif
 
 # if !defined(BOOST_FILESYSTEM_VERSION)
 #   define BOOST_FILESYSTEM_VERSION 3
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
 
-# else
-#  include 
+// This header implements separate compilation features as described in
+// http://www.boost.org/more/separate_compilation.html
 
+#include 
+#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
+#include  
+
+//  BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
+
+# ifdef BOOST_FILESYSTEM_SOURCE
+#   define BOOST_FILESYSTEM_DEPRECATED
 # endif
 
-#endif  // BOOST_FILESYSTEM_CONFIGX_HPP 
+//  throw an exception  ----------------------------------------------------------------//
+//
+//  Exceptions were originally thrown via boost::throw_exception().
+//  As throw_exception() became more complex, it caused user error reporting
+//  to be harder to interpret, since the exception reported became much more complex.
+//  The immediate fix was to throw directly, wrapped in a macro to make any later change
+//  easier.
+
+#define BOOST_FILESYSTEM_THROW(EX) throw EX
+
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
+# endif
+
+//  This header implements separate compilation features as described in
+//  http://www.boost.org/more/separate_compilation.html
+
+//  normalize macros  ------------------------------------------------------------------//
+
+#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) \
+  && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK)
+# define BOOST_FILESYSTEM_STATIC_LINK
+#endif
+
+#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK)
+# define BOOST_FILESYSTEM_DYN_LINK 
+#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
+# define BOOST_FILESYSTEM_STATIC_LINK 
+#endif
+
+#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK)
+# error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK
+#endif
+
+#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
+# define BOOST_FILESYSTEM_NO_LIB 
+#endif
+
+//  enable dynamic linking  ------------------------------------------------------------//
+
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
+# if defined(BOOST_FILESYSTEM_SOURCE)
+#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
+# else 
+#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
+# endif
+#else
+# define BOOST_FILESYSTEM_DECL
+#endif
+
+//  enable automatic library variant selection  ----------------------------------------// 
+
+#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
+  && !defined(BOOST_FILESYSTEM_NO_LIB)
+//
+// Set the name of our library, this will get undef'ed by auto_link.hpp
+// once it's done with it:
+//
+#define BOOST_LIB_NAME boost_filesystem
+//
+// If we're importing code from a dll, then tell auto_link.hpp about it:
+//
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
+#  define BOOST_DYN_LINK
+#endif
+//
+// And include the header that does the work:
+//
+#include 
+#endif  // auto-linking disabled
+
+#endif // BOOST_FILESYSTEM3_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/convenience.hpp b/project/jni/boost/include/boost/filesystem/convenience.hpp
index a132e17f0..f0bd98690 100644
--- a/project/jni/boost/include/boost/filesystem/convenience.hpp
+++ b/project/jni/boost/include/boost/filesystem/convenience.hpp
@@ -1,35 +1,58 @@
-//  boost/filesystem/convenience.hpp  --------------------------------------------------//
+//  boost/filesystem/convenience.hpp  ----------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes, 2002-2005
+//  Copyright Vladimir Prus, 2002
+//  Use, modification, and distribution is subject to the Boost Software
+//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
 
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
+//  See library home page at http://www.boost.org/libs/filesystem
 
-//  Library home page: http://www.boost.org/libs/filesystem
+//----------------------------------------------------------------------------// 
 
-//--------------------------------------------------------------------------------------// 
+#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
+#define BOOST_FILESYSTEM3_CONVENIENCE_HPP
 
-#ifndef BOOST_FILESYSTEM_CONVENIENCEX_HPP
-#define BOOST_FILESYSTEM_CONVENIENCEX_HPP
+#include 
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
+#include 
+#include 
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#include  // must be the last #include
 
-# else
-#  include 
+namespace boost
+{
+  namespace filesystem
+  {
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+
+    inline std::string extension(const path & p)
+    {
+      return p.extension().string();
+    }
+
+    inline std::string basename(const path & p)
+    {
+      return p.stem().string();
+    }
+
+    inline path change_extension( const path & p, const path & new_extension )
+    { 
+      path new_p( p );
+      new_p.replace_extension( new_extension );
+      return new_p;
+    }
 
 # endif
 
-#endif  // BOOST_FILESYSTEM_CONVENIENCEX_HPP 
+
+  } // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/exception.hpp b/project/jni/boost/include/boost/filesystem/exception.hpp
index 6ba8466d1..985cd8f71 100644
--- a/project/jni/boost/include/boost/filesystem/exception.hpp
+++ b/project/jni/boost/include/boost/filesystem/exception.hpp
@@ -1,35 +1,9 @@
-//  boost/filesystem/exception.hpp  ----------------------------------------------------//
+//  boost/filesystem/exception.hpp  -----------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2003
+//  Use, modification, and distribution is subject to the Boost Software
+//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
 
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP
-#define BOOST_FILESYSTEM_EXCEPTIONX_HPP
-
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-
-# else
-#  include 
-
-# endif
-
-#endif  // BOOST_FILESYSTEM_EXCEPTIONX_HPP 
+//  This header is no longer used. The contents have been moved to path.hpp.
+//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/fstream.hpp b/project/jni/boost/include/boost/filesystem/fstream.hpp
index e159e58ed..072723887 100644
--- a/project/jni/boost/include/boost/filesystem/fstream.hpp
+++ b/project/jni/boost/include/boost/filesystem/fstream.hpp
@@ -1,6 +1,6 @@
 //  boost/filesystem/fstream.hpp  ------------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2002
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
@@ -9,27 +9,174 @@
 
 //--------------------------------------------------------------------------------------// 
 
-#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP
-#define BOOST_FILESYSTEM_FSTREAMX_HPP
+#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP
+#define BOOST_FILESYSTEM3_FSTREAM_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
+#include 
+#include 
+#include 
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#include  // must be the last #include
 
-# else
-#  include 
+//  on Windows, except for standard libaries known to have wchar_t overloads for
+//  file stream I/O, use path::string() to get a narrow character c_str()
+#if defined(BOOST_WINDOWS_API) \
+  && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
+  // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
+# define BOOST_FILESYSTEM_C_STR string().c_str()  // use narrow, since wide not available
+#else  // use the native c_str, which will be narrow on POSIX, wide on Windows
+# define BOOST_FILESYSTEM_C_STR c_str()
+#endif
 
-# endif
+namespace boost
+{
+namespace filesystem
+{
 
-#endif  // BOOST_FILESYSTEM_FSTREAMX_HPP 
+//--------------------------------------------------------------------------------------//
+//                                  basic_filebuf                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_filebuf : public std::basic_filebuf
+  {
+  private: // disallow copying
+    basic_filebuf(const basic_filebuf&);
+    const basic_filebuf& operator=(const basic_filebuf&);
+
+  public:
+    basic_filebuf() {}
+    virtual ~basic_filebuf() {}
+
+    basic_filebuf*
+      open(const path& p, std::ios_base::openmode mode) 
+    {
+      return std::basic_filebuf::open(p.BOOST_FILESYSTEM_C_STR, mode)
+        ? this : 0;
+    }
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                 basic_ifstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_ifstream : public std::basic_ifstream
+  {
+  private: // disallow copying
+    basic_ifstream(const basic_ifstream&);
+    const basic_ifstream& operator=(const basic_ifstream&);
+
+  public:
+    basic_ifstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_ifstream(const path& p)
+      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
+
+    basic_ifstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_ifstream() {}
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                 basic_ofstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_ofstream : public std::basic_ofstream
+  {
+  private: // disallow copying
+    basic_ofstream(const basic_ofstream&);
+    const basic_ofstream& operator=(const basic_ofstream&);
+
+  public:
+    basic_ofstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_ofstream(const path& p)
+      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
+
+    basic_ofstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_ofstream() {}
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                  basic_fstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_fstream : public std::basic_fstream
+  {
+  private: // disallow copying
+    basic_fstream(const basic_fstream&);
+    const basic_fstream & operator=(const basic_fstream&);
+
+  public:
+    basic_fstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_fstream(const path& p)
+      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR,
+          std::ios_base::in | std::ios_base::out) {}
+
+    basic_fstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR,
+          std::ios_base::in | std::ios_base::out); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_fstream() {}
+
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                    typedefs                                          //
+//--------------------------------------------------------------------------------------//
+
+  typedef basic_filebuf filebuf;
+  typedef basic_ifstream ifstream;
+  typedef basic_ofstream ofstream;
+  typedef basic_fstream fstream;
+
+  typedef basic_filebuf wfilebuf;
+  typedef basic_ifstream wifstream;
+  typedef basic_ofstream wofstream;
+  typedef basic_fstream wfstream;
+  
+} // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif  // BOOST_FILESYSTEM3_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/operations.hpp b/project/jni/boost/include/boost/filesystem/operations.hpp
index db7b1235e..dc01b7d8b 100644
--- a/project/jni/boost/include/boost/filesystem/operations.hpp
+++ b/project/jni/boost/include/boost/filesystem/operations.hpp
@@ -1,35 +1,1096 @@
 //  boost/filesystem/operations.hpp  ---------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
-
+//  Copyright Beman Dawes 2002-2009
+//  Copyright Jan Langer 2002
+//  Copyright Dietmar Kuehl 2001                                        
+//  Copyright Vladimir Prus 2002
+   
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
 //  Library home page: http://www.boost.org/libs/filesystem
 
-//--------------------------------------------------------------------------------------// 
+//--------------------------------------------------------------------------------------//
 
-#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP
-#define BOOST_FILESYSTEM_OPERATIONSX_HPP
+#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP
+#define BOOST_FILESYSTEM3_OPERATIONS_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include  // for pair
+#include 
+#include 
+#include 
+
+#ifdef BOOST_WINDOWS_API
+#  include 
+#endif
+
+#include  // must be the last #include
+
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+  namespace filesystem
+  {
+
+//--------------------------------------------------------------------------------------//
+//                                     file_type                                        //
+//--------------------------------------------------------------------------------------//
+
+  enum file_type
+  { 
+    status_error,
+#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+    status_unknown = status_error,
+#   endif
+    file_not_found,
+    regular_file,
+    directory_file,
+    // the following may not apply to some operating systems or file systems
+    symlink_file,
+    block_file,
+    character_file,
+    fifo_file,
+    socket_file,
+    reparse_file,  // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
+    type_unknown,  // file does exist, but isn't one of the above types or
+                   // we don't have strong enough permission to find its type
+
+    _detail_directory_symlink  // internal use only; never exposed to users
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                       perms                                          //
+//--------------------------------------------------------------------------------------//
+
+  enum perms
+  {
+    no_perms = 0,       // file_not_found is no_perms rather than perms_not_known
+
+    // POSIX equivalent macros given in comments.
+    // Values are from POSIX and are given in octal per the POSIX standard.
+
+    // permission bits
+    
+    owner_read = 0400,  // S_IRUSR, Read permission, owner
+    owner_write = 0200, // S_IWUSR, Write permission, owner
+    owner_exe = 0100,   // S_IXUSR, Execute/search permission, owner
+    owner_all = 0700,   // S_IRWXU, Read, write, execute/search by owner
+
+    group_read = 040,   // S_IRGRP, Read permission, group
+    group_write = 020,  // S_IWGRP, Write permission, group
+    group_exe = 010,    // S_IXGRP, Execute/search permission, group
+    group_all = 070,    // S_IRWXG, Read, write, execute/search by group
+
+    others_read = 04,   // S_IROTH, Read permission, others
+    others_write = 02,  // S_IWOTH, Write permission, others
+    others_exe = 01,    // S_IXOTH, Execute/search permission, others
+    others_all = 07,    // S_IRWXO, Read, write, execute/search by others
+
+    all_all = owner_all|group_all|others_all,  // 0777
+
+    // other POSIX bits
+
+    set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
+    set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
+    sticky_bit     = 01000, // S_ISVTX,
+                            // (POSIX XSI) On directories, restricted deletion flag 
+	                          // (V7) 'sticky bit': save swapped text even after use 
+                            // (SunOS) On non-directories: don't cache this file
+                            // (SVID-v4.2) On directories: restricted deletion flag
+                            // Also see http://en.wikipedia.org/wiki/Sticky_bit
+
+    perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit,  // 07777
+
+    perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
+
+    // options for permissions() function
+
+    add_perms = 0x1000,     // adds the given permission bits to the current bits
+    remove_perms = 0x2000,  // removes the given permission bits from the current bits;
+                            // choose add_perms or remove_perms, not both; if neither add_perms
+                            // nor remove_perms is given, replace the current bits with
+                            // the given bits.
+
+    symlink_perms = 0x4000  // on POSIX, don't resolve symlinks; implied on Windows
+  };
+
+  BOOST_BITMASK(perms)
+
+//--------------------------------------------------------------------------------------//
+//                                    file_status                                       //
+//--------------------------------------------------------------------------------------//
+
+  class BOOST_FILESYSTEM_DECL file_status
+  {
+  public:
+             file_status()            : m_value(status_error), m_perms(perms_not_known) {}
+    explicit file_status(file_type v, perms prms = perms_not_known)
+                                      : m_value(v), m_perms(prms) {}
+
+    // observers
+    file_type  type() const                       { return m_value; }
+    perms      permissions() const                { return m_perms; } 
+
+    // modifiers
+    void       type(file_type v)                  { m_value = v; }
+    void       permissions(perms prms)            { m_perms = prms; }
+
+    bool operator==(const file_status& rhs) const { return type() == rhs.type() && 
+                                                    permissions() == rhs.permissions(); }
+    bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
+
+  private:
+    file_type   m_value;
+    enum perms  m_perms;
+  };
+
+  inline bool type_present(file_status f) { return f.type() != status_error; }
+  inline bool permissions_present(file_status f)
+                                          {return f.permissions() != perms_not_known;}
+  inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); }
+  inline bool exists(file_status f)       { return f.type() != status_error
+                                                && f.type() != file_not_found; }
+  inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
+  inline bool is_directory(file_status f) { return f.type() == directory_file; }
+  inline bool is_symlink(file_status f)   { return f.type() == symlink_file; }
+  inline bool is_other(file_status f)     { return exists(f) && !is_regular_file(f)
+                                                && !is_directory(f) && !is_symlink(f); }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline bool is_regular(file_status f)   { return f.type() == regular_file; }
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+  struct space_info
+  {
+    // all values are byte counts
+    boost::uintmax_t capacity;
+    boost::uintmax_t free;      // <= capacity
+    boost::uintmax_t available; // <= free
+  };
 
-# else
-#  include 
+  BOOST_SCOPED_ENUM_START(copy_option)
+    {none, fail_if_exists = none, overwrite_if_exists};
+  BOOST_SCOPED_ENUM_END
 
+//--------------------------------------------------------------------------------------//
+//                             implementation details                                   //
+//--------------------------------------------------------------------------------------//
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL
+    file_status status(const path&p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    file_status symlink_status(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool is_empty(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path initial_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path canonical(const path& p, const path& base, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy(const path& from, const path& to, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_directory(const path& from, const path& to, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_file(const path& from, const path& to,
+                    BOOST_SCOPED_ENUM(copy_option) option,  // See ticket #2925
+                    system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool create_directories(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool create_directory(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_directory_symlink(const path& to, const path& from,
+                                  system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_symlink(const path& to, const path& from, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path current_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void current_path(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    std::time_t last_write_time(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void last_write_time(const path& p, const std::time_t new_time,
+                         system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void permissions(const path& p, perms prms, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path read_symlink(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+      // For standardization, if the committee doesn't like "remove", consider "eliminate"
+    bool remove(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    space_info space(const path& p, system::error_code* ec=0); 
+    BOOST_FILESYSTEM_DECL
+    path system_complete(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path temp_directory_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path unique_path(const path& p, system::error_code* ec=0);
+  }  // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                             status query functions                                   //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  inline
+  file_status status(const path& p)    {return detail::status(p);}
+  inline 
+  file_status status(const path& p, system::error_code& ec)
+                                       {return detail::status(p, &ec);}
+  inline 
+  file_status symlink_status(const path& p) {return detail::symlink_status(p);}
+  inline
+  file_status symlink_status(const path& p, system::error_code& ec)
+                                       {return detail::symlink_status(p, &ec);}
+  inline 
+  bool exists(const path& p)           {return exists(detail::status(p));}
+  inline 
+  bool exists(const path& p, system::error_code& ec)
+                                       {return exists(detail::status(p, &ec));}
+  inline 
+  bool is_directory(const path& p)     {return is_directory(detail::status(p));}
+  inline 
+  bool is_directory(const path& p, system::error_code& ec)
+                                       {return is_directory(detail::status(p, &ec));}
+  inline 
+  bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
+  inline 
+  bool is_regular_file(const path& p, system::error_code& ec)
+                                       {return is_regular_file(detail::status(p, &ec));}
+  inline 
+  bool is_other(const path& p)         {return is_other(detail::status(p));}
+  inline 
+  bool is_other(const path& p, system::error_code& ec)
+                                       {return is_other(detail::status(p, &ec));}
+  inline
+  bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
+  inline 
+  bool is_symlink(const path& p, system::error_code& ec)
+                                       {return is_symlink(detail::symlink_status(p, &ec));}
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline
+  bool is_regular(const path& p)       {return is_regular(detail::status(p));}
+  inline
+  bool is_regular(const path& p, system::error_code& ec)
+                                       {return is_regular(detail::status(p, &ec));}
 # endif
 
-#endif  // BOOST_FILESYSTEM_OPERATIONSX_HPP 
+  inline
+  bool is_empty(const path& p)         {return detail::is_empty(p);}
+  inline
+  bool is_empty(const path& p, system::error_code& ec)
+                                       {return detail::is_empty(p, &ec);}
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                             operational functions                                    //
+//                  in alphabetical order, unless otherwise noted                       //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+ 
+  //  forward declarations
+  path current_path();  // fwd declaration
+  path initial_path();
+
+  BOOST_FILESYSTEM_DECL
+  path absolute(const path& p, const path& base=current_path());
+  //  If base.is_absolute(), throws nothing. Thus no need for ec argument
+
+  inline
+  path canonical(const path& p, const path& base=current_path())
+                                       {return detail::canonical(p, base);}
+  inline
+  path canonical(const path& p, system::error_code& ec)
+                                       {return detail::canonical(p, current_path(), &ec);}
+  inline
+  path canonical(const path& p, const path& base, system::error_code& ec)
+                                       {return detail::canonical(p, base, &ec);}
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline
+  path complete(const path& p)
+  {
+    return absolute(p, initial_path());
+  }
+
+  inline
+  path complete(const path& p, const path& base)
+  {
+    return absolute(p, base);
+  }
+# endif
+
+  inline
+  void copy(const path& from, const path& to) {detail::copy(from, to);}
+
+  inline
+  void copy(const path& from, const path& to, system::error_code& ec) 
+                                       {detail::copy(from, to, &ec);}
+  inline
+  void copy_directory(const path& from, const path& to)
+                                       {detail::copy_directory(from, to);}
+  inline
+  void copy_directory(const path& from, const path& to, system::error_code& ec)
+                                       {detail::copy_directory(from, to, &ec);}
+  inline
+  void copy_file(const path& from, const path& to,   // See ticket #2925
+                 BOOST_SCOPED_ENUM(copy_option) option)
+                                       {detail::copy_file(from, to, option);}
+  inline
+  void copy_file(const path& from, const path& to)
+                                       {detail::copy_file(from, to, copy_option::fail_if_exists);}
+  inline
+  void copy_file(const path& from, const path& to,   // See ticket #2925
+                 BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec)
+                                       {detail::copy_file(from, to, option, &ec);}
+  inline
+  void copy_file(const path& from, const path& to, system::error_code& ec)
+                                       {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);}
+  inline
+  void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}
+
+  inline
+  void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec)
+                                       {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
+  inline
+  bool create_directories(const path& p) {return detail::create_directories(p);}
+
+  inline
+  bool create_directories(const path& p, system::error_code& ec)
+                                       {return detail::create_directories(p, &ec);}
+  inline
+  bool create_directory(const path& p) {return detail::create_directory(p);}
+
+  inline
+  bool create_directory(const path& p, system::error_code& ec)
+                                       {return detail::create_directory(p, &ec);}
+  inline
+  void create_directory_symlink(const path& to, const path& from)
+                                       {detail::create_directory_symlink(to, from);}
+  inline
+  void create_directory_symlink(const path& to, const path& from, system::error_code& ec)
+                                       {detail::create_directory_symlink(to, from, &ec);}
+  inline
+  void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
+
+  inline
+  void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec)
+                                       {detail::create_hard_link(to, new_hard_link, &ec);}
+  inline
+  void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
+
+  inline
+  void create_symlink(const path& to, const path& new_symlink, system::error_code& ec)
+                                       {detail::create_symlink(to, new_symlink, &ec);}
+  inline
+  path current_path()                  {return detail::current_path();}
+
+  inline
+  path current_path(system::error_code& ec) {return detail::current_path(&ec);}
+
+  inline
+  void current_path(const path& p)     {detail::current_path(p);}
+
+  inline
+  void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);}
+
+  inline
+  bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
+
+  inline
+  bool equivalent(const path& p1, const path& p2, system::error_code& ec)
+                                       {return detail::equivalent(p1, p2, &ec);}
+  inline
+  boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
+
+  inline
+  boost::uintmax_t file_size(const path& p, system::error_code& ec)
+                                       {return detail::file_size(p, &ec);}
+  inline
+  boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
+
+  inline
+  boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
+                                       {return detail::hard_link_count(p, &ec);}
+  inline
+  path initial_path()                  {return detail::initial_path();}
+
+  inline
+  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
+
+  template 
+  path initial_path() {return initial_path();}
+  template 
+  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
+
+  inline
+  std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
+
+  inline
+  std::time_t last_write_time(const path& p, system::error_code& ec)
+                                       {return detail::last_write_time(p, &ec);}
+  inline
+  void last_write_time(const path& p, const std::time_t new_time)
+                                       {detail::last_write_time(p, new_time);}
+  inline
+  void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec)
+                                       {detail::last_write_time(p, new_time, &ec);}
+  inline
+  void permissions(const path& p, perms prms)
+                                       {detail::permissions(p, prms);}
+  inline
+  void permissions(const path& p, perms prms, system::error_code& ec)
+                                       {detail::permissions(p, prms, &ec);}
+
+  inline
+  path read_symlink(const path& p)     {return detail::read_symlink(p);}
+
+  inline
+  path read_symlink(const path& p, system::error_code& ec)
+                                       {return detail::read_symlink(p, &ec);}
+  inline
+    // For standardization, if the committee doesn't like "remove", consider "eliminate"
+  bool remove(const path& p)           {return detail::remove(p);}
+
+  inline
+  bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);}
+
+  inline
+  boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
+    
+  inline
+  boost::uintmax_t remove_all(const path& p, system::error_code& ec)
+                                       {return detail::remove_all(p, &ec);}
+  inline
+  void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
+
+  inline
+  void rename(const path& old_p, const path& new_p, system::error_code& ec)
+                                       {detail::rename(old_p, new_p, &ec);}
+  inline  // name suggested by Scott McMurray
+  void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
+
+  inline
+  void resize_file(const path& p, uintmax_t size, system::error_code& ec)
+                                       {detail::resize_file(p, size, &ec);}
+  inline
+  space_info space(const path& p)      {return detail::space(p);} 
+
+  inline
+  space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} 
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline bool symbolic_link_exists(const path& p)
+                                       { return is_symlink(symlink_status(p)); }
+# endif
+
+  inline
+  path system_complete(const path& p)  {return detail::system_complete(p);}
+
+  inline
+  path system_complete(const path& p, system::error_code& ec)
+                                       {return detail::system_complete(p, &ec);}
+  inline
+  path temp_directory_path()           {return detail::temp_directory_path();}
+
+  inline
+  path temp_directory_path(system::error_code& ec) 
+                                       {return detail::temp_directory_path(&ec);}
+  inline
+  path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
+                                       { return detail::unique_path(p); }
+  inline
+  path unique_path(const path& p, system::error_code& ec)
+                                       { return detail::unique_path(p, &ec); }
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                                 directory_entry                                      //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+//  GCC has a problem with a member function named path within a namespace or 
+//  sub-namespace that also has a class named path. The workaround is to always
+//  fully qualify the name path when it refers to the class name.
+
+class BOOST_FILESYSTEM_DECL directory_entry
+{
+public:
+
+  // compiler generated copy constructor, copy assignment, and destructor apply
+
+  directory_entry() {}
+  explicit directory_entry(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st=file_status())
+    : m_path(p), m_status(st), m_symlink_status(symlink_st)
+    {}
+
+  void assign(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st = file_status())
+    { m_path = p; m_status = st; m_symlink_status = symlink_st; }
+
+  void replace_filename(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st = file_status())
+  {
+    m_path.remove_filename();
+    m_path /= p;
+    m_status = st;
+    m_symlink_status = symlink_st;
+  }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  void replace_leaf(const boost::filesystem::path& p,
+    file_status st, file_status symlink_st)
+      { replace_filename(p, st, symlink_st); }
+# endif
+
+  const boost::filesystem::path&  path() const               {return m_path;}
+  file_status   status() const                               {return m_get_status();}
+  file_status   status(system::error_code& ec) const         {return m_get_status(&ec);}
+  file_status   symlink_status() const                       {return m_get_symlink_status();}
+  file_status   symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
+
+  bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} 
+  bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} 
+  bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} 
+  bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} 
+  bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} 
+  bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} 
+
+private:
+  boost::filesystem::path   m_path;
+  mutable file_status       m_status;           // stat()-like
+  mutable file_status       m_symlink_status;   // lstat()-like
+
+  file_status m_get_status(system::error_code* ec=0) const;
+  file_status m_get_symlink_status(system::error_code* ec=0) const;
+}; // directory_entry
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                            directory_iterator helpers                                //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+class directory_iterator;
+
+namespace detail
+{
+  BOOST_FILESYSTEM_DECL
+    system::error_code dir_itr_close(// never throws()
+    void *& handle
+#   if     defined(BOOST_POSIX_API)
+    , void *& buffer
+#   endif
+  ); 
+
+  struct dir_itr_imp
+  {
+    directory_entry  dir_entry;
+    void*            handle;
+
+#   ifdef BOOST_POSIX_API
+    void*            buffer;  // see dir_itr_increment implementation
+#   endif
+
+    dir_itr_imp() : handle(0)
+#   ifdef BOOST_POSIX_API
+      , buffer(0)
+#   endif
+    {}
+
+    ~dir_itr_imp() // never throws
+    {
+      dir_itr_close(handle
+#       if defined(BOOST_POSIX_API)
+         , buffer
+#       endif
+    );
+    }
+  };
+
+  // see path::iterator: comment below
+  BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it,
+    const path& p, system::error_code* ec);
+  BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it,
+    system::error_code* ec);
+
+}  // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                                directory_iterator                                    //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  class directory_iterator
+    : public boost::iterator_facade< directory_iterator,
+                                     directory_entry,
+                                     boost::single_pass_traversal_tag >
+  {
+  public:
+
+    directory_iterator(){}  // creates the "end" iterator
+
+    // iterator_facade derived classes don't seem to like implementations in
+    // separate translation unit dll's, so forward to detail functions
+    explicit directory_iterator(const path& p)
+        : m_imp(new detail::dir_itr_imp)
+          { detail::directory_iterator_construct(*this, p, 0); }
+
+    directory_iterator(const path& p, system::error_code& ec)
+        : m_imp(new detail::dir_itr_imp)
+          { detail::directory_iterator_construct(*this, p, &ec); }
+
+   ~directory_iterator() {} // never throws
+
+    directory_iterator& increment(system::error_code& ec)
+    { 
+      detail::directory_iterator_increment(*this, &ec);
+      return *this;
+    }
+
+  private:
+    friend struct detail::dir_itr_imp;
+    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it,
+      const path& p, system::error_code* ec);
+    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
+      system::error_code* ec);
+
+    // shared_ptr provides shallow-copy semantics required for InputIterators.
+    // m_imp.get()==0 indicates the end iterator.
+    boost::shared_ptr< detail::dir_itr_imp >  m_imp;
+
+    friend class boost::iterator_core_access;
+
+    boost::iterator_facade<
+      directory_iterator,
+      directory_entry,
+      boost::single_pass_traversal_tag >::reference dereference() const 
+    {
+      BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
+      return m_imp->dir_entry;
+    }
+
+    void increment() { detail::directory_iterator_increment(*this, 0); }
+
+    bool equal(const directory_iterator& rhs) const
+      { return m_imp == rhs.m_imp; }
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                      recursive_directory_iterator helpers                            //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  BOOST_SCOPED_ENUM_START(symlink_option)
+  {
+    none,
+    no_recurse = none,         // don't follow directory symlinks (default behavior)
+    recurse,                   // follow directory symlinks
+    _detail_no_push = recurse << 1  // internal use only
+  };
+  BOOST_SCOPED_ENUM_END
+
+  BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option))
+
+  namespace detail
+  {
+    struct recur_dir_itr_imp
+    {
+      typedef directory_iterator element_type;
+      std::stack< element_type, std::vector< element_type > > m_stack;
+      int  m_level;
+      BOOST_SCOPED_ENUM(symlink_option) m_options;
+
+      recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {}
+
+      void increment(system::error_code* ec);  // ec == 0 means throw on error
+
+      void pop();
+
+    };
+
+    //  Implementation is inline to avoid dynamic linking difficulties with m_stack:
+    //  Microsoft warning C4251, m_stack needs to have dll-interface to be used by
+    //  clients of struct 'boost::filesystem::detail::recur_dir_itr_imp'
+
+    inline
+    void recur_dir_itr_imp::increment(system::error_code* ec)
+    // ec == 0 means throw on error
+    {
+      if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
+        m_options &= ~symlink_option::_detail_no_push;
+
+      else
+      {
+        // Logic for following predicate was contributed by Daniel Aarno to handle cyclic
+        // symlinks correctly and efficiently, fixing ticket #5652.
+        //   if (((m_options & symlink_option::recurse) == symlink_option::recurse
+        //         || !is_symlink(m_stack.top()->symlink_status()))
+        //       && is_directory(m_stack.top()->status())) ...
+        // The predicate code has since been rewritten to pass error_code arguments,
+        // per ticket #5653.
+        bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
+                       || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
+                                   : !is_symlink(m_stack.top()->symlink_status(*ec)));
+        if (ec != 0 && *ec)
+          return;
+        bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
+                                            : is_directory(m_stack.top()->status(*ec)));
+        if (ec != 0 && *ec)
+          return;
+
+        if (and_pred)
+        {
+          if (ec == 0)
+            m_stack.push(directory_iterator(m_stack.top()->path()));
+          else
+          {
+            m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
+            if (*ec)
+              return;
+          }
+          if (m_stack.top() != directory_iterator())
+          {
+            ++m_level;
+            return;
+          }
+          m_stack.pop();
+        }
+      }
+
+      while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
+      {
+        m_stack.pop();
+        --m_level;
+      }
+    }
+
+    inline
+    void recur_dir_itr_imp::pop()
+    {
+      BOOST_ASSERT_MSG(m_level > 0,
+        "pop() on recursive_directory_iterator with level < 1");
+
+      do
+      {
+        m_stack.pop();
+        --m_level;
+      }
+      while (!m_stack.empty() && ++m_stack.top() == directory_iterator());
+    }
+  } // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                           recursive_directory_iterator                               //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  class recursive_directory_iterator
+    : public boost::iterator_facade<
+        recursive_directory_iterator,
+        directory_entry,
+        boost::single_pass_traversal_tag >
+  {
+  public:
+
+    recursive_directory_iterator(){}  // creates the "end" iterator
+
+    explicit recursive_directory_iterator(const path& dir_path,
+      BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none)
+      : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = opt;
+      m_imp->m_stack.push(directory_iterator(dir_path));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator(const path& dir_path,
+      BOOST_SCOPED_ENUM(symlink_option) opt,
+      system::error_code & ec)
+    : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = opt;
+      m_imp->m_stack.push(directory_iterator(dir_path, ec));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator(const path& dir_path,
+      system::error_code & ec)
+    : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = symlink_option::none;
+      m_imp->m_stack.push(directory_iterator(dir_path, ec));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator& increment(system::error_code& ec)
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "increment() on end recursive_directory_iterator");
+      m_imp->increment(&ec);
+      if (m_imp->m_stack.empty())
+        m_imp.reset(); // done, so make end iterator
+      return *this;
+    }
+
+    int level() const
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "level() on end recursive_directory_iterator");
+      return m_imp->m_level;
+    }
+
+    bool no_push_pending() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "is_no_push_requested() on end recursive_directory_iterator");
+      return (m_imp->m_options & symlink_option::_detail_no_push)
+        == symlink_option::_detail_no_push;
+    }
+
+#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+    bool no_push_request() const { return no_push_pending(); }
+#   endif
+
+    void pop()
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "pop() on end recursive_directory_iterator");
+      m_imp->pop();
+      if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
+    }
+
+    void no_push(bool value=true)
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "no_push() on end recursive_directory_iterator");
+      if (value)
+        m_imp->m_options |= symlink_option::_detail_no_push;
+      else
+        m_imp->m_options &= ~symlink_option::_detail_no_push;
+    }
+
+    file_status status() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "status() on end recursive_directory_iterator");
+      return m_imp->m_stack.top()->status();
+    }
+
+    file_status symlink_status() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "symlink_status() on end recursive_directory_iterator");
+      return m_imp->m_stack.top()->symlink_status();
+    }
+
+  private:
+
+    // shared_ptr provides shallow-copy semantics required for InputIterators.
+    // m_imp.get()==0 indicates the end iterator.
+    boost::shared_ptr< detail::recur_dir_itr_imp >  m_imp;
+
+    friend class boost::iterator_core_access;
+
+    boost::iterator_facade< 
+      recursive_directory_iterator,
+      directory_entry,
+      boost::single_pass_traversal_tag >::reference
+    dereference() const 
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "dereference of end recursive_directory_iterator");
+      return *m_imp->m_stack.top();
+    }
+
+    void increment()
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "increment of end recursive_directory_iterator");
+      m_imp->increment(0);
+      if (m_imp->m_stack.empty())
+        m_imp.reset(); // done, so make end iterator
+    }
+
+    bool equal(const recursive_directory_iterator& rhs) const
+      { return m_imp == rhs.m_imp; }
+
+  };
+
+# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+  typedef recursive_directory_iterator wrecursive_directory_iterator;
+# endif
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                            class filesystem_error                                    //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+  
+  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
+  {
+  // see http://www.boost.org/more/error_handling.html for design rationale
+
+  // all functions are inline to avoid issues with crossing dll boundaries
+
+  public:
+    // compiler generates copy constructor and copy assignment
+
+    filesystem_error(
+      const std::string & what_arg, system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+
+    filesystem_error(
+      const std::string & what_arg, const path& path1_arg,
+      system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+        m_imp_ptr->m_path1 = path1_arg;
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+    
+    filesystem_error(
+      const std::string & what_arg, const path& path1_arg,
+      const path& path2_arg, system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+        m_imp_ptr->m_path1 = path1_arg;
+        m_imp_ptr->m_path2 = path2_arg;
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+
+    ~filesystem_error() throw() {}
+
+    const path& path1() const
+    {
+      static const path empty_path;
+      return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
+    }
+    const path& path2() const
+    {
+      static const path empty_path;
+      return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
+    }
+
+    const char* what() const throw()
+    {
+      if (!m_imp_ptr.get())
+        return system::system_error::what();
+
+      try
+      {
+        if (m_imp_ptr->m_what.empty())
+        {
+          m_imp_ptr->m_what = system::system_error::what();
+          if (!m_imp_ptr->m_path1.empty())
+          {
+            m_imp_ptr->m_what += ": \"";
+            m_imp_ptr->m_what += m_imp_ptr->m_path1.string();
+            m_imp_ptr->m_what += "\"";
+          }
+          if (!m_imp_ptr->m_path2.empty())
+          {
+            m_imp_ptr->m_what += ", \"";
+            m_imp_ptr->m_what += m_imp_ptr->m_path2.string();
+            m_imp_ptr->m_what += "\"";
+          }
+        }
+        return m_imp_ptr->m_what.c_str();
+      }
+      catch (...)
+      {
+        return system::system_error::what();
+      }
+    }
+
+  private:
+    struct m_imp
+    {
+      path         m_path1; // may be empty()
+      path         m_path2; // may be empty()
+      std::string  m_what;  // not built until needed
+    };
+    boost::shared_ptr m_imp_ptr;
+  };
+
+//  test helper  -----------------------------------------------------------------------//
+
+//  Not part of the documented interface since false positives are possible;
+//  there is no law that says that an OS that has large stat.st_size
+//  actually supports large file sizes.
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
+  }
+
+  } // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/path.hpp b/project/jni/boost/include/boost/filesystem/path.hpp
index 3bed7d2c8..2dd1b00ea 100644
--- a/project/jni/boost/include/boost/filesystem/path.hpp
+++ b/project/jni/boost/include/boost/filesystem/path.hpp
@@ -1,35 +1,758 @@
-//  boost/filesystem/path.hpp  ---------------------------------------------------------//
+//  filesystem path.hpp  ---------------------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2002-2005, 2009
+//  Copyright Vladimir Prus 2002
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
 //  Library home page: http://www.boost.org/libs/filesystem
 
-//--------------------------------------------------------------------------------------// 
+//  path::stem(), extension(), and replace_extension() are based on
+//  basename(), extension(), and change_extension() from the original
+//  filesystem/convenience.hpp header by Vladimir Prus.
 
-#ifndef BOOST_FILESYSTEM_PATHX_HPP
-#define BOOST_FILESYSTEM_PATHX_HPP
+#ifndef BOOST_FILESYSTEM_PATH_HPP
+#define BOOST_FILESYSTEM_PATH_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
+#include 
+#include   // includes 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include  // must be the last #include
+
+namespace boost
+{
+namespace filesystem
+{
+  //------------------------------------------------------------------------------------//
+  //                                                                                    //
+  //                                    class path                                      //
+  //                                                                                    //
+  //------------------------------------------------------------------------------------//
+
+  class BOOST_FILESYSTEM_DECL path
+  {
+  public:
+
+    //  value_type is the character type used by the operating system API to
+    //  represent paths.
+
+# ifdef BOOST_WINDOWS_API
+    typedef wchar_t                        value_type;
+    BOOST_STATIC_CONSTEXPR value_type      preferred_separator = L'\\';
+# else 
+    typedef char                           value_type;
+    BOOST_STATIC_CONSTEXPR value_type      preferred_separator = '/';
+# endif
+    typedef std::basic_string  string_type;  
+    typedef std::codecvt   codecvt_type;
+
+
+    //  ----- character encoding conversions -----
+
+    //  Following the principle of least astonishment, path input arguments
+    //  passed to or obtained from the operating system via objects of
+    //  class path behave as if they were directly passed to or
+    //  obtained from the O/S API, unless conversion is explicitly requested.
+    //
+    //  POSIX specfies that path strings are passed unchanged to and from the
+    //  API. Note that this is different from the POSIX command line utilities,
+    //  which convert according to a locale.
+    //
+    //  Thus for POSIX, char strings do not undergo conversion.  wchar_t strings
+    //  are converted to/from char using the path locale or, if a conversion
+    //  argument is given, using a conversion object modeled on
+    //  std::wstring_convert.
+    //
+    //  The path locale, which is global to the thread, can be changed by the
+    //  imbue() function. It is initialized to an implementation defined locale.
+    //  
+    //  For Windows, wchar_t strings do not undergo conversion. char strings
+    //  are converted using the "ANSI" or "OEM" code pages, as determined by
+    //  the AreFileApisANSI() function, or, if a conversion argument is given,
+    //  using a conversion object modeled on std::wstring_convert.
+    //
+    //  See m_pathname comments for further important rationale.
+
+    //  TODO: rules needed for operating systems that use / or .
+    //  differently, or format directory paths differently from file paths. 
+    //
+    //  **********************************************************************************
+    //
+    //  More work needed: How to handle an operating system that may have
+    //  slash characters or dot characters in valid filenames, either because
+    //  it doesn't follow the POSIX standard, or because it allows MBCS
+    //  filename encodings that may contain slash or dot characters. For
+    //  example, ISO/IEC 2022 (JIS) encoding which allows switching to
+    //  JIS x0208-1983 encoding. A valid filename in this set of encodings is
+    //  0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU]
+    //                                             ^^^^
+    //  Note that 0x2F is the ASCII slash character
+    //
+    //  **********************************************************************************
+
+    //  Supported source arguments: half-open iterator range, container, c-array,
+    //  and single pointer to null terminated string.
+
+    //  All source arguments except pointers to null terminated byte strings support
+    //  multi-byte character strings which may have embedded nulls. Embedded null
+    //  support is required for some Asian languages on Windows.
+
+    //  [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used
+    //  because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults
+    //  correctly in templates.
+
+    //  -----  constructors  -----
+
+    path(){}                                          
+
+    path(const path& p) : m_pathname(p.m_pathname) {}
+
+    template 
+    path(Source const& source,
+      typename boost::enable_if::type> >::type* =0)
+    {
+      path_traits::dispatch(source, m_pathname, codecvt());
+    }
+
+    //  Overloads for the operating system API's native character type. Rationale:
+    //    - Avoids use of codecvt() for native value_type strings. This limits the
+    //      impact of locale("") initialization failures on POSIX systems to programs
+    //      that actually depend on locale(""). It further ensures that exceptions thrown
+    //      as a result of such failues occur after main() has started, so can be caught.
+    //      This is a partial resolution of tickets 4688, 5100, and 5289.
+    //    - A slight optimization for a common use case, particularly on POSIX since
+    //      value_type is char and that is the most common useage.
+    path(const value_type* s) : m_pathname(s) {}
+    path(const std::basic_string& s) : m_pathname(s) {}
+
+    template 
+    path(Source const& source, const codecvt_type& cvt)
+    //  see [defaults] note above explaining why codecvt() default arguments are not used
+    {
+      path_traits::dispatch(source, m_pathname, cvt);
+    }
+
+    template 
+    path(InputIterator begin, InputIterator end)
+    { 
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt());
+      }
+    }
+
+    template 
+    path(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      }
+    }
+
+    //  -----  assignments  -----
+
+    path& operator=(const path& p)
+    {
+      m_pathname = p.m_pathname;
+      return *this;
+    }
+
+    path& operator=(const value_type* ptr)  // required in case ptr overlaps *this
+    {
+      m_pathname = ptr;
+      return *this;
+    }
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator=(Source const& source)
+    {
+      m_pathname.clear();
+      path_traits::dispatch(source, m_pathname, codecvt());
+      return *this;
+    }
+
+    path& assign(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
+    {
+      m_pathname = ptr;
+      return *this;
+    }
+
+    template 
+    path& assign(Source const& source, const codecvt_type& cvt)
+    {
+      m_pathname.clear();
+      path_traits::dispatch(source, m_pathname, cvt);
+      return *this;
+    }
+
+    template 
+    path& assign(InputIterator begin, InputIterator end)
+    {
+      return assign(begin, end, codecvt());
+    }
+
+    template 
+    path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      m_pathname.clear();
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      }
+      return *this;
+    }
+
+    //  -----  concatenation  -----
+
+    path& operator+=(const path& p)         {m_pathname += p.m_pathname; return *this;}
+    path& operator+=(const string_type& s)  {m_pathname += s; return *this;}
+    path& operator+=(const value_type* ptr) {m_pathname += ptr; return *this;}
+    path& operator+=(value_type c)          {m_pathname += c; return *this;}
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator+=(Source const& source)
+    {
+      return concat(source, codecvt());
+    }
+
+    template 
+      typename boost::enable_if, path&>::type
+    operator+=(CharT c)
+    {
+      CharT tmp[2];
+      tmp[0] = c;
+      tmp[1] = 0;
+      return concat(tmp, codecvt());
+    }
+
+    template 
+    path& concat(Source const& source, const codecvt_type& cvt)
+    {
+      path_traits::dispatch(source, m_pathname, cvt);
+      return *this;
+    }
+
+    template 
+    path& concat(InputIterator begin, InputIterator end)
+    { 
+      return concat(begin, end, codecvt());
+    }
+
+    template 
+    path& concat(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      if (begin == end)
+        return *this;
+      std::basic_string::value_type>
+        s(begin, end);
+      path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      return *this;
+    }
+
+    //  -----  appends  -----
+
+    //  if a separator is added, it is the preferred separator for the platform;
+    //  slash for POSIX, backslash for Windows
+
+    path& operator/=(const path& p);
+
+    path& operator/=(const value_type* ptr);
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator/=(Source const& source)
+    {
+      return append(source, codecvt());
+    }
+
+    path& append(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
+    {
+      this->operator/=(ptr);
+      return *this;
+    }
+
+    template 
+    path& append(Source const& source, const codecvt_type& cvt);
+
+    template 
+    path& append(InputIterator begin, InputIterator end)
+    { 
+      return append(begin, end, codecvt());
+    }
+
+    template 
+    path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
+
+    //  -----  modifiers  -----
+
+    void   clear()             { m_pathname.clear(); }
+    path&  make_preferred()
+#   ifdef BOOST_POSIX_API
+      { return *this; }  // POSIX no effect
+#   else // BOOST_WINDOWS_API
+      ;  // change slashes to backslashes
+#   endif
+    path&  remove_filename();
+    path&  replace_extension(const path& new_extension = path());
+    void   swap(path& rhs)     { m_pathname.swap(rhs.m_pathname); }
+
+    //  -----  observers  -----
+  
+    //  For operating systems that format file paths differently than directory
+    //  paths, return values from observers are formatted as file names unless there
+    //  is a trailing separator, in which case returns are formatted as directory
+    //  paths. POSIX and Windows make no such distinction.
+
+    //  Implementations are permitted to return const values or const references.
+
+    //  The string or path returned by an observer are specified as being formatted
+    //  as "native" or "generic".
+    //
+    //  For POSIX, these are all the same format; slashes and backslashes are as input and
+    //  are not modified.
+    //
+    //  For Windows,   native:    as input; slashes and backslashes are not modified;
+    //                            this is the format of the internally stored string.
+    //                 generic:   backslashes are converted to slashes
+
+    //  -----  native format observers  -----
+
+    const string_type&  native() const { return m_pathname; }          // Throws: nothing
+    const value_type*   c_str() const  { return m_pathname.c_str(); }  // Throws: nothing
+
+    template 
+    String string() const;
+
+    template 
+    String string(const codecvt_type& cvt) const;
+
+#   ifdef BOOST_WINDOWS_API
+    const std::string string() const { return string(codecvt()); } 
+    const std::string string(const codecvt_type& cvt) const
+    { 
+      std::string tmp;
+      if (!m_pathname.empty())
+        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
+          tmp, cvt);
+      return tmp;
+    }
+    
+    //  string_type is std::wstring, so there is no conversion
+    const std::wstring&  wstring() const { return m_pathname; }
+    const std::wstring&  wstring(const codecvt_type&) const { return m_pathname; }
+
+#   else   // BOOST_POSIX_API
+    //  string_type is std::string, so there is no conversion
+    const std::string&  string() const { return m_pathname; }
+    const std::string&  string(const codecvt_type&) const { return m_pathname; }
+
+    const std::wstring  wstring() const { return wstring(codecvt()); }
+    const std::wstring  wstring(const codecvt_type& cvt) const
+    { 
+      std::wstring tmp;
+      if (!m_pathname.empty())
+        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
+          tmp, cvt);
+      return tmp;
+    }
+
+#   endif
+
+    //  -----  generic format observers  -----
+
+    template 
+    String generic_string() const;
+
+    template 
+    String generic_string(const codecvt_type& cvt) const;
+
+#   ifdef BOOST_WINDOWS_API
+    const std::string   generic_string() const { return generic_string(codecvt()); } 
+    const std::string   generic_string(const codecvt_type& cvt) const; 
+    const std::wstring  generic_wstring() const;
+    const std::wstring  generic_wstring(const codecvt_type&) const { return generic_wstring(); };
+
+#   else // BOOST_POSIX_API
+    //  On POSIX-like systems, the generic format is the same as the native format
+    const std::string&  generic_string() const  { return m_pathname; }
+    const std::string&  generic_string(const codecvt_type&) const  { return m_pathname; }
+    const std::wstring  generic_wstring() const { return wstring(codecvt()); }
+    const std::wstring  generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); }
+
+#   endif
+
+    //  -----  compare  -----
+
+    int compare(const path& p) const BOOST_NOEXCEPT;  // generic, lexicographical
+    int compare(const std::string& s) const { return compare(path(s)); }
+    int compare(const value_type* s) const  { return compare(path(s)); }
+
+    //  -----  decomposition  -----
+
+    path  root_path() const; 
+    path  root_name() const;         // returns 0 or 1 element path
+                                     // even on POSIX, root_name() is non-empty() for network paths
+    path  root_directory() const;    // returns 0 or 1 element path
+    path  relative_path() const;
+    path  parent_path() const;
+    path  filename() const;          // returns 0 or 1 element path
+    path  stem() const;              // returns 0 or 1 element path
+    path  extension() const;         // returns 0 or 1 element path
+
+    //  -----  query  -----
+
+    bool empty() const               { return m_pathname.empty(); } // name consistent with std containers
+    bool has_root_path() const       { return has_root_directory() || has_root_name(); }
+    bool has_root_name() const       { return !root_name().empty(); }
+    bool has_root_directory() const  { return !root_directory().empty(); }
+    bool has_relative_path() const   { return !relative_path().empty(); }
+    bool has_parent_path() const     { return !parent_path().empty(); }
+    bool has_filename() const        { return !m_pathname.empty(); }
+    bool has_stem() const            { return !stem().empty(); }
+    bool has_extension() const       { return !extension().empty(); }
+    bool is_absolute() const
+    {
+#     ifdef BOOST_WINDOWS_API
+      return has_root_name() && has_root_directory();
+#     else
+      return has_root_directory();
+#     endif
+    }
+    bool is_relative() const         { return !is_absolute(); } 
+
+    //  -----  iterators  -----
+
+    class iterator;
+    typedef iterator const_iterator;
+
+    iterator begin() const;
+    iterator end() const;
+
+    //  -----  static member functions  -----
+
+    static std::locale  imbue(const std::locale& loc);
+    static const        codecvt_type& codecvt();
+
+    //  -----  deprecated functions  -----
+
+# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+#   error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-
-# else
-#  include 
-
+# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+    //  recently deprecated functions supplied by default
+    path&  normalize()              { return m_normalize(); }
+    path&  remove_leaf()            { return remove_filename(); }
+    path   leaf() const             { return filename(); }
+    path   branch_path() const      { return parent_path(); }
+    bool   has_leaf() const         { return !m_pathname.empty(); }
+    bool   has_branch_path() const  { return !parent_path().empty(); }
+    bool   is_complete() const      { return is_absolute(); }
 # endif
 
-#endif  // BOOST_FILESYSTEM_PATHX_HPP 
+# if defined(BOOST_FILESYSTEM_DEPRECATED)
+    //  deprecated functions with enough signature or semantic changes that they are
+    //  not supplied by default 
+    const std::string file_string() const               { return string(); }
+    const std::string directory_string() const          { return string(); }
+    const std::string native_file_string() const        { return string(); }
+    const std::string native_directory_string() const   { return string(); }
+    const string_type external_file_string() const      { return native(); }
+    const string_type external_directory_string() const { return native(); }
+
+    //  older functions no longer supported
+    //typedef bool (*name_check)(const std::string & name);
+    //basic_path(const string_type& str, name_check) { operator/=(str); }
+    //basic_path(const typename string_type::value_type* s, name_check)
+    //  { operator/=(s);}
+    //static bool default_name_check_writable() { return false; } 
+    //static void default_name_check(name_check) {}
+    //static name_check default_name_check() { return 0; }
+    //basic_path& canonize();
+# endif
+
+//--------------------------------------------------------------------------------------//
+//                            class path private members                                //
+//--------------------------------------------------------------------------------------//
+
+  private:
+#   if defined(_MSC_VER)
+#     pragma warning(push) // Save warning settings
+#     pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
+#   endif                            // needs to have dll-interface...
+/*
+      m_pathname has the type, encoding, and format required by the native
+      operating system. Thus for POSIX and Windows there is no conversion for
+      passing m_pathname.c_str() to the O/S API or when obtaining a path from the
+      O/S API. POSIX encoding is unspecified other than for dot and slash
+      characters; POSIX just treats paths as a sequence of bytes. Windows
+      encoding is UCS-2 or UTF-16 depending on the version.
+*/
+    string_type  m_pathname;  // Windows: as input; backslashes NOT converted to slashes,
+                              // slashes NOT converted to backslashes
+#   if defined(_MSC_VER)
+#     pragma warning(pop) // restore warning settings.
+#   endif 
+
+    string_type::size_type m_append_separator_if_needed();
+    //  Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0.
+    //  Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
+
+    void m_erase_redundant_separator(string_type::size_type sep_pos);
+    string_type::size_type m_parent_path_end() const;
+
+    path& m_normalize();
+
+    // Was qualified; como433beta8 reports:
+    //    warning #427-D: qualified name is not allowed in member declaration 
+    friend class iterator;
+    friend bool operator<(const path& lhs, const path& rhs);
+
+    // see path::iterator::increment/decrement comment below
+    static void m_path_iterator_increment(path::iterator & it);
+    static void m_path_iterator_decrement(path::iterator & it);
+
+  };  // class path
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL
+      int lex_compare(path::iterator first1, path::iterator last1,
+        path::iterator first2, path::iterator last2);
+  }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  typedef path wpath;
+# endif
+
+  //------------------------------------------------------------------------------------//
+  //                             class path::iterator                                   //
+  //------------------------------------------------------------------------------------//
+ 
+  class path::iterator
+    : public boost::iterator_facade<
+      path::iterator,
+      path const,
+      boost::bidirectional_traversal_tag >
+  {
+  private:
+    friend class boost::iterator_core_access;
+    friend class boost::filesystem::path;
+    friend void m_path_iterator_increment(path::iterator & it);
+    friend void m_path_iterator_decrement(path::iterator & it);
+
+    const path& dereference() const { return m_element; }
+
+    bool equal(const iterator & rhs) const
+    {
+      return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos;
+    }
+
+    // iterator_facade derived classes don't seem to like implementations in
+    // separate translation unit dll's, so forward to class path static members
+    void increment() { m_path_iterator_increment(*this); }
+    void decrement() { m_path_iterator_decrement(*this); }
+
+    path                    m_element;   // current element
+    const path*             m_path_ptr;  // path being iterated over
+    string_type::size_type  m_pos;       // position of m_element in
+                                         // m_path_ptr->m_pathname.
+                                         // if m_element is implicit dot, m_pos is the
+                                         // position of the last separator in the path.
+                                         // end() iterator is indicated by 
+                                         // m_pos == m_path_ptr->m_pathname.size()
+  }; // path::iterator
+
+  //------------------------------------------------------------------------------------//
+  //                                                                                    //
+  //                              non-member functions                                  //
+  //                                                                                    //
+  //------------------------------------------------------------------------------------//
+
+  //  std::lexicographical_compare would infinately recurse because path iterators
+  //  yield paths, so provide a path aware version
+  inline bool lexicographical_compare(path::iterator first1, path::iterator last1,
+    path::iterator first2, path::iterator last2)
+    { return detail::lex_compare(first1, last1, first2, last2) < 0; }
+  
+  inline bool operator==(const path& lhs, const path& rhs)              {return lhs.compare(rhs) == 0;}
+  inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;} 
+  inline bool operator==(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) == 0;}
+  inline bool operator==(const path& lhs, const path::value_type* rhs)  {return lhs.compare(rhs) == 0;}
+  inline bool operator==(const path::value_type* lhs, const path& rhs)  {return rhs.compare(lhs) == 0;}
+  
+  inline bool operator!=(const path& lhs, const path& rhs)              {return lhs.compare(rhs) != 0;}
+  inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;} 
+  inline bool operator!=(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) != 0;}
+  inline bool operator!=(const path& lhs, const path::value_type* rhs)  {return lhs.compare(rhs) != 0;}
+  inline bool operator!=(const path::value_type* lhs, const path& rhs)  {return rhs.compare(lhs) != 0;}
+
+  // TODO: why do == and != have additional overloads, but the others don't?
+
+  inline bool operator<(const path& lhs, const path& rhs)  {return lhs.compare(rhs) < 0;}
+  inline bool operator<=(const path& lhs, const path& rhs) {return !(rhs < lhs);}
+  inline bool operator> (const path& lhs, const path& rhs) {return rhs < lhs;}
+  inline bool operator>=(const path& lhs, const path& rhs) {return !(lhs < rhs);}
+
+  inline std::size_t hash_value(const path& x)
+  {
+# ifdef BOOST_WINDOWS_API
+    std::size_t seed = 0;
+    for(const path::value_type* it = x.c_str(); *it; ++it)
+      hash_combine(seed, *it == '/' ? L'\\' : *it);
+    return seed;
+# else   // BOOST_POSIX_API
+    return hash_range(x.native().begin(), x.native().end());
+# endif
+  }
+
+  inline void swap(path& lhs, path& rhs)                   { lhs.swap(rhs); }
+
+  inline path operator/(const path& lhs, const path& rhs)  { return path(lhs) /= rhs; }
+
+  //  inserters and extractors
+  //    use boost::io::quoted() to handle spaces in paths
+  //    use '&' as escape character to ease use for Windows paths
+
+  template 
+  inline std::basic_ostream&
+  operator<<(std::basic_ostream& os, const path& p)
+  {
+    return os
+      << boost::io::quoted(p.template string >(), static_cast('&'));
+  }
+  
+  template 
+  inline std::basic_istream&
+  operator>>(std::basic_istream& is, path& p)
+  {
+    std::basic_string str;
+    is >> boost::io::quoted(str, static_cast('&'));
+    p = str;
+    return is;
+  }
+  
+  //  name_checks
+
+  //  These functions are holdovers from version 1. It isn't clear they have much
+  //  usefulness, or how to generalize them for later versions.
+
+  BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool native(const std::string & name);
+ 
+//--------------------------------------------------------------------------------------//
+//                     class path member template implementation                        //
+//--------------------------------------------------------------------------------------//
+
+  template 
+  path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+  { 
+    if (begin == end)
+      return *this;
+    string_type::size_type sep_pos(m_append_separator_if_needed());
+    std::basic_string::value_type>
+      s(begin, end);
+    path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+    if (sep_pos)
+      m_erase_redundant_separator(sep_pos);
+    return *this;
+  }
+
+  template 
+  path& path::append(Source const& source, const codecvt_type& cvt)
+  {
+    if (path_traits::empty(source))
+      return *this;
+    string_type::size_type sep_pos(m_append_separator_if_needed());
+    path_traits::dispatch(source, m_pathname, cvt);
+    if (sep_pos)
+      m_erase_redundant_separator(sep_pos);
+    return *this;
+  }
+
+//--------------------------------------------------------------------------------------//
+//                     class path member template specializations                       //
+//--------------------------------------------------------------------------------------//
+
+  template <> inline
+  std::string path::string() const
+    { return string(); }
+
+  template <> inline
+  std::wstring path::string() const
+    { return wstring(); }
+
+  template <> inline
+  std::string path::string(const codecvt_type& cvt) const
+    { return string(cvt); }
+
+  template <> inline
+  std::wstring path::string(const codecvt_type& cvt) const
+    { return wstring(cvt); }
+
+  template <> inline
+  std::string path::generic_string() const
+    { return generic_string(); }
+
+  template <> inline
+  std::wstring path::generic_string() const
+    { return generic_wstring(); }
+
+  template <> inline
+  std::string path::generic_string(const codecvt_type& cvt) const
+    { return generic_string(cvt); }
+
+  template <> inline
+  std::wstring path::generic_string(const codecvt_type& cvt) const
+    { return generic_wstring(cvt); }
+
+
+}  // namespace filesystem
+}  // namespace boost
+
+//----------------------------------------------------------------------------//
+
+#include  // pops abi_prefix.hpp pragmas
+
+#endif  // BOOST_FILESYSTEM_PATH_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/path_traits.hpp b/project/jni/boost/include/boost/filesystem/path_traits.hpp
similarity index 95%
rename from project/jni/boost/include/boost/filesystem/v3/path_traits.hpp
rename to project/jni/boost/include/boost/filesystem/path_traits.hpp
index 13f1b2095..a6a250557 100644
--- a/project/jni/boost/include/boost/filesystem/v3/path_traits.hpp
+++ b/project/jni/boost/include/boost/filesystem/path_traits.hpp
@@ -16,7 +16,7 @@
 #   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +32,7 @@
 
 #include  // must be the last #include
 
-namespace boost { namespace filesystem3 {
+namespace boost { namespace filesystem {
 
   BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category();
   //  uses std::codecvt_base::result used for error codes:
@@ -85,8 +85,8 @@ namespace path_traits {
   }
 
   template  inline
-     bool empty(T (&)[N])
-       { return N <= 1; }
+     bool empty(T (&x)[N])
+       { return !x[0]; }
 
   // value types differ  ---------------------------------------------------------------//
   //
@@ -230,18 +230,6 @@ namespace path_traits {
 
 }}} // namespace boost::filesystem::path_traits
 
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::codecvt_error_category;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
 #include  // pops abi_prefix.hpp pragmas
 
 #endif  // BOOST_FILESYSTEM_PATH_TRAITS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/config.hpp b/project/jni/boost/include/boost/filesystem/v2/config.hpp
deleted file mode 100644
index 7116de5c5..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/config.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//  boost/filesystem/v2/config.hpp  ------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-
-//  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 library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_CONFIG_HPP
-#define BOOST_FILESYSTEM2_CONFIG_HPP
-
-# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 2
-#   error Compiling Filesystem version 2 file with BOOST_FILESYSTEM_VERSION defined != 2
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 2
-# endif
-
-#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
-
-//  ability to change namespace aids path_table.cpp  ------------------------// 
-#ifndef BOOST_FILESYSTEM2_NAMESPACE
-# define BOOST_FILESYSTEM2_NAMESPACE filesystem2
-#endif
-
-#include 
-#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
-#include  
-
-//  BOOST_POSIX_PATH or BOOST_WINDOWS_PATH specify which path syntax to recognise
-
-# if defined(BOOST_WINDOWS_API) && defined(BOOST_POSIX_PATH)
-#   error builds with Windows API do not support BOOST_POSIX_PATH
-# endif
-
-# if !defined(_WIN32) && !defined(__CYGWIN__) && defined(BOOST_WINDOWS_PATH)
-#   error builds on non-Windows platforms do not support BOOST_WINDOWS_PATH
-# endif
-
-# if defined(BOOST_WINDOWS_PATH) && defined(BOOST_POSIX_PATH)
-#   error both BOOST_WINDOWS_PATH and BOOST_POSIX_PATH are defined
-# elif !defined(BOOST_WINDOWS_PATH) && !defined(BOOST_POSIX_PATH)
-#   if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__CYGWIN__))
-#     define BOOST_WINDOWS_PATH
-#   else
-#     define BOOST_POSIX_PATH
-#   endif
-# endif
-
-//  throw an exception  ----------------------------------------------------------------//
-//
-//  Exceptions were originally thrown via boost::throw_exception().
-//  As throw_exception() became more complex, it caused user error reporting
-//  to be harder to interpret, since the exception reported became much more complex.
-//  The immediate fix was to throw directly, wrapped in a macro to make any later change
-//  easier.
-
-#define BOOST_FILESYSTEM_THROW(EX) throw EX
-
-//  narrow support only for badly broken compilers or libraries  -------------//
-
-# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610)
-#   define BOOST_FILESYSTEM2_NARROW_ONLY
-# endif
-
-// This header implements separate compilation features as described in
-// http://www.boost.org/more/separate_compilation.html
-
-//  enable dynamic linking ---------------------------------------------------//
-
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-# if defined(BOOST_FILESYSTEM_SOURCE)
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
-# else 
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
-# endif
-#else
-# define BOOST_FILESYSTEM_DECL
-#endif
-
-//  enable automatic library variant selection  ------------------------------// 
-
-#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
-  && !defined(BOOST_FILESYSTEM_NO_LIB)
-//
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_filesystem
-//
-// If we're importing code from a dll, then tell auto_link.hpp about it:
-//
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-#  define BOOST_DYN_LINK
-#endif
-//
-// And include the header that does the work:
-//
-#include 
-#endif  // auto-linking disabled
-
-#endif // BOOST_FILESYSTEM2_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/convenience.hpp b/project/jni/boost/include/boost/filesystem/v2/convenience.hpp
deleted file mode 100644
index 30b6adee7..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/convenience.hpp
+++ /dev/null
@@ -1,339 +0,0 @@
-//  boost/filesystem/convenience.hpp  ----------------------------------------//
-
-//  Copyright Beman Dawes, 2002-2005
-//  Copyright Vladimir Prus, 2002
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP
-#define BOOST_FILESYSTEM2_CONVENIENCE_HPP
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) \
-      template typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_FS_FUNC_STRING BOOST_FS_FUNC(typename Path::string_type)
-#   define BOOST_FS_TYPENAME typename
-# else
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE 
-    typedef boost::filesystem::path Path;
-#   define BOOST_FS_FUNC_STRING inline std::string
-#   define BOOST_FS_TYPENAME
-# endif
-
-namespace boost
-{
-  namespace filesystem2
-  {
-
-    BOOST_FS_FUNC(bool) create_directories(const Path& ph)
-    {
-         if (ph.empty() || exists(ph))
-         {
-           if ( !ph.empty() && !is_directory(ph) )
-               boost::throw_exception( basic_filesystem_error(
-                 "boost::filesystem::create_directories", ph,
-                 make_error_code( boost::system::errc::file_exists ) ) );
-           return false;
-         }
-
-         // First create branch, by calling ourself recursively
-         create_directories(ph.parent_path());
-         // Now that parent's path exists, create the directory
-         create_directory(ph);
-         return true;
-     }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    BOOST_FS_FUNC_STRING extension(const Path& ph)
-    {
-      typedef BOOST_FS_TYPENAME Path::string_type string_type;
-      string_type filename = ph.filename();
-
-      BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
-      if (n != string_type::npos)
-        return filename.substr(n);
-      else
-        return string_type();
-    }
-
-    BOOST_FS_FUNC_STRING basename(const Path& ph)
-    {
-      typedef BOOST_FS_TYPENAME Path::string_type string_type;
-      string_type filename = ph.filename();
-      BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
-      return filename.substr(0, n);
-    }
-
-
-    BOOST_FS_FUNC(Path) change_extension( const Path & ph,
-      const BOOST_FS_TYPENAME Path::string_type & new_extension )
-    {
-#   if !defined(_STLPORT_VERSION)
-      return ph.parent_path() / (basename(ph) + new_extension); 
-#   else
-      typedef BOOST_FS_TYPENAME Path::string_type string_type; 
-      string_type filename = basename(ph) + new_extension; 
-      return ph.parent_path() / filename;
-#   endif
-    } 
-# endif
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    // "do-the-right-thing" overloads  ---------------------------------------//
-
-    inline bool create_directories(const path& ph)
-      { return create_directories(ph); }
-    inline bool create_directories(const wpath& ph)
-      { return create_directories(ph); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline std::string extension(const path& ph)
-      { return extension(ph); }
-    inline std::wstring extension(const wpath& ph)
-      { return extension(ph); }
-
-    inline std::string basename(const path& ph)
-      { return basename( ph ); }
-    inline std::wstring basename(const wpath& ph)
-      { return basename( ph ); }
-
-    inline path change_extension( const path & ph, const std::string& new_ex )
-      { return change_extension( ph, new_ex ); }
-    inline wpath change_extension( const wpath & ph, const std::wstring& new_ex )
-      { return change_extension( ph, new_ex ); }
-# endif
-
-# endif
-
-
-    //  basic_recursive_directory_iterator helpers  --------------------------//
-
-    namespace detail
-    {
-      template< class Path >
-      struct recur_dir_itr_imp
-      {
-        typedef basic_directory_iterator< Path > element_type;
-        std::stack< element_type, std::vector< element_type > > m_stack;
-        int  m_level;
-        bool m_no_push;
-        bool m_no_throw;
-
-        recur_dir_itr_imp() : m_level(0), m_no_push(false), m_no_throw(false) {}
-      };
-
-    } // namespace detail
-
-    //  basic_recursive_directory_iterator  ----------------------------------//
-
-    template< class Path >
-    class basic_recursive_directory_iterator
-      : public boost::iterator_facade<
-          basic_recursive_directory_iterator,
-          basic_directory_entry,
-          boost::single_pass_traversal_tag >
-    {
-    public:
-      typedef Path path_type;
-
-      basic_recursive_directory_iterator(){}  // creates the "end" iterator
-
-      explicit basic_recursive_directory_iterator( const Path & dir_path );
-      basic_recursive_directory_iterator( const Path & dir_path,
-        system::error_code & ec );
-
-      int level() const { return m_imp->m_level; }
-
-      void pop();
-      void no_push()
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to no_push() on end iterator" );
-        m_imp->m_no_push = true;
-      }
-
-      file_status status() const
-      {
-        BOOST_ASSERT( m_imp.get()
-          && "attempt to call status() on end recursive_iterator" );
-        return m_imp->m_stack.top()->status();
-      }
-
-      file_status symlink_status() const
-      {
-        BOOST_ASSERT( m_imp.get()
-          && "attempt to call symlink_status() on end recursive_iterator" );
-        return m_imp->m_stack.top()->symlink_status();
-      }
-
-    private:
-
-      // shared_ptr provides shallow-copy semantics required for InputIterators.
-      // m_imp.get()==0 indicates the end iterator.
-      boost::shared_ptr< detail::recur_dir_itr_imp< Path > >  m_imp;
-
-      friend class boost::iterator_core_access;
-
-      typename boost::iterator_facade< 
-        basic_recursive_directory_iterator,
-        basic_directory_entry,
-        boost::single_pass_traversal_tag >::reference
-      dereference() const 
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" );
-        return *m_imp->m_stack.top();
-      }
-
-      void increment();
-
-      bool equal( const basic_recursive_directory_iterator & rhs ) const
-        { return m_imp == rhs.m_imp; }
-
-    };
-
-    typedef basic_recursive_directory_iterator recursive_directory_iterator;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_recursive_directory_iterator wrecursive_directory_iterator;
-# endif
-
-    //  basic_recursive_directory_iterator implementation  -------------------//
-
-    //  constructors
-    template
-    basic_recursive_directory_iterator::
-      basic_recursive_directory_iterator( const Path & dir_path )
-      : m_imp( new detail::recur_dir_itr_imp )
-    {
-      m_imp->m_stack.push( basic_directory_iterator( dir_path ) );
-      if ( m_imp->m_stack.top () == basic_directory_iterator() )
-        { m_imp.reset (); }
-    }
-
-    template
-    basic_recursive_directory_iterator::
-      basic_recursive_directory_iterator( const Path & dir_path,
-        system::error_code & ec )
-      : m_imp( new detail::recur_dir_itr_imp )
-    {
-      m_imp->m_no_throw = true;
-      m_imp->m_stack.push( basic_directory_iterator( dir_path, ec ) );
-      if ( m_imp->m_stack.top () == basic_directory_iterator() )
-        { m_imp.reset (); }
-    }
-
-    //  increment
-    template
-    void basic_recursive_directory_iterator::increment()
-    {
-      BOOST_ASSERT( m_imp.get() && "increment on end iterator" );
-      
-      static const basic_directory_iterator end_itr;
-
-      if ( m_imp->m_no_push )
-        { m_imp->m_no_push = false; }
-      else if ( is_directory( m_imp->m_stack.top()->status() ) )
-      {
-        system::error_code ec;
-#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
-        if( m_imp->m_no_throw ) {
-            m_imp->m_stack.push(
-                basic_directory_iterator( *m_imp->m_stack.top(), ec )
-            );
-        }
-        else {
-            m_imp->m_stack.push(
-                basic_directory_iterator( *m_imp->m_stack.top() )
-            );
-        }
-#else
-        m_imp->m_stack.push(
-          m_imp->m_no_throw
-            ? basic_directory_iterator( *m_imp->m_stack.top(), ec )
-            : basic_directory_iterator( *m_imp->m_stack.top() ) );
-#endif
-        if ( m_imp->m_stack.top() != end_itr )
-        {
-          ++m_imp->m_level;
-          return;
-        }
-        m_imp->m_stack.pop();
-      }
-
-      while ( !m_imp->m_stack.empty()
-        && ++m_imp->m_stack.top() == end_itr )
-      {
-        m_imp->m_stack.pop();
-        --m_imp->m_level;
-      }
-
-      if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator
-    }
-
-    //  pop
-    template
-    void basic_recursive_directory_iterator::pop()
-    {
-      BOOST_ASSERT( m_imp.get() && "pop on end iterator" );
-      BOOST_ASSERT( m_imp->m_level > 0 && "pop with level < 1" );
-
-      static const basic_directory_iterator end_itr;
-
-      do
-      {
-        m_imp->m_stack.pop();
-        --m_imp->m_level;
-      }
-      while ( !m_imp->m_stack.empty()
-        && ++m_imp->m_stack.top() == end_itr );
-
-      if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator
-    }
-
-  } // namespace filesystem2
-} // namespace boost
-
-#undef BOOST_FS_FUNC_STRING
-#undef BOOST_FS_FUNC
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::create_directories;
-    using filesystem2::basic_recursive_directory_iterator;
-    using filesystem2::recursive_directory_iterator;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem2::extension;
-    using filesystem2::basename;
-    using filesystem2::change_extension;
-# endif
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wrecursive_directory_iterator;
-# endif
-
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM2_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/exception.hpp b/project/jni/boost/include/boost/filesystem/v2/exception.hpp
deleted file mode 100644
index edea663b1..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/exception.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-//  boost/filesystem/exception.hpp  -------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  This header is no long used. The contents have been moved to path.hpp.
-//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/v2/fstream.hpp b/project/jni/boost/include/boost/filesystem/v2/fstream.hpp
deleted file mode 100644
index 887d59d3a..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/fstream.hpp
+++ /dev/null
@@ -1,613 +0,0 @@
-//  boost/filesystem/fstream.hpp  --------------------------------------------//
-
-//  Copyright Beman Dawes 2002.
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP
-#define BOOST_FILESYSTEM2_FSTREAM_HPP
-
-#include 
-#include  // for 8.3 hack (see below)
-#include 
-#include 
-
-#include 
-#include 
-
-#include  // must be the last #include
-
-// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for
-// various compiler problems. They have been removed to ease development of the
-// basic i18n functionality. Once the new interface is stable, the workarounds
-// will be reinstated for any compilers that otherwise can support the rest of
-// the library after internationalization.
-
-namespace boost
-{
-  namespace filesystem2
-  {
-    namespace detail
-    {
-#   if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-#     if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405
-      // The 8.3 hack:
-      // C++98 does not supply a wchar_t open, so try to get an equivalent
-      // narrow char name based on the short, so-called 8.3, name.
-      // Not needed for Dinkumware 405 and later as they do supply wchar_t open.
-      BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph,
-        std::ios_base::openmode mode ); // true if succeeds
-      BOOST_FILESYSTEM_DECL std::string narrow_path_api(
-        const std::wstring & ph ); // return is empty if fails
-
-      inline std::string path_proxy( const std::wstring & file_ph,
-        std::ios_base::openmode mode )
-      // Return a non-existant path if cannot supply narrow short path.
-      // An empty path doesn't work because some Dinkumware versions
-      // assert the path is non-empty.  
-      {
-        std::string narrow_ph;
-        bool created_file( false );
-        if ( !exists( file_ph )
-          && (mode & std::ios_base::out) != 0
-          && create_file_api( file_ph, mode ) )
-        {
-          created_file = true;
-        }
-        narrow_ph = narrow_path_api( file_ph );
-        if ( narrow_ph.empty() )
-        {
-          if ( created_file ) remove_api( file_ph );
-          narrow_ph = "\x01";
-        }
-        return narrow_ph;
-      }
-#     else
-      // Dinkumware 405 and later does supply wchar_t functions
-      inline const std::wstring & path_proxy( const std::wstring & file_ph,
-        std::ios_base::openmode )
-        { return file_ph; }
-#     endif
-#   endif 
-
-      inline const std::string & path_proxy( const std::string & file_ph,
-        std::ios_base::openmode )
-        { return file_ph; }
-
-    } // namespace detail
-
-    template < class charT, class traits = std::char_traits >
-    class basic_filebuf : public std::basic_filebuf
-    {
-    private: // disallow copying
-      basic_filebuf( const basic_filebuf & );
-      const basic_filebuf & operator=( const basic_filebuf & ); 
-    public:
-      basic_filebuf() {}
-      virtual ~basic_filebuf() {}
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-      template
-      typename boost::enable_if,
-        basic_filebuf *>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-
-      basic_filebuf *
-      open( const wpath & file_ph, std::ios_base::openmode mode );
-#   endif
-
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      basic_filebuf *
-      open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_ifstream : public std::basic_ifstream
-    {
-    private: // disallow copying
-      basic_ifstream( const basic_ifstream & );
-      const basic_ifstream & operator=( const basic_ifstream & ); 
-    public:
-      basic_ifstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-      template
-      explicit basic_ifstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-
-      template
-      basic_ifstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-
-      explicit basic_ifstream( const wpath & file_ph );
-      basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-#   endif
-
-      explicit basic_ifstream( const path & file_ph );
-      basic_ifstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_ifstream() {}
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_ofstream : public std::basic_ofstream
-    {
-    private: // disallow copying
-      basic_ofstream( const basic_ofstream & );
-      const basic_ofstream & operator=( const basic_ofstream & ); 
-    public:
-      basic_ofstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-      template
-      explicit basic_ofstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-      explicit basic_ofstream( const wpath & file_ph );
-
-      template
-      basic_ofstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-      basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-      void open( const wpath & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-
-#   endif
-
-      explicit basic_ofstream( const path & file_ph );
-      basic_ofstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_ofstream() {}
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_fstream : public std::basic_fstream
-    {
-    private: // disallow copying
-      basic_fstream( const basic_fstream & );
-      const basic_fstream & operator=( const basic_fstream & ); 
-    public:
-      basic_fstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-      template
-      explicit basic_fstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-      explicit basic_fstream( const wpath & file_ph );
-
-      template
-      basic_fstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-      basic_fstream( const wpath & file_ph, std::ios_base::openmode mode );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-      void open( const wpath & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-
-#   endif
-
-      explicit basic_fstream( const path & file_ph );
-      basic_fstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_fstream() {}
-
-    };
- 
-    typedef basic_filebuf filebuf;
-    typedef basic_ifstream ifstream;
-    typedef basic_ofstream ofstream;
-    typedef basic_fstream fstream;
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_filebuf wfilebuf;
-    typedef basic_ifstream wifstream;
-    typedef basic_fstream wfstream;
-    typedef basic_ofstream wofstream;
-# endif
-    
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-//  basic_filebuf definitions  -----------------------------------------------//
-
-    template 
-    template
-    typename boost::enable_if,
-      basic_filebuf *>::type
-    basic_filebuf::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return (std::basic_filebuf::open( detail::path_proxy(
-        file_ph.external_file_string(), mode ).c_str(), mode )
-          == 0) ? 0 : this;
-    }
-
-    template 
-    basic_filebuf *
-    basic_filebuf::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return this->BOOST_NESTED_TEMPLATE open( file_ph, mode );
-    }
-
-//  basic_ifstream definitions  ----------------------------------------------//
-
-    template  template
-    basic_ifstream::basic_ifstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const wpath & file_ph )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in ) {}
-    
-    template  template
-    basic_ifstream::basic_ifstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ifstream::open( const Path & file_ph )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in );
-    }
-
-    template 
-    void basic_ifstream::open( const wpath & file_ph )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ifstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-    
-    template 
-    void basic_ifstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-//  basic_ofstream definitions  ----------------------------------------------//
-
-    template  template
-    basic_ofstream::basic_ofstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const wpath & file_ph )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out ) {}
-
-    template  template
-    basic_ofstream::basic_ofstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ofstream::open( const Path & file_ph )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out );
-    }
-    
-    template 
-    void basic_ofstream::open( const wpath & file_ph )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ofstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-    template 
-    void basic_ofstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-//  basic_fstream definitions  -----------------------------------------------//
-
-    template  template
-    basic_fstream::basic_fstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-    template 
-    basic_fstream::basic_fstream( const wpath & file_ph )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-    template  template
-    basic_fstream::basic_fstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-    
-    template 
-    basic_fstream::basic_fstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-      
-    template  template
-    typename boost::enable_if, void>::type
-    basic_fstream::open( const Path & file_ph )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out );
-    }
-
-    template 
-    void basic_fstream::open( const wpath & file_ph )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_fstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-    template 
-    void basic_fstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-# endif
-
-#  if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    basic_filebuf *
-    basic_filebuf::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return std::basic_filebuf::open(
-        file_ph.file_string().c_str(), mode ) == 0 ? 0 : this;
-    }
-#  endif
-
-    template 
-    basic_ifstream::basic_ifstream( const path & file_ph )
-      : std::basic_ifstream(
-          file_ph.file_string().c_str(), std::ios_base::in ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ifstream(
-          file_ph.file_string().c_str(), mode ) {}
-    
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_ifstream::open( const path & file_ph )
-    {
-      std::basic_ifstream::open(
-        file_ph.file_string().c_str(), std::ios_base::in );
-    }
-    
-    template 
-    void basic_ifstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-
-    template 
-    basic_ofstream::basic_ofstream( const path & file_ph )
-      : std::basic_ofstream(
-          file_ph.file_string().c_str(), std::ios_base::out ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ofstream(
-          file_ph.file_string().c_str(), mode ) {}
-    
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_ofstream::open( const path & file_ph )
-    {
-      std::basic_ofstream::open(
-        file_ph.file_string().c_str(), std::ios_base::out );
-    }
-    
-    template 
-    void basic_ofstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-
-    template 
-    basic_fstream::basic_fstream( const path & file_ph )
-      : std::basic_fstream(
-          file_ph.file_string().c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-
-    template 
-    basic_fstream::basic_fstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_fstream(
-          file_ph.file_string().c_str(), mode ) {}
-
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_fstream::open( const path & file_ph )
-    {
-      std::basic_fstream::open(
-        file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out );
-    }
-
-    template 
-    void basic_fstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-  } // namespace filesystem2
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wfilebuf;
-    using filesystem2::wifstream;
-    using filesystem2::wfstream;
-    using filesystem2::wofstream;
-# endif
-    using filesystem2::filebuf;
-    using filesystem2::ifstream;
-    using filesystem2::ofstream;
-    using filesystem2::fstream;
-    using filesystem2::basic_filebuf;
-    using filesystem2::basic_ifstream;
-    using filesystem2::basic_ofstream;
-    using filesystem2::basic_fstream;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif  // BOOST_FILESYSTEM2_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/operations.hpp b/project/jni/boost/include/boost/filesystem/v2/operations.hpp
deleted file mode 100644
index 57c406daa..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/operations.hpp
+++ /dev/null
@@ -1,1245 +0,0 @@
-//  boost/filesystem/operations.hpp  -----------------------------------------//
-
-//  Copyright 2002-2005 Beman Dawes
-//  Copyright 2002 Jan Langer
-//  Copyright 2001 Dietmar Kuehl                                        
-//  
-//  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 library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP
-#define BOOST_FILESYSTEM2_OPERATIONS_HPP
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for pair
-#include 
-
-#ifdef BOOST_WINDOWS_API
-#  include 
-#  if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0500
-#    define BOOST_FS_HARD_LINK // Default for Windows 2K or later 
-#  endif
-#endif
-
-#include  // must be the last #include
-
-# ifdef BOOST_NO_STDC_NAMESPACE
-    namespace std { using ::time_t; }
-# endif
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem2
-  {
-
-// typedef boost::filesystem::path Path; needs to be in namespace boost::filesystem
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) \
-      template typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \
-      template inline typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_FS_TYPENAME typename
-# else
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE
-#   define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE
-    typedef boost::filesystem2::path Path;
-#   define BOOST_FS_TYPENAME
-# endif
-
-    template class basic_directory_iterator;
-
-    // BOOST_FILESYSTEM2_NARROW_ONLY needs this:
-    typedef basic_directory_iterator directory_iterator;
-
-    template class basic_directory_entry;
-
-    enum file_type
-    { 
-      status_unknown,
-      file_not_found,
-      regular_file,
-      directory_file,
-      // the following will never be reported by some operating or file systems
-      symlink_file,
-      block_file,
-      character_file,
-      fifo_file,
-      socket_file,
-      type_unknown // file does exist, but isn't one of the above types or
-                   // we don't have strong enough permission to find its type
-    };
-
-    class file_status
-    {
-    public:
-      explicit file_status( file_type v = status_unknown ) : m_value(v) {}
-
-      void type( file_type v )  { m_value = v; }
-      file_type type() const    { return m_value; }
-
-    private:
-      // the internal representation is unspecified so that additional state
-      // information such as permissions can be added in the future; this
-      // implementation just uses status_type as the internal representation
-
-      file_type m_value;
-    };
-
-    inline bool status_known( file_status f ) { return f.type() != status_unknown; }
-    inline bool exists( file_status f )       { return f.type() != status_unknown && f.type() != file_not_found; }
-    inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
-    inline bool is_directory( file_status f ) { return f.type() == directory_file; }
-    inline bool is_symlink( file_status f )   { return f.type() == symlink_file; }
-    inline bool is_other( file_status f )     { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool is_regular( file_status f )   { return f.type() == regular_file; }
-# endif
-
-    struct space_info
-    {
-      // all values are byte counts
-      boost::uintmax_t capacity;
-      boost::uintmax_t free;      // <= capacity
-      boost::uintmax_t available; // <= free
-    };
-
-    namespace detail
-    {
-      typedef std::pair< system::error_code, bool >
-        query_pair;
-
-      typedef std::pair< system::error_code, boost::uintmax_t >
-        uintmax_pair;
-
-      typedef std::pair< system::error_code, std::time_t >
-        time_pair;
-
-      typedef std::pair< system::error_code, space_info >
-        space_pair;
-
-      template< class Path >
-      struct directory_pair
-      {
-        typedef std::pair< system::error_code,
-          typename Path::external_string_type > type;
-      };
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      BOOST_FILESYSTEM_DECL bool
-        symbolic_link_exists_api( const std::string & ); // deprecated
-#   endif
-
-      BOOST_FILESYSTEM_DECL file_status
-        status_api( const std::string & ph, system::error_code & ec );
-#   ifndef BOOST_WINDOWS_API
-      BOOST_FILESYSTEM_DECL file_status
-        symlink_status_api( const std::string & ph, system::error_code & ec );
-#   endif
-      BOOST_FILESYSTEM_DECL query_pair
-        is_empty_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        equivalent_api( const std::string & ph1, const std::string & ph2 );
-      BOOST_FILESYSTEM_DECL uintmax_pair
-        file_size_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL space_pair
-        space_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL time_pair 
-        last_write_time_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        last_write_time_api( const std::string & ph, std::time_t new_value );
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_current_path_api( std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        set_current_path_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        create_directory_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_hard_link_api( const std::string & to_ph,
-          const std::string & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_symlink_api( const std::string & to_ph,
-          const std::string & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        remove_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        rename_api( const std::string & from, const std::string & to );
-      BOOST_FILESYSTEM_DECL system::error_code
-        copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists );
-
-#   if defined(BOOST_WINDOWS_API)
-      
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_full_path_name_api( const std::string & ph, std::string & target );
-
-#     if !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-
-      BOOST_FILESYSTEM_DECL  boost::filesystem2::file_status
-        status_api( const std::wstring & ph, system::error_code & ec );
-      BOOST_FILESYSTEM_DECL query_pair 
-        is_empty_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        equivalent_api( const std::wstring & ph1, const std::wstring & ph2 );
-      BOOST_FILESYSTEM_DECL uintmax_pair 
-        file_size_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL space_pair 
-        space_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_full_path_name_api( const std::wstring & ph, std::wstring & target );
-      BOOST_FILESYSTEM_DECL time_pair 
-        last_write_time_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        last_write_time_api( const std::wstring & ph, std::time_t new_value );
-      BOOST_FILESYSTEM_DECL system::error_code 
-        get_current_path_api( std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code 
-        set_current_path_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        create_directory_api( const std::wstring & ph );
-# ifdef BOOST_FS_HARD_LINK
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_hard_link_api( const std::wstring & existing_ph,
-          const std::wstring & new_ph );
-# endif
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_symlink_api( const std::wstring & to_ph,
-          const std::wstring & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        remove_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        rename_api( const std::wstring & from, const std::wstring & to );
-      BOOST_FILESYSTEM_DECL system::error_code
-        copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists );
-
-#     endif
-#   endif
-
-      template
-      bool remove_aux( const Path & ph, file_status f );
-
-      template
-      unsigned long remove_all_aux( const Path & ph, file_status f );
-
-    } // namespace detail
-
-//  operations functions  ----------------------------------------------------//
-
-    //  The non-template overloads enable automatic conversion from std and
-    //  C-style strings. See basic_path constructors. The enable_if for the
-    //  templates implements the famous "do-the-right-thing" rule.
-
-//  query functions  ---------------------------------------------------------//
-
-    BOOST_INLINE_FS_FUNC(file_status)
-    status( const Path & ph, system::error_code & ec )
-      { return detail::status_api( ph.external_file_string(), ec ); }
-
-    BOOST_FS_FUNC(file_status)
-    status( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-        "boost::filesystem::status", ph, ec ) );
-      return result;
-    }
-
-    BOOST_INLINE_FS_FUNC(file_status)
-    symlink_status( const Path & ph, system::error_code & ec )
-#   ifdef BOOST_WINDOWS_API
-      { return detail::status_api( ph.external_file_string(), ec ); }
-#   else
-      { return detail::symlink_status_api( ph.external_file_string(), ec ); }
-#   endif
-
-    BOOST_FS_FUNC(file_status)
-    symlink_status( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( symlink_status( ph, ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-        "boost::filesystem::symlink_status", ph, ec ) );
-      return result;
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool symbolic_link_exists( const path & ph )
-      { return is_symlink( symlink_status(ph) ); }
-# endif
-
-    BOOST_FS_FUNC(bool) exists( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::exists", ph, ec ) );
-      return exists( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_directory( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_directory", ph, ec ) );
-      return is_directory( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_regular_file( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_regular_file", ph, ec ) );
-      return is_regular_file( result );
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    BOOST_FS_FUNC(bool) is_regular( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_regular", ph, ec ) );
-      return is_regular( result );
-    }
-# endif
-
-    BOOST_FS_FUNC(bool) is_other( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_other", ph, ec ) );
-      return is_other( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_symlink(
-#   ifdef BOOST_WINDOWS_API
-      const Path & )
-    {
-      return false;
-#   else
-      const Path & ph)
-    {
-      system::error_code ec;
-      file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_symlink", ph, ec ) );
-      return is_symlink( result );
-#   endif
-    }
-
-    // VC++ 7.0 and earlier has a serious namespace bug that causes a clash
-    // between boost::filesystem2::is_empty and the unrelated type trait
-    // boost::is_empty.
-
-# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300
-    BOOST_FS_FUNC(bool) is_empty( const Path & ph )
-# else
-    BOOST_FS_FUNC(bool) _is_empty( const Path & ph )
-# endif
-    {
-      detail::query_pair result(
-        detail::is_empty_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_empty", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(bool) equivalent( const Path & ph1, const Path & ph2 )
-    {
-      detail::query_pair result( detail::equivalent_api(
-        ph1.external_file_string(), ph2.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::equivalent", ph1, ph2, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(boost::uintmax_t) file_size( const Path & ph )
-    {
-      detail::uintmax_pair result
-        ( detail::file_size_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::file_size", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(space_info) space( const Path & ph )
-    {
-      detail::space_pair result
-        ( detail::space_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::space", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(std::time_t) last_write_time( const Path & ph )
-    {
-      detail::time_pair result
-        ( detail::last_write_time_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::last_write_time", ph, result.first ) );
-      return result.second;
-    }
-
-
-//  operations  --------------------------------------------------------------//
-
-    BOOST_FS_FUNC(bool) create_directory( const Path & dir_ph )
-    {
-      detail::query_pair result(
-        detail::create_directory_api( dir_ph.external_directory_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_directory",
-          dir_ph, result.first ) );
-      return result.second;
-    }
-
-#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    BOOST_FS_FUNC(void)
-    create_hard_link( const Path & to_ph, const Path & from_ph )
-    {
-      system::error_code ec( 
-        detail::create_hard_link_api(
-          to_ph.external_file_string(),
-          from_ph.external_file_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_hard_link",
-          to_ph, from_ph, ec ) );
-    }
-
-    BOOST_FS_FUNC(system::error_code)
-    create_hard_link( const Path & to_ph, const Path & from_ph,
-      system::error_code & ec )
-    {
-      ec = detail::create_hard_link_api(
-            to_ph.external_file_string(),
-            from_ph.external_file_string() );
-      return ec;
-    }
-#endif
-
-    BOOST_FS_FUNC(void)
-    create_symlink( const Path & to_ph, const Path & from_ph )
-    {
-      system::error_code ec( 
-        detail::create_symlink_api(
-          to_ph.external_file_string(),
-          from_ph.external_file_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_symlink",
-          to_ph, from_ph, ec ) );
-    }
-
-    BOOST_FS_FUNC(system::error_code)
-    create_symlink( const Path & to_ph, const Path & from_ph,
-      system::error_code & ec )
-    {
-      ec = detail::create_symlink_api(
-             to_ph.external_file_string(),
-             from_ph.external_file_string() );
-      return ec;
-    }
-
-    BOOST_FS_FUNC(bool) remove( const Path & ph )
-    {
-      system::error_code ec;
-      file_status f = symlink_status( ph, ec );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::remove", ph, ec ) );
-      return detail::remove_aux( ph, f );
-    }
-
-    BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph )
-    {
-      system::error_code ec;
-      file_status f = symlink_status( ph, ec );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::remove_all", ph, ec ) );
-      return exists( f ) ? detail::remove_all_aux( ph, f ) : 0;
-    }
-
-    BOOST_FS_FUNC(void) rename( const Path & from_path, const Path & to_path )
-    {
-      system::error_code ec( detail::rename_api(
-        from_path.external_directory_string(),
-        to_path.external_directory_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::rename",
-          from_path, to_path, ec ) );
-    }
-
-    BOOST_SCOPED_ENUM_START(copy_option)
-      { fail_if_exists, overwrite_if_exists };
-    BOOST_SCOPED_ENUM_END
-
-    BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path,
-      BOOST_SCOPED_ENUM(copy_option) option = copy_option::fail_if_exists )
-    {
-      system::error_code ec( detail::copy_file_api(
-        from_path.external_directory_string(),
-        to_path.external_directory_string(), option == copy_option::fail_if_exists ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::copy_file",
-          from_path, to_path, ec ) );
-    }
-
-    template< class Path >
-    Path current_path()
-    {
-      typename Path::external_string_type ph;
-      system::error_code ec( detail::get_current_path_api( ph ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::current_path", ec ) );
-      return Path( Path::traits_type::to_internal( ph ) );
-    }
-
-    BOOST_FS_FUNC(void) current_path( const Path & ph )
-    {
-      system::error_code ec( detail::set_current_path_api(
-        ph.external_directory_string() ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::current_path", ph, ec ) );
-    }
-
-    template< class Path >
-    const Path & initial_path()
-    {
-      static Path init_path;
-      if ( init_path.empty() ) init_path = current_path();
-      return init_path;
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    // legacy support
-    inline path current_path()  // overload supports pre-i18n apps
-      { return current_path(); }
-    inline const path & initial_path() // overload supports pre-i18n apps
-      { return initial_path(); }
-# endif
-
-    BOOST_FS_FUNC(Path) system_complete( const Path & ph )
-    {
-# ifdef BOOST_WINDOWS_API
-      if ( ph.empty() ) return ph;
-      BOOST_FS_TYPENAME Path::external_string_type sys_ph;
-      system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(),
-              sys_ph ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::system_complete", ph, ec ) );
-      return Path( Path::traits_type::to_internal( sys_ph ) );
-# else
-      return (ph.empty() || ph.is_complete())
-        ? ph : current_path() / ph;
-# endif
-    }
-
-    BOOST_FS_FUNC(Path)
-    complete( const Path & ph,
-      const Path & base/* = initial_path() */)
-    {
-      BOOST_ASSERT( base.is_complete()
-        && (ph.is_complete() || !ph.has_root_name())
-        && "boost::filesystem::complete() precondition not met" );
-#   ifdef BOOST_WINDOWS_PATH
-      if (ph.empty() || ph.is_complete()) return ph;
-      if ( !ph.has_root_name() )
-        return ph.has_root_directory()
-          ? Path( base.root_name() ) / ph
-          : base / ph;
-      return base / ph;
-#   else
-      return (ph.empty() || ph.is_complete()) ? ph : base / ph;
-#   endif
-    }
-
-    // VC++ 7.1 had trouble with default arguments, so separate one argument
-    // signatures are provided as workarounds; the effect is the same.
-    BOOST_FS_FUNC(Path) complete( const Path & ph )
-      { return complete( ph, initial_path() ); }
-
-    BOOST_FS_FUNC(void)
-    last_write_time( const Path & ph, const std::time_t new_time )
-    {
-      system::error_code ec( detail::last_write_time_api( ph.external_file_string(),
-          new_time ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::last_write_time", ph, ec ) );
-    }
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    // "do-the-right-thing" overloads  ---------------------------------------//
-
-    inline file_status status( const path & ph )
-      { return status( ph ); }
-    inline file_status status( const wpath & ph )
-      { return status( ph ); }
-
-    inline file_status status( const path & ph, system::error_code & ec )
-      { return status( ph, ec ); }
-    inline file_status status( const wpath & ph, system::error_code & ec )
-      { return status( ph, ec ); }
-
-    inline file_status symlink_status( const path & ph )
-      { return symlink_status( ph ); }
-    inline file_status symlink_status( const wpath & ph )
-      { return symlink_status( ph ); }
-
-    inline file_status symlink_status( const path & ph, system::error_code & ec )
-      { return symlink_status( ph, ec ); }
-    inline file_status symlink_status( const wpath & ph, system::error_code & ec )
-      { return symlink_status( ph, ec ); }
-
-    inline bool exists( const path & ph ) { return exists( ph ); }
-    inline bool exists( const wpath & ph ) { return exists( ph ); }
-
-    inline bool is_directory( const path & ph )
-      { return is_directory( ph ); }
-    inline bool is_directory( const wpath & ph )
-      { return is_directory( ph ); }
- 
-    inline bool is_regular_file( const path & ph )
-      { return is_regular_file( ph ); }
-    inline bool is_regular_file( const wpath & ph )
-      { return is_regular_file( ph ); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool is_regular( const path & ph )
-      { return is_regular( ph ); }
-    inline bool is_regular( const wpath & ph )
-      { return is_regular( ph ); }
-# endif
-
-    inline bool is_other( const path & ph )
-      { return is_other( ph ); }
-    inline bool is_other( const wpath & ph )
-      { return is_other( ph ); }
-
-    inline bool is_symlink( const path & ph )
-      { return is_symlink( ph ); }
-    inline bool is_symlink( const wpath & ph )
-      { return is_symlink( ph ); }
-
-    inline bool is_empty( const path & ph )
-      { return boost::filesystem2::is_empty( ph ); }
-    inline bool is_empty( const wpath & ph )
-      { return boost::filesystem2::is_empty( ph ); }
-
-    inline bool equivalent( const path & ph1, const path & ph2 )
-      { return equivalent( ph1, ph2 ); }
-    inline bool equivalent( const wpath & ph1, const wpath & ph2 )
-      { return equivalent( ph1, ph2 ); }
-
-    inline boost::uintmax_t file_size( const path & ph )
-      { return file_size( ph ); }
-    inline boost::uintmax_t file_size( const wpath & ph )
-      { return file_size( ph ); }
-
-    inline space_info space( const path & ph )
-      { return space( ph ); }
-    inline space_info space( const wpath & ph )
-      { return space( ph ); }
-
-    inline std::time_t last_write_time( const path & ph )
-      { return last_write_time( ph ); }
-    inline std::time_t last_write_time( const wpath & ph )
-      { return last_write_time( ph ); }
-
-    inline bool create_directory( const path & dir_ph )
-      { return create_directory( dir_ph ); }
-    inline bool create_directory( const wpath & dir_ph )
-      { return create_directory( dir_ph ); }
-
-#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    inline void create_hard_link( const path & to_ph,
-      const path & from_ph )
-      { return create_hard_link( to_ph, from_ph ); }
-    inline void create_hard_link( const wpath & to_ph,
-      const wpath & from_ph )
-      { return create_hard_link( to_ph, from_ph ); }
-
-    inline system::error_code create_hard_link( const path & to_ph,
-      const path & from_ph, system::error_code & ec )
-      { return create_hard_link( to_ph, from_ph, ec ); }
-    inline system::error_code create_hard_link( const wpath & to_ph,
-      const wpath & from_ph, system::error_code & ec )
-      { return create_hard_link( to_ph, from_ph, ec ); }
-#endif
-    
-    inline void create_symlink( const path & to_ph,
-      const path & from_ph )
-      { return create_symlink( to_ph, from_ph ); }
-    inline void create_symlink( const wpath & to_ph,
-      const wpath & from_ph )
-      { return create_symlink( to_ph, from_ph ); }
-
-    inline system::error_code create_symlink( const path & to_ph,
-      const path & from_ph, system::error_code & ec )
-      { return create_symlink( to_ph, from_ph, ec ); }
-    inline system::error_code create_symlink( const wpath & to_ph,
-      const wpath & from_ph, system::error_code & ec )
-      { return create_symlink( to_ph, from_ph, ec ); }
-
-    inline bool remove( const path & ph )
-      { return remove( ph ); }
-    inline bool remove( const wpath & ph )
-      { return remove( ph ); }
-
-    inline unsigned long remove_all( const path & ph )
-      { return remove_all( ph ); }
-    inline unsigned long remove_all( const wpath & ph )
-      { return remove_all( ph ); }
-
-    inline void rename( const path & from_path, const path & to_path )
-      { return rename( from_path, to_path ); }
-    inline void rename( const wpath & from_path, const wpath & to_path )
-      { return rename( from_path, to_path ); }
-
-    inline void copy_file( const path & from_path, const path & to_path )
-      { return copy_file( from_path, to_path ); }
-    inline void copy_file( const wpath & from_path, const wpath & to_path )
-      { return copy_file( from_path, to_path ); }
-
-    inline path system_complete( const path & ph )
-      { return system_complete( ph ); }
-    inline wpath system_complete( const wpath & ph )
-      { return system_complete( ph ); }
-
-    inline path complete( const path & ph,
-      const path & base/* = initial_path()*/ )
-      { return complete( ph, base ); }
-    inline wpath complete( const wpath & ph,
-      const wpath & base/* = initial_path()*/ )
-      { return complete( ph, base ); }
-
-    inline path complete( const path & ph )
-      { return complete( ph, initial_path() ); }
-    inline wpath complete( const wpath & ph )
-      { return complete( ph, initial_path() ); }
-
-    inline void last_write_time( const path & ph, const std::time_t new_time )
-      { last_write_time( ph, new_time ); }
-    inline void last_write_time( const wpath & ph, const std::time_t new_time )
-      { last_write_time( ph, new_time ); }
-
-    inline void current_path( const path & ph )
-      { current_path( ph ); }
-    inline void current_path( const wpath & ph )
-      { current_path( ph ); }
-
-# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    namespace detail
-    {
-      template
-      bool remove_aux( const Path & ph, file_status f )
-      {
-        if ( exists( f ) )
-        {
-          system::error_code ec = remove_api( ph.external_file_string() );
-          if ( ec )
-            BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-              "boost::filesystem::remove", ph, ec ) );
-          return true;
-        }
-        return false;
-      }
-
-      template
-      unsigned long remove_all_aux( const Path & ph, file_status f )
-      {
-        static const boost::filesystem2::basic_directory_iterator end_itr;
-        unsigned long count = 1;
-        if ( !boost::filesystem2::is_symlink( f ) // don't recurse symbolic links
-          && boost::filesystem2::is_directory( f ) )
-        {
-          for ( boost::filesystem2::basic_directory_iterator itr( ph );
-                itr != end_itr; ++itr )
-          {
-            boost::system::error_code ec;
-            boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec );
-            if ( ec )
-              BOOST_FILESYSTEM_THROW( basic_filesystem_error( 
-                "boost::filesystem:remove_all", ph, ec ) );
-            count += remove_all_aux( itr->path(), fn );
-          }
-        }
-        remove_aux( ph, f );
-        return count;
-      }
-
-//  test helper  -------------------------------------------------------------//
-
-    // not part of the documented interface because false positives are possible;
-    // there is no law that says that an OS that has large stat.st_size
-    // actually supports large file sizes.
-      BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
-
-//  directory_iterator helpers  ----------------------------------------------//
-
-//    forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class
-//    basic_directory_iterator, and so avoid iterator_facade DLL template
-//    problems. They also overload to the proper external path character type.
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_first( void *& handle,
-#if       defined(BOOST_POSIX_API)
-            void *& buffer,
-#endif
-          const std::string & dir_path,
-          std::string & target, file_status & fs, file_status & symlink_fs );
-      // eof: return==0 && handle==0
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_increment( void *& handle,
-#if       defined(BOOST_POSIX_API)
-            void *& buffer,
-#endif
-          std::string & target, file_status & fs, file_status & symlink_fs );
-      // eof: return==0 && handle==0
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_close( void *& handle
-#if       defined(BOOST_POSIX_API)
-            , void *& buffer
-#endif
-          );
-      // Effects: none if handle==0, otherwise close handle, set handle=0
-
-#     if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_first( void *& handle, const std::wstring & ph,
-          std::wstring & target, file_status & fs, file_status & symlink_fs );
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_increment( void *& handle, std::wstring & target,
-          file_status & fs, file_status & symlink_fs );
-#     endif
-
-      template< class Path >
-      class dir_itr_imp
-      {
-      public:  
-        basic_directory_entry m_directory_entry;
-        void *        m_handle;
-#       ifdef BOOST_POSIX_API
-          void *      m_buffer;  // see dir_itr_increment implementation
-#       endif
-        dir_itr_imp() : m_handle(0)
-#       ifdef BOOST_POSIX_API
-          , m_buffer(0)
-#       endif
-        {}
-
-        ~dir_itr_imp() { dir_itr_close( m_handle
-#if       defined(BOOST_POSIX_API)
-            , m_buffer
-#endif
-          ); }
-      };
-
-      BOOST_FILESYSTEM_DECL system::error_code not_found_error();
-
-    } // namespace detail
-
-//  basic_directory_iterator  ------------------------------------------------//
-
-    template< class Path >
-    class basic_directory_iterator
-      : public boost::iterator_facade<
-          basic_directory_iterator,
-          basic_directory_entry,
-          boost::single_pass_traversal_tag >
-    {
-    public:
-      typedef Path path_type;
-
-      basic_directory_iterator(){}  // creates the "end" iterator
-
-      explicit basic_directory_iterator( const Path & dir_path );
-      basic_directory_iterator( const Path & dir_path, system::error_code & ec );
-
-    private:
-
-      // shared_ptr provides shallow-copy semantics required for InputIterators.
-      // m_imp.get()==0 indicates the end iterator.
-      boost::shared_ptr< detail::dir_itr_imp< Path > >  m_imp;
-
-      friend class boost::iterator_core_access;
-
-      typename boost::iterator_facade<
-        basic_directory_iterator,
-        basic_directory_entry,
-        boost::single_pass_traversal_tag >::reference dereference() const 
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" );
-        return m_imp->m_directory_entry;
-      }
-
-      void increment();
-
-      bool equal( const basic_directory_iterator & rhs ) const
-        { return m_imp == rhs.m_imp; }
-
-      system::error_code m_init( const Path & dir_path );
-    };
-
-    typedef basic_directory_iterator< path > directory_iterator;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_directory_iterator< wpath > wdirectory_iterator;
-# endif
-
-    //  basic_directory_iterator implementation  ---------------------------//
-
-    template
-    system::error_code basic_directory_iterator::m_init(
-      const Path & dir_path )
-    {
-      if ( dir_path.empty() )
-      {
-        m_imp.reset();
-        return detail::not_found_error();
-      }
-      typename Path::external_string_type name;
-      file_status fs, symlink_fs;
-      system::error_code ec( detail::dir_itr_first( m_imp->m_handle,
-#if   defined(BOOST_POSIX_API)
-        m_imp->m_buffer,
-#endif
-        dir_path.external_directory_string(),
-        name, fs, symlink_fs ) );
-
-      if ( ec )
-      {
-        m_imp.reset();
-        return ec;
-      }
-      
-      if ( m_imp->m_handle == 0 ) m_imp.reset(); // eof, so make end iterator
-      else // not eof
-      {
-        m_imp->m_directory_entry.assign( dir_path
-          / Path::traits_type::to_internal( name ), fs, symlink_fs );
-        if ( name[0] == dot::value // dot or dot-dot
-          && (name.size() == 1
-            || (name[1] == dot::value
-              && name.size() == 2)) )
-          {  increment(); }
-      }
-      return boost::system::error_code();
-    }
-
-    template
-    basic_directory_iterator::basic_directory_iterator(
-      const Path & dir_path )
-      : m_imp( new detail::dir_itr_imp )
-    {
-      system::error_code ec( m_init(dir_path) );
-      if ( ec )
-      {
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error( 
-          "boost::filesystem::basic_directory_iterator constructor",
-          dir_path, ec ) );
-      }
-    }
-
-    template
-    basic_directory_iterator::basic_directory_iterator(
-      const Path & dir_path, system::error_code & ec )
-      : m_imp( new detail::dir_itr_imp )
-    {
-      ec = m_init(dir_path);
-    }
-
-    template
-    void basic_directory_iterator::increment()
-    {
-      BOOST_ASSERT( m_imp.get() && "attempt to increment end iterator" );
-      BOOST_ASSERT( m_imp->m_handle != 0 && "internal program error" );
-      
-      typename Path::external_string_type name;
-      file_status fs, symlink_fs;
-      system::error_code ec;
-
-      for (;;)
-      {
-        ec = detail::dir_itr_increment( m_imp->m_handle,
-#if     defined(BOOST_POSIX_API)
-          m_imp->m_buffer,
-#endif
-          name, fs, symlink_fs );
-        if ( ec )
-        {
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(  
-            "boost::filesystem::basic_directory_iterator increment",
-            m_imp->m_directory_entry.path().parent_path(), ec ) );
-        }
-        if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end
-        if ( !(name[0] == dot::value // !(dot or dot-dot)
-          && (name.size() == 1
-            || (name[1] == dot::value
-              && name.size() == 2))) )
-        {
-          m_imp->m_directory_entry.replace_filename(
-            Path::traits_type::to_internal( name ), fs, symlink_fs );
-          return;
-        }
-      }
-    }
-
-    //  basic_directory_entry  -----------------------------------------------//
-    
-    template
-    class basic_directory_entry
-    {
-    public:
-      typedef Path path_type;
-      typedef typename Path::string_type string_type;
-
-      // compiler generated copy-ctor, copy assignment, and destructor apply
-
-      basic_directory_entry() {}
-      explicit basic_directory_entry( const path_type & p,
-        file_status st = file_status(), file_status symlink_st=file_status() )
-        : m_path(p), m_status(st), m_symlink_status(symlink_st)
-        {}
-
-      void assign( const path_type & p,
-        file_status st, file_status symlink_st )
-        { m_path = p; m_status = st; m_symlink_status = symlink_st; }
-
-      void replace_filename( const string_type & s,
-        file_status st, file_status symlink_st )
-      {
-        m_path.remove_filename();
-        m_path /= s;
-        m_status = st;
-        m_symlink_status = symlink_st;
-      }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      void replace_leaf( const string_type & s,
-        file_status st, file_status symlink_st )
-          { replace_filename( s, st, symlink_st ); }
-#   endif
-
-      const Path &  path() const { return m_path; }
-      file_status   status() const;
-      file_status   status( system::error_code & ec ) const;
-      file_status   symlink_status() const;
-      file_status   symlink_status( system::error_code & ec ) const;
-
-      // conversion simplifies the most common use of basic_directory_entry
-      operator const path_type &() const { return m_path; }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      // deprecated functions preserve common use cases in legacy code
-      typename Path::string_type filename() const
-      {
-        return path().filename();
-      }
-      typename Path::string_type leaf() const
-      {
-        return path().filename();
-      }
-      typename Path::string_type string() const
-      {
-        return path().string();
-      }
-#   endif
-
-    private:
-      path_type             m_path;
-      mutable file_status  m_status;           // stat()-like
-      mutable file_status  m_symlink_status;   // lstat()-like
-        // note: m_symlink_status is not used by Windows implementation
-
-    }; // basic_directory_status
-
-    typedef basic_directory_entry directory_entry;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_directory_entry wdirectory_entry;
-# endif
-
-    //  basic_directory_entry implementation  --------------------------------//
-
-    template
-    file_status
-    basic_directory_entry::status() const
-    {
-      if ( !status_known( m_status ) )
-      {
-#     ifndef BOOST_WINDOWS_API
-        if ( status_known( m_symlink_status )
-          && !is_symlink( m_symlink_status ) )
-          { m_status = m_symlink_status; }
-        else { m_status = boost::filesystem2::status( m_path ); }
-#     else
-        m_status = boost::filesystem2::status( m_path );
-#     endif
-      }
-      return m_status;
-    }
-
-    template
-    file_status
-    basic_directory_entry::status( system::error_code & ec ) const
-    {
-      if ( !status_known( m_status ) )
-      {
-#     ifndef BOOST_WINDOWS_API
-        if ( status_known( m_symlink_status )
-          && !is_symlink( m_symlink_status ) )
-          { ec = boost::system::error_code();; m_status = m_symlink_status; }
-        else { m_status = boost::filesystem2::status( m_path, ec ); }
-#     else
-        m_status = boost::filesystem2::status( m_path, ec );
-#     endif
-      }
-      else ec = boost::system::error_code();;
-      return m_status;
-    }
-
-    template
-    file_status
-    basic_directory_entry::symlink_status() const
-    {
-#   ifndef BOOST_WINDOWS_API
-      if ( !status_known( m_symlink_status ) )
-        { m_symlink_status = boost::filesystem2::symlink_status( m_path ); }
-      return m_symlink_status;
-#   else
-      return status();
-#   endif
-    }
-
-    template
-    file_status
-    basic_directory_entry::symlink_status( system::error_code & ec ) const
-    {
-#   ifndef BOOST_WINDOWS_API
-      if ( !status_known( m_symlink_status ) )
-        { m_symlink_status = boost::filesystem2::symlink_status( m_path, ec ); }
-      else ec = boost::system::error_code();;
-      return m_symlink_status;
-#   else
-      return status( ec );
-#   endif
-    }
-  } // namespace filesystem2
-} // namespace boost
-
-#undef BOOST_FS_FUNC
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::basic_directory_entry;
-    using filesystem2::basic_directory_iterator;
-    using filesystem2::block_file;
-    using filesystem2::character_file;
-    using filesystem2::complete;
-    using filesystem2::copy_file;
-    using filesystem2::copy_option;
-    using filesystem2::create_directory;
-# if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    using filesystem2::create_hard_link;
-# endif
-    using filesystem2::create_symlink;
-    using filesystem2::current_path;
-    using filesystem2::directory_entry;
-    using filesystem2::directory_file;
-    using filesystem2::directory_iterator;
-    using filesystem2::equivalent;
-    using filesystem2::exists;
-    using filesystem2::fifo_file;
-    using filesystem2::file_not_found;
-    using filesystem2::file_size;
-    using filesystem2::file_status;
-    using filesystem2::file_type;
-    using filesystem2::initial_path;
-    using filesystem2::is_directory;
-    using filesystem2::is_directory;
-    using filesystem2::is_empty;
-    using filesystem2::is_other;
-    using filesystem2::is_regular_file;
-    using filesystem2::is_symlink;
-    using filesystem2::last_write_time;
-    using filesystem2::regular_file;
-    using filesystem2::remove;
-    using filesystem2::remove_all;
-    using filesystem2::rename;
-    using filesystem2::socket_file;
-    using filesystem2::space;
-    using filesystem2::space_info;
-    using filesystem2::status;
-    using filesystem2::status_known;
-    using filesystem2::symlink_file;
-    using filesystem2::symlink_status;
-    using filesystem2::system_complete;
-    using filesystem2::type_unknown;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem2::is_regular;
-    using filesystem2::symbolic_link_exists;
-# endif
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wdirectory_iterator;
-    using filesystem2::wdirectory_entry;
-# endif
-    namespace detail
-    {
-      using filesystem2::detail::not_found_error;
-      using filesystem2::detail::possible_large_file_size_support;
-    }
-  }
-}
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM2_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/path.hpp b/project/jni/boost/include/boost/filesystem/v2/path.hpp
deleted file mode 100644
index 615b89cd3..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/path.hpp
+++ /dev/null
@@ -1,1571 +0,0 @@
-//  boost/filesystem/path.hpp  -----------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2005
-//  Copyright Vladimir Prus 2002
-
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying
-//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//  basic_path's stem(), extension(), and replace_extension() are based on
-//  basename(), extension(), and change_extension() from the original
-//  filesystem/convenience.hpp header by Vladimir Prus.
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_PATH_HPP
-#define BOOST_FILESYSTEM2_PATH_HPP
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for lexicographical_compare
-#include     // needed by basic_path inserter and extractor
-#include 
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   include 
-# endif
-
-#include  // must be the last #include
-
-namespace boost
-{
-  namespace BOOST_FILESYSTEM2_NAMESPACE
-  {
-    template class basic_path;
-
-    struct path_traits;
-    typedef basic_path< std::string, path_traits > path;
-
-    struct path_traits
-    {
-      typedef std::string internal_string_type;
-      typedef std::string external_string_type;
-      static external_string_type to_external( const path &,
-        const internal_string_type & src ) { return src; }
-      static internal_string_type to_internal(
-        const external_string_type & src ) { return src; }
-    };
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    struct BOOST_FILESYSTEM_DECL wpath_traits;
-    
-    typedef basic_path< std::wstring, wpath_traits > wpath;
-
-    struct BOOST_FILESYSTEM_DECL wpath_traits
-    {
-      typedef std::wstring internal_string_type;
-# ifdef BOOST_WINDOWS_API
-      typedef std::wstring external_string_type;
-      static external_string_type to_external( const wpath &,
-        const internal_string_type & src ) { return src; }
-      static internal_string_type to_internal(
-        const external_string_type & src ) { return src; }
-# else
-      typedef std::string external_string_type;
-      static external_string_type to_external( const wpath & ph,
-        const internal_string_type & src );
-      static internal_string_type to_internal(
-        const external_string_type & src );
-# endif
-      static void imbue( const std::locale & loc );
-      static bool imbue( const std::locale & loc, const std::nothrow_t & );
-    };
-
-# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    //  path traits  ---------------------------------------------------------//
-
-    template struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = false ); };
-    template<> struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = true ); };
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = true ); };
-# endif
-
-    // These only have to be specialized if Path::string_type::value_type
-    // is not convertible from char, although specializations may eliminate
-    // compiler warnings. See ticket 2543.
-    template struct slash
-      { BOOST_STATIC_CONSTANT( char, value = '/' ); };
-
-    template struct dot
-      { BOOST_STATIC_CONSTANT( char, value = '.' ); };
-
-    template struct colon
-      { BOOST_STATIC_CONSTANT( char, value = ':' ); };
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct slash
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'/' ); };
-    template<> struct dot
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'.' ); };
-    template<> struct colon
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L':' ); };
-# endif
-
-# ifdef BOOST_WINDOWS_PATH
-    template struct path_alt_separator
-      { BOOST_STATIC_CONSTANT( char, value = '\\' ); };
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct path_alt_separator
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'\\' ); };
-#   endif
-# endif
-
-    //  workaround for VC++ 7.0 and earlier issues with nested classes
-    namespace detail
-    {
-      template
-      class iterator_helper
-      {
-      public:
-        typedef typename Path::iterator iterator;
-        static void do_increment( iterator & ph );
-        static void do_decrement( iterator & ph );
-      };
-    }
-
-    //  basic_path  ----------------------------------------------------------//
-  
-    template
-    class basic_path
-    {
-    // invariant: m_path valid according to the portable generic path grammar
-
-      // validate template arguments
-// TODO: get these working
-//      BOOST_STATIC_ASSERT( ::boost::is_same::value );
-//      BOOST_STATIC_ASSERT( ::boost::is_same::value || ::boost::is_same::value );
-
-    public:
-      // compiler generates copy constructor and copy assignment
-
-      typedef basic_path path_type;
-      typedef String string_type;
-      typedef typename String::value_type value_type;
-      typedef Traits traits_type;
-      typedef typename Traits::external_string_type external_string_type; 
-
-      // constructors/destructor
-      basic_path() {}
-      basic_path( const string_type & s ) { operator/=( s ); }
-      basic_path( const value_type * s )  { operator/=( s ); }
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path( InputIterator first, InputIterator last )
-            { append( first, last ); }
-#     endif
-     ~basic_path() {}
-
-      // assignments
-      basic_path & operator=( const string_type & s )
-      {
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-        operator/=( s ); 
-        return *this;
-      }
-      basic_path & operator=( const value_type * s )
-      { 
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-        operator/=( s ); 
-        return *this;
-      }
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path & assign( InputIterator first, InputIterator last )
-            { m_path.clear(); append( first, last ); return *this; }
-#     endif
-
-      // modifiers
-      basic_path & operator/=( const basic_path & rhs )  { return operator /=( rhs.string().c_str() ); }
-      basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); }
-      basic_path & operator/=( const value_type * s );
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path & append( InputIterator first, InputIterator last );
-#     endif
-      
-      void clear()
-      { 
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-      }
-
-      void swap( basic_path & rhs )
-      {
-        m_path.swap( rhs.m_path );
-#       ifdef BOOST_CYGWIN_PATH
-          std::swap( m_cygwin_root, rhs.m_cygwin_root );
-#       endif
-      }
-
-      basic_path & remove_filename();
-      basic_path & replace_extension( const string_type & new_extension = string_type() );
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      basic_path & remove_leaf() { return remove_filename(); }
-# endif
-
-      // observers
-      const string_type & string() const         { return m_path; }
-      const string_type file_string() const;
-      const string_type directory_string() const { return file_string(); }
-
-      const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); }
-      const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); }
-
-      basic_path   root_path() const;
-      string_type  root_name() const;
-      string_type  root_directory() const;
-      basic_path   relative_path() const;
-      basic_path   parent_path() const;
-      string_type  filename() const;
-      string_type  stem() const;
-      string_type  extension() const;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      string_type  leaf() const            { return filename(); }
-      basic_path   branch_path() const     { return parent_path(); }
-      bool         has_leaf() const        { return !m_path.empty(); }
-      bool         has_branch_path() const { return !parent_path().empty(); }
-# endif
-
-      bool empty() const               { return m_path.empty(); } // name consistent with std containers
-      bool is_complete() const;
-      bool has_root_path() const;
-      bool has_root_name() const;
-      bool has_root_directory() const;
-      bool has_relative_path() const   { return !relative_path().empty(); }
-      bool has_filename() const        { return !m_path.empty(); }
-      bool has_parent_path() const     { return !parent_path().empty(); }
-
-      // iterators
-      class iterator : public boost::iterator_facade<
-        iterator,
-        string_type const,
-        boost::bidirectional_traversal_tag >
-      {
-      private:
-        friend class boost::iterator_core_access;
-        friend class boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path;
-
-        const string_type & dereference() const
-          { return m_name; }
-        bool equal( const iterator & rhs ) const
-          { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; }
-
-        friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper;
-
-        void increment()
-        { 
-          boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper::do_increment(
-            *this );
-        }
-        void decrement()
-        { 
-          boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper::do_decrement(
-            *this );
-        }
-
-        string_type             m_name;     // current element
-        const basic_path *      m_path_ptr; // path being iterated over
-        typename string_type::size_type  m_pos;  // position of name in
-                                            // path_ptr->string(). The
-                                            // end() iterator is indicated by 
-                                            // pos == path_ptr->m_path.size()
-      }; // iterator
-
-      typedef iterator const_iterator;
-
-      iterator begin() const;
-      iterator end() const;
-
-    private:
-      // Note: This is an implementation for POSIX and Windows, where there
-      // are only minor differences between generic and native path grammars.
-      // Private members might be quite different in other implementations,
-      // particularly where there were wide differences between portable and
-      // native path formats, or between file_string() and
-      // directory_string() formats, or simply that the implementation
-      // was willing expend additional memory to achieve greater speed for
-      // some operations at the expense of other operations.
-
-      string_type  m_path; // invariant: portable path grammar
-                           // on Windows, backslashes converted to slashes
-
-#   ifdef BOOST_CYGWIN_PATH
-      bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization
-                          // done by append
-#   endif  
-
-      void m_append_separator_if_needed();
-      void m_append( value_type value ); // converts Windows alt_separator
-
-      // Was qualified; como433beta8 reports:
-      //    warning #427-D: qualified name is not allowed in member declaration 
-      friend class iterator;
-      friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper;
-
-      // Deprecated features ease transition for existing code. Don't use these
-      // in new code.
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    public:
-      typedef bool (*name_check)( const std::string & name );
-      basic_path( const string_type & str, name_check ) { operator/=( str ); }
-      basic_path( const typename string_type::value_type * s, name_check )
-        { operator/=( s );}
-      string_type native_file_string() const { return file_string(); }
-      string_type native_directory_string() const { return directory_string(); }
-      static bool default_name_check_writable() { return false; } 
-      static void default_name_check( name_check ) {}
-      static name_check default_name_check() { return 0; }
-      basic_path & canonize();
-      basic_path & normalize();
-# endif
-    };
-
-  //  basic_path non-member functions  ---------------------------------------//
-
-    template< class String, class Traits >
-    inline void swap( basic_path & lhs,
-               basic_path & rhs ) { lhs.swap( rhs ); }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs, const basic_path & rhs )
-    {
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs )
-    {
-      basic_path tmp( lhs );
-      return std::lexicographical_compare(
-        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs )
-    {
-      basic_path tmp( lhs );
-      return std::lexicographical_compare(
-        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-    {
-      basic_path tmp( rhs );
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-    {
-      basic_path tmp( rhs );
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
-    }
-
-    //  operator == uses hand-written compare rather than !(lhs < rhs) && !(rhs < lhs)
-    //  because the result is the same yet the direct compare is much more efficient
-    //  than lexicographical_compare, which would also be called twice.
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-    {
-      typedef typename
-        boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-      const typename path_type::string_type::value_type * l (lhs.string().c_str());
-      while ( (*l == *rhs
-#      ifdef BOOST_WINDOWS_PATH
-        || (*l == path_alt_separator::value && *rhs == slash::value) 
-            || (*l == slash::value && *rhs == path_alt_separator::value)
-#      endif
-        ) && *l ) { ++l; ++rhs; }
-      return *l == *rhs
-#      ifdef BOOST_WINDOWS_PATH
-        || (*l == path_alt_separator::value && *rhs == slash::value) 
-          || (*l == slash::value && *rhs == path_alt_separator::value)
-#      endif
-        ;  
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                            const basic_path & rhs )
-    { 
-      return lhs == rhs.string().c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs )
-    {
-      return rhs == lhs;
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs )
-    {
-      return rhs == lhs.c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-    {
-      return lhs == rhs.c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const basic_path & rhs )
-        { return !(lhs == rhs); }
-    
-    template< class String, class Traits >
-    inline bool operator!=( const typename basic_path::string_type::value_type * lhs,
-        const basic_path & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const typename basic_path::string_type & lhs,
-      const basic_path & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const typename basic_path::string_type::value_type * rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const typename basic_path::string_type & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs, const basic_path & rhs ) { return rhs < lhs; }
-    
-    template< class String, class Traits >
-    inline bool operator>( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return rhs < basic_path(lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return rhs < basic_path(lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return basic_path(rhs) < lhs; }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return basic_path(rhs) < lhs; }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs, const basic_path & rhs ) { return !(rhs < lhs); }
-    
-    template< class String, class Traits >
-    inline bool operator<=( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return !(rhs < basic_path(lhs)); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return !(rhs < basic_path(lhs)); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return !(basic_path(rhs) < lhs); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return !(basic_path(rhs) < lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs, const basic_path & rhs ) { return !(lhs < rhs); }
-    
-    template< class String, class Traits >
-    inline bool operator>=( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return !(lhs < basic_path(rhs)); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return !(lhs < basic_path(rhs)); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return !(basic_path(lhs) < rhs); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return !(basic_path(lhs) < rhs); }
-
-    // operator /
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs,
-      const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs,
-      const typename String::value_type * rhs )
-      { return basic_path( lhs ) /=
-          basic_path( rhs ); }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs, const String & rhs )
-      { return basic_path( lhs ) /=
-          basic_path( rhs ); }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const typename String::value_type * lhs,
-      const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-
-    template< class String, class Traits >
-    inline basic_path operator/(
-      const String & lhs, const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-   
-    //  inserters and extractors  --------------------------------------------//
-
-// bypass VC++ 7.0 and earlier, and broken Borland compilers
-# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, < 0x610)
-    template< class Path >
-    std::basic_ostream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type > &
-      operator<<
-      ( std::basic_ostream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type >& os, const Path & ph )
-    {
-      os << ph.string();
-      return os;
-    }
-
-    template< class Path >
-    std::basic_istream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type > &
-      operator>>
-      ( std::basic_istream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type >& is, Path & ph )
-    {
-      typename Path::string_type str;
-      std::getline(is, str);  // See ticket 3863
-      ph = str;
-      return is;
-    }
-# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-    template< class String, class Traits >
-    std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
-      BOOST_DEDUCED_TYPENAME String::traits_type > &
-      operator<<
-      ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
-          BOOST_DEDUCED_TYPENAME String::traits_type >& os, 
-        const basic_path< String, Traits > & ph )
-    {
-      os << ph.string();
-      return os;
-    }
-
-    template< class String, class Traits >
-    std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, 
-      BOOST_DEDUCED_TYPENAME String::traits_type > &
-      operator>>
-      ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type,
-          BOOST_DEDUCED_TYPENAME String::traits_type> & is,
-        basic_path< String, Traits > & ph )
-    {
-      String str;
-      std::getline(is, str);  // See ticket 3863
-      ph = str;
-      return is;
-    }
-# endif
-
-    //  basic_filesystem_error helpers  --------------------------------------//
-
-    //  Originally choice of implementation was done via specialization of
-    //  basic_filesystem_error::what(). Several compilers (GCC, aCC, etc.)
-    //  couldn't handle that, so the choice is now accomplished by overloading.
-
-    namespace detail
-    {
-      // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure!
-      inline
-      const char * what( const char * sys_err_what,
-        const path & path1_arg, const path & path2_arg, std::string & target )
-      {
-        try
-        {
-          if ( target.empty() )
-          {
-            target = sys_err_what;
-            if ( !path1_arg.empty() )
-            {
-              target += ": \"";
-              target += path1_arg.file_string();
-              target += "\"";
-            }
-            if ( !path2_arg.empty() )
-            {
-              target += ", \"";
-              target += path2_arg.file_string();
-              target += "\"";
-            }
-          }
-          return target.c_str();
-        }
-        catch (...)
-        {
-          return sys_err_what;
-        }
-      }
-
-      template
-      const char * what( const char * sys_err_what,
-        const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ )
-      {
-        return sys_err_what;
-      }
-    }
-
-    //  basic_filesystem_error  ----------------------------------------------//
-
-    template
-    class basic_filesystem_error : public system::system_error
-    {
-    // see http://www.boost.org/more/error_handling.html for design rationale
-    public:
-      // compiler generates copy constructor and copy assignment
-
-      typedef Path path_type;
-
-      basic_filesystem_error( const std::string & what_arg,
-        system::error_code ec );
-
-      basic_filesystem_error( const std::string & what_arg,
-        const path_type & path1_arg, system::error_code ec );
-
-      basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg,
-        const path_type & path2_arg, system::error_code ec );
-
-      ~basic_filesystem_error() throw() {}
-
-      const path_type & path1() const
-      {
-        static const path_type empty_path;
-        return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
-      }
-      const path_type & path2() const
-      {
-        static const path_type empty_path;
-        return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
-      }
-
-      const char * what() const throw()
-      { 
-        if ( !m_imp_ptr.get() )
-          return system::system_error::what();
-        return detail::what( system::system_error::what(), m_imp_ptr->m_path1,
-          m_imp_ptr->m_path2, m_imp_ptr->m_what );  
-      }
-
-    private:
-      struct m_imp
-      {
-        path_type                 m_path1; // may be empty()
-        path_type                 m_path2; // may be empty()
-        std::string               m_what;  // not built until needed
-      };
-      boost::shared_ptr m_imp_ptr;
-    };
-
-    typedef basic_filesystem_error filesystem_error;
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_filesystem_error wfilesystem_error;
-# endif
-
-  //  path::name_checks  -----------------------------------------------------//
-
-    BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool native( const std::string & name );
-    inline bool no_check( const std::string & )
-      { return true; }
-
-// implementation  -----------------------------------------------------------//
-
-    namespace detail
-    {
-
-      //  is_separator helper ------------------------------------------------//
-
-      template
-      inline  bool is_separator( typename Path::string_type::value_type c )
-      {
-        return c == slash::value
-#     ifdef BOOST_WINDOWS_PATH
-          || c == path_alt_separator::value
-#     endif
-          ;
-      }
-
-      // filename_pos helper  ----------------------------------------------------//
-
-      template
-      typename String::size_type filename_pos(
-        const String & str, // precondition: portable generic path grammar
-        typename String::size_type end_pos ) // end_pos is past-the-end position
-      // return 0 if str itself is filename (or empty)
-      {
-        typedef typename
-          boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-        // case: "//"
-        if ( end_pos == 2 
-          && str[0] == slash::value
-          && str[1] == slash::value ) return 0;
-
-        // case: ends in "/"
-        if ( end_pos && str[end_pos-1] == slash::value )
-          return end_pos-1;
-        
-        // set pos to start of last element
-        typename String::size_type pos(
-          str.find_last_of( slash::value, end_pos-1 ) );
-#       ifdef BOOST_WINDOWS_PATH
-        if ( pos == String::npos )
-          pos = str.find_last_of( path_alt_separator::value, end_pos-1 );
-        if ( pos == String::npos )
-          pos = str.find_last_of( colon::value, end_pos-2 );
-#       endif
-
-        return ( pos == String::npos // path itself must be a filename (or empty)
-          || (pos == 1 && str[0] == slash::value) ) // or net
-            ? 0 // so filename is entire string
-            : pos + 1; // or starts after delimiter
-      }
-
-      // first_element helper  -----------------------------------------------//
-      //   sets pos and len of first element, excluding extra separators
-      //   if src.empty(), sets pos,len, to 0,0.
-
-      template
-        void first_element(
-          const String & src, // precondition: portable generic path grammar
-          typename String::size_type & element_pos,
-          typename String::size_type & element_size,
-#       if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1
-          typename String::size_type size = String::npos
-#       else
-          typename String::size_type size = -1
-#       endif
-          )
-      {
-        if ( size == String::npos ) size = src.size();
-        element_pos = 0;
-        element_size = 0;
-        if ( src.empty() ) return;
-
-        typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-        typename String::size_type cur(0);
-        
-        // deal with // [network]
-        if ( size >= 2 && src[0] == slash::value
-          && src[1] == slash::value
-          && (size == 2
-            || src[2] != slash::value) )
-        { 
-          cur += 2;
-          element_size += 2;
-        }
-
-        // leading (not non-network) separator
-        else if ( src[0] == slash::value )
-        {
-          ++element_size;
-          // bypass extra leading separators
-          while ( cur+1 < size
-            && src[cur+1] == slash::value )
-          {
-            ++cur;
-            ++element_pos;
-          }
-          return;
-        }
-
-        // at this point, we have either a plain name, a network name,
-        // or (on Windows only) a device name
-
-        // find the end
-        while ( cur < size
-#         ifdef BOOST_WINDOWS_PATH
-          && src[cur] != colon::value
-#         endif
-          && src[cur] != slash::value )
-        {
-          ++cur;
-          ++element_size;
-        }
-
-#       ifdef BOOST_WINDOWS_PATH
-        if ( cur == size ) return;
-        // include device delimiter
-        if ( src[cur] == colon::value )
-          { ++element_size; }
-#       endif
-
-        return;
-      }
-
-      // root_directory_start helper  ----------------------------------------//
-
-      template
-      typename String::size_type root_directory_start(
-        const String & s, // precondition: portable generic path grammar
-        typename String::size_type size )
-      // return npos if no root_directory found
-      {
-        typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-#     ifdef BOOST_WINDOWS_PATH
-        // case "c:/"
-        if ( size > 2
-          && s[1] == colon::value
-          && s[2] == slash::value ) return 2;
-#     endif
-
-        // case "//"
-        if ( size == 2
-          && s[0] == slash::value
-          && s[1] == slash::value ) return String::npos;
-
-        // case "//net {/}"
-        if ( size > 3
-          && s[0] == slash::value
-          && s[1] == slash::value
-          && s[2] != slash::value )
-        {
-          typename String::size_type pos(
-            s.find( slash::value, 2 ) );
-          return pos < size ? pos : String::npos;
-        }
-        
-        // case "/"
-        if ( size > 0 && s[0] == slash::value ) return 0;
-
-        return String::npos;
-      }
-
-      // is_non_root_slash helper  -------------------------------------------//
-
-      template
-      bool is_non_root_slash( const String & str,
-        typename String::size_type pos ) // pos is position of the slash
-      {
-        typedef typename
-          boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path
-            path_type;
-
-        BOOST_ASSERT( !str.empty() && str[pos] == slash::value
-          && "precondition violation" );
-
-        // subsequent logic expects pos to be for leftmost slash of a set
-        while ( pos > 0 && str[pos-1] == slash::value )
-          --pos;
-
-        return  pos != 0
-          && (pos <= 2 || str[1] != slash::value
-            || str.find( slash::value, 2 ) != pos)
-#       ifdef BOOST_WINDOWS_PATH
-          && (pos !=2 || str[1] != colon::value)
-#       endif
-            ;
-      }
-    } // namespace detail
-
-    // decomposition functions  ----------------------------------------------//
-
-    template
-    String basic_path::filename() const
-    {
-      typename String::size_type end_pos(
-        detail::filename_pos( m_path, m_path.size() ) );
-      return (m_path.size()
-                && end_pos
-                && m_path[end_pos] == slash::value
-                && detail::is_non_root_slash< String, Traits >(m_path, end_pos))
-        ? String( 1, dot::value )
-        : m_path.substr( end_pos );
-    }
-
-    template
-    String basic_path::stem() const
-    {
-      string_type name = filename();
-      typename string_type::size_type n = name.rfind(dot::value);
-      return name.substr(0, n);
-    }
-
-    template
-    String basic_path::extension() const
-    {
-      string_type name = filename();
-      typename string_type::size_type n = name.rfind(dot::value);
-      if (n != string_type::npos)
-        return name.substr(n);
-      else
-        return string_type();
-    }
-
-    template
-    basic_path basic_path::parent_path() const
-    {
-      typename String::size_type end_pos(
-        detail::filename_pos( m_path, m_path.size() ) );
-
-      bool filename_was_separator( m_path.size()
-        && m_path[end_pos] == slash::value );
-
-      // skip separators unless root directory
-      typename string_type::size_type root_dir_pos( detail::root_directory_start
-        ( m_path, end_pos ) );
-      for ( ; 
-        end_pos > 0
-        && (end_pos-1) != root_dir_pos
-        && m_path[end_pos-1] == slash::value
-        ;
-        --end_pos ) {}
-
-     return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
-       ? path_type()
-       : path_type( m_path.substr( 0, end_pos ) );
-    }
-
-    template
-    basic_path basic_path::relative_path() const
-    {
-      iterator itr( begin() );
-      for ( ; itr.m_pos != m_path.size()
-          && (itr.m_name[0] == slash::value
-#     ifdef BOOST_WINDOWS_PATH
-          || itr.m_name[itr.m_name.size()-1]
-            == colon::value
-#     endif
-             ); ++itr ) {}
-
-      return basic_path( m_path.substr( itr.m_pos ) );
-    }
-
-    template
-    String basic_path::root_name() const
-    {
-      iterator itr( begin() );
-
-      return ( itr.m_pos != m_path.size()
-        && (
-            ( itr.m_name.size() > 1
-              && itr.m_name[0] == slash::value
-              && itr.m_name[1] == slash::value
-            )
-#     ifdef BOOST_WINDOWS_PATH
-          || itr.m_name[itr.m_name.size()-1]
-            == colon::value
-#     endif
-           ) )
-        ? *itr
-        : String();
-    }
-
-    template
-    String basic_path::root_directory() const
-    {
-      typename string_type::size_type start(
-        detail::root_directory_start( m_path, m_path.size() ) );
-
-      return start == string_type::npos
-        ? string_type()
-        : m_path.substr( start, 1 );
-    }
-
-    template
-    basic_path basic_path::root_path() const
-    {
-      // even on POSIX, root_name() is non-empty() on network paths
-      return basic_path( root_name() ) /= root_directory();
-    }
-
-    // path query functions  -------------------------------------------------//
-
-    template
-    inline bool basic_path::is_complete() const
-    {
-#   ifdef BOOST_WINDOWS_PATH
-      return has_root_name() && has_root_directory();
-#   else
-      return has_root_directory();
-#   endif
-    }
-
-    template
-    inline bool basic_path::has_root_path() const
-    {
-      return !root_path().empty();
-    }
-
-    template
-    inline bool basic_path::has_root_name() const
-    {
-      return !root_name().empty();
-    }
-
-    template
-    inline bool basic_path::has_root_directory() const
-    {
-      return !root_directory().empty();
-    }
-
-    // append  ---------------------------------------------------------------//
-
-    template
-    void basic_path::m_append_separator_if_needed()
-    // requires: !empty()
-    {
-      if (
-#       ifdef BOOST_WINDOWS_PATH
-        *(m_path.end()-1) != colon::value && 
-#       endif
-        *(m_path.end()-1) != slash::value )
-      {
-        m_path += slash::value;
-      }
-    }
-      
-    template
-    void basic_path::m_append( value_type value )
-    {
-#   ifdef BOOST_CYGWIN_PATH
-      if ( m_path.empty() ) m_cygwin_root = (value == slash::value);
-#   endif
-
-#   ifdef BOOST_WINDOWS_PATH
-      // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/')
-      m_path += ( value == path_alt_separator::value
-        ? slash::value
-        : value );
-#   else
-      m_path += value;
-#   endif
-    }
-    
-    // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers,
-    // the append() member template could replace this code.
-    template
-    basic_path & basic_path::operator /=
-      ( const value_type * next_p )
-    {
-      // ignore escape sequence on POSIX or Windows
-      if ( *next_p == slash::value
-        && *(next_p+1) == slash::value
-        && *(next_p+2) == colon::value ) next_p += 3;
-      
-      // append slash::value if needed
-      if ( !empty() && *next_p != 0
-        && !detail::is_separator( *next_p ) )
-      { m_append_separator_if_needed(); }
-
-      for ( ; *next_p != 0; ++next_p ) m_append( *next_p );
-      return *this;
-    }
-
-# ifndef BOOST_NO_MEMBER_TEMPLATES
-    template template 
-      basic_path & basic_path::append(
-        InputIterator first, InputIterator last )
-    {
-      // append slash::value if needed
-      if ( !empty() && first != last
-        && !detail::is_separator( *first ) )
-      { m_append_separator_if_needed(); }
-
-      // song-and-dance to avoid violating InputIterator requirements
-      // (which prohibit lookahead) in detecting a possible escape sequence
-      // (escape sequences are simply ignored on POSIX and Windows)
-      bool was_escape_sequence(true);
-      std::size_t append_count(0);
-      typename String::size_type initial_pos( m_path.size() );
-
-      for ( ; first != last && *first; ++first )
-      {
-        if ( append_count == 0 && *first != slash::value )
-          was_escape_sequence = false;
-        if ( append_count == 1 && *first != slash::value )
-          was_escape_sequence = false;
-        if ( append_count == 2 && *first != colon::value )
-          was_escape_sequence = false;
-        m_append( *first );
-        ++append_count;
-      }
-
-      // erase escape sequence if any
-      if ( was_escape_sequence && append_count >= 3 )
-        m_path.erase( initial_pos, 3 );
-
-      return *this;
-    }
-# endif
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    // canonize  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::canonize()
-    {
-      static const typename string_type::value_type dot_str[]
-        = { dot::value, 0 };
-
-      if ( m_path.empty() ) return *this;
-        
-      path_type temp;
-
-      for ( iterator itr( begin() ); itr != end(); ++itr )
-      {
-        temp /= *itr;
-      };
-
-      if ( temp.empty() ) temp /= dot_str;
-      m_path = temp.m_path;
-      return *this;
-    }
-
-    // normalize  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::normalize()
-    {
-      static const typename string_type::value_type dot_str[]
-        = { dot::value, 0 };
-
-      if ( m_path.empty() ) return *this;
-        
-      path_type temp;
-      iterator start( begin() );
-      iterator last( end() );
-      iterator stop( last-- );
-      for ( iterator itr( start ); itr != stop; ++itr )
-      {
-        // ignore "." except at start and last
-        if ( itr->size() == 1
-          && (*itr)[0] == dot::value
-          && itr != start
-          && itr != last ) continue;
-
-        // ignore a name and following ".."
-        if ( !temp.empty()
-          && itr->size() == 2
-          && (*itr)[0] == dot::value
-          && (*itr)[1] == dot::value ) // dot dot
-        {
-          string_type lf( temp.filename() );  
-          if ( lf.size() > 0  
-            && (lf.size() != 1
-              || (lf[0] != dot::value
-                && lf[0] != slash::value))
-            && (lf.size() != 2 
-              || (lf[0] != dot::value
-                && lf[1] != dot::value
-#             ifdef BOOST_WINDOWS_PATH
-                && lf[1] != colon::value
-#             endif
-                 )
-               )
-            )
-          {
-            temp.remove_filename();
-            // if not root directory, must also remove "/" if any
-            if ( temp.m_path.size() > 0
-              && temp.m_path[temp.m_path.size()-1]
-                == slash::value )
-            {
-              typename string_type::size_type rds(
-                detail::root_directory_start( temp.m_path,
-                  temp.m_path.size() ) );
-              if ( rds == string_type::npos
-                || rds != temp.m_path.size()-1 ) 
-                { temp.m_path.erase( temp.m_path.size()-1 ); }
-            }
-
-            iterator next( itr );
-            if ( temp.empty() && ++next != stop
-              && next == last && *last == dot_str ) temp /= dot_str;
-            continue;
-          }
-        }
-
-        temp /= *itr;
-      };
-
-      if ( temp.empty() ) temp /= dot_str;
-      m_path = temp.m_path;
-      return *this;
-    }
-
-# endif
-
-    // modifiers  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::remove_filename()
-    {
-      m_path.erase(
-        detail::filename_pos( m_path, m_path.size() ) );
-      return *this;
-    }
-
-    template
-    basic_path &
-    basic_path::replace_extension( const string_type & new_ext )
-    {
-      // erase existing extension if any
-      string_type old_ext = extension();
-      if ( !old_ext.empty() )
-        m_path.erase( m_path.size() - old_ext.size() );
-
-      if ( !new_ext.empty() && new_ext[0] != dot::value )
-        m_path += dot::value;
-
-      m_path += new_ext;
-
-      return *this;
-    }
-
-
-    // path conversion functions  --------------------------------------------//
-
-    template
-    const String
-    basic_path::file_string() const
-    {
-#   ifdef BOOST_WINDOWS_PATH
-      // for Windows, use the alternate separator, and bypass extra 
-      // root separators
-
-      typename string_type::size_type root_dir_start(
-        detail::root_directory_start( m_path, m_path.size() ) );
-      bool in_root( root_dir_start != string_type::npos );
-      String s;
-      for ( typename string_type::size_type pos( 0 );
-        pos != m_path.size(); ++pos )
-      {
-        // special case // [net]
-        if ( pos == 0 && m_path.size() > 1
-          && m_path[0] == slash::value
-          && m_path[1] == slash::value
-          && ( m_path.size() == 2 
-            || !detail::is_separator( m_path[2] )
-             ) )
-        {
-          ++pos;
-          s += path_alt_separator::value;
-          s += path_alt_separator::value;
-          continue;
-        }   
-
-        // bypass extra root separators
-        if ( in_root )
-        { 
-          if ( s.size() > 0
-            && s[s.size()-1] == path_alt_separator::value
-            && m_path[pos] == slash::value
-            ) continue;
-        }
-
-        if ( m_path[pos] == slash::value )
-          s += path_alt_separator::value;
-        else
-          s += m_path[pos];
-
-        if ( pos > root_dir_start
-          && m_path[pos] == slash::value )
-          { in_root = false; }
-      }
-#   ifdef BOOST_CYGWIN_PATH
-      if ( m_cygwin_root ) s[0] = slash::value;
-#   endif
-      return s;
-#   else
-      return m_path;
-#   endif
-    }
-
-    // iterator functions  ---------------------------------------------------//
-
-    template
-    typename basic_path::iterator basic_path::begin() const
-    {
-      iterator itr;
-      itr.m_path_ptr = this;
-      typename string_type::size_type element_size;
-      detail::first_element( m_path, itr.m_pos, element_size );
-      itr.m_name = m_path.substr( itr.m_pos, element_size );
-      return itr;
-    }
-
-    template
-    typename basic_path::iterator basic_path::end() const
-      {
-        iterator itr;
-        itr.m_path_ptr = this;
-        itr.m_pos = m_path.size();
-        return itr;
-      }
-
-    namespace detail
-    {
-      //  do_increment  ------------------------------------------------------//
-
-      template
-      void iterator_helper::do_increment( iterator & itr )
-      {
-        typedef typename Path::string_type string_type;
-        typedef typename Path::traits_type traits_type;
-
-        BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
-
-        bool was_net( itr.m_name.size() > 2
-          && itr.m_name[0] == slash::value
-          && itr.m_name[1] == slash::value
-          && itr.m_name[2] != slash::value );
-
-        // increment to position past current element
-        itr.m_pos += itr.m_name.size();
-
-        // if end reached, create end iterator
-        if ( itr.m_pos == itr.m_path_ptr->m_path.size() )
-        {
-          itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() 
-          return;
-        }
-
-        // process separator (Windows drive spec is only case not a separator)
-        if ( itr.m_path_ptr->m_path[itr.m_pos] == slash::value )
-        {
-          // detect root directory
-          if ( was_net
-  #       ifdef BOOST_WINDOWS_PATH
-            // case "c:/"
-            || itr.m_name[itr.m_name.size()-1] == colon::value
-  #       endif
-             )
-          {
-            itr.m_name = slash::value;
-            return;
-          }
-
-          // bypass separators
-          while ( itr.m_pos != itr.m_path_ptr->m_path.size()
-            && itr.m_path_ptr->m_path[itr.m_pos] == slash::value )
-            { ++itr.m_pos; }
-
-          // detect trailing separator, and treat it as ".", per POSIX spec
-          if ( itr.m_pos == itr.m_path_ptr->m_path.size()
-            && detail::is_non_root_slash< string_type, traits_type >(
-                itr.m_path_ptr->m_path, itr.m_pos-1 ) ) 
-          {
-            --itr.m_pos;
-            itr.m_name = dot::value;
-            return;
-          }
-        }
-
-        // get next element
-        typename string_type::size_type end_pos(
-          itr.m_path_ptr->m_path.find( slash::value, itr.m_pos ) );
-        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
-      } 
-
-      //  do_decrement  ------------------------------------------------------//
-
-      template
-      void iterator_helper::do_decrement( iterator & itr )
-      {                                                                                
-        BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()"  );
-
-        typedef typename Path::string_type string_type;
-        typedef typename Path::traits_type traits_type;
-
-        typename string_type::size_type end_pos( itr.m_pos );
-
-        typename string_type::size_type root_dir_pos(
-          detail::root_directory_start(
-            itr.m_path_ptr->m_path, end_pos ) );
-
-        // if at end and there was a trailing non-root '/', return "."
-        if ( itr.m_pos == itr.m_path_ptr->m_path.size()
-          && itr.m_path_ptr->m_path.size() > 1
-          && itr.m_path_ptr->m_path[itr.m_pos-1] == slash::value
-          && detail::is_non_root_slash< string_type, traits_type >(
-               itr.m_path_ptr->m_path, itr.m_pos-1 ) 
-           )
-        {
-          --itr.m_pos;
-            itr.m_name = dot::value;
-            return;
-        }
-
-        // skip separators unless root directory
-        for ( 
-          ; 
-          end_pos > 0
-          && (end_pos-1) != root_dir_pos
-          && itr.m_path_ptr->m_path[end_pos-1] == slash::value
-          ;
-          --end_pos ) {}
-
-        itr.m_pos = detail::filename_pos
-            ( itr.m_path_ptr->m_path, end_pos );
-        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
-      }
-    } // namespace detail
-
-    //  basic_filesystem_error implementation --------------------------------//
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, const path_type & path1_arg,
-      system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-        m_imp_ptr->m_path1 = path1_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, const path_type & path1_arg,
-      const path_type & path2_arg, system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-        m_imp_ptr->m_path1 = path1_arg;
-        m_imp_ptr->m_path2 = path2_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-  } // namespace BOOST_FILESYSTEM2_NAMESPACE
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::basic_path;
-    using filesystem2::path_traits;
-
-    using filesystem2::slash;
-    using filesystem2::dot;
-    using filesystem2::colon;
-
-    using filesystem2::path;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wpath_traits;
-    using filesystem2::wpath;
-    using filesystem2::wfilesystem_error;
-# endif
-    using filesystem2::basic_filesystem_error;
-    using filesystem2::filesystem_error;
-    using filesystem2::portable_posix_name;
-    using filesystem2::windows_name;
-    using filesystem2::portable_name;
-    using filesystem2::portable_directory_name;
-    using filesystem2::portable_file_name;
-    using filesystem2::native;
-    using filesystem2::no_check;
-    using filesystem2::swap;
-    using filesystem2::operator<;
-    using filesystem2::operator==;
-    using filesystem2::operator!=;
-    using filesystem2::operator>;
-    using filesystem2::operator<=;
-    using filesystem2::operator>=;
-    using filesystem2::operator/;
-    using filesystem2::operator<<;
-    using filesystem2::operator>>;
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-
-#endif // BOOST_FILESYSTEM2_PATH_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/config.hpp b/project/jni/boost/include/boost/filesystem/v3/config.hpp
deleted file mode 100644
index 13fc308db..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/config.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//  boost/filesystem/v3/config.hpp  ----------------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_CONFIG_HPP
-#define BOOST_FILESYSTEM3_CONFIG_HPP
-
-# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
-#   error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
-
-// This header implements separate compilation features as described in
-// http://www.boost.org/more/separate_compilation.html
-
-#include 
-#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
-#include  
-
-//  BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
-
-# ifdef BOOST_FILESYSTEM_SOURCE
-#   define BOOST_FILESYSTEM_DEPRECATED
-# endif
-
-//  throw an exception  ----------------------------------------------------------------//
-//
-//  Exceptions were originally thrown via boost::throw_exception().
-//  As throw_exception() became more complex, it caused user error reporting
-//  to be harder to interpret, since the exception reported became much more complex.
-//  The immediate fix was to throw directly, wrapped in a macro to make any later change
-//  easier.
-
-#define BOOST_FILESYSTEM_THROW(EX) throw EX
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-//  enable dynamic linking -------------------------------------------------------------//
-
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-# if defined(BOOST_FILESYSTEM_SOURCE)
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
-# else 
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
-# endif
-#else
-# define BOOST_FILESYSTEM_DECL
-#endif
-
-//  enable automatic library variant selection  ----------------------------------------// 
-
-#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
-  && !defined(BOOST_FILESYSTEM_NO_LIB)
-//
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_filesystem
-//
-// If we're importing code from a dll, then tell auto_link.hpp about it:
-//
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-#  define BOOST_DYN_LINK
-#endif
-//
-// And include the header that does the work:
-//
-#include 
-#endif  // auto-linking disabled
-
-#endif // BOOST_FILESYSTEM3_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/convenience.hpp b/project/jni/boost/include/boost/filesystem/v3/convenience.hpp
deleted file mode 100644
index 1a1f9435f..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/convenience.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//  boost/filesystem/convenience.hpp  ----------------------------------------//
-
-//  Copyright Beman Dawes, 2002-2005
-//  Copyright Vladimir Prus, 2002
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
-#define BOOST_FILESYSTEM3_CONVENIENCE_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-
-#include  // must be the last #include
-
-namespace boost
-{
-  namespace filesystem3
-  {
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    inline std::string extension(const path & p)
-    {
-      return p.extension().string();
-    }
-
-    inline std::string basename(const path & p)
-    {
-      return p.stem().string();
-    }
-
-    inline path change_extension( const path & p, const path & new_extension )
-    { 
-      path new_p( p );
-      new_p.replace_extension( new_extension );
-      return new_p;
-    }
-
-# endif
-
-
-  } // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::extension;
-    using filesystem3::basename;
-    using filesystem3::change_extension;
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/exception.hpp b/project/jni/boost/include/boost/filesystem/v3/exception.hpp
deleted file mode 100644
index 985cd8f71..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/exception.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-//  boost/filesystem/exception.hpp  -----------------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  This header is no longer used. The contents have been moved to path.hpp.
-//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/v3/fstream.hpp b/project/jni/boost/include/boost/filesystem/v3/fstream.hpp
deleted file mode 100644
index 60a2a3b2b..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/fstream.hpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//  boost/filesystem/fstream.hpp  ------------------------------------------------------//
-
-//  Copyright Beman Dawes 2002
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP
-#define BOOST_FILESYSTEM3_FSTREAM_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-//  on Windows, except for standard libaries known to have wchar_t overloads for
-//  file stream I/O, use path::string() to get a narrow character c_str()
-#if defined(BOOST_WINDOWS_API) \
-  && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
-  // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
-# define BOOST_FILESYSTEM_C_STR string().c_str()  // use narrow, since wide not available
-#else  // use the native c_str, which will be narrow on POSIX, wide on Windows
-# define BOOST_FILESYSTEM_C_STR c_str()
-#endif
-
-namespace boost
-{
-namespace filesystem3
-{
-
-//--------------------------------------------------------------------------------------//
-//                                  basic_filebuf                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_filebuf : public std::basic_filebuf
-  {
-  private: // disallow copying
-    basic_filebuf(const basic_filebuf&);
-    const basic_filebuf& operator=(const basic_filebuf&);
-
-  public:
-    basic_filebuf() {}
-    virtual ~basic_filebuf() {}
-
-    basic_filebuf*
-      open(const path& p, std::ios_base::openmode mode) 
-    {
-      return std::basic_filebuf::open(p.BOOST_FILESYSTEM_C_STR, mode)
-        ? this : 0;
-    }
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                 basic_ifstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_ifstream : public std::basic_ifstream
-  {
-  private: // disallow copying
-    basic_ifstream(const basic_ifstream&);
-    const basic_ifstream& operator=(const basic_ifstream&);
-
-  public:
-    basic_ifstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_ifstream(const path& p)
-      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
-
-    basic_ifstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_ifstream() {}
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                 basic_ofstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_ofstream : public std::basic_ofstream
-  {
-  private: // disallow copying
-    basic_ofstream(const basic_ofstream&);
-    const basic_ofstream& operator=(const basic_ofstream&);
-
-  public:
-    basic_ofstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_ofstream(const path& p)
-      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
-
-    basic_ofstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_ofstream() {}
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                  basic_fstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_fstream : public std::basic_fstream
-  {
-  private: // disallow copying
-    basic_fstream(const basic_fstream&);
-    const basic_fstream & operator=(const basic_fstream&);
-
-  public:
-    basic_fstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_fstream(const path& p)
-      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR,
-          std::ios_base::in | std::ios_base::out) {}
-
-    basic_fstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR,
-          std::ios_base::in | std::ios_base::out); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_fstream() {}
-
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                    typedefs                                          //
-//--------------------------------------------------------------------------------------//
-
-  typedef basic_filebuf filebuf;
-  typedef basic_ifstream ifstream;
-  typedef basic_ofstream ofstream;
-  typedef basic_fstream fstream;
-
-  typedef basic_filebuf wfilebuf;
-  typedef basic_ifstream wifstream;
-  typedef basic_ofstream wofstream;
-  typedef basic_fstream wfstream;
-  
-} // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::filebuf;
-    using filesystem3::ifstream;
-    using filesystem3::ofstream;
-    using filesystem3::fstream;
-    using filesystem3::wfilebuf;
-    using filesystem3::wifstream;
-    using filesystem3::wfstream;
-    using filesystem3::wofstream;
-    using filesystem3::basic_filebuf;
-    using filesystem3::basic_ifstream;
-    using filesystem3::basic_ofstream;
-    using filesystem3::basic_fstream;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif  // BOOST_FILESYSTEM3_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/operations.hpp b/project/jni/boost/include/boost/filesystem/v3/operations.hpp
deleted file mode 100644
index ace3bc8f1..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/operations.hpp
+++ /dev/null
@@ -1,1199 +0,0 @@
-//  boost/filesystem/operations.hpp  ---------------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2009
-//  Copyright Jan Langer 2002
-//  Copyright Dietmar Kuehl 2001                                        
-//  Copyright Vladimir Prus 2002
-   
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------//
-
-#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP
-#define BOOST_FILESYSTEM3_OPERATIONS_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for pair
-#include 
-#include 
-#include 
-
-#ifdef BOOST_WINDOWS_API
-#  include 
-#endif
-
-#include  // must be the last #include
-
-//--------------------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem3
-  {
-
-//--------------------------------------------------------------------------------------//
-//                                     file_type                                        //
-//--------------------------------------------------------------------------------------//
-
-  enum file_type
-  { 
-    status_error,
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    status_unknown = status_error,
-#   endif
-    file_not_found,
-    regular_file,
-    directory_file,
-    // the following may not apply to some operating systems or file systems
-    symlink_file,
-    block_file,
-    character_file,
-    fifo_file,
-    socket_file,
-    reparse_file,  // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
-    type_unknown,  // file does exist, but isn't one of the above types or
-                   // we don't have strong enough permission to find its type
-
-    _detail_directory_symlink  // internal use only; never exposed to users
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                       perms                                          //
-//--------------------------------------------------------------------------------------//
-
-  enum perms
-  {
-    no_perms = 0,       // file_not_found is no_perms rather than perms_not_known
-
-    // POSIX equivalent macros given in comments.
-    // Values are from POSIX and are given in octal per the POSIX standard.
-
-    // permission bits
-    
-    owner_read = 0400,  // S_IRUSR, Read permission, owner
-    owner_write = 0200, // S_IWUSR, Write permission, owner
-    owner_exe = 0100,   // S_IXUSR, Execute/search permission, owner
-    owner_all = 0700,   // S_IRWXU, Read, write, execute/search by owner
-
-    group_read = 040,   // S_IRGRP, Read permission, group
-    group_write = 020,  // S_IWGRP, Write permission, group
-    group_exe = 010,    // S_IXGRP, Execute/search permission, group
-    group_all = 070,    // S_IRWXG, Read, write, execute/search by group
-
-    others_read = 04,   // S_IROTH, Read permission, others
-    others_write = 02,  // S_IWOTH, Write permission, others
-    others_exe = 01,    // S_IXOTH, Execute/search permission, others
-    others_all = 07,    // S_IRWXO, Read, write, execute/search by others
-
-    all_all = owner_all|group_all|others_all,  // 0777
-
-    // other POSIX bits
-
-    set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
-    set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
-    sticky_bit     = 01000, // S_ISVTX,
-                            // (POSIX XSI) On directories, restricted deletion flag 
-	                          // (V7) 'sticky bit': save swapped text even after use 
-                            // (SunOS) On non-directories: don't cache this file
-                            // (SVID-v4.2) On directories: restricted deletion flag
-                            // Also see http://en.wikipedia.org/wiki/Sticky_bit
-
-    perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit,  // 07777
-
-    perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
-
-    // options for permissions() function
-
-    add_perms = 0x1000,     // adds the given permission bits to the current bits
-    remove_perms = 0x2000,  // removes the given permission bits from the current bits;
-                            // choose add_perms or remove_perms, not both; if neither add_perms
-                            // nor remove_perms is given, replace the current bits with
-                            // the given bits.
-
-    symlink_perms = 0x4000  // on POSIX, don't resolve symlinks; implied on Windows
-  };
-
-  BOOST_BITMASK(perms)
-
-//--------------------------------------------------------------------------------------//
-//                                    file_status                                       //
-//--------------------------------------------------------------------------------------//
-
-  class BOOST_FILESYSTEM_DECL file_status
-  {
-  public:
-             file_status()            : m_value(status_error), m_perms(perms_not_known) {}
-    explicit file_status(file_type v, perms prms = perms_not_known)
-                                      : m_value(v), m_perms(prms) {}
-
-    // observers
-    file_type  type() const                       { return m_value; }
-    perms      permissions() const                { return m_perms; } 
-
-    // modifiers
-    void       type(file_type v)                  { m_value = v; }
-    void       permissions(perms prms)            { m_perms = prms; }
-
-    bool operator==(const file_status& rhs) const { return type() == rhs.type() && 
-                                                    permissions() == rhs.permissions(); }
-    bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
-
-  private:
-    file_type   m_value;
-    enum perms  m_perms;
-  };
-
-  inline bool type_present(file_status f) { return f.type() != status_error; }
-  inline bool permissions_present(file_status f)
-                                          {return f.permissions() != perms_not_known;}
-  inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); }
-  inline bool exists(file_status f)       { return f.type() != status_error
-                                                && f.type() != file_not_found; }
-  inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
-  inline bool is_directory(file_status f) { return f.type() == directory_file; }
-  inline bool is_symlink(file_status f)   { return f.type() == symlink_file; }
-  inline bool is_other(file_status f)     { return exists(f) && !is_regular_file(f)
-                                                && !is_directory(f) && !is_symlink(f); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline bool is_regular(file_status f)   { return f.type() == regular_file; }
-# endif
-
-  struct space_info
-  {
-    // all values are byte counts
-    boost::uintmax_t capacity;
-    boost::uintmax_t free;      // <= capacity
-    boost::uintmax_t available; // <= free
-  };
-
-  BOOST_SCOPED_ENUM_START(copy_option)
-    {none, fail_if_exists = none, overwrite_if_exists};
-  BOOST_SCOPED_ENUM_END
-
-//--------------------------------------------------------------------------------------//
-//                             implementation details                                   //
-//--------------------------------------------------------------------------------------//
-
-  namespace detail
-  {
-    BOOST_FILESYSTEM_DECL
-    file_status status(const path&p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    file_status symlink_status(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool is_empty(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path initial_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path canonical(const path& p, const path& base, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy(const path& from, const path& to, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_directory(const path& from, const path& to, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_file(const path& from, const path& to,
-                    BOOST_SCOPED_ENUM(copy_option) option,  // See ticket #2925
-                    system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool create_directories(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool create_directory(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_directory_symlink(const path& to, const path& from,
-                                  system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_symlink(const path& to, const path& from, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path current_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void current_path(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    std::time_t last_write_time(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void last_write_time(const path& p, const std::time_t new_time,
-                         system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void permissions(const path& p, perms prms, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path read_symlink(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-      // For standardization, if the committee doesn't like "remove", consider "eliminate"
-    bool remove(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    space_info space(const path& p, system::error_code* ec=0); 
-    BOOST_FILESYSTEM_DECL
-    path system_complete(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path temp_directory_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path unique_path(const path& p, system::error_code* ec=0);
-  }  // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                             status query functions                                   //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  inline
-  file_status status(const path& p)    {return detail::status(p);}
-  inline 
-  file_status status(const path& p, system::error_code& ec)
-                                       {return detail::status(p, &ec);}
-  inline 
-  file_status symlink_status(const path& p) {return detail::symlink_status(p);}
-  inline
-  file_status symlink_status(const path& p, system::error_code& ec)
-                                       {return detail::symlink_status(p, &ec);}
-  inline 
-  bool exists(const path& p)           {return exists(detail::status(p));}
-  inline 
-  bool exists(const path& p, system::error_code& ec)
-                                       {return exists(detail::status(p, &ec));}
-  inline 
-  bool is_directory(const path& p)     {return is_directory(detail::status(p));}
-  inline 
-  bool is_directory(const path& p, system::error_code& ec)
-                                       {return is_directory(detail::status(p, &ec));}
-  inline 
-  bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
-  inline 
-  bool is_regular_file(const path& p, system::error_code& ec)
-                                       {return is_regular_file(detail::status(p, &ec));}
-  inline 
-  bool is_other(const path& p)         {return is_other(detail::status(p));}
-  inline 
-  bool is_other(const path& p, system::error_code& ec)
-                                       {return is_other(detail::status(p, &ec));}
-  inline
-  bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
-  inline 
-  bool is_symlink(const path& p, system::error_code& ec)
-                                       {return is_symlink(detail::symlink_status(p, &ec));}
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline
-  bool is_regular(const path& p)       {return is_regular(detail::status(p));}
-  inline
-  bool is_regular(const path& p, system::error_code& ec)
-                                       {return is_regular(detail::status(p, &ec));}
-# endif
-
-  inline
-  bool is_empty(const path& p)         {return detail::is_empty(p);}
-  inline
-  bool is_empty(const path& p, system::error_code& ec)
-                                       {return detail::is_empty(p, &ec);}
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                             operational functions                                    //
-//                  in alphabetical order, unless otherwise noted                       //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
- 
-  //  forward declarations
-  path current_path();  // fwd declaration
-  path initial_path();
-
-  BOOST_FILESYSTEM_DECL
-  path absolute(const path& p, const path& base=current_path());
-  //  If base.is_absolute(), throws nothing. Thus no need for ec argument
-
-  inline
-  path canonical(const path& p, const path& base=current_path())
-                                       {return detail::canonical(p, base);}
-  inline
-  path canonical(const path& p, system::error_code& ec)
-                                       {return detail::canonical(p, current_path(), &ec);}
-  inline
-  path canonical(const path& p, const path& base, system::error_code& ec)
-                                       {return detail::canonical(p, base, &ec);}
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline
-  path complete(const path& p)
-  {
-    return absolute(p, initial_path());
-  }
-
-  inline
-  path complete(const path& p, const path& base)
-  {
-    return absolute(p, base);
-  }
-# endif
-
-  inline
-  void copy(const path& from, const path& to) {detail::copy(from, to);}
-
-  inline
-  void copy(const path& from, const path& to, system::error_code& ec) 
-                                       {detail::copy(from, to, &ec);}
-  inline
-  void copy_directory(const path& from, const path& to)
-                                       {detail::copy_directory(from, to);}
-  inline
-  void copy_directory(const path& from, const path& to, system::error_code& ec)
-                                       {detail::copy_directory(from, to, &ec);}
-  inline
-  void copy_file(const path& from, const path& to,   // See ticket #2925
-                 BOOST_SCOPED_ENUM(copy_option) option)
-                                       {detail::copy_file(from, to, option);}
-  inline
-  void copy_file(const path& from, const path& to)
-                                       {detail::copy_file(from, to, copy_option::fail_if_exists);}
-  inline
-  void copy_file(const path& from, const path& to,   // See ticket #2925
-                 BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec)
-                                       {detail::copy_file(from, to, option, &ec);}
-  inline
-  void copy_file(const path& from, const path& to, system::error_code& ec)
-                                       {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);}
-  inline
-  void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}
-
-  inline
-  void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec)
-                                       {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
-  inline
-  bool create_directories(const path& p) {return detail::create_directories(p);}
-
-  inline
-  bool create_directories(const path& p, system::error_code& ec)
-                                       {return detail::create_directories(p, &ec);}
-  inline
-  bool create_directory(const path& p) {return detail::create_directory(p);}
-
-  inline
-  bool create_directory(const path& p, system::error_code& ec)
-                                       {return detail::create_directory(p, &ec);}
-  inline
-  void create_directory_symlink(const path& to, const path& from)
-                                       {detail::create_directory_symlink(to, from);}
-  inline
-  void create_directory_symlink(const path& to, const path& from, system::error_code& ec)
-                                       {detail::create_directory_symlink(to, from, &ec);}
-  inline
-  void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
-
-  inline
-  void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec)
-                                       {detail::create_hard_link(to, new_hard_link, &ec);}
-  inline
-  void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
-
-  inline
-  void create_symlink(const path& to, const path& new_symlink, system::error_code& ec)
-                                       {detail::create_symlink(to, new_symlink, &ec);}
-  inline
-  path current_path()                  {return detail::current_path();}
-
-  inline
-  path current_path(system::error_code& ec) {return detail::current_path(&ec);}
-
-  inline
-  void current_path(const path& p)     {detail::current_path(p);}
-
-  inline
-  void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);}
-
-  inline
-  bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
-
-  inline
-  bool equivalent(const path& p1, const path& p2, system::error_code& ec)
-                                       {return detail::equivalent(p1, p2, &ec);}
-  inline
-  boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
-
-  inline
-  boost::uintmax_t file_size(const path& p, system::error_code& ec)
-                                       {return detail::file_size(p, &ec);}
-  inline
-  boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
-
-  inline
-  boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
-                                       {return detail::hard_link_count(p, &ec);}
-  inline
-  path initial_path()                  {return detail::initial_path();}
-
-  inline
-  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-
-  template 
-  path initial_path() {return initial_path();}
-  template 
-  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-
-  inline
-  std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
-
-  inline
-  std::time_t last_write_time(const path& p, system::error_code& ec)
-                                       {return detail::last_write_time(p, &ec);}
-  inline
-  void last_write_time(const path& p, const std::time_t new_time)
-                                       {detail::last_write_time(p, new_time);}
-  inline
-  void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec)
-                                       {detail::last_write_time(p, new_time, &ec);}
-  inline
-  void permissions(const path& p, perms prms)
-                                       {detail::permissions(p, prms);}
-  inline
-  void permissions(const path& p, perms prms, system::error_code& ec)
-                                       {detail::permissions(p, prms, &ec);}
-
-  inline
-  path read_symlink(const path& p)     {return detail::read_symlink(p);}
-
-  inline
-  path read_symlink(const path& p, system::error_code& ec)
-                                       {return detail::read_symlink(p, &ec);}
-  inline
-    // For standardization, if the committee doesn't like "remove", consider "eliminate"
-  bool remove(const path& p)           {return detail::remove(p);}
-
-  inline
-  bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);}
-
-  inline
-  boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
-    
-  inline
-  boost::uintmax_t remove_all(const path& p, system::error_code& ec)
-                                       {return detail::remove_all(p, &ec);}
-  inline
-  void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
-
-  inline
-  void rename(const path& old_p, const path& new_p, system::error_code& ec)
-                                       {detail::rename(old_p, new_p, &ec);}
-  inline  // name suggested by Scott McMurray
-  void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
-
-  inline
-  void resize_file(const path& p, uintmax_t size, system::error_code& ec)
-                                       {detail::resize_file(p, size, &ec);}
-  inline
-  space_info space(const path& p)      {return detail::space(p);} 
-
-  inline
-  space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} 
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline bool symbolic_link_exists(const path& p)
-                                       { return is_symlink(symlink_status(p)); }
-# endif
-
-  inline
-  path system_complete(const path& p)  {return detail::system_complete(p);}
-
-  inline
-  path system_complete(const path& p, system::error_code& ec)
-                                       {return detail::system_complete(p, &ec);}
-  inline
-  path temp_directory_path()           {return detail::temp_directory_path();}
-
-  inline
-  path temp_directory_path(system::error_code& ec) 
-                                       {return detail::temp_directory_path(&ec);}
-  inline
-  path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
-                                       { return detail::unique_path(p); }
-  inline
-  path unique_path(const path& p, system::error_code& ec)
-                                       { return detail::unique_path(p, &ec); }
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                                 directory_entry                                      //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-//  GCC has a problem with a member function named path within a namespace or 
-//  sub-namespace that also has a class named path. The workaround is to always
-//  fully qualify the name path when it refers to the class name.
-
-class BOOST_FILESYSTEM_DECL directory_entry
-{
-public:
-
-  // compiler generated copy constructor, copy assignment, and destructor apply
-
-  directory_entry() {}
-  explicit directory_entry(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st=file_status())
-    : m_path(p), m_status(st), m_symlink_status(symlink_st)
-    {}
-
-  void assign(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st = file_status())
-    { m_path = p; m_status = st; m_symlink_status = symlink_st; }
-
-  void replace_filename(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st = file_status())
-  {
-    m_path.remove_filename();
-    m_path /= p;
-    m_status = st;
-    m_symlink_status = symlink_st;
-  }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  void replace_leaf(const boost::filesystem::path& p,
-    file_status st, file_status symlink_st)
-      { replace_filename(p, st, symlink_st); }
-# endif
-
-  const boost::filesystem::path&  path() const               {return m_path;}
-  file_status   status() const                               {return m_get_status();}
-  file_status   status(system::error_code& ec) const         {return m_get_status(&ec);}
-  file_status   symlink_status() const                       {return m_get_symlink_status();}
-  file_status   symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
-
-  bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} 
-  bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} 
-  bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} 
-  bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} 
-  bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} 
-  bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} 
-
-private:
-  boost::filesystem::path   m_path;
-  mutable file_status       m_status;           // stat()-like
-  mutable file_status       m_symlink_status;   // lstat()-like
-
-  file_status m_get_status(system::error_code* ec=0) const;
-  file_status m_get_symlink_status(system::error_code* ec=0) const;
-}; // directory_entry
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                            directory_iterator helpers                                //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-class directory_iterator;
-
-namespace detail
-{
-  BOOST_FILESYSTEM_DECL
-    system::error_code dir_itr_close(// never throws()
-    void *& handle
-#   if     defined(BOOST_POSIX_API)
-    , void *& buffer
-#   endif
-  ); 
-
-  struct dir_itr_imp
-  {
-    directory_entry  dir_entry;
-    void*            handle;
-
-#   ifdef BOOST_POSIX_API
-    void*            buffer;  // see dir_itr_increment implementation
-#   endif
-
-    dir_itr_imp() : handle(0)
-#   ifdef BOOST_POSIX_API
-      , buffer(0)
-#   endif
-    {}
-
-    ~dir_itr_imp() // never throws
-    {
-      dir_itr_close(handle
-#       if defined(BOOST_POSIX_API)
-         , buffer
-#       endif
-    );
-    }
-  };
-
-  // see path::iterator: comment below
-  BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it,
-    const path& p, system::error_code* ec);
-  BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it,
-    system::error_code* ec);
-
-}  // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                                directory_iterator                                    //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  class directory_iterator
-    : public boost::iterator_facade< directory_iterator,
-                                     directory_entry,
-                                     boost::single_pass_traversal_tag >
-  {
-  public:
-
-    directory_iterator(){}  // creates the "end" iterator
-
-    // iterator_facade derived classes don't seem to like implementations in
-    // separate translation unit dll's, so forward to detail functions
-    explicit directory_iterator(const path& p)
-        : m_imp(new detail::dir_itr_imp)
-          { detail::directory_iterator_construct(*this, p, 0); }
-
-    directory_iterator(const path& p, system::error_code& ec)
-        : m_imp(new detail::dir_itr_imp)
-          { detail::directory_iterator_construct(*this, p, &ec); }
-
-   ~directory_iterator() {} // never throws
-
-    directory_iterator& increment(system::error_code& ec)
-    { 
-      detail::directory_iterator_increment(*this, &ec);
-      return *this;
-    }
-
-  private:
-    friend struct detail::dir_itr_imp;
-    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it,
-      const path& p, system::error_code* ec);
-    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
-      system::error_code* ec);
-
-    // shared_ptr provides shallow-copy semantics required for InputIterators.
-    // m_imp.get()==0 indicates the end iterator.
-    boost::shared_ptr< detail::dir_itr_imp >  m_imp;
-
-    friend class boost::iterator_core_access;
-
-    boost::iterator_facade<
-      directory_iterator,
-      directory_entry,
-      boost::single_pass_traversal_tag >::reference dereference() const 
-    {
-      BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
-      return m_imp->dir_entry;
-    }
-
-    void increment() { detail::directory_iterator_increment(*this, 0); }
-
-    bool equal(const directory_iterator& rhs) const
-      { return m_imp == rhs.m_imp; }
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                      recursive_directory_iterator helpers                            //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  BOOST_SCOPED_ENUM_START(symlink_option)
-  {
-    none,
-    no_recurse = none,         // don't follow directory symlinks (default behavior)
-    recurse,                   // follow directory symlinks
-    _detail_no_push = recurse << 1  // internal use only
-  };
-  BOOST_SCOPED_ENUM_END
-
-  BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option))
-
-  namespace detail
-  {
-    struct recur_dir_itr_imp
-    {
-      typedef directory_iterator element_type;
-      std::stack< element_type, std::vector< element_type > > m_stack;
-      int  m_level;
-      BOOST_SCOPED_ENUM(symlink_option) m_options;
-
-      recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {}
-
-      void increment(system::error_code* ec);  // ec == 0 means throw on error
-
-      void pop();
-
-    };
-
-    //  Implementation is inline to avoid dynamic linking difficulties with m_stack:
-    //  Microsoft warning C4251, m_stack needs to have dll-interface to be used by
-    //  clients of struct 'boost::filesystem::detail::recur_dir_itr_imp'
-
-    inline
-    void recur_dir_itr_imp::increment(system::error_code* ec)
-    // ec == 0 means throw on error
-    {
-      if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
-        m_options &= ~symlink_option::_detail_no_push;
-
-      else
-      {
-        // Logic for following predicate was contributed by Daniel Aarno to handle cyclic
-        // symlinks correctly and efficiently, fixing ticket #5652.
-        //   if (((m_options & symlink_option::recurse) == symlink_option::recurse
-        //         || !is_symlink(m_stack.top()->symlink_status()))
-        //       && is_directory(m_stack.top()->status())) ...
-        // The predicate code has since been rewritten to pass error_code arguments,
-        // per ticket #5653.
-        bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
-                       || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
-                                   : !is_symlink(m_stack.top()->symlink_status(*ec)));
-        if (ec != 0 && *ec)
-          return;
-        bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
-                                            : is_directory(m_stack.top()->status(*ec)));
-        if (ec != 0 && *ec)
-          return;
-
-        if (and_pred)
-        {
-          if (ec == 0)
-            m_stack.push(directory_iterator(m_stack.top()->path()));
-          else
-          {
-            m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
-            if (*ec)
-              return;
-          }
-          if (m_stack.top() != directory_iterator())
-          {
-            ++m_level;
-            return;
-          }
-          m_stack.pop();
-        }
-      }
-
-      while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
-      {
-        m_stack.pop();
-        --m_level;
-      }
-    }
-
-    inline
-    void recur_dir_itr_imp::pop()
-    {
-      BOOST_ASSERT_MSG(m_level > 0,
-        "pop() on recursive_directory_iterator with level < 1");
-
-      do
-      {
-        m_stack.pop();
-        --m_level;
-      }
-      while (!m_stack.empty() && ++m_stack.top() == directory_iterator());
-    }
-  } // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                           recursive_directory_iterator                               //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  class recursive_directory_iterator
-    : public boost::iterator_facade<
-        recursive_directory_iterator,
-        directory_entry,
-        boost::single_pass_traversal_tag >
-  {
-  public:
-
-    recursive_directory_iterator(){}  // creates the "end" iterator
-
-    explicit recursive_directory_iterator(const path& dir_path,
-      BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none)
-      : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = opt;
-      m_imp->m_stack.push(directory_iterator(dir_path));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator(const path& dir_path,
-      BOOST_SCOPED_ENUM(symlink_option) opt,
-      system::error_code & ec)
-    : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = opt;
-      m_imp->m_stack.push(directory_iterator(dir_path, ec));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator(const path& dir_path,
-      system::error_code & ec)
-    : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = symlink_option::none;
-      m_imp->m_stack.push(directory_iterator(dir_path, ec));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator& increment(system::error_code& ec)
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "increment() on end recursive_directory_iterator");
-      m_imp->increment(&ec);
-      if (m_imp->m_stack.empty())
-        m_imp.reset(); // done, so make end iterator
-      return *this;
-    }
-
-    int level() const
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "level() on end recursive_directory_iterator");
-      return m_imp->m_level;
-    }
-
-    bool no_push_pending() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "is_no_push_requested() on end recursive_directory_iterator");
-      return (m_imp->m_options & symlink_option::_detail_no_push)
-        == symlink_option::_detail_no_push;
-    }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    bool no_push_request() const { return no_push_pending(); }
-#   endif
-
-    void pop()
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "pop() on end recursive_directory_iterator");
-      m_imp->pop();
-      if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
-    }
-
-    void no_push(bool value=true)
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "no_push() on end recursive_directory_iterator");
-      if (value)
-        m_imp->m_options |= symlink_option::_detail_no_push;
-      else
-        m_imp->m_options &= ~symlink_option::_detail_no_push;
-    }
-
-    file_status status() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "status() on end recursive_directory_iterator");
-      return m_imp->m_stack.top()->status();
-    }
-
-    file_status symlink_status() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "symlink_status() on end recursive_directory_iterator");
-      return m_imp->m_stack.top()->symlink_status();
-    }
-
-  private:
-
-    // shared_ptr provides shallow-copy semantics required for InputIterators.
-    // m_imp.get()==0 indicates the end iterator.
-    boost::shared_ptr< detail::recur_dir_itr_imp >  m_imp;
-
-    friend class boost::iterator_core_access;
-
-    boost::iterator_facade< 
-      recursive_directory_iterator,
-      directory_entry,
-      boost::single_pass_traversal_tag >::reference
-    dereference() const 
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "dereference of end recursive_directory_iterator");
-      return *m_imp->m_stack.top();
-    }
-
-    void increment()
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "increment of end recursive_directory_iterator");
-      m_imp->increment(0);
-      if (m_imp->m_stack.empty())
-        m_imp.reset(); // done, so make end iterator
-    }
-
-    bool equal(const recursive_directory_iterator& rhs) const
-      { return m_imp == rhs.m_imp; }
-
-  };
-
-# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-  typedef recursive_directory_iterator wrecursive_directory_iterator;
-# endif
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                            class filesystem_error                                    //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-  
-  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
-  {
-  // see http://www.boost.org/more/error_handling.html for design rationale
-
-  // all functions are inline to avoid issues with crossing dll boundaries
-
-  public:
-    // compiler generates copy constructor and copy assignment
-
-    filesystem_error(
-      const std::string & what_arg, system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    filesystem_error(
-      const std::string & what_arg, const path& path1_arg,
-      system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-        m_imp_ptr->m_path1 = path1_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-    
-    filesystem_error(
-      const std::string & what_arg, const path& path1_arg,
-      const path& path2_arg, system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-        m_imp_ptr->m_path1 = path1_arg;
-        m_imp_ptr->m_path2 = path2_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    ~filesystem_error() throw() {}
-
-    const path& path1() const
-    {
-      static const path empty_path;
-      return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
-    }
-    const path& path2() const
-    {
-      static const path empty_path;
-      return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
-    }
-
-    const char* what() const throw()
-    {
-      if (!m_imp_ptr.get())
-        return system::system_error::what();
-
-      try
-      {
-        if (m_imp_ptr->m_what.empty())
-        {
-          m_imp_ptr->m_what = system::system_error::what();
-          if (!m_imp_ptr->m_path1.empty())
-          {
-            m_imp_ptr->m_what += ": \"";
-            m_imp_ptr->m_what += m_imp_ptr->m_path1.string();
-            m_imp_ptr->m_what += "\"";
-          }
-          if (!m_imp_ptr->m_path2.empty())
-          {
-            m_imp_ptr->m_what += ", \"";
-            m_imp_ptr->m_what += m_imp_ptr->m_path2.string();
-            m_imp_ptr->m_what += "\"";
-          }
-        }
-        return m_imp_ptr->m_what.c_str();
-      }
-      catch (...)
-      {
-        return system::system_error::what();
-      }
-    }
-
-  private:
-    struct m_imp
-    {
-      path         m_path1; // may be empty()
-      path         m_path2; // may be empty()
-      std::string  m_what;  // not built until needed
-    };
-    boost::shared_ptr m_imp_ptr;
-  };
-
-//  test helper  -----------------------------------------------------------------------//
-
-//  Not part of the documented interface since false positives are possible;
-//  there is no law that says that an OS that has large stat.st_size
-//  actually supports large file sizes.
-
-  namespace detail
-  {
-    BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
-  }
-
-  } // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    // permissions
-    using filesystem3::no_perms;
-    using filesystem3::owner_read;
-    using filesystem3::owner_write;
-    using filesystem3::owner_exe;
-    using filesystem3::owner_all;
-    using filesystem3::group_read;
-    using filesystem3::group_write;
-    using filesystem3::group_exe;
-    using filesystem3::group_all;
-    using filesystem3::others_read;
-    using filesystem3::others_write;
-    using filesystem3::others_exe;
-    using filesystem3::others_all;
-    using filesystem3::all_all;
-    using filesystem3::set_uid_on_exe;
-    using filesystem3::set_gid_on_exe;
-    using filesystem3::sticky_bit;
-    using filesystem3::perms_mask;
-    using filesystem3::perms_not_known;
-    using filesystem3::add_perms;
-    using filesystem3::remove_perms;
-    using filesystem3::symlink_perms;
-
-    using filesystem3::absolute;
-    using filesystem3::block_file;
-    using filesystem3::canonical;
-    using filesystem3::character_file;
-//    using filesystem3::copy;
-    using filesystem3::copy_file;
-    using filesystem3::copy_option;
-    using filesystem3::copy_symlink;
-    using filesystem3::create_directories;
-    using filesystem3::create_directory;
-    using filesystem3::create_hard_link;
-    using filesystem3::create_symlink;
-    using filesystem3::create_directory_symlink;
-    using filesystem3::current_path;
-    using filesystem3::directory_entry;
-    using filesystem3::directory_file;
-    using filesystem3::directory_iterator;
-    using filesystem3::equivalent;
-    using filesystem3::exists;
-    using filesystem3::fifo_file;
-    using filesystem3::file_not_found;
-    using filesystem3::file_size;
-    using filesystem3::file_status;
-    using filesystem3::file_type;
-    using filesystem3::filesystem_error;
-    using filesystem3::hard_link_count;
-    using filesystem3::initial_path;
-    using filesystem3::is_directory;
-    using filesystem3::is_directory;
-    using filesystem3::is_empty;
-    using filesystem3::is_other;
-    using filesystem3::is_regular_file;
-    using filesystem3::is_symlink;
-    using filesystem3::last_write_time;
-    using filesystem3::permissions;
-    using filesystem3::permissions_present;
-    using filesystem3::perms;
-    using filesystem3::read_symlink;
-    using filesystem3::recursive_directory_iterator;
-    using filesystem3::regular_file;
-    using filesystem3::reparse_file;
-    using filesystem3::remove;
-    using filesystem3::remove_all;
-    using filesystem3::rename;
-    using filesystem3::resize_file;
-    using filesystem3::socket_file;
-    using filesystem3::space;
-    using filesystem3::space_info;
-    using filesystem3::status;
-    using filesystem3::status_error;
-    using filesystem3::status_known;
-    using filesystem3::symlink_file;
-    using filesystem3::symlink_option;
-    using filesystem3::symlink_status;
-    using filesystem3::system_complete;
-    using filesystem3::temp_directory_path;
-    using filesystem3::type_present;
-    using filesystem3::type_unknown;
-    using filesystem3::unique_path;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::is_regular;
-    using filesystem3::status_unknown;
-    using filesystem3::symbolic_link_exists;
-    //using filesystem3::wdirectory_iterator;
-    //using filesystem3::wdirectory_entry;
-# endif
-    namespace detail
-    {
-      using filesystem3::detail::possible_large_file_size_support;
-    }
-  }
-}
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/path.hpp b/project/jni/boost/include/boost/filesystem/v3/path.hpp
deleted file mode 100644
index c483671d0..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/path.hpp
+++ /dev/null
@@ -1,760 +0,0 @@
-//  filesystem path.hpp  ---------------------------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2005, 2009
-//  Copyright Vladimir Prus 2002
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//  path::stem(), extension(), and replace_extension() are based on
-//  basename(), extension(), and change_extension() from the original
-//  filesystem/convenience.hpp header by Vladimir Prus.
-
-#ifndef BOOST_FILESYSTEM_PATH_HPP
-#define BOOST_FILESYSTEM_PATH_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include   // includes 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-namespace boost
-{
-namespace filesystem3
-{
-  //------------------------------------------------------------------------------------//
-  //                                                                                    //
-  //                                    class path                                      //
-  //                                                                                    //
-  //------------------------------------------------------------------------------------//
-
-  class BOOST_FILESYSTEM_DECL path
-  {
-  public:
-
-    //  value_type is the character type used by the operating system API to
-    //  represent paths.
-
-#   ifdef BOOST_WINDOWS_API
-    typedef wchar_t                                     value_type;
-#   else 
-    typedef char                                        value_type;
-#   endif
-    typedef std::basic_string               string_type;  
-    typedef std::codecvt codecvt_type;
-
-
-    //  ----- character encoding conversions -----
-
-    //  Following the principle of least astonishment, path input arguments
-    //  passed to or obtained from the operating system via objects of
-    //  class path behave as if they were directly passed to or
-    //  obtained from the O/S API, unless conversion is explicitly requested.
-    //
-    //  POSIX specfies that path strings are passed unchanged to and from the
-    //  API. Note that this is different from the POSIX command line utilities,
-    //  which convert according to a locale.
-    //
-    //  Thus for POSIX, char strings do not undergo conversion.  wchar_t strings
-    //  are converted to/from char using the path locale or, if a conversion
-    //  argument is given, using a conversion object modeled on
-    //  std::wstring_convert.
-    //
-    //  The path locale, which is global to the thread, can be changed by the
-    //  imbue() function. It is initialized to an implementation defined locale.
-    //  
-    //  For Windows, wchar_t strings do not undergo conversion. char strings
-    //  are converted using the "ANSI" or "OEM" code pages, as determined by
-    //  the AreFileApisANSI() function, or, if a conversion argument is given,
-    //  using a conversion object modeled on std::wstring_convert.
-    //
-    //  See m_pathname comments for further important rationale.
-
-    //  TODO: rules needed for operating systems that use / or .
-    //  differently, or format directory paths differently from file paths. 
-    //
-    //  **********************************************************************************
-    //
-    //  More work needed: How to handle an operating system that may have
-    //  slash characters or dot characters in valid filenames, either because
-    //  it doesn't follow the POSIX standard, or because it allows MBCS
-    //  filename encodings that may contain slash or dot characters. For
-    //  example, ISO/IEC 2022 (JIS) encoding which allows switching to
-    //  JIS x0208-1983 encoding. A valid filename in this set of encodings is
-    //  0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU]
-    //                                             ^^^^
-    //  Note that 0x2F is the ASCII slash character
-    //
-    //  **********************************************************************************
-
-    //  Supported source arguments: half-open iterator range, container, c-array,
-    //  and single pointer to null terminated string.
-
-    //  All source arguments except pointers to null terminated byte strings support
-    //  multi-byte character strings which may have embedded nulls. Embedded null
-    //  support is required for some Asian languages on Windows.
-
-    //  [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used
-    //  because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults
-    //  correctly in templates.
-
-    //  -----  constructors  -----
-
-    path(){}                                          
-
-    path(const path& p) : m_pathname(p.m_pathname) {}
-
-    template 
-    path(Source const& source,
-      typename boost::enable_if::type> >::type* =0)
-    {
-      path_traits::dispatch(source, m_pathname, codecvt());
-    }
-
-    //  Overloads for the operating system API's native character type. Rationale:
-    //    - Avoids use of codecvt() for native value_type strings. This limits the
-    //      impact of locale("") initialization failures on POSIX systems to programs
-    //      that actually depend on locale(""). It further ensures that exceptions thrown
-    //      as a result of such failues occur after main() has started, so can be caught.
-    //      This is a partial resolution of tickets 4688, 5100, and 5289.
-    //    - A slight optimization for a common use case, particularly on POSIX since
-    //      value_type is char and that is the most common useage.
-    path(const value_type* s) : m_pathname(s) {}
-    path(const std::basic_string& s) : m_pathname(s) {}
-
-    template 
-    path(Source const& source, const codecvt_type& cvt)
-    //  see [defaults] note above explaining why codecvt() default arguments are not used
-    {
-      path_traits::dispatch(source, m_pathname, cvt);
-    }
-
-    template 
-    path(InputIterator begin, InputIterator end)
-    { 
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt());
-      }
-    }
-
-    template 
-    path(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-    { 
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-      }
-    }
-
-    //  -----  assignments  -----
-
-    path& operator=(const path& p)
-    {
-      m_pathname = p.m_pathname;
-      return *this;
-    }
-
-    path& operator=(const value_type* ptr)  // required in case ptr overlaps *this
-    {
-      m_pathname = ptr;
-      return *this;
-    }
-
-    template 
-      typename boost::enable_if::type>, path&>::type
-    operator=(Source const& source)
-    {
-      m_pathname.clear();
-      path_traits::dispatch(source, m_pathname, codecvt());
-      return *this;
-    }
-
-    path& assign(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
-    {
-      m_pathname = ptr;
-      return *this;
-    }
-
-    template 
-    path& assign(Source const& source, const codecvt_type& cvt)
-    {
-      m_pathname.clear();
-      path_traits::dispatch(source, m_pathname, cvt);
-      return *this;
-    }
-
-    template 
-    path& assign(InputIterator begin, InputIterator end)
-    {
-      return assign(begin, end, codecvt());
-    }
-
-    template 
-    path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-    { 
-      m_pathname.clear();
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-      }
-      return *this;
-    }
-
-    //  -----  appends  -----
-
-    //  if a separator is added, it is the preferred separator for the platform;
-    //  slash for POSIX, backslash for Windows
-
-    path& operator/=(const path& p);
-
-    path& operator/=(const value_type* ptr);
-
-    template 
-      typename boost::enable_if::type>, path&>::type
-    operator/=(Source const& source)
-    {
-      return append(source, codecvt());
-    }
-
-    path& append(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
-    {
-      this->operator/=(ptr);
-      return *this;
-    }
-
-    template 
-    path& append(Source const& source, const codecvt_type& cvt);
-
-    template 
-    path& append(InputIterator begin, InputIterator end)
-    { 
-      return append(begin, end, codecvt());
-    }
-
-    template 
-    path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
-
-    //  -----  modifiers  -----
-
-    void   clear()             { m_pathname.clear(); }
-    path&  make_preferred()
-#   ifdef BOOST_POSIX_API
-      { return *this; }  // POSIX no effect
-#   else // BOOST_WINDOWS_API
-      ;  // change slashes to backslashes
-#   endif
-    path&  remove_filename();
-    path&  replace_extension(const path& new_extension = path());
-    void   swap(path& rhs)     { m_pathname.swap(rhs.m_pathname); }
-
-    //  -----  observers  -----
-  
-    //  For operating systems that format file paths differently than directory
-    //  paths, return values from observers are formatted as file names unless there
-    //  is a trailing separator, in which case returns are formatted as directory
-    //  paths. POSIX and Windows make no such distinction.
-
-    //  Implementations are permitted to return const values or const references.
-
-    //  The string or path returned by an observer are specified as being formatted
-    //  as "native" or "generic".
-    //
-    //  For POSIX, these are all the same format; slashes and backslashes are as input and
-    //  are not modified.
-    //
-    //  For Windows,   native:    as input; slashes and backslashes are not modified;
-    //                            this is the format of the internally stored string.
-    //                 generic:   backslashes are converted to slashes
-
-    //  -----  native format observers  -----
-
-    const string_type&  native() const { return m_pathname; }          // Throws: nothing
-    const value_type*   c_str() const  { return m_pathname.c_str(); }  // Throws: nothing
-
-    template 
-    String string() const;
-
-    template 
-    String string(const codecvt_type& cvt) const;
-
-#   ifdef BOOST_WINDOWS_API
-    const std::string string() const { return string(codecvt()); } 
-    const std::string string(const codecvt_type& cvt) const
-    { 
-      std::string tmp;
-      if (!m_pathname.empty())
-        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
-          tmp, cvt);
-      return tmp;
-    }
-    
-    //  string_type is std::wstring, so there is no conversion
-    const std::wstring&  wstring() const { return m_pathname; }
-    const std::wstring&  wstring(const codecvt_type&) const { return m_pathname; }
-
-#   else   // BOOST_POSIX_API
-    //  string_type is std::string, so there is no conversion
-    const std::string&  string() const { return m_pathname; }
-    const std::string&  string(const codecvt_type&) const { return m_pathname; }
-
-    const std::wstring  wstring() const { return wstring(codecvt()); }
-    const std::wstring  wstring(const codecvt_type& cvt) const
-    { 
-      std::wstring tmp;
-      if (!m_pathname.empty())
-        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
-          tmp, cvt);
-      return tmp;
-    }
-
-#   endif
-
-    //  -----  generic format observers  -----
-
-    template 
-    String generic_string() const;
-
-    template 
-    String generic_string(const codecvt_type& cvt) const;
-
-#   ifdef BOOST_WINDOWS_API
-    const std::string   generic_string() const { return generic_string(codecvt()); } 
-    const std::string   generic_string(const codecvt_type& cvt) const; 
-    const std::wstring  generic_wstring() const;
-    const std::wstring  generic_wstring(const codecvt_type&) const { return generic_wstring(); };
-
-#   else // BOOST_POSIX_API
-    //  On POSIX-like systems, the generic format is the same as the native format
-    const std::string&  generic_string() const  { return m_pathname; }
-    const std::string&  generic_string(const codecvt_type&) const  { return m_pathname; }
-    const std::wstring  generic_wstring() const { return wstring(codecvt()); }
-    const std::wstring  generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); }
-
-#   endif
-
-    //  -----  decomposition  -----
-
-    path  root_path() const; 
-    path  root_name() const;         // returns 0 or 1 element path
-                                     // even on POSIX, root_name() is non-empty() for network paths
-    path  root_directory() const;    // returns 0 or 1 element path
-    path  relative_path() const;
-    path  parent_path() const;
-    path  filename() const;          // returns 0 or 1 element path
-    path  stem() const;              // returns 0 or 1 element path
-    path  extension() const;         // returns 0 or 1 element path
-
-    //  -----  query  -----
-
-    bool empty() const               { return m_pathname.empty(); } // name consistent with std containers
-    bool has_root_path() const       { return has_root_directory() || has_root_name(); }
-    bool has_root_name() const       { return !root_name().empty(); }
-    bool has_root_directory() const  { return !root_directory().empty(); }
-    bool has_relative_path() const   { return !relative_path().empty(); }
-    bool has_parent_path() const     { return !parent_path().empty(); }
-    bool has_filename() const        { return !m_pathname.empty(); }
-    bool has_stem() const            { return !stem().empty(); }
-    bool has_extension() const       { return !extension().empty(); }
-    bool is_absolute() const
-    {
-#     ifdef BOOST_WINDOWS_API
-      return has_root_name() && has_root_directory();
-#     else
-      return has_root_directory();
-#     endif
-    }
-    bool is_relative() const         { return !is_absolute(); } 
-
-    //  -----  iterators  -----
-
-    class iterator;
-    typedef iterator const_iterator;
-
-    iterator begin() const;
-    iterator end() const;
-
-    //  -----  static members  -----
-
-    //  -----  imbue  -----
-
-    static std::locale imbue(const std::locale& loc);
-
-    //  -----  codecvt  -----
-
-    static const codecvt_type& codecvt()
-    {
-      return *wchar_t_codecvt_facet();
-    }
-
-    //  -----  deprecated functions  -----
-
-# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-#   error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
-# endif
-
-# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-    //  recently deprecated functions supplied by default
-    path&  normalize()              { return m_normalize(); }
-    path&  remove_leaf()            { return remove_filename(); }
-    path   leaf() const             { return filename(); }
-    path   branch_path() const      { return parent_path(); }
-    bool   has_leaf() const         { return !m_pathname.empty(); }
-    bool   has_branch_path() const  { return !parent_path().empty(); }
-    bool   is_complete() const      { return is_absolute(); }
-# endif
-
-# if defined(BOOST_FILESYSTEM_DEPRECATED)
-    //  deprecated functions with enough signature or semantic changes that they are
-    //  not supplied by default 
-    const std::string file_string() const               { return string(); }
-    const std::string directory_string() const          { return string(); }
-    const std::string native_file_string() const        { return string(); }
-    const std::string native_directory_string() const   { return string(); }
-    const string_type external_file_string() const      { return native(); }
-    const string_type external_directory_string() const { return native(); }
-
-    //  older functions no longer supported
-    //typedef bool (*name_check)(const std::string & name);
-    //basic_path(const string_type& str, name_check) { operator/=(str); }
-    //basic_path(const typename string_type::value_type* s, name_check)
-    //  { operator/=(s);}
-    //static bool default_name_check_writable() { return false; } 
-    //static void default_name_check(name_check) {}
-    //static name_check default_name_check() { return 0; }
-    //basic_path& canonize();
-# endif
-
-//--------------------------------------------------------------------------------------//
-//                            class path private members                                //
-//--------------------------------------------------------------------------------------//
-
-  private:
-#   if defined(_MSC_VER)
-#     pragma warning(push) // Save warning settings
-#     pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
-#   endif                            // needs to have dll-interface...
-/*
-      m_pathname has the type, encoding, and format required by the native
-      operating system. Thus for POSIX and Windows there is no conversion for
-      passing m_pathname.c_str() to the O/S API or when obtaining a path from the
-      O/S API. POSIX encoding is unspecified other than for dot and slash
-      characters; POSIX just treats paths as a sequence of bytes. Windows
-      encoding is UCS-2 or UTF-16 depending on the version.
-*/
-    string_type  m_pathname;  // Windows: as input; backslashes NOT converted to slashes,
-                              // slashes NOT converted to backslashes
-#   if defined(_MSC_VER)
-#     pragma warning(pop) // restore warning settings.
-#   endif 
-
-    string_type::size_type m_append_separator_if_needed();
-    //  Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0.
-    //  Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
-
-    void m_erase_redundant_separator(string_type::size_type sep_pos);
-    string_type::size_type m_parent_path_end() const;
-
-    path& m_normalize();
-
-    // Was qualified; como433beta8 reports:
-    //    warning #427-D: qualified name is not allowed in member declaration 
-    friend class iterator;
-    friend bool operator<(const path& lhs, const path& rhs);
-
-    // see path::iterator::increment/decrement comment below
-    static void m_path_iterator_increment(path::iterator & it);
-    static void m_path_iterator_decrement(path::iterator & it);
-
-    static const codecvt_type *&  wchar_t_codecvt_facet();
-
-  };  // class path
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  typedef path wpath;
-# endif
-
-  //------------------------------------------------------------------------------------//
-  //                             class path::iterator                                   //
-  //------------------------------------------------------------------------------------//
- 
-  class path::iterator
-    : public boost::iterator_facade<
-      path::iterator,
-      path const,
-      boost::bidirectional_traversal_tag >
-  {
-  private:
-    friend class boost::iterator_core_access;
-    friend class boost::filesystem3::path;
-    friend void m_path_iterator_increment(path::iterator & it);
-    friend void m_path_iterator_decrement(path::iterator & it);
-
-    const path& dereference() const { return m_element; }
-
-    bool equal(const iterator & rhs) const
-    {
-      return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos;
-    }
-
-    // iterator_facade derived classes don't seem to like implementations in
-    // separate translation unit dll's, so forward to class path static members
-    void increment() { m_path_iterator_increment(*this); }
-    void decrement() { m_path_iterator_decrement(*this); }
-
-    path                    m_element;   // current element
-    const path *            m_path_ptr;  // path being iterated over
-    string_type::size_type  m_pos;       // position of name in
-                                         // m_path_ptr->m_pathname. The
-                                         // end() iterator is indicated by 
-                                         // m_pos == m_path_ptr->m_pathname.size()
-  }; // path::iterator
-
-  //------------------------------------------------------------------------------------//
-  //                                                                                    //
-  //                              non-member functions                                  //
-  //                                                                                    //
-  //------------------------------------------------------------------------------------//
-
-  //  std::lexicographical_compare would infinately recurse because path iterators
-  //  yield paths, so provide a path aware version
-  inline bool lexicographical_compare(path::iterator first1, path::iterator last1,
-    path::iterator first2, path::iterator last2)
-  {
-    for (; first1 != last1 && first2 != last2 ; ++first1, ++first2)
-    {
-      if (first1->native() < first2->native()) return true;
-      if (first2->native() < first1->native()) return false;
-    }
-    return first1 == last1 && first2 != last2;
-  }
-  
-  inline bool operator<(const path& lhs, const path& rhs)
-  {
-    return lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
-  }
-
-  inline bool operator<=(const path& lhs, const path& rhs) { return !(rhs < lhs); }
-  inline bool operator> (const path& lhs, const path& rhs) { return rhs < lhs; }
-  inline bool operator>=(const path& lhs, const path& rhs) { return !(lhs < rhs);  }
-
-  // equality operators act as if comparing generic format strings, to achieve the
-  // effect of lexicographical_compare element by element compare.
-  // operator==() efficiency is a concern; a user reported the original version 2
-  // !(lhs < rhs) && !(rhs < lhs) implementation caused a serious performance problem
-  // for a map of 10,000 paths.
-
-# ifdef BOOST_WINDOWS_API
-  inline bool operator==(const path& lhs, const path::value_type* rhs)
-  {
-    const path::value_type* l(lhs.c_str());
-    while ((*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'))
-      && *l) { ++l; ++rhs; }
-    return *l == *rhs;
-  }
-  inline bool operator==(const path& lhs, const path& rhs)              { return lhs == rhs.c_str(); }
-  inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs == rhs.c_str(); }
-  inline bool operator==(const path::string_type& lhs, const path& rhs) { return rhs == lhs.c_str(); }
-  inline bool operator==(const path::value_type* lhs, const path& rhs)  { return rhs == lhs; }
-
-  inline std::size_t hash_value(const path& x)
-  {
-    std::size_t seed = 0;
-    for(const path::value_type* it = x.c_str(); *it; ++it)
-      hash_combine(seed, *it == '/' ? L'\\' : *it);
-    return seed;
-  }
-# else   // BOOST_POSIX_API
-  inline bool operator==(const path& lhs, const path& rhs)              { return lhs.native() == rhs.native(); }
-  inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs.native() == rhs; }
-  inline bool operator==(const path& lhs, const path::value_type* rhs)  { return lhs.native() == rhs; }
-  inline bool operator==(const path::string_type& lhs, const path& rhs) { return lhs == rhs.native(); }
-  inline bool operator==(const path::value_type* lhs, const path& rhs)  { return lhs == rhs.native(); }
-
-  inline std::size_t hash_value(const path& x)
-  {
-    return hash_range(x.native().begin(), x.native().end());
-  }
-# endif
-
-  inline bool operator!=(const path& lhs, const path& rhs)              { return !(lhs == rhs); }
-  inline bool operator!=(const path& lhs, const path::string_type& rhs) { return !(lhs == rhs); }
-  inline bool operator!=(const path& lhs, const path::value_type* rhs)  { return !(lhs == rhs); }
-  inline bool operator!=(const path::string_type& lhs, const path& rhs) { return !(lhs == rhs); }
-  inline bool operator!=(const path::value_type* lhs, const path& rhs)  { return !(lhs == rhs); }
-
-  inline void swap(path& lhs, path& rhs)                   { lhs.swap(rhs); }
-
-  inline path operator/(const path& lhs, const path& rhs)  { return path(lhs) /= rhs; }
-
-  //  inserters and extractors
-  //    use boost::io::quoted() to handle spaces in paths
-  //    use '&' as escape character to ease use for Windows paths
-
-  template 
-  inline std::basic_ostream&
-  operator<<(std::basic_ostream& os, const path& p)
-  {
-    return os
-      << boost::io::quoted(p.template string >(), static_cast('&'));
-  }
-  
-  template 
-  inline std::basic_istream&
-  operator>>(std::basic_istream& is, path& p)
-  {
-    std::basic_string str;
-    is >> boost::io::quoted(str, static_cast('&'));
-    p = str;
-    return is;
-  }
-  
-  //  name_checks
-
-  //  These functions are holdovers from version 1. It isn't clear they have much
-  //  usefulness, or how to generalize them for later versions.
-
-  BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool native(const std::string & name);
- 
-//--------------------------------------------------------------------------------------//
-//                     class path member template implementation                        //
-//--------------------------------------------------------------------------------------//
-
-  template 
-  path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-  { 
-    if (begin == end)
-      return *this;
-    string_type::size_type sep_pos(m_append_separator_if_needed());
-    std::basic_string::value_type>
-      s(begin, end);
-    path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-    if (sep_pos)
-      m_erase_redundant_separator(sep_pos);
-    return *this;
-  }
-
-  template 
-  path& path::append(Source const& source, const codecvt_type& cvt)
-  {
-    if (path_traits::empty(source))
-      return *this;
-      string_type::size_type sep_pos(m_append_separator_if_needed());
-      path_traits::dispatch(source, m_pathname, cvt);
-      if (sep_pos)
-        m_erase_redundant_separator(sep_pos);
-    return *this;
-  }
-
-//--------------------------------------------------------------------------------------//
-//                     class path member template specializations                       //
-//--------------------------------------------------------------------------------------//
-
-  template <> inline
-  std::string path::string() const
-    { return string(); }
-
-  template <> inline
-  std::wstring path::string() const
-    { return wstring(); }
-
-  template <> inline
-  std::string path::string(const codecvt_type& cvt) const
-    { return string(cvt); }
-
-  template <> inline
-  std::wstring path::string(const codecvt_type& cvt) const
-    { return wstring(cvt); }
-
-  template <> inline
-  std::string path::generic_string() const
-    { return generic_string(); }
-
-  template <> inline
-  std::wstring path::generic_string() const
-    { return generic_wstring(); }
-
-  template <> inline
-  std::string path::generic_string(const codecvt_type& cvt) const
-    { return generic_string(cvt); }
-
-  template <> inline
-  std::wstring path::generic_string(const codecvt_type& cvt) const
-    { return generic_wstring(cvt); }
-
-
-}  // namespace filesystem3
-}  // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::path;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::wpath;
-# endif
-    using filesystem3::lexicographical_compare;
-    using filesystem3::portable_posix_name;
-    using filesystem3::windows_name;
-    using filesystem3::portable_name;
-    using filesystem3::portable_directory_name;
-    using filesystem3::portable_file_name;
-    using filesystem3::native;
-    using filesystem3::swap;
-    using filesystem3::operator<;
-    using filesystem3::operator==;
-    using filesystem3::operator!=;
-    using filesystem3::operator>;
-    using filesystem3::operator<=;
-    using filesystem3::operator>=;
-    using filesystem3::operator/;
-    using filesystem3::operator<<;
-    using filesystem3::operator>>;
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-
-#endif  // BOOST_FILESYSTEM_PATH_HPP
diff --git a/project/jni/boost/include/boost/foreach.hpp b/project/jni/boost/include/boost/foreach.hpp
index ccfc101b8..33b59202d 100644
--- a/project/jni/boost/include/boost/foreach.hpp
+++ b/project/jni/boost/include/boost/foreach.hpp
@@ -31,7 +31,7 @@
 #include 
 
 // 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(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) &&       \
                                                                   !defined(BOOST_CLANG))         \
@@ -165,7 +165,7 @@ namespace foreach
 //   this one works on legacy compilers. Overload boost_foreach_is_lightweight_proxy
 //   at the global namespace for your type.
 template
-inline boost::BOOST_FOREACH::is_lightweight_proxy *
+inline boost::foreach::is_lightweight_proxy *
 boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; }
 
 template
@@ -190,7 +190,7 @@ boost_foreach_is_lightweight_proxy(T **&, boost::foreach::tag) { return 0; }
 //   this one works on legacy compilers. Overload boost_foreach_is_noncopyable
 //   at the global namespace for your type.
 template
-inline boost::BOOST_FOREACH::is_noncopyable *
+inline boost::foreach::is_noncopyable *
 boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; }
 
 namespace boost
@@ -228,7 +228,7 @@ template
 inline boost::mpl::true_ *is_const_(T const &) { return 0; }
 #endif
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
 template
 inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; }
 
@@ -437,7 +437,6 @@ inline T (*&to_ptr(T (&)[N]))[N]
     static T (*t)[N] = 0;
     return t;
 }
-#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 // derefof
@@ -454,8 +453,13 @@ inline T &derefof(T *t)
     );
 }
 
+# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T)
+#else
+# define BOOST_FOREACH_DEREFOF(T) (*T)
+#endif
+
 #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
 // whether an expression is an rvalue.
@@ -465,7 +469,7 @@ inline T &derefof(T *t)
     boost::foreach_detail_::is_rvalue_((COL), 0)
 
 #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
 // an lvalue. This is rather non-standard, but some popular compilers
@@ -667,7 +671,7 @@ begin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::begin(derefof(auto_any_cast(col)))));
+        iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -707,7 +711,7 @@ end(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::end(derefof(auto_any_cast(col)))));
+        iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -786,7 +790,7 @@ rbegin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::rbegin(derefof(auto_any_cast(col)))));
+        iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -829,7 +833,7 @@ rend(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::rend(derefof(auto_any_cast(col)))));
+        iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -955,7 +959,7 @@ rderef(auto_any_t cur, type2type *)
     (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
-// 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.
 # define BOOST_FOREACH_SHOULD_COPY(COL)                                                         \
     (boost::foreach_detail_::should_copy_impl(                                                  \
diff --git a/project/jni/boost/include/boost/foreach_fwd.hpp b/project/jni/boost/include/boost/foreach_fwd.hpp
index 8b246c78e..4e0bb370c 100644
--- a/project/jni/boost/include/boost/foreach_fwd.hpp
+++ b/project/jni/boost/include/boost/foreach_fwd.hpp
@@ -14,8 +14,6 @@
 #ifndef BOOST_FOREACH_FWD_HPP
 #define BOOST_FOREACH_FWD_HPP
 
-#include  // for std::pair
-
 // This must be at global scope, hence the uglified name
 enum boost_foreach_argument_dependent_lookup_hack
 {
@@ -27,9 +25,6 @@ namespace boost
 
 namespace foreach
 {
-    template
-    std::pair in_range(T begin, T end);
-
     ///////////////////////////////////////////////////////////////////////////////
     // boost::foreach::tag
     //
@@ -51,24 +46,6 @@ namespace foreach
 
 } // namespace foreach
 
-// Workaround for unfortunate https://svn.boost.org/trac/boost/ticket/6131
-namespace BOOST_FOREACH
-{
-    using foreach::in_range;
-    using foreach::tag;
-
-    template
-    struct is_lightweight_proxy
-      : foreach::is_lightweight_proxy
-    {};
-
-    template
-    struct is_noncopyable
-      : foreach::is_noncopyable
-    {};
-
-} // namespace BOOST_FOREACH
-
 } // namespace boost
 
 #endif
diff --git a/project/jni/boost/include/boost/function/function_template.hpp b/project/jni/boost/include/boost/function/function_template.hpp
index bf139a095..73ed72ef4 100644
--- a/project/jni/boost/include/boost/function/function_template.hpp
+++ b/project/jni/boost/include/boost/function/function_template.hpp
@@ -677,7 +677,7 @@ namespace boost {
 
     vtable_type* get_vtable() const {
       return reinterpret_cast(
-               reinterpret_cast(vtable) & ~static_cast(0x01));
+               reinterpret_cast(vtable) & ~static_cast(0x01));
     }
 
     struct clear_type {};
@@ -748,7 +748,14 @@ namespace boost {
     {
       this->assign_to_own(f);
     }
-
+    
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base()
+    {
+      this->move_assign(f);
+    }
+#endif
+    
     ~BOOST_FUNCTION_FUNCTION() { clear(); }
 
     result_type operator()(BOOST_FUNCTION_PARMS) const
@@ -830,6 +837,26 @@ namespace boost {
       BOOST_CATCH_END
       return *this;
     }
+    
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    // Move assignment from another BOOST_FUNCTION_FUNCTION
+    BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f)
+    {
+      
+      if (&f == this)
+        return *this;
+
+      this->clear();
+      BOOST_TRY {
+        this->move_assign(f);
+      } BOOST_CATCH (...) {
+        vtable = 0;
+        BOOST_RETHROW;
+      }
+      BOOST_CATCH_END
+      return *this;
+    }
+#endif
 
     void swap(BOOST_FUNCTION_FUNCTION& other)
     {
@@ -1063,12 +1090,26 @@ public:
 
   function(const base_type& f) : base_type(static_cast(f)){}
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  // Move constructors
+  function(self_type&& f): base_type(static_cast(f)){}
+  function(base_type&& f): base_type(static_cast(f)){}
+#endif
+  
   self_type& operator=(const self_type& f)
   {
     self_type(f).swap(*this);
     return *this;
   }
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  self_type& operator=(self_type&& f)
+  {
+    self_type(static_cast(f)).swap(*this);
+    return *this;
+  }
+#endif  
+
   template
 #ifndef BOOST_NO_SFINAE
   typename enable_if_c<
@@ -1097,6 +1138,14 @@ public:
     self_type(f).swap(*this);
     return *this;
   }
+  
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  self_type& operator=(base_type&& f)
+  {
+    self_type(static_cast(f)).swap(*this);
+    return *this;
+  }
+#endif 
 };
 
 #undef BOOST_FUNCTION_PARTIAL_SPEC
diff --git a/project/jni/boost/include/boost/functional/detail/container_fwd.hpp b/project/jni/boost/include/boost/functional/detail/container_fwd.hpp
deleted file mode 100644
index 9a69d155b..000000000
--- a/project/jni/boost/include/boost/functional/detail/container_fwd.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-// Copyright 2005-2008 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// Forwarding header for container_fwd.hpp's new location.
-// This header is deprecated, I'll be adding a warning in a future release,
-// then converting it to an error and finally removing this header completely.
-
-#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)
-#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include 
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp b/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
index ae03ff091..4b8374d47 100644
--- a/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
+++ b/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
@@ -13,6 +13,94 @@
 # pragma once
 #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 
+        struct call_ldexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int y) const {
+                return std::ldexp(x, y);
+            }
+        };
+
+        template 
+        struct call_frexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int* y) const {
+                return std::frexp(x, y);
+            }
+        };
+
+        template 
+        struct select_hash_type
+        {
+            typedef Float type;
+        };
+    }
+}
+
+#else // BOOST_HASH_CONFORMANT_FLOATS == 0
+
 // 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
 // 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
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
index ea1bc25f4..a98cd700f 100644
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
+++ b/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
@@ -1,5 +1,5 @@
 
-// Copyright 2005-2009 Daniel James.
+// Copyright 2005-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)
 
@@ -13,21 +13,19 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
-// Include hash implementation for the current platform.
-
-// Cygwn
-#if defined(__CYGWIN__)
-#  if defined(__i386__) || defined(_M_IX86)
-#    include 
-#  else
-#    include 
-#  endif
-#else
-#  include 
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC >= 1400
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
+                              // not satisfy test. Loop body not executed
+#endif
 #endif
 
 // Can we use fpclassify?
@@ -50,6 +48,159 @@
 #  define BOOST_HASH_USE_FPCLASSIFY 0
 #endif
 
+namespace boost
+{
+    namespace hash_detail
+    {
+        inline void hash_float_combine(std::size_t& seed, std::size_t value)
+        {
+            seed ^= value + (seed<<6) + (seed>>2);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Binary hash function
+        //
+        // Only used for floats with known iec559 floats, and certain values in
+        // numeric_limits
+
+        inline std::size_t hash_binary(char* ptr, std::size_t length)
+        {
+            std::size_t seed = 0;
+
+            if (length >= sizeof(std::size_t)) {
+                seed = *(std::size_t*) ptr;
+                length -= sizeof(std::size_t);
+                ptr += sizeof(std::size_t);
+
+                while(length >= sizeof(std::size_t)) {
+                    std::size_t buffer = 0;
+                    std::memcpy(&buffer, ptr, sizeof(std::size_t));
+                    hash_float_combine(seed, buffer);
+                    length -= sizeof(std::size_t);
+                    ptr += sizeof(std::size_t);
+                }
+            }
+
+            if (length > 0) {
+                std::size_t buffer = 0;
+                std::memcpy(&buffer, ptr, length);
+                hash_float_combine(seed, buffer);
+            }
+
+            return seed;
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 24 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 128,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 4);
+        }
+
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 53 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 1024,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 8);
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 64 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 10);
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 113 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 16);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Portable hash function
+        //
+        // Used as a fallback when the binary hash function isn't supported.
+
+        template 
+        inline std::size_t float_hash_impl2(T v)
+        {
+            boost::hash_detail::call_frexp frexp;
+            boost::hash_detail::call_ldexp ldexp;
+
+            int exp = 0;
+
+            v = frexp(v, &exp);
+
+            // A postive value is easier to hash, so combine the
+            // sign with the exponent and use the absolute value.
+            if(v < 0) {
+                v = -v;
+                exp += limits::max_exponent -
+                    limits::min_exponent;
+            }
+
+            v = ldexp(v, limits::digits);
+            std::size_t seed = static_cast(v);
+            v -= static_cast(seed);
+
+            // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
+            std::size_t const length
+                = (limits::digits *
+                        boost::static_log2::radix>::value
+                        + limits::digits - 1)
+                / limits::digits;
+
+            for(std::size_t i = 0; i != length; ++i)
+            {
+                v = ldexp(v, limits::digits);
+                std::size_t part = static_cast(v);
+                v -= static_cast(part);
+                hash_float_combine(seed, part);
+            }
+
+            hash_float_combine(seed, exp);
+
+            return seed;
+        }
+
+#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC)
+        template 
+        inline std::size_t float_hash_impl(T v, ...)
+        {
+            typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type;
+            return float_hash_impl2(static_cast(v));
+        }
+#endif
+    }
+}
+
 #if BOOST_HASH_USE_FPCLASSIFY
 
 #include 
@@ -61,8 +212,15 @@ namespace boost
         template 
         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;
-            switch (fpclassify(v)) {
+            switch (fpclassify(v))
+#endif
+            {
             case FP_ZERO:
                 return 0;
             case FP_INFINITE:
@@ -71,7 +229,7 @@ namespace boost
                 return (std::size_t)(-3);
             case FP_NORMAL:
             case FP_SUBNORMAL:
-                return float_hash_impl(v);
+                return float_hash_impl(v, 0);
             default:
                 BOOST_ASSERT(0);
                 return 0;
@@ -86,10 +244,24 @@ namespace boost
 {
     namespace hash_detail
     {
+        template 
+        inline bool is_zero(T v)
+        {
+#if !defined(__GNUC__)
+            return v == 0;
+#else
+            // GCC's '-Wfloat-equal' will complain about comparing
+            // v to 0, but because it disables warnings for system
+            // headers it won't complain if you use std::equal_to to
+            // compare with 0. Resulting in this silliness:
+            return std::equal_to()(v, 0);
+#endif
+        }
+
         template 
         inline std::size_t float_hash_value(T v)
         {
-            return v == 0 ? 0 : float_hash_impl(v);
+            return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0);
         }
     }
 }
@@ -98,4 +270,8 @@ namespace boost
 
 #undef BOOST_HASH_USE_FPCLASSIFY
 
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
 #endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp
deleted file mode 100644
index 1278c2f62..000000000
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-// Copyright 2005-2009 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// A general purpose hash function for non-zero floating point values.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
-
-#include 
-#include 
-#include 
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#if defined(BOOST_MSVC)
-#pragma warning(push)
-#if BOOST_MSVC >= 1400
-#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
-                              // not satisfy test. Loop body not executed 
-#endif
-#endif
-
-namespace boost
-{
-    namespace hash_detail
-    {
-        inline void hash_float_combine(std::size_t& seed, std::size_t value)
-        {
-            seed ^= value + (seed<<6) + (seed>>2);
-        }
-
-        template 
-        inline std::size_t float_hash_impl2(T v)
-        {
-            boost::hash_detail::call_frexp frexp;
-            boost::hash_detail::call_ldexp ldexp;
-        
-            int exp = 0;
-
-            v = frexp(v, &exp);
-
-            // A postive value is easier to hash, so combine the
-            // sign with the exponent and use the absolute value.
-            if(v < 0) {
-                v = -v;
-                exp += limits::max_exponent -
-                    limits::min_exponent;
-            }
-
-            v = ldexp(v, limits::digits);
-            std::size_t seed = static_cast(v);
-            v -= static_cast(seed);
-
-            // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
-            std::size_t const length
-                = (limits::digits *
-                        boost::static_log2::radix>::value
-                        + limits::digits - 1)
-                / limits::digits;
-
-            for(std::size_t i = 0; i != length; ++i)
-            {
-                v = ldexp(v, limits::digits);
-                std::size_t part = static_cast(v);
-                v -= static_cast(part);
-                hash_float_combine(seed, part);
-            }
-
-            hash_float_combine(seed, exp);
-
-            return seed;
-        }
-
-        template 
-        inline std::size_t float_hash_impl(T v)
-        {
-            typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type;
-            return float_hash_impl2(static_cast(v));
-        }
-    }
-}
-
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp
deleted file mode 100644
index b39bb0d08..000000000
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// Copyright 2005-2009 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// A non-portable hash function form non-zero floats on x86.
-//
-// Even if you're on an x86 platform, this might not work if their floating
-// point isn't set up as this expects. So this should only be used if it's
-// absolutely certain that it will work.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
-
-#include 
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-namespace boost
-{
-    namespace hash_detail
-    {
-        inline void hash_float_combine(std::size_t& seed, std::size_t value)
-        {
-            seed ^= value + (seed<<6) + (seed>>2);
-        }
-
-        inline std::size_t float_hash_impl(float v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr;
-            return seed;
-        }
-
-        inline std::size_t float_hash_impl(double v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr++;
-            hash_float_combine(seed, *ptr);
-            return seed;
-        }
-
-        inline std::size_t float_hash_impl(long double v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr++;
-            hash_float_combine(seed, *ptr++);
-            hash_float_combine(seed, *(boost::uint16_t*)ptr);
-            return seed;
-        }
-    }
-}
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/extensions.hpp b/project/jni/boost/include/boost/functional/hash/extensions.hpp
index 3c587a3bf..998c08e46 100644
--- a/project/jni/boost/include/boost/functional/hash/extensions.hpp
+++ b/project/jni/boost/include/boost/functional/hash/extensions.hpp
@@ -15,6 +15,22 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+#   include 
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+#   include 
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
+#   include 
+#endif
 
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
 # pragma once
@@ -54,51 +70,51 @@ namespace boost
     std::size_t hash_value(std::pair const& v)
     {
         std::size_t seed = 0;
-        hash_combine(seed, v.first);
-        hash_combine(seed, v.second);
+        boost::hash_combine(seed, v.first);
+        boost::hash_combine(seed, v.second);
         return seed;
     }
 
     template 
     std::size_t hash_value(std::vector const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::list const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::deque const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::set const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::multiset const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::map const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::multimap const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
@@ -110,6 +126,83 @@ namespace boost
         return seed;
     }
 
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+    template 
+    std::size_t hash_value(std::array const& v)
+    {
+        return boost::hash_range(v.begin(), v.end());
+    }
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+    namespace hash_detail {
+        template 
+        inline typename boost::enable_if_c<(I == std::tuple_size::value),
+                void>::type
+            hash_combine_tuple(std::size_t&, T const&)
+        {
+        }
+
+        template 
+        inline typename boost::enable_if_c<(I < std::tuple_size::value),
+                void>::type
+            hash_combine_tuple(std::size_t& seed, T const& v)
+        {
+            boost::hash_combine(seed, std::get(v));
+            boost::hash_detail::hash_combine_tuple(seed, v);
+        }
+
+        template 
+        inline std::size_t hash_tuple(T const& v)
+        {
+            std::size_t seed = 0;
+            boost::hash_detail::hash_combine_tuple<0>(seed, v);
+            return seed;
+        }
+    }
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+    template 
+    inline std::size_t hash_value(std::tuple const& v)
+    {
+        return boost::hash_detail::hash_tuple(v);
+    }
+#else
+
+    inline std::size_t hash_value(std::tuple<> const& v)
+    {
+        return boost::hash_detail::hash_tuple(v);
+    }
+
+#   define BOOST_HASH_TUPLE_F(z, n, _)                                      \
+    template<                                                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)                            \
+    >                                                                       \
+    inline std::size_t hash_value(std::tuple<                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, A)                                     \
+    > const& v)                                                             \
+    {                                                                       \
+        return boost::hash_detail::hash_tuple(v);                           \
+    }
+
+    BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _)
+#   undef BOOST_HASH_TUPLE_F
+#endif
+
+#endif
+
+#if !defined(BOOST_NO_CXX11_SMART_PTR)
+    template 
+    inline std::size_t hash_value(std::shared_ptr const& x) {
+        return boost::hash_value(x.get());
+    }
+
+    template 
+    inline std::size_t hash_value(std::unique_ptr const& x) {
+        return boost::hash_value(x.get());
+    }
+#endif
+
     //
     // call_hash_impl
     //
diff --git a/project/jni/boost/include/boost/functional/hash/hash.hpp b/project/jni/boost/include/boost/functional/hash/hash.hpp
index 51ec8608c..aa4e49f8a 100644
--- a/project/jni/boost/include/boost/functional/hash/hash.hpp
+++ b/project/jni/boost/include/boost/functional/hash/hash.hpp
@@ -15,16 +15,15 @@
 #include 
 #include 
 #include 
-
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
-#include 
-#endif
+#include 
+#include 
+#include 
 
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 #include 
 #endif
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
 #include 
 #endif
 
@@ -37,38 +36,82 @@
 
 namespace boost
 {
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
+    namespace hash_detail
+    {
+        struct enable_hash_value { typedef std::size_t type; };
 
-    // If you get a static assertion here, it's because hash_value
-    // isn't declared for your type.
-    template 
-    std::size_t hash_value(T const&) {
-        BOOST_STATIC_ASSERT((T*) 0 && false);
-        return 0;
-    }
+        template  struct basic_numbers {};
+        template  struct long_numbers;
+        template  struct ulong_numbers;
+        template  struct float_numbers {};
 
-#endif
-
-    std::size_t hash_value(bool);
-    std::size_t hash_value(char);
-    std::size_t hash_value(unsigned char);
-    std::size_t hash_value(signed char);
-    std::size_t hash_value(short);
-    std::size_t hash_value(unsigned short);
-    std::size_t hash_value(int);
-    std::size_t hash_value(unsigned int);
-    std::size_t hash_value(long);
-    std::size_t hash_value(unsigned long);
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
 
 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
-    std::size_t hash_value(wchar_t);
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
 #endif
-    
+
+        // long_numbers is defined like this to allow for separate
+        // specialization for long_long and int128_type, in case
+        // they conflict.
+        template  struct long_numbers2 {};
+        template  struct ulong_numbers2 {};
+        template  struct long_numbers : long_numbers2 {};
+        template  struct ulong_numbers : ulong_numbers2 {};
+
 #if !defined(BOOST_NO_LONG_LONG)
-    std::size_t hash_value(boost::long_long_type);
-    std::size_t hash_value(boost::ulong_long_type);
+        template <> struct long_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers :
+            boost::hash_detail::enable_hash_value {};
 #endif
 
+#if defined(BOOST_HAS_INT128)
+        template <> struct long_numbers2 :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers2 :
+            boost::hash_detail::enable_hash_value {};
+#endif
+
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+    }
+
+    template 
+    typename boost::hash_detail::basic_numbers::type hash_value(T);
+    template 
+    typename boost::hash_detail::long_numbers::type hash_value(T);
+    template 
+    typename boost::hash_detail::ulong_numbers::type hash_value(T);
+
+    template 
+    typename boost::enable_if, std::size_t>::type
+        hash_value(T);
+
 #if !BOOST_WORKAROUND(__DMC__, <= 0x848)
     template  std::size_t hash_value(T* const&);
 #else
@@ -83,15 +126,14 @@ namespace boost
     std::size_t hash_value(T (&x)[N]);
 #endif
 
-    std::size_t hash_value(float v);
-    std::size_t hash_value(double v);
-    std::size_t hash_value(long double v);
-
     template 
     std::size_t hash_value(
         std::basic_string, A> const&);
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+    template 
+    typename boost::hash_detail::float_numbers::type hash_value(T);
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
     std::size_t hash_value(std::type_index);
 #endif
 
@@ -141,74 +183,30 @@ namespace boost
         }
     }
 
-    inline std::size_t hash_value(bool v)
+    template 
+    typename boost::hash_detail::basic_numbers::type hash_value(T v)
     {
         return static_cast(v);
     }
 
-    inline std::size_t hash_value(char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(signed char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(short v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned short v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(int v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned int v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(long v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned long v)
-    {
-        return static_cast(v);
-    }
-
-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
-    inline std::size_t hash_value(wchar_t v)
-    {
-        return static_cast(v);
-    }
-#endif
-
-#if !defined(BOOST_NO_LONG_LONG)
-    inline std::size_t hash_value(boost::long_long_type v)
+    template 
+    typename boost::hash_detail::long_numbers::type hash_value(T v)
     {
         return hash_detail::hash_value_signed(v);
     }
 
-    inline std::size_t hash_value(boost::ulong_long_type v)
+    template 
+    typename boost::hash_detail::ulong_numbers::type hash_value(T v)
     {
         return hash_detail::hash_value_unsigned(v);
     }
-#endif
+
+    template 
+    typename boost::enable_if, std::size_t>::type
+        hash_value(T v)
+    {
+        return static_cast(v);
+    }
 
     // Implementation by Alberto Barbati and Dave Harris.
 #if !BOOST_WORKAROUND(__DMC__, <= 0x848)
@@ -324,22 +322,13 @@ namespace boost
         return hash_range(v.begin(), v.end());
     }
 
-    inline std::size_t hash_value(float v)
+    template 
+    typename boost::hash_detail::float_numbers::type hash_value(T v)
     {
         return boost::hash_detail::float_hash_value(v);
     }
 
-    inline std::size_t hash_value(double v)
-    {
-        return boost::hash_detail::float_hash_value(v);
-    }
-
-    inline std::size_t hash_value(long double v)
-    {
-        return boost::hash_detail::float_hash_value(v);
-    }
-
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
     inline std::size_t hash_value(std::type_index v)
     {
         return v.hash_code();
@@ -450,7 +439,12 @@ namespace boost
     BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
 #endif
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#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)
     BOOST_HASH_SPECIALIZE(std::type_index)
 #endif
 
diff --git a/project/jni/boost/include/boost/functional/overloaded_function.hpp b/project/jni/boost/include/boost/functional/overloaded_function.hpp
new file mode 100644
index 000000000..83fe4b384
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function.hpp
@@ -0,0 +1,311 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef DOXYGEN // Doxygen documentation only.
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+
+#define BOOST_FUNCTIONAL_f_type(z, n, unused) \
+    BOOST_PP_CAT(F, n)
+
+#define BOOST_FUNCTIONAL_f_arg(z, n, unused) \
+    BOOST_PP_CAT(f, n)
+
+#define BOOST_FUNCTIONAL_f_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_f_type(z, n, ~) \
+
+#define BOOST_FUNCTIONAL_f_tparam_dflt(z, n, is_tspec) \
+    BOOST_FUNCTIONAL_f_tparam(z, n, ~) \
+    /* overload requires at least 2 functors so F0 and F1 not optional */ \
+    BOOST_PP_EXPR_IIF(BOOST_PP_AND(BOOST_PP_NOT(is_tspec), \
+            BOOST_PP_GREATER(n, 1)), \
+        = void \
+    )
+
+#define BOOST_FUNCTIONAL_f_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_f_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_f_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_type(z, n, unused) \
+    BOOST_PP_CAT(G, n)
+
+#define BOOST_FUNCTIONAL_g_arg(z, n, unused) \
+    BOOST_PP_CAT(g, n)
+
+#define BOOST_FUNCTIONAL_g_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_g_type(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_g_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_g_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base(z, n, unused) \
+    ::boost::overloaded_function_detail::base< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >
+
+#define BOOST_FUNCTIONAL_inherit(z, n, unused) \
+    public BOOST_FUNCTIONAL_base(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base_init(z, n, unused) \
+    BOOST_FUNCTIONAL_base(z, n, ~)(BOOST_FUNCTIONAL_g_arg(z, n, ~))
+
+#define BOOST_FUNCTIONAL_using_operator_call(z, n, unused) \
+    using BOOST_FUNCTIONAL_base(z, n, ~)::operator();
+
+#define BOOST_FUNCTIONAL_function_type(z, n, unused) \
+    typename ::boost::overloaded_function_detail::function_type< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >::type
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+            /* at least 2 func to overload so start from 2 to MAX */ \
+            /* (cannot iterate [0, MAX-2) because error on Sun) */ \
+            (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+            "boost/functional/overloaded_function.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over function arity.
+
+#undef BOOST_FUNCTIONAL_f_type
+#undef BOOST_FUNCTIONAL_f_arg
+#undef BOOST_FUNCTIONAL_f_tparam
+#undef BOOST_FUNCTIONAL_f_arg_decl
+#undef BOOST_FUNCTIONAL_f_tparam_dflt
+#undef BOOST_FUNCTIONAL_g_type
+#undef BOOST_FUNCTIONAL_g_arg
+#undef BOOST_FUNCTIONAL_g_tparam
+#undef BOOST_FUNCTIONAL_g_arg_decl
+#undef BOOST_FUNCTIONAL_base
+#undef BOOST_FUNCTIONAL_inherit
+#undef BOOST_FUNCTIONAL_base_init
+#undef BOOST_FUNCTIONAL_using_operator_call
+#undef BOOST_FUNCTIONAL_function_type
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_overloads \
+        /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \
+        /* (add 2 because iteration started from 2 to MAX) */ \
+        BOOST_PP_ADD(2, BOOST_PP_SUB( \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+                BOOST_PP_FRAME_ITERATION(1)))
+#   define BOOST_FUNCTIONAL_is_tspec \
+        /* if template specialization */ \
+        BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX)
+
+// For type-of emulation: This must be included at this pp iteration level.
+#   include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+namespace boost {
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt,
+            BOOST_FUNCTIONAL_is_tspec)
+>
+class overloaded_function
+    // Template specialization.
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), <)
+    BOOST_PP_IIF(BOOST_FUNCTIONAL_is_tspec,
+        BOOST_PP_ENUM
+    ,
+        BOOST_PP_TUPLE_EAT(3)
+    )(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_type, ~)
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), >)
+    // Bases (overloads >= 2 so always at least 2 bases).
+    : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+            BOOST_FUNCTIONAL_inherit, ~)
+{
+public:
+    template<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_g_tparam, ~)
+    > /* implicit */ inline overloaded_function(
+            BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_g_arg_decl, ~))
+            // Overloads >= 2 so always at least 2 bases to initialize.
+            : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_base_init, ~)
+    {}
+
+    BOOST_PP_REPEAT(BOOST_FUNCTIONAL_overloads, 
+            BOOST_FUNCTIONAL_using_operator_call, ~)
+};
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam, ~)
+>
+overloaded_function<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_function_type, ~)
+> make_overloaded_function(
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg_decl, ~)
+) {
+    return overloaded_function<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                BOOST_FUNCTIONAL_function_type, ~)
+    >(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~));
+}
+
+} // namespace
+
+// For type-of emulation: Register overloaded function type (for _AUTO, etc).
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::overloaded_function,
+    BOOST_FUNCTIONAL_overloads)
+
+#   undef BOOST_FUNCTIONAL_overloads
+#   undef BOOST_FUNCTIONAL_is_tspec
+#endif // iteration
+
+// DOCUMENTATION //
+
+#else // DOXYGEN
+
+/** @file
+@brief Overload distinct function pointers, function references, and
+monomorphic function objects into a single function object.
+*/
+
+namespace boost {
+
+/**
+@brief Function object to overload functions with distinct signatures.
+
+This function object aggregates together calls to functions of all the
+specified function types F1, F2, etc which must have distinct
+function signatures from one another.
+
+@Params
+@Param{Fi,
+Each function type must be specified using the following syntax (which is
+Boost.Function's preferred syntax):
+@code
+    result_type (argument1_type\, argumgnet2_type\, ...)
+@endcode
+}
+@EndParams
+
+In some cases, the @RefFunc{make_overloaded_function} function template can be
+useful to construct an overloaded function object without explicitly
+specifying the function types.
+
+At least two distinct function types must be specified (because there is
+nothing to overload between one or zero functions).
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+The maximum number of function parameters for each of the specified function
+types is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX}
+configuration macro.
+
+@See @RefSect{tutorial, Tutorial} section, @RefFunc{make_overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX},
+Boost.Function.
+*/
+template
+class overloaded_function {
+public:
+    /**
+    @brief Construct the overloaded function object.
+
+    Any function pointer, function reference, and monomorphic function object
+    that can be converted to a boost::function function object can be
+    specified as parameter.
+
+    @Note Unfortunately, it is not possible to support polymorphic function
+    objects (as explained here).
+    */
+    overloaded_function(const boost::function&,
+            const boost::function&, ...);
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 1st template parameter.
+
+    This will in turn invoke the call operator of the 1st function passed to
+    the constructor.
+    */
+    typename boost::function_traits::result_type operator()(
+            typename boost::function_traits::arg1_type,
+            typename boost::function_traits::arg2_type,
+            ...) const;
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 2nd template parameter.
+
+    This will in turn invoke the call operator of the 2nd function passed to
+    the constructor.
+
+    @Note Similar call operators are present for all specified function types
+    F1, F2, etc (even if not exhaustively listed by this
+    documentation).
+    */
+    typename boost::function_traits::result_type operator()(
+            typename boost::function_traits::arg1_type,
+            typename boost::function_traits::arg2_type,
+            ...) const;
+};
+
+/**
+@brief Make an overloaded function object without explicitly specifying the
+function types.
+
+This function template creates and returns an @RefClass{overloaded_function}
+object that overloads all the specified functions f1, f2, etc.
+
+The function types are internally determined from the template parameter types
+so they do not need to be explicitly specified.
+Therefore, this function template usually has a more concise syntax when
+compared with @RefClass{overloaded_function}.
+This is especially useful when the explicit type of the returned
+@RefClass{overloaded_function} object does not need to be known (e.g., when
+used with Boost.Typeof's BOOST_AUTO, C++11 auto, or when the
+overloaded function object is handled using a function template parameter, see
+the @RefSect{tutorial, Tutorial} section).
+
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+
+@Note In this documentation, __function_type__ is a placeholder for a
+symbol that is specific to the implementation of this library.
+
+@See @RefSect{tutorial, Tutorial} section, @RefClass{overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}.
+*/
+template
+overloaded_function<
+    __function_type__, __function_type__, ...
+> make_overloaded_function(F1 f1, F2 f2, ...);
+
+} // namespace
+
+#endif // DOXYGEN
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/config.hpp b/project/jni/boost/include/boost/functional/overloaded_function/config.hpp
new file mode 100644
index 000000000..2f5d9e132
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/config.hpp
@@ -0,0 +1,50 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+
+/** @file
+@brief Change the compile-time configuration of this library.
+*/
+
+/**
+@brief Specify the maximum number of arguments of the functions being
+overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When specified by the user, this macro must be a non-negative integer number.
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{boost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 5
+#endif
+
+/**
+@brief Specify the maximum number of functions that can be overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When defined by the user, this macro must be an integer number greater or
+equal than 2 (because at least two distinct functions need to be specified in
+order to define an overload).
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{boost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX 5
+#endif
+#if BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX < 2
+#   error "maximum overload macro cannot be less than 2"
+#endif
+
+#endif // #include guard
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp b/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp
new file mode 100644
index 000000000..8fd9a0a2c
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp
@@ -0,0 +1,86 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_PP_CAT(A, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \
+    BOOST_PP_CAT(a, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_f \
+    R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \
+            BOOST_FUNCTIONAL_DETAIL_arg_type, ~))
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace boost { namespace overloaded_function_detail {
+
+template
+class base {}; // Empty template cannot be used directly (only its spec).
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+                (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \
+                "boost/functional/overloaded_function/detail/base.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over funciton arity.
+
+} } // namespace
+
+#undef BOOST_FUNCTIONAL_DETAIL_arg_type
+#undef BOOST_FUNCTIONAL_DETAIL_arg_name
+#undef BOOST_FUNCTIONAL_DETAIL_arg_tparam
+#undef BOOST_FUNCTIONAL_DETAIL_arg
+#undef BOOST_FUNCTIONAL_DETAIL_f
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1)
+
+template<
+    typename R
+    BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity)
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~)
+>
+class base< BOOST_FUNCTIONAL_DETAIL_f > {
+public:
+    /* implicit */ inline base(
+            // This requires specified type to be implicitly convertible to
+            // a boost::function<> functor.
+            boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f)
+    {}
+
+    inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg, ~)) const {
+        return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+                BOOST_FUNCTIONAL_DETAIL_arg_name, ~));
+    }
+
+private:
+    boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_;
+};
+
+#   undef BOOST_FUNCTIONAL_DETAIL_arity
+#endif // iteration
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp b/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp
new file mode 100644
index 000000000..0c28607b8
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp
@@ -0,0 +1,85 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace boost { namespace overloaded_function_detail {
+
+// Requires: F is a monomorphic functor (i.e., has non-template `operator()`).
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+// It does not assume F typedef result_type, arg1_type, ... but needs typeof.
+template
+class functor_type {
+    // NOTE: clang does not accept extra parenthesis `&(...)`.
+    typedef BOOST_TYPEOF_TPL(&F::operator()) call_ptr;
+public:
+    typedef
+        typename boost::function_types::function_type<
+            typename boost::mpl::push_front<
+                  typename boost::mpl::pop_front< // Remove functor type (1st).
+                    typename boost::function_types::parameter_types<
+                            call_ptr>::type
+                  >::type
+                , typename boost::function_types::result_type::type
+            >::type
+        >::type
+    type;
+};
+
+// NOTE: When using boost::function in Boost.Typeof emulation mode, the user
+// has to register boost::functionN instead of boost::function in oder to
+// do TYPEOF(F::operator()). That is confusing, so boost::function is handled
+// separately so it does not require any Boost.Typeof registration at all.
+template
+struct functor_type< boost::function > {
+    typedef F type;
+};
+
+// Requires: F is a function type, pointer, reference, or monomorphic functor.
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+template
+struct function_type {
+    typedef
+        typename boost::mpl::if_,
+            boost::mpl::identity
+        ,
+            typename boost::mpl::if_,
+                boost::remove_pointer
+            ,
+                typename boost::mpl::if_,
+                    boost::remove_reference
+                , // Else, requires that F is a functor.
+                    functor_type
+                >::type
+            >::type
+        >::type
+    ::type type;
+};
+
+} } // namespace
+
+#endif // #include guard
+
diff --git a/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp b/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
index 50c40cf34..2f4db4dd0 100644
--- a/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
@@ -12,13 +12,28 @@
 
 #include 
 #include 
+#include 
+#include 
 
-namespace boost { namespace fusion { namespace detail
-{
+namespace boost { namespace fusion
+{ 
+    namespace detail
+    {
     template 
     struct get_identity
       : remove_const::type>
     {};
-}}}
+    }
+    
+    namespace extension
+    {
+        // Overload as_const() to unwrap adt_attribute_proxy.
+        template 
+        typename adt_attribute_proxy::type as_const(const adt_attribute_proxy& proxy)
+        {
+            return proxy.get();
+        }
+    }
+}}
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
index 2f09719ca..400f366e9 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
@@ -9,7 +9,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -29,13 +29,13 @@ namespace boost { namespace fusion
             struct apply
             {
                 typedef typename remove_const::type seq_type;
-                typedef std::tuple_element element;
+                typedef typename std::tuple_element::type element;
 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , fusion::detail::cref_result
-                      , fusion::detail::ref_result
+                      , typename fusion::detail::cref_result::type
+                      , typename fusion::detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
index 4998e21d1..082018a44 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -48,12 +48,12 @@ namespace boost { namespace fusion
         template 
         struct deref
         {
-            typedef value_of element;
+            typedef typename value_of::type element;
             typedef typename
-                mpl::eval_if<
+                mpl::if_<
                     is_const
-                  , fusion::detail::cref_result
-                  , fusion::detail::ref_result
+                  , typename fusion::detail::cref_result::type
+                  , typename fusion::detail::ref_result::type
                 >::type
             type;
 
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
index 10e2e1814..6d7b4d6fb 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
@@ -10,12 +10,6 @@
 #include 
 #include 
 
-namespace std
-{
-    template 
-    class tuple;
-}
-
 namespace boost { namespace fusion
 {
     struct std_tuple_tag;
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct.hpp b/project/jni/boost/include/boost/fusion/adapted/struct.hpp
index acc12e692..e51b514b0 100644
--- a/project/jni/boost/include/boost/fusion/adapted/struct.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/struct.hpp
@@ -16,5 +16,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp
new file mode 100644
index 000000000..9dc5b44cc
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_STRUCT_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+#include 
+
+#define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(                                  \
+    TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES)                                      \
+                                                                                \
+    BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL(                                 \
+        TEMPLATE_PARAMS_SEQ,                                                    \
+        NAME,                                                                   \
+        ATTRIBUTES)
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE(NAME, ATTRIBUTES)                     \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES)                    \
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
new file mode 100644
index 000000000..7bc5fe08a
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
@@ -0,0 +1,412 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE)        \
+    BOOST_PP_COMMA_IF(N) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)()
+
+#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST(ATTRIBUTES_SEQ)                     \
+            : BOOST_PP_SEQ_FOR_EACH_I(                                          \
+              BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY,                        \
+              ~,                                                                \
+              ATTRIBUTES_SEQ)                                                   \
+
+#define BOOST_FUSION_IGNORE_1(ARG1)
+#define BOOST_FUSION_IGNORE_2(ARG1, ARG2)
+
+#define BOOST_FUSION_MAKE_COPY_CONSTRUCTOR(NAME, ATTRIBUTES_SEQ)                \
+    NAME(BOOST_PP_SEQ_FOR_EACH_I(                                               \
+            BOOST_FUSION_MAKE_CONST_REF_PARAM,                                  \
+            ~,                                                                  \
+            ATTRIBUTES_SEQ))                                                    \
+        : BOOST_PP_SEQ_FOR_EACH_I(                                              \
+              BOOST_FUSION_MAKE_INIT_LIST_ENTRY,                                \
+              ~,                                                                \
+              ATTRIBUTES_SEQ)                                                   \
+    {                                                                           \
+    }                                                                           \
+
+#define BOOST_FUSION_MAKE_CONST_REF_PARAM(R, DATA, N, ATTRIBUTE)                \
+    BOOST_PP_COMMA_IF(N)                                                        \
+    BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) const&                                 \
+    BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
+
+#define BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(NAME) NAME(NAME)
+
+#define BOOST_FUSION_MAKE_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE)                \
+    BOOST_PP_COMMA_IF(N)                                                        \
+    BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE))
+
+#define BOOST_FUSION_ITERATOR_NAME(NAME)                                        \
+    BOOST_PP_CAT(boost_fusion_detail_, BOOST_PP_CAT(NAME, _iterator))
+
+// Note: all template parameter names need to be uglified, otherwise they might
+//       shadow a template parameter of the struct when used with
+//       BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE
+
+#define BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS(Z, N, NAME)                   \
+    template                                   \
+    struct value_of<                                                            \
+               BOOST_FUSION_ITERATOR_NAME(NAME)      \
+           >                                                                    \
+        : boost::mpl::identity<                                                 \
+              typename boost_fusion_detail_Sq::t##N##_type                      \
+          >                                                                     \
+    {                                                                           \
+    };
+
+#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC(                                  \
+    SPEC_TYPE, CALL_ARG_TYPE, TYPE_QUAL, ATTRIBUTE, N)                          \
+                                                                                \
+    template                                   \
+    struct deref >                                                \
+    {                                                                           \
+        typedef typename boost_fusion_detail_Sq::t##N##_type TYPE_QUAL& type;   \
+        static type call(CALL_ARG_TYPE, N> const& iter)                         \
+        {                                                                       \
+            return iter.seq_.BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);              \
+        }                                                                       \
+    };
+
+#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS(R, NAME, N, ATTRIBUTE)           \
+    BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC(                                      \
+        BOOST_FUSION_ITERATOR_NAME(NAME)                                  \
+    struct value_at >               \
+    {                                                                           \
+        typedef typename boost_fusion_detail_Sq::t##N##_type type;              \
+    };
+
+#define BOOST_FUSION_MAKE_AT_SPECS(R, DATA, N, ATTRIBUTE)                       \
+    template                                   \
+    struct at >                     \
+    {                                                                           \
+        typedef typename boost::mpl::if_<                                       \
+            boost::is_const,                            \
+            typename boost_fusion_detail_Sq::t##N##_type const&,                \
+            typename boost_fusion_detail_Sq::t##N##_type&                       \
+        >::type type;                                                           \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return sq. BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);                    \
+        }                                                                       \
+    };
+
+#define BOOST_FUSION_MAKE_TYPEDEF(R, DATA, N, ATTRIBUTE)                        \
+    typedef BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) t##N##_type;
+
+#define BOOST_FUSION_MAKE_DATA_MEMBER(R, DATA, N, ATTRIBUTE)                    \
+    BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);
+
+// Note: We can't nest the iterator inside the struct because we run into
+//       a MSVC10 bug involving partial specializations of nested templates.
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES)                \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)                \
+    struct NAME : boost::fusion::sequence_facade<                               \
+                      NAME,                                                     \
+                      boost::fusion::random_access_traversal_tag                \
+                  >                                                             \
+    {                                                                           \
+        BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    };
+
+#define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL(                             \
+    TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES)                                      \
+                                                                                \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)                \
+                                                                                \
+    template <                                                                  \
+        BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL(                  \
+            (0)TEMPLATE_PARAMS_SEQ)                                             \
+    >                                                                           \
+    struct NAME : boost::fusion::sequence_facade<                               \
+                      NAME<                                                     \
+                          BOOST_PP_SEQ_ENUM(TEMPLATE_PARAMS_SEQ)                \
+                      >,                                                        \
+                      boost::fusion::random_access_traversal_tag                \
+                  >                                                             \
+    {                                                                           \
+        BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    };
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(                                    \
+        NAME,                                                                   \
+        BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
+
+// Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
+//       ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
+//       sequence produces warnings on MSVC.
+#define BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(NAME, ATTRIBUTES_SEQ)           \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL(                        \
+        NAME,                                                                   \
+        ATTRIBUTES_SEQ,                                                         \
+        BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)            \
+    BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(                                   \
+        NAME,                                                                   \
+        BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
+
+#define BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(NAME, ATTRIBUTES_SEQ)          \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL(                       \
+        NAME,                                                                   \
+        ATTRIBUTES_SEQ,                                                         \
+        BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL(                   \
+    NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE)                                  \
+                                                                                \
+    template                           \
+    struct BOOST_FUSION_ITERATOR_NAME(NAME)                                     \
+        : boost::fusion::iterator_facade<                                       \
+              BOOST_FUSION_ITERATOR_NAME(NAME),     \
+              boost::fusion::random_access_traversal_tag                        \
+          >                                                                     \
+    {                                                                           \
+        typedef boost::mpl::int_ index;                                      \
+        typedef boost_fusion_detail_Seq sequence_type;                          \
+                                                                                \
+        BOOST_FUSION_ITERATOR_NAME(NAME)(boost_fusion_detail_Seq& seq)          \
+            : seq_(seq) {}                                                      \
+                                                                                \
+        boost_fusion_detail_Seq& seq_;                                          \
+                                                                                \
+        template  struct value_of;              \
+        BOOST_PP_REPEAT(                                                        \
+            ATTRIBUTES_SEQ_SIZE,                                                \
+            BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS,                          \
+            NAME)                                                               \
+                                                                                \
+        template  struct deref;                 \
+        BOOST_PP_SEQ_FOR_EACH_I(                                                \
+            BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS,                             \
+            NAME,                                                               \
+            ATTRIBUTES_SEQ)                                                     \
+                                                                                \
+        template                               \
+        struct next                                                             \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value + 1                        \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template                               \
+        struct prior                                                            \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value - 1                        \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template <                                                              \
+            typename boost_fusion_detail_It1,                                   \
+            typename boost_fusion_detail_It2                                    \
+        >                                                                       \
+        struct distance                                                         \
+        {                                                                       \
+            typedef typename boost::mpl::minus<                                 \
+                typename boost_fusion_detail_It2::index,                        \
+                typename boost_fusion_detail_It1::index                         \
+            >::type type;                                                       \
+                                                                                \
+             static type call(boost_fusion_detail_It1 const& it1,               \
+                              boost_fusion_detail_It2 const& it2)               \
+            {                                                                   \
+                return type();                                                  \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template <                                                              \
+            typename boost_fusion_detail_It,                                    \
+            typename boost_fusion_detail_M                                      \
+        >                                                                       \
+        struct advance                                                          \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value                            \
+                    + boost_fusion_detail_M::value                              \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+    };
+
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL(                    \
+    NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE)                                  \
+                                                                                \
+    /* Note: second BOOST_PP_IF is necessary to avoid MSVC warning when */      \
+    /*       calling BOOST_FUSION_IGNORE_1 with no arguments.           */      \
+    NAME()                                                                      \
+        BOOST_PP_IF(                                                            \
+            ATTRIBUTES_SEQ_SIZE,                                                \
+            BOOST_FUSION_MAKE_DEFAULT_INIT_LIST,                                \
+            BOOST_FUSION_IGNORE_1)                                              \
+                (BOOST_PP_IF(                                                   \
+                    ATTRIBUTES_SEQ_SIZE,                                        \
+                    ATTRIBUTES_SEQ,                                             \
+                    0))                                                         \
+    {                                                                           \
+    }                                                                           \
+                                                                                \
+    BOOST_PP_IF(                                                                \
+        ATTRIBUTES_SEQ_SIZE,                                                    \
+        BOOST_FUSION_MAKE_COPY_CONSTRUCTOR,                                     \
+        BOOST_FUSION_IGNORE_2)                                                  \
+            (NAME, ATTRIBUTES_SEQ)                                              \
+                                                                                \
+    template                                  \
+    NAME(const boost_fusion_detail_Seq& rhs)                                    \
+    {                                                                           \
+        boost::fusion::copy(rhs, *this);                                        \
+    }                                                                           \
+                                                                                \
+    template                                  \
+    NAME& operator=(const boost_fusion_detail_Seq& rhs)                         \
+    {                                                                           \
+        boost::fusion::copy(rhs, *this);                                        \
+        return *this;                                                           \
+    }                                                                           \
+                                                                                \
+    template                                   \
+    struct begin                                                                \
+    {                                                                           \
+        typedef BOOST_FUSION_ITERATOR_NAME(NAME)     \
+             type;                                                              \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return type(sq);                                                    \
+        }                                                                       \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct end                                                                  \
+    {                                                                           \
+        typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                               \
+            boost_fusion_detail_Sq,                                             \
+            ATTRIBUTES_SEQ_SIZE                                                 \
+        > type;                                                                 \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return type(sq);                                                    \
+        }                                                                       \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct size : boost::mpl::int_                         \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct empty : boost::mpl::bool_                  \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    template <                                                                  \
+        typename boost_fusion_detail_Sq,                                        \
+        typename boost_fusion_detail_N                                          \
+    >                                                                           \
+    struct value_at : value_at<                                                 \
+                          boost_fusion_detail_Sq,                               \
+                          boost::mpl::int_        \
+                      >                                                         \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    BOOST_PP_REPEAT(                                                            \
+        ATTRIBUTES_SEQ_SIZE,                                                    \
+        BOOST_FUSION_MAKE_VALUE_AT_SPECS,                                       \
+        ~)                                                                      \
+                                                                                \
+    template <                                                                  \
+        typename boost_fusion_detail_Sq,                                        \
+        typename boost_fusion_detail_N                                          \
+    >                                                                           \
+    struct at : at<                                                             \
+                    boost_fusion_detail_Sq,                                     \
+                    boost::mpl::int_              \
+                >                                                               \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_AT_SPECS, ~, ATTRIBUTES_SEQ)      \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_TYPEDEF, ~, ATTRIBUTES_SEQ)       \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(                                                    \
+        BOOST_FUSION_MAKE_DATA_MEMBER,                                          \
+        ~,                                                                      \
+        ATTRIBUTES_SEQ)
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp b/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
index 2720627c4..fd866468e 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
@@ -11,8 +11,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 
 #if defined (BOOST_MSVC)
 #  pragma warning(push)
@@ -54,7 +57,15 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if_c<
+            type_traits::ice_and<
+                traits::is_sequence::value
+              , traits::is_sequence::value
+            >::value,
+            void
+        >::type
     copy(Seq1 const& src, Seq2& dest)
     {
         BOOST_STATIC_ASSERT(
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
index a8d6a357a..4b676dea6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
@@ -9,6 +9,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,14 +25,24 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::accumulate::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence& seq, State const& state, F f)
     {
         return fusion::fold(seq, state, f);
     }
 
     template 
-    inline typename result_of::accumulate::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence const& seq, State const& state, F f)
     {
         return fusion::fold(seq, state, f);
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
index 9c0bd115f..a4ca316c1 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
@@ -7,6 +7,9 @@
 #if !defined(BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED)
 #define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED
 
+#include 
+#include 
+
 namespace boost { namespace fusion
 {
     namespace result_of
@@ -16,11 +19,19 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::accumulate::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence& seq, State const& state, F f);
 
     template 
-    typename result_of::accumulate::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence const& seq, State const& state, F f);
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
index d368338a0..c89a7ddad 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
@@ -116,7 +116,7 @@ namespace boost { namespace fusion
         {
             template
             static Result
-            call(State const& state,It0 const& it0, F)
+            call(State const& state,It0 const&, F)
             {
                 return static_cast(state);
             }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
index 71730abf0..48a413446 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
@@ -115,7 +115,7 @@ namespace boost { namespace fusion
         {
             template
             static Result
-            call(State const& state,It0 const& it0, F)
+            call(State const& state,It0 const&, F)
             {
                 return static_cast(state);
             }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
index ab8b8f0e8..17cde34a4 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
@@ -11,6 +11,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,14 +26,24 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence& seq, F const& f)
     {
         detail::for_each(seq, f, typename traits::is_segmented::type());
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence const& seq, F const& f)
     {
         detail::for_each(seq, f, typename traits::is_segmented::type());
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
index 544915d94..b757873e6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
@@ -7,6 +7,9 @@
 #if !defined(BOOST_FUSION_FOR_EACH_FWD_HPP_INCLUDED)
 #define BOOST_FUSION_FOR_EACH_FWD_HPP_INCLUDED
 
+#include 
+#include 
+
 namespace boost { namespace fusion
 {
     namespace result_of
@@ -16,11 +19,21 @@ namespace boost { namespace fusion
     }
 
     template 
-    void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence& seq, F const& f);
 
     template 
-    void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence const& seq, F const& f);
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
index ade58671a..048871632 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
@@ -10,6 +10,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline int
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , int
+        >::type
     count(Sequence const& seq, T const& x)
     {
         detail::count_compare f(x);
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
index 51112cf0d..792979733 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
@@ -10,6 +10,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline int
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , int
+        >::type
     count_if(Sequence const& seq, F f)
     {
         return detail::count_if(
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
index 42409d5a1..5f6b85772 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
@@ -109,7 +109,7 @@ namespace detail
     struct unrolled_any<0>
     {
         template 
-        static bool call(It const& it, F f)
+        static bool call(It const&, F)
         {
             return false;
         }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
index 304ed4c51..6ad737fd1 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
@@ -16,6 +16,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -53,18 +56,38 @@ namespace boost { namespace fusion
             }
         };
 
+        struct use_default;
+        
+        template 
+        struct fusion_default_help
+          : mpl::if_<
+                is_same
+              , Default
+              , T
+            >
+        {
+        };
+        
         template <
             typename Sequence
           , typename First
-          , typename Last = typename compute_erase_last::type>
+          , typename Last = use_default>
         struct erase
         {
             typedef typename result_of::begin::type seq_first_type;
             typedef typename result_of::end::type seq_last_type;
             BOOST_STATIC_ASSERT((!result_of::equal_to::value));
 
-            typedef typename convert_iterator::type first_type;
-            typedef typename convert_iterator::type last_type;
+            typedef First FirstType;
+            typedef typename 
+                fusion_default_help<
+                    Last 
+                  , typename compute_erase_last::type
+                >::type
+            LastType;
+            
+            typedef typename convert_iterator::type first_type;
+            typedef typename convert_iterator::type last_type;
             typedef iterator_range left_type;
             typedef iterator_range right_type;
             typedef joint_view type;
@@ -72,7 +95,11 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::erase::type
+    typename 
+        lazy_enable_if<
+            traits::is_sequence
+          , typename result_of::erase 
+        >::type
     erase(Sequence const& seq, First const& first)
     {
         typedef result_of::erase result_of;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
index ac5bca38a..2052fc01a 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -38,8 +40,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::insert<
-        Sequence const, Position, T>::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::insert
+        >::type
     insert(Sequence const& seq, Position const& pos, T const& x)
     {
         typedef result_of::insert<
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
index 00a01a806..9afe538ab 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,7 +26,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::push_back::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_back
+        >::type
     push_back(Sequence const& seq, T const& x)
     {
         typedef typename result_of::push_back push_back;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
index d08ad2798..abe7faade 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,7 +26,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::push_front::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_front
+        >::type
     push_front(Sequence const& seq, T const& x)
     {
         typedef typename result_of::push_front push_front;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
index bfe186e5a..a92e6e373 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
@@ -9,6 +9,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -22,7 +24,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::replace::type
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , typename result_of::replace::type
+        >::type
     replace(Sequence const& seq, T const& old_value, T const& new_value)
     {
         typedef typename result_of::replace::type result;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
index 29913436e..39b9009a7 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -24,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::replace_if::type
+    inline 
+    typename 
+        enable_if<
+            traits::is_sequence
+          , typename result_of::replace_if::type
+        >::type
     replace_if(Sequence const& seq, F pred, T const& new_value)
     {
         typedef typename result_of::replace_if::type result;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
index 23c4fe653..923b90fc6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
@@ -8,6 +8,8 @@
 #define FUSION_REVERSE_07212005_1230
 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -21,7 +23,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline reverse_view
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , reverse_view
+        >::type
     reverse(Sequence const& view)
     {
         return reverse_view(view);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
index ef8345f7d..738e05bbd 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
@@ -1,36 +1,47 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_BACK_EXTENDED_DEQUE_26112006_2209)
 #define BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209
 
-#include 
 #include 
-#include 
+
 #include 
 #include 
+#include 
 
-#include 
-#include 
-
-namespace boost { namespace fusion {
-    template
+namespace boost { namespace fusion
+{
+    template 
     struct back_extended_deque
-        : detail::keyed_element,
-          sequence_base >
+      : detail::keyed_element
+      , sequence_base >
     {
         typedef detail::keyed_element base;
         typedef typename Deque::next_down next_down;
-        typedef mpl::int_ >::value> next_up;
-        typedef mpl::plus::type, mpl::int_<1> > size;
+        typedef mpl::int_<(Deque::next_up::value + 1)> next_up;
+        typedef mpl::int_<(result_of::size::value + 1)> size;
 
-        back_extended_deque(Deque const& deque, typename add_reference::type>::type t)
-            : base(t, deque)
+        template 
+        back_extended_deque(Deque const& deque, Arg const& val)
+          : base(val, deque)
         {}
+
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        back_extended_deque(Deque const& deque, Arg& val)
+          : base(val, deque)
+        {}
+#else
+        template 
+        back_extended_deque(Deque const& deque, Arg&& val)
+          : base(std::forward(val), deque)
+        {}
+#endif
     };
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/convert.hpp b/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
index 0f8ea6576..1910cb84f 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -21,7 +21,9 @@ namespace boost { namespace fusion
         template 
         struct as_deque
         {
-            typedef typename detail::as_deque::value> gen;
+            typedef typename
+                detail::as_deque::value>
+            gen;
             typedef typename gen::
                 template apply::type>::type
             type;
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
index 97238f4ad..56ae290e0 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,20 +8,26 @@
 #if !defined(BOOST_FUSION_DEQUE_26112006_1649)
 #define BOOST_FUSION_DEQUE_26112006_1649
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 
+///////////////////////////////////////////////////////////////////////////////
+// With variadics, we will use the PP version version
+///////////////////////////////////////////////////////////////////////////////
+#if defined(BOOST_NO_VARIADIC_TEMPLATES)
+# include 
+#else
+# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#   define BOOST_FUSION_HAS_VARIADIC_DEQUE
+# endif
+
+///////////////////////////////////////////////////////////////////////////////
+// C++11 variadic interface
+///////////////////////////////////////////////////////////////////////////////
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -29,93 +35,129 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
-#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
-#include 
-#else
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
-#endif
-
-/*=============================================================================
-    Copyright (c) 2001-2011 Joel de Guzman
-
-    Distributed under the Boost Software License, Version 1.0. (See accompanying
-    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-    This is an auto-generated file. Do not edit!
-==============================================================================*/
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 1)
-#endif
-
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    template
-    struct deque
-        :
-        detail::deque_keyed_values::type,
-        sequence_base >
+    template 
+    struct deque : detail::nil_keyed_element
     {
         typedef deque_tag fusion_tag;
         typedef bidirectional_traversal_tag category;
-        typedef typename detail::deque_keyed_values::type base;
-        typedef typename detail::deque_initial_size::type size;
-        typedef mpl::int_ next_up;
-        typedef mpl::int_<
-            mpl::if_ >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
+        typedef mpl::int_<0> size;
+        typedef mpl::int_<0> next_up;
+        typedef mpl::int_<0> next_down;
         typedef mpl::false_ is_view;
 
-#include 
+        template 
+        deque(Sequence const&,
+            typename enable_if<
+                mpl::and_<
+                    traits::is_sequence
+                  , result_of::empty>>::type* /*dummy*/ = 0)
+        {}
+
+        deque() {}
+    };
+
+    template 
+    struct deque
+      : detail::deque_keyed_values::type
+      , sequence_base>
+    {
+        typedef deque_tag fusion_tag;
+        typedef bidirectional_traversal_tag category;
+        typedef typename detail::deque_keyed_values::type base;
+        typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
+        typedef mpl::int_ next_up;
+        typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down;
+        typedef mpl::false_ is_view;
 
         deque()
-            {}
+        {}
 
-        explicit deque(typename add_reference::type>::type t0)
-            : base(t0, detail::nil_keyed_element())
-            {}
+        template 
+        deque(deque const& seq)
+          : base(seq)
+        {}
 
-        template
-            deque(deque const& seq)
-            : base(seq)
-            {}
+        template 
+        deque(deque& seq)
+          : base(seq)
+        {}
 
-        template
-            deque(Sequence const& seq, typename disable_if >::type* /*dummy*/ = 0)
-            : base(base::from_iterator(fusion::begin(seq)))
-            {}
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque(deque&& seq)
+          : base(std::forward>(seq))
+        {}
+#endif
 
-        template 
-        deque&
-        operator=(deque const& rhs)
+        deque(deque const& seq)
+          : base(seq)
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        deque(deque&& seq)
+          : base(std::forward(seq))
+        {}
+#endif
+
+        explicit deque(Head const& head, Tail const&... tail)
+          : base(detail::deque_keyed_values::construct(head, tail...))
+        {}
+
+        template 
+        explicit deque(Head_ const& head, Tail_ const&... tail)
+          : base(detail::deque_keyed_values::construct(head, tail...))
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        explicit deque(Head_&& head, Tail_&&... tail)
+          : base(detail::deque_keyed_values
+                ::forward_(std::forward(head), std::forward(tail)...))
+        {}
+#endif
+
+        template 
+        explicit deque(Sequence const& seq
+          , typename disable_if >::type* /*dummy*/ = 0)
+          : base(base::from_iterator(fusion::begin(seq)))
+        {}
+
+        template 
+        deque& operator=(deque const& rhs)
         {
             base::operator=(rhs);
             return *this;
         }
 
         template 
-        deque&
-        operator=(T const& rhs)
+        deque& operator=(T const& rhs)
         {
             base::operator=(rhs);
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque& operator=(T&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            return *this;
+        }
+#endif
+
     };
 }}
 
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(output: null)
 #endif
-
-#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
-
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
index 7f9a1f9b7..fc1f9cbde 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2007 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,43 +8,28 @@
 #if !defined(FUSION_DEQUE_FORWARD_02092007_0749)
 #define FUSION_DEQUE_FORWARD_02092007_0749
 
-#include 
-#include 
+#include 
 
-#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
-#include 
+///////////////////////////////////////////////////////////////////////////////
+// With no decltype and variadics, we will use the C++03 version
+///////////////////////////////////////////////////////////////////////////////
+#if (defined(BOOST_NO_DECLTYPE)             \
+  || defined(BOOST_NO_VARIADIC_TEMPLATES)   \
+  || defined(BOOST_NO_RVALUE_REFERENCES))
+# include 
 #else
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR "_fwd.hpp")
-#endif
-
-/*=============================================================================
-    Copyright (c) 2001-2011 Joel de Guzman
-
-    Distributed under the Boost Software License, Version 1.0. (See accompanying
-    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-    This is an auto-generated file. Do not edit!
-==============================================================================*/
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 1)
-#endif
+# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#   define BOOST_FUSION_HAS_VARIADIC_DEQUE
+# endif
 
+///////////////////////////////////////////////////////////////////////////////
+// C++11 interface
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace fusion
 {
-    struct void_;
-
-    template<
-        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
-            FUSION_MAX_DEQUE_SIZE, typename T, void_)>
+    template 
     struct deque;
 }}
 
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(output: null)
 #endif
-
-#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
-
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
index 3cb02f08f..d3e5f31eb 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_ITERATOR_26112006_2154)
@@ -12,13 +12,13 @@
 #include 
 #include 
 #include 
-#include  
+#include 
 
 namespace boost { namespace fusion {
 
     struct bidirectional_traversal_tag;
 
-    template
+    template 
     struct deque_iterator
         : iterator_facade, bidirectional_traversal_tag>
     {
@@ -84,7 +84,7 @@ namespace boost { namespace fusion {
             typedef typename
                 mpl::minus<
                     typename I2::index, typename I1::index
-                >::type 
+                >::type
             type;
 
             static type
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
index bc9ae8461..906f4fb65 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
index dc09d31b7..0684dcf19 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_AT_IMPL_09122006_2017)
@@ -19,15 +19,15 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct at_impl;
-        
+
         template<>
         struct at_impl
         {
@@ -37,15 +37,21 @@ namespace boost { namespace fusion {
                 typedef typename Sequence::next_up next_up;
                 typedef typename Sequence::next_down next_down;
                 BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-                
-                typedef mpl::plus > offset;
-                typedef mpl::int_::value> adjusted_index;
-                typedef typename detail::keyed_element_value_at::type element_type;
-                typedef typename add_reference<
-                    typename mpl::eval_if<
-                    is_const,
-                    add_const,
-                    mpl::identity >::type>::type type;
+
+                static int const offset = next_down::value + 1;
+                typedef mpl::int_<(N::value + offset)> adjusted_index;
+                typedef typename
+                    detail::keyed_element_value_at::type
+                element_type;
+
+                typedef typename
+                    add_reference<
+                      typename mpl::eval_if<
+                      is_const,
+                      add_const,
+                      mpl::identity >::type
+                    >::type
+                type;
 
                 static type call(Sequence& seq)
                 {
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
index 8c02b9ac8..1447868a3 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct begin_impl;
-        
+
         template<>
         struct begin_impl
         {
             template
             struct apply
             {
-                typedef typename mpl::if_<
-                    mpl::equal_to,
-                    deque_iterator,
-                    deque_iterator<
-                    Sequence, mpl::plus >::value> >::type type;
-                
+                typedef typename
+                    mpl::if_c<
+                        (Sequence::next_down::value == Sequence::next_up::value)
+                      , deque_iterator
+                      , deque_iterator
+                    >::type
+                type;
+
                 static type call(Sequence& seq)
                 {
                     return type(seq);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
index 9693d95d1..1401ef1ac 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -28,7 +28,7 @@ namespace boost { namespace fusion
             template 
             struct apply
             {
-                typedef typename detail::as_deque::value> gen;
+                typedef detail::as_deque::value> gen;
                 typedef typename gen::
                     template apply::type>::type
                 type;
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
index 38d5e6430..44d279f62 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
@@ -1,14 +1,20 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_PP_IS_ITERATING)
 #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#define FUSION_DEQUE_FORWARD_CTOR_FORWARD(z, n, _)    std::forward(t##n)
+
 #include 
 #include 
 #include 
@@ -18,14 +24,22 @@
 #define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_DEQUE_FORWARD_CTOR_FORWARD
 #endif
 #else
 
 #define N BOOST_PP_ITERATION()
 
 deque(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
-    : base(detail::deque_keyed_values::call(BOOST_PP_ENUM_PARAMS(N, t)))
+    : base(detail::deque_keyed_values::construct(BOOST_PP_ENUM_PARAMS(N, t)))
 {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
+    : base(detail::deque_keyed_values::
+		forward_(BOOST_PP_ENUM(N, FUSION_DEQUE_FORWARD_CTOR_FORWARD, _)))
+{}
+#endif
+
 #undef N
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
index 738221ce2..21075ef47 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
 #include 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
index d96f16a0c..d457516fc 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,21 +9,30 @@
 #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
+#include 
 #include 
 
+#define FUSION_DEQUE_KEYED_VALUES_FORWARD(z, n, _)    \
+   std::forward(BOOST_PP_CAT(t, n))
+
 #define BOOST_PP_FILENAME_1 \
     
 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_DEQUE_KEYED_VALUES_FORWARD
 #endif
 #else
 
 #define N BOOST_PP_ITERATION()
 
-        static type call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
+        static type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
         {
             return type(t0,
                         deque_keyed_values_impl<
@@ -34,5 +43,16 @@
                         >::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
         }
 
+        static type forward_(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
+        {
+            return type(std::forward(t0),
+                        deque_keyed_values_impl<
+                        next_index
+        #if N > 1
+                        , BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
+        #endif
+                        >::forward_(BOOST_PP_ENUM_SHIFTED(N, FUSION_DEQUE_KEYED_VALUES_FORWARD, _)));
+        }
+
 #undef N
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
index 0727e00f5..8037689ab 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_END_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct end_impl;
-        
+
         template<>
         struct end_impl
         {
             template
             struct apply
             {
-                typedef typename mpl::if_<
-                    mpl::equal_to,
-                    deque_iterator,
-                    deque_iterator<
-                    Sequence, Sequence::next_up::value> >::type type;
-                
+                typedef typename
+                    mpl::if_c<
+                        (Sequence::next_down::value == Sequence::next_up::value)
+                      , deque_iterator
+                      , deque_iterator
+                    >::type
+                type;
+
                 static type call(Sequence& seq)
                 {
                     return type(seq);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
index ff88ed6f2..b4718be41 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2010 Christopher Schmidt
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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)
 ==============================================================================*/
 
@@ -14,18 +14,16 @@ namespace boost { namespace fusion
 {
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct is_sequence_impl;
-        
+
         template<>
         struct is_sequence_impl
         {
             template
-            struct apply
-              : mpl::true_
-            {};
+            struct apply : mpl::true_ {};
         };
     }
 }}
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
index 1b5e34687..e5bdc2abd 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
@@ -1,47 +1,45 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
 #define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
 
-#include 
-#include 
-
+#include 
 #include 
 #include 
 
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
     struct fusion_sequence_tag;
+}}
 
-namespace detail {
-
+namespace boost { namespace fusion { namespace detail
+{
     struct nil_keyed_element
     {
         typedef fusion_sequence_tag tag;
         void get();
 
         template
-        static nil_keyed_element 
+        static nil_keyed_element
         from_iterator(It const&)
         {
             return nil_keyed_element();
         }
     };
 
-    template
-    struct keyed_element
-        : Rest
+    template 
+    struct keyed_element : Rest
     {
         typedef Rest base;
         typedef fusion_sequence_tag tag;
         using Rest::get;
 
-        template
+        template 
         static keyed_element
         from_iterator(It const& it)
         {
@@ -49,30 +47,65 @@ namespace detail {
                 *it, base::from_iterator(fusion::next(it)));
         }
 
-        template
-        keyed_element(keyed_element const& rhs)
-            : Rest(rhs.get_base()), value_(rhs.value_)
+        keyed_element(keyed_element const& rhs)
+          : Rest(rhs.get_base()), value_(rhs.value_)
         {}
 
-        Rest const get_base() const
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element(keyed_element&& rhs)
+          : Rest(std::forward(rhs.forward_base()))
+          , value_(std::forward(rhs.value_))
+        {}
+#endif
+
+        template 
+        keyed_element(keyed_element const& rhs)
+          : Rest(rhs.get_base()), value_(rhs.value_)
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#endif
+
+        Rest& get_base()
         {
             return *this;
         }
 
-        typename add_reference::type>::type get(Key) const
+        Rest const& get_base() const
+        {
+            return *this;
+        }
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        Rest&& forward_base()
+        {
+            return std::forward(*static_cast(this));
+        }
+#endif
+
+        typename cref_result::type get(Key) const
         {
             return value_;
         }
 
-        typename add_reference::type get(Key)
+        typename ref_result::type get(Key)
         {
             return value_;
         }
 
-        keyed_element(typename add_reference::type>::type value, Rest const& rest)
+        keyed_element(
+            typename detail::call_param::type value
+          , Rest const& rest)
             : Rest(rest), value_(value)
         {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element(Value&& value, Rest&& rest)
+            : Rest(std::forward(rest))
+            , value_(std::forward(value))
+        {}
+#endif
+
         keyed_element()
             : Rest(), value_()
         {}
@@ -92,12 +125,21 @@ namespace detail {
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element& operator=(keyed_element&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            value_ = std::forward(rhs.value_);
+            return *this;
+        }
+#endif
+
         Value value_;
     };
 
     template
     struct keyed_element_value_at
-        : keyed_element_value_at
+      : keyed_element_value_at
     {};
 
     template
@@ -105,7 +147,6 @@ namespace detail {
     {
         typedef Value type;
     };
-
 }}}
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp
new file mode 100644
index 000000000..7913b67ba
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp
@@ -0,0 +1,156 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2006 Dan Marsden
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
+#define BOOST_PP_FUSION_DEQUE_26112006_1649
+
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include 
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
+#endif
+
+/*=============================================================================
+    Copyright (c) 2001-2011 Joel de Guzman
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+    This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion {
+
+    struct deque_tag;
+
+    template
+    struct deque
+        :
+        detail::deque_keyed_values::type,
+        sequence_base >
+    {
+        typedef deque_tag fusion_tag;
+        typedef bidirectional_traversal_tag category;
+        typedef typename detail::deque_keyed_values::type base;
+        typedef typename detail::deque_initial_size::type size;
+        typedef mpl::int_ next_up;
+        typedef mpl::int_<
+            mpl::if_ >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
+        typedef mpl::false_ is_view;
+
+#include 
+
+        deque()
+            {}
+
+        explicit deque(typename add_reference::type>::type t0)
+            : base(t0, detail::nil_keyed_element())
+            {}
+
+        explicit deque(deque const& rhs)
+            : base(rhs)
+            {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        explicit deque(T0&& t0)
+            : base(std::forward(t0), detail::nil_keyed_element())
+            {}
+
+        explicit deque(deque&& rhs)
+            : base(std::forward(rhs))
+            {}
+#endif
+
+        template
+        deque(deque const& seq)
+            : base(seq)
+            {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template
+        deque(deque&& seq)
+            : base(std::forward>(seq))
+            {}
+#endif
+
+        template
+        deque(Sequence const& seq, typename disable_if >::type* /*dummy*/ = 0)
+            : base(base::from_iterator(fusion::begin(seq)))
+            {}
+
+        template 
+        deque&
+        operator=(deque const& rhs)
+        {
+            base::operator=(rhs);
+            return *this;
+        }
+
+        template 
+        deque&
+        operator=(T const& rhs)
+        {
+            base::operator=(rhs);
+            return *this;
+        }
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque&
+        operator=(T&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            return *this;
+        }
+#endif
+
+    };
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp
new file mode 100644
index 000000000..354cfccdc
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp
@@ -0,0 +1,54 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2007 Dan Marsden
+
+    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(FUSION_PP_DEQUE_FORWARD_02092007_0749)
+#define FUSION_PP_DEQUE_FORWARD_02092007_0749
+
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include 
+#include 
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include 
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR "_fwd.hpp")
+#endif
+
+/*=============================================================================
+    Copyright (c) 2001-2011 Joel de Guzman
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+    This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion
+{
+    struct void_;
+
+    template<
+        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+            FUSION_MAX_DEQUE_SIZE, typename T, void_)>
+    struct deque;
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
similarity index 93%
rename from project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp
rename to project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
index 898bc46b9..a7c4939a3 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
 
@@ -68,6 +72,11 @@ namespace boost { namespace fusion { namespace detail
         {
             return type();
         }
+
+        static type forward_()
+        {
+            return type();
+        }
     };
 
     template
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
index 64dbe5e16..cba31a3e0 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    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_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756)
@@ -13,15 +13,15 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct value_at_impl;
-        
+
         template<>
         struct value_at_impl
         {
@@ -31,10 +31,12 @@ namespace boost { namespace fusion {
                 typedef typename Sequence::next_up next_up;
                 typedef typename Sequence::next_down next_down;
                 BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-                
-                typedef mpl::plus > offset;
-                typedef mpl::int_::value> adjusted_index;
-                typedef typename detail::keyed_element_value_at::type type;
+
+                static int const offset = next_down::value + 1;
+                typedef mpl::int_<(N::value + offset)> adjusted_index;
+                typedef typename
+                    detail::keyed_element_value_at::type
+                type;
             };
         };
     }
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp
new file mode 100644
index 000000000..aae26a5b3
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2006 Dan Marsden
+
+    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_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901)
+#define BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901
+
+#include 
+#include 
+#include 
+#include 
+
+namespace boost { namespace fusion { namespace detail
+{
+    template
+    struct keyed_element;
+
+    template 
+    struct deque_keyed_values_impl;
+
+    template 
+    struct deque_keyed_values_impl
+    {
+        typedef mpl::int_<(N::value + 1)> next_index;
+        typedef typename deque_keyed_values_impl::type tail;
+        typedef keyed_element type;
+
+        static type construct(
+          typename detail::call_param::type head
+        , typename detail::call_param::type... tail)
+        {
+            return type(
+                head
+              , deque_keyed_values_impl::construct(tail...)
+            );
+        }
+
+        template 
+        static type forward_(Head_&& head, Tail_&&... tail)
+        {
+            return type(
+                std::forward(head)
+              , deque_keyed_values_impl::
+                  forward_(std::forward(tail)...)
+            );
+        }
+    };
+
+    struct nil_keyed_element;
+
+    template 
+    struct deque_keyed_values_impl
+    {
+        typedef nil_keyed_element type;
+        static type construct() { return type(); }
+        static type forward_() { return type(); }
+    };
+
+    template 
+    struct deque_keyed_values
+      : deque_keyed_values_impl, Elements...> {};
+}}}
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
index 7a7f9cee2..2f3654ede 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,32 +8,39 @@
 #if !defined(BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209)
 #define BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209
 
-#include 
 #include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
-    template
+    template 
     struct front_extended_deque
-        : detail::keyed_element,
-          sequence_base >
+      : detail::keyed_element
+      , sequence_base >
     {
         typedef detail::keyed_element base;
-        typedef mpl::int_ >::value> next_down;
+        typedef mpl::int_<(Deque::next_down::value - 1)> next_down;
         typedef typename Deque::next_up next_up;
-        typedef mpl::plus::type, mpl::int_<1> > size;
+        typedef mpl::int_<(result_of::size::value + 1)> size;
 
-        front_extended_deque(Deque const& deque, typename add_reference::type>::type t)
-            : base(t, deque)
+        template 
+        front_extended_deque(Deque const& deque, Arg const& val)
+          : base(val, deque)
         {}
+
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        front_extended_deque(Deque const& deque, Arg& val)
+          : base(val, deque)
+        {}
+#else
+        template 
+        front_extended_deque(Deque const& deque, Arg&& val)
+          : base(std::forward(val), deque)
+        {}
+#endif
     };
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/limits.hpp b/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
index 891d41ed0..7892ba1a8 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
 #define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 
 #if !defined(FUSION_MAX_DEQUE_SIZE)
diff --git a/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
index 145f8aa53..757463928 100644
--- a/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 namespace boost { namespace fusion
@@ -93,15 +93,15 @@ namespace boost { namespace fusion
             template 
             struct apply
             {
-                typedef detail::cons_deref<
-                    typename detail::cons_advance::type>
+                typedef typename detail::cons_deref<
+                    typename detail::cons_advance::type>::type
                 element;
 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , detail::cref_result
-                      , detail::ref_result
+                      , typename detail::cref_result::type
+                      , typename detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
index f871bee08..025c1724a 100644
--- a/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
@@ -28,7 +28,9 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename 
+                    mpl::at::type 
+                element;
                 typedef typename detail::ref_result::type type;
     
                 static type
@@ -39,9 +41,11 @@ namespace boost { namespace fusion
             };
 
             template 
-            struct apply 
+            struct apply
             {
-                typedef mpl::at element;
+                typedef typename 
+                    mpl::at::type 
+                element;
                 typedef typename detail::cref_result::type type;
     
                 static type
diff --git a/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp b/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
index 07087a39a..8304c898e 100644
--- a/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
@@ -12,8 +12,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 namespace boost { namespace fusion { namespace extension
 {
@@ -29,10 +28,10 @@ namespace boost { namespace fusion { namespace extension
             typedef typename result_of::value_of::type::second_type data;
 
             typedef typename
-                mpl::eval_if<
+                mpl::if_<
                     is_const
-                  , detail::cref_result >
-                  , detail::ref_result >
+                  , typename detail::cref_result::type
+                  , typename detail::ref_result::type
                 >::type
             type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
index 0a006dc33..0017d9c81 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
@@ -27,7 +27,7 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename mpl::at::type element;
                 typedef typename detail::ref_result::type type;
     
                 static type
@@ -40,7 +40,7 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename mpl::at::type element;
                 typedef typename detail::cref_result::type type;
     
                 static type
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
index 1d9ac4a83..8c5fb9420 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -29,14 +30,14 @@ namespace boost { namespace fusion
                 typedef typename Iterator::vector vector;
                 typedef typename Iterator::index index;
                 typedef typename mpl::at<
-                    typename vector::types, index> 
+                    typename vector::types, index>::type
                 element;
                 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , fusion::detail::cref_result
-                      , fusion::detail::ref_result
+                      , typename fusion::detail::cref_result::type
+                      , typename fusion::detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
index d6258f60a..8ef9947de 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
@@ -34,6 +34,15 @@ namespace boost { namespace fusion
             
             return vector_data1(*i0);
         }
+        template 
+        static vector_data1
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            
+            return vector_data1(*i0);
+        }
         T0 m0;
     };
     template 
@@ -64,6 +73,12 @@ namespace boost { namespace fusion
           , typename boost::disable_if >::type* = 0
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector1(
+            Sequence& seq
+          , typename boost::disable_if >::type* = 0
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector1&
         operator=(vector1 const& vec)
@@ -121,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0);
             return vector_data2(*i0 , *i1);
         }
+        template 
+        static vector_data2
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0);
+            return vector_data2(*i0 , *i1);
+        }
         T0 m0; T1 m1;
     };
     template 
@@ -149,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector2(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector2&
         operator=(vector2 const& vec)
@@ -206,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1);
             return vector_data3(*i0 , *i1 , *i2);
         }
+        template 
+        static vector_data3
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1);
+            return vector_data3(*i0 , *i1 , *i2);
+        }
         T0 m0; T1 m1; T2 m2;
     };
     template 
@@ -234,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector3(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector3&
         operator=(vector3 const& vec)
@@ -291,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2);
             return vector_data4(*i0 , *i1 , *i2 , *i3);
         }
+        template 
+        static vector_data4
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2);
+            return vector_data4(*i0 , *i1 , *i2 , *i3);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3;
     };
     template 
@@ -319,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector4(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector4&
         operator=(vector4 const& vec)
@@ -376,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3);
             return vector_data5(*i0 , *i1 , *i2 , *i3 , *i4);
         }
+        template 
+        static vector_data5
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3);
+            return vector_data5(*i0 , *i1 , *i2 , *i3 , *i4);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4;
     };
     template 
@@ -404,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector5(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector5&
         operator=(vector5 const& vec)
@@ -461,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4);
             return vector_data6(*i0 , *i1 , *i2 , *i3 , *i4 , *i5);
         }
+        template 
+        static vector_data6
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4);
+            return vector_data6(*i0 , *i1 , *i2 , *i3 , *i4 , *i5);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5;
     };
     template 
@@ -489,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector6(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector6&
         operator=(vector6 const& vec)
@@ -546,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5);
             return vector_data7(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6);
         }
+        template 
+        static vector_data7
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5);
+            return vector_data7(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6;
     };
     template 
@@ -574,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector7(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector7&
         operator=(vector7 const& vec)
@@ -631,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6);
             return vector_data8(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7);
         }
+        template 
+        static vector_data8
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6);
+            return vector_data8(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7;
     };
     template 
@@ -659,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector8(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector8&
         operator=(vector8 const& vec)
@@ -716,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7);
             return vector_data9(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8);
         }
+        template 
+        static vector_data9
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7);
+            return vector_data9(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8;
     };
     template 
@@ -744,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector9(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector9&
         operator=(vector9 const& vec)
@@ -801,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8);
             return vector_data10(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9);
         }
+        template 
+        static vector_data10
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8);
+            return vector_data10(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9;
     };
     template 
@@ -829,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector10(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector10&
         operator=(vector10 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
index a409b2e7a..151acbbdc 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9);
             return vector_data11(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10);
         }
+        template 
+        static vector_data11
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9);
+            return vector_data11(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector11(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector11&
         operator=(vector11 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10);
             return vector_data12(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11);
         }
+        template 
+        static vector_data12
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10);
+            return vector_data12(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector12(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector12&
         operator=(vector12 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11);
             return vector_data13(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12);
         }
+        template 
+        static vector_data13
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11);
+            return vector_data13(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector13(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector13&
         operator=(vector13 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12);
             return vector_data14(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13);
         }
+        template 
+        static vector_data14
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12);
+            return vector_data14(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector14(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector14&
         operator=(vector14 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13);
             return vector_data15(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14);
         }
+        template 
+        static vector_data15
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13);
+            return vector_data15(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector15(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector15&
         operator=(vector15 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14);
             return vector_data16(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15);
         }
+        template 
+        static vector_data16
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14);
+            return vector_data16(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector16(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector16&
         operator=(vector16 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15);
             return vector_data17(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16);
         }
+        template 
+        static vector_data17
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15);
+            return vector_data17(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector17(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector17&
         operator=(vector17 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16);
             return vector_data18(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17);
         }
+        template 
+        static vector_data18
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16);
+            return vector_data18(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector18(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector18&
         operator=(vector18 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17);
             return vector_data19(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18);
         }
+        template 
+        static vector_data19
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17);
+            return vector_data19(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector19(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector19&
         operator=(vector19 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18);
             return vector_data20(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19);
         }
+        template 
+        static vector_data20
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18);
+            return vector_data20(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector20(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector20&
         operator=(vector20 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
index 032ff9d29..3810091bc 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19);
             return vector_data21(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20);
         }
+        template 
+        static vector_data21
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19);
+            return vector_data21(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector21(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector21&
         operator=(vector21 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20);
             return vector_data22(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21);
         }
+        template 
+        static vector_data22
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20);
+            return vector_data22(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector22(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector22&
         operator=(vector22 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21);
             return vector_data23(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22);
         }
+        template 
+        static vector_data23
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21);
+            return vector_data23(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector23(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector23&
         operator=(vector23 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22);
             return vector_data24(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23);
         }
+        template 
+        static vector_data24
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22);
+            return vector_data24(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector24(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector24&
         operator=(vector24 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23);
             return vector_data25(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24);
         }
+        template 
+        static vector_data25
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23);
+            return vector_data25(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector25(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector25&
         operator=(vector25 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24);
             return vector_data26(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25);
         }
+        template 
+        static vector_data26
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24);
+            return vector_data26(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector26(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector26&
         operator=(vector26 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25);
             return vector_data27(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26);
         }
+        template 
+        static vector_data27
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25);
+            return vector_data27(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector27(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector27&
         operator=(vector27 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26);
             return vector_data28(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27);
         }
+        template 
+        static vector_data28
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26);
+            return vector_data28(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector28(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector28&
         operator=(vector28 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27);
             return vector_data29(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28);
         }
+        template 
+        static vector_data29
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27);
+            return vector_data29(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector29(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector29&
         operator=(vector29 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28);
             return vector_data30(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29);
         }
+        template 
+        static vector_data30
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28);
+            return vector_data30(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector30(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector30&
         operator=(vector30 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
index 1b5fa58d9..07fac8dcf 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29);
             return vector_data31(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30);
         }
+        template 
+        static vector_data31
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29);
+            return vector_data31(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector31(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector31&
         operator=(vector31 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30);
             return vector_data32(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31);
         }
+        template 
+        static vector_data32
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30);
+            return vector_data32(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector32(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector32&
         operator=(vector32 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31);
             return vector_data33(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32);
         }
+        template 
+        static vector_data33
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31);
+            return vector_data33(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector33(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector33&
         operator=(vector33 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32);
             return vector_data34(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33);
         }
+        template 
+        static vector_data34
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32);
+            return vector_data34(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector34(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector34&
         operator=(vector34 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33);
             return vector_data35(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34);
         }
+        template 
+        static vector_data35
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33);
+            return vector_data35(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector35(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector35&
         operator=(vector35 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34);
             return vector_data36(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35);
         }
+        template 
+        static vector_data36
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34);
+            return vector_data36(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector36(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector36&
         operator=(vector36 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35);
             return vector_data37(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36);
         }
+        template 
+        static vector_data37
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35);
+            return vector_data37(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector37(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector37&
         operator=(vector37 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36);
             return vector_data38(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37);
         }
+        template 
+        static vector_data38
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36);
+            return vector_data38(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector38(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector38&
         operator=(vector38 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37);
             return vector_data39(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38);
         }
+        template 
+        static vector_data39
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37);
+            return vector_data39(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector39(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector39&
         operator=(vector39 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38);
             return vector_data40(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39);
         }
+        template 
+        static vector_data40
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38);
+            return vector_data40(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector40(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector40&
         operator=(vector40 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
index ba6c1771f..7ef9402e6 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39);
             return vector_data41(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40);
         }
+        template 
+        static vector_data41
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39);
+            return vector_data41(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector41(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector41&
         operator=(vector41 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40);
             return vector_data42(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41);
         }
+        template 
+        static vector_data42
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40);
+            return vector_data42(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector42(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector42&
         operator=(vector42 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41);
             return vector_data43(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42);
         }
+        template 
+        static vector_data43
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41);
+            return vector_data43(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector43(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector43&
         operator=(vector43 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42);
             return vector_data44(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43);
         }
+        template 
+        static vector_data44
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42);
+            return vector_data44(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector44(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector44&
         operator=(vector44 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43);
             return vector_data45(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44);
         }
+        template 
+        static vector_data45
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43);
+            return vector_data45(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector45(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector45&
         operator=(vector45 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44);
             return vector_data46(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45);
         }
+        template 
+        static vector_data46
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44);
+            return vector_data46(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector46(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector46&
         operator=(vector46 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45);
             return vector_data47(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46);
         }
+        template 
+        static vector_data47
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45);
+            return vector_data47(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector47(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector47&
         operator=(vector47 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46);
             return vector_data48(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47);
         }
+        template 
+        static vector_data48
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46);
+            return vector_data48(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector48(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector48&
         operator=(vector48 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47);
             return vector_data49(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48);
         }
+        template 
+        static vector_data49
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47);
+            return vector_data49(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47; T48 m48;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector49(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector49&
         operator=(vector49 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47); typedef typename result_of::next< I48>::type I49; I49 i49 = fusion::next(i48);
             return vector_data50(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48 , *i49);
         }
+        template 
+        static vector_data50
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47); typedef typename result_of::next< I48>::type I49; I49 i49 = fusion::next(i48);
+            return vector_data50(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48 , *i49);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47; T48 m48; T49 m49;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector50(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector50&
         operator=(vector50 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
index 92f7aa6c2..c41d5b297 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
@@ -12,11 +12,14 @@
 #include 
 #include 
 
+#define FUSION_FORWARD_CTOR_MOVE(z, n, _)    std::move(_##n)
+
 #define BOOST_PP_FILENAME_1 \
     
 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_FORWARD_CTOR_MOVE
 #endif
 #else // defined(BOOST_PP_IS_ITERATING)
 ///////////////////////////////////////////////////////////////////////////////
@@ -34,6 +37,14 @@
         N, typename detail::call_param::type _))
         : vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if N == 1
+    explicit
+#endif
+    vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+        : vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {}
+#endif
+
 #undef N
 #endif // defined(BOOST_PP_IS_ITERATING)
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
index 431774b37..539b47fa9 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
@@ -9,24 +9,31 @@
 #if !defined(FUSION_MACRO_05042005)
 #define FUSION_MACRO_05042005
 
-#define FUSION_MEMBER_DEFAULT_INIT(z, n, _)     m##n()
-#define FUSION_MEMBER_INIT(z, n, _)             m##n(_##n)
-#define FUSION_COPY_INIT(z, n, _)               m##n(other.m##n)
-#define FUSION_MEMBER_DECL(z, n, _)             T##n m##n;
+#define FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT(z, n, _)   m##n()
+#define FUSION_VECTOR_MEMBER_MEMBER_INIT(z, n, _)           m##n(_##n)
+#define FUSION_VECTOR_MEMBER_COPY_INIT(z, n, _)             m##n(other.m##n)
+#define FUSION_VECTOR_MEMBER_FWD(z, n, _)                   m##n(std::forward(other.m##n))
+#define FUSION_VECTOR_ARG_FWD(z, n, _)                      m##n(std::forward(_##n))
+#define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _)           T##n m##n;
+#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _)               std::forward(_##n)
 
-#define FUSION_MEMBER_ASSIGN(z, n, _)                                           \
+#define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _)                             \
     this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
 
-#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _)                                     \
+#define FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN(z, n, _)                       \
     this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
 
-#define FUSION_AT_IMPL(z, n, _)                                                 \
+#define FUSION_VECTOR_MEMBER_MEMBER_FORWARD(z, n, _)                            \
+    this->BOOST_PP_CAT(m, n) = std::forward<                                    \
+        BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
+
+#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _)                                   \
     typename add_reference::type                                          \
         at_impl(mpl::int_) { return this->m##n; }                            \
     typename add_reference::type>::type                \
         at_impl(mpl::int_) const { return this->m##n; }
 
-#define FUSION_ITER_DECL_VAR(z, n, _)                                           \
+#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _)                             \
     typedef typename result_of::next<                                           \
         BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n);             \
     BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n)                                       \
@@ -40,21 +47,32 @@
     struct BOOST_PP_CAT(vector_data, N)
     {
         BOOST_PP_CAT(vector_data, N)()
-            : BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT, _) {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {}
+#endif
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_ENUM_BINARY_PARAMS(
                 N, typename detail::call_param::type _))
-            : BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {}
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_CAT(vector_data, N) const& other)
-            : BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_COPY_INIT, _) {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector_data, N)(
+            BOOST_PP_CAT(vector_data, N)&& other)
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FWD, _) {}
+#endif
 
         BOOST_PP_CAT(vector_data, N)&
         operator=(BOOST_PP_CAT(vector_data, N) const& vec)
         {
-            BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -64,11 +82,21 @@
         {
             typedef typename result_of::begin::type I0;
             I0 i0 = fusion::begin(seq);
-            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
             return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
         }
 
-        BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
+        template 
+        static BOOST_PP_CAT(vector_data, N)
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
+            return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
+        }
+
+        BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_DECL, _)
     };
 
     template 
@@ -95,6 +123,19 @@
                 N, typename detail::call_param::type _))
             : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if (N == 1)
+        explicit
+#endif
+        BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+            : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {}
+#endif
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
+            : base_type(std::forward(rhs)) {}
+#endif
+
         template 
         BOOST_PP_CAT(vector, N)(
             BOOST_PP_CAT(vector, N) const& vec)
@@ -109,11 +150,20 @@
             )
             : base_type(base_type::init_from_sequence(seq)) {}
 
+        template 
+        BOOST_PP_CAT(vector, N)(
+            Sequence& seq
+#if (N == 1)
+          , typename boost::disable_if >::type* /*dummy*/ = 0
+#endif
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
+
         template 
         BOOST_PP_CAT(vector, N)&
         operator=(BOOST_PP_CAT(vector, N) const& vec)
         {
-            BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -123,12 +173,21 @@
         {
             typedef typename result_of::begin::type I0;
             I0 i0 = fusion::begin(seq);
-            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
-            BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN, _)
             return *this;
         }
 
-        BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector, N)&
+        operator=(BOOST_PP_CAT(vector, N)&& vec)
+        {
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_FORWARD, _)
+            return *this;
+        }
+#endif
+
+        BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
 
         template
         typename add_reference::type>::type
@@ -147,3 +206,4 @@
 
 #undef N
 
+
diff --git a/project/jni/boost/include/boost/fusion/container/vector/vector.hpp b/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
index 6563bc933..36c1b7ac9 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
@@ -106,6 +106,11 @@ namespace boost { namespace fusion
         vector(vector const& rhs)
             : vec(rhs.vec) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        vector(vector&& rhs)
+            : vec(std::forward(rhs.vec)) {}
+#endif
+
         template 
         vector(Sequence const& rhs)
             : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
@@ -135,6 +140,23 @@ namespace boost { namespace fusion
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        vector&
+        operator=(vector&& rhs)
+        {
+            vec = std::forward(rhs.vec);
+            return *this;
+        }
+
+        template 
+        vector&
+        operator=(T&& rhs)
+        {
+            vec = std::forward(rhs);
+            return *this;
+        }
+#endif
+
         template 
         typename add_reference<
             typename mpl::at_c::type
diff --git a/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp b/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
index b0d02bc47..facd5c542 100644
--- a/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
@@ -100,6 +100,7 @@ namespace boost { namespace fusion
 
 namespace boost 
 {
+#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_DECLTYPE)
     template
     struct result_of< boost::fusion::unfused const () >
     {
@@ -110,6 +111,17 @@ namespace boost
     {
         typedef typename boost::fusion::unfused::call_0_result type;
     };
+#endif
+    template
+    struct tr1_result_of< boost::fusion::unfused const () >
+    {
+        typedef typename boost::fusion::unfused::call_const_0_result type;
+    };
+    template
+    struct tr1_result_of< boost::fusion::unfused() >
+    {
+        typedef typename boost::fusion::unfused::call_0_result type;
+    };
 }
 
 #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED
diff --git a/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp b/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
index 0f19f28f0..923c6876c 100644
--- a/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
@@ -80,6 +80,7 @@ namespace boost { namespace fusion
 
 namespace boost 
 {
+#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_DECLTYPE)
     template
     struct result_of< boost::fusion::unfused_typed const () >
         : boost::fusion::unfused_typed::template result< 
@@ -90,6 +91,17 @@ namespace boost
         : boost::fusion::unfused_typed::template result< 
             boost::fusion::unfused_typed () >
     { };
+#endif
+    template
+    struct tr1_result_of< boost::fusion::unfused_typed const () >
+        : boost::fusion::unfused_typed::template result< 
+            boost::fusion::unfused_typed const () >
+    { };
+    template
+    struct tr1_result_of< boost::fusion::unfused_typed() >
+        : boost::fusion::unfused_typed::template result< 
+            boost::fusion::unfused_typed () >
+    { };
 }
 
 
diff --git a/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp b/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
index 085beb7ed..1a4917027 100644
--- a/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
@@ -57,13 +57,13 @@ namespace boost { namespace fusion
         template  struct invoke;
     }
 
-    template 
-    inline typename result_of::invoke::type
-    invoke(Function, Sequence &);
+    //~ template 
+    //~ inline typename result_of::invoke::type
+    //~ invoke(Function, Sequence &);
 
-    template 
-    inline typename result_of::invoke::type
-    invoke(Function, Sequence const &);
+    //~ template 
+    //~ inline typename result_of::invoke::type
+    //~ invoke(Function, Sequence const &);
 
     //----- ---- --- -- - -  -   -
 
@@ -85,6 +85,9 @@ namespace boost { namespace fusion
         template 
         struct invoke_data_member;
 
+        template 
+        struct invoke_fn_ptr;
+
         template 
         struct invoke_mem_fn;
 
@@ -95,10 +98,10 @@ namespace boost { namespace fusion
         template 
         struct invoke_nonmember_builtin
         // use same implementation as for function objects but...
-            : invoke_impl< // ...work around boost::result_of bugs
+            : invoke_fn_ptr< // ...work around boost::result_of bugs
                 typename mpl::eval_if< ft::is_function,
                     boost::add_reference, boost::remove_cv >::type,
-                Sequence, N, false, RandomAccess >
+                Sequence, N, RandomAccess >
         { };
 
         template 
@@ -199,6 +202,35 @@ namespace boost { namespace fusion
                     Function(BOOST_PP_ENUM(N,M,~)) >::type result_type;
 #undef M
 
+#if N > 0
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & s)
+            {
+#define M(z,j,data) fusion::at_c(s)
+                return f( BOOST_PP_ENUM(N,M,~) );
+            }
+
+#else
+            template 
+            static inline result_type
+            call(F & f, Sequence & /*s*/)
+            {
+                return f();
+            }
+
+#endif
+
+        };
+
+        template 
+        struct invoke_fn_ptr
+        {
+        public:
+
+            typedef typename ft::result_type::type result_type;
+
 #if N > 0
 
             template 
@@ -278,6 +310,39 @@ namespace boost { namespace fusion
                 return f();
             }
 
+#endif
+
+        };
+
+        template 
+        struct invoke_fn_ptr
+        {
+        private:
+            typedef invoke_param_types seq;
+        public:
+
+            typedef typename ft::result_type::type result_type;
+
+#if N > 0
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & s)
+            {
+                typename seq::I0 i0 = fusion::begin(s);
+                BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
+                return f( BOOST_PP_ENUM_PARAMS(N,*i) );
+            }
+
+#else
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & /*s*/)
+            {
+                return f();
+            }
+
 #endif
 
         };
diff --git a/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp
new file mode 100644
index 000000000..141ad4e2d
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp
@@ -0,0 +1,13 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_INCLUDE_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_INCLUDE_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/include/repetetive_view.hpp b/project/jni/boost/include/boost/fusion/include/repetitive_view.hpp
similarity index 100%
rename from project/jni/boost/include/boost/fusion/include/repetetive_view.hpp
rename to project/jni/boost/include/boost/fusion/include/repetitive_view.hpp
diff --git a/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp b/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
index 680562694..9077f8fa0 100644
--- a/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
+++ b/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
@@ -23,8 +23,8 @@ namespace boost { namespace fusion
         iterator_base_type;
         iterator_base_type iterator_base;
 
-        iterator_adapter(iterator_base_type const& iterator_base)
-            : iterator_base(iterator_base) {}
+        iterator_adapter(iterator_base_type const& iterator_base_)
+            : iterator_base(iterator_base_) {}
 
         // default implementation
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
index 3e15e63ae..56cfe1b24 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a == *b
+            return extension::as_const(*a) == extension::as_const(*b)
                 && call(fusion::next(a), fusion::next(b));
         }
 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
index b4c4b087a..e61287765 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a > *b ||
-                (!(*b > *a) && call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) > extension::as_const(*b) ||
+                (!(extension::as_const(*b) > extension::as_const(*a)) && 
+                 call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
index f3eccd5d5..6d91e27bb 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a >= *b
-                && (!(*b >= *a) || call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) >= extension::as_const(*b)
+                && (!(extension::as_const(*b) >= extension::as_const(*a)) || 
+                    call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
index 4957d7bfa..1342bb142 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a < *b ||
-                (!(*b < *a) && call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) < extension::as_const(*b) ||
+                (!(extension::as_const(*b) < extension::as_const(*a)) && 
+                 call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
index 08fe9ec38..5683849a2 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a <= *b
-                && (!(*b <= *a) || call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) <= extension::as_const(*b)
+                && (!(extension::as_const(*b) <= extension::as_const(*a)) || 
+                    call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
index ac54dfb7d..77c235089 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a != *b
+            return extension::as_const(*a) != extension::as_const(*b)
                 || call(fusion::next(a), fusion::next(b));
         }
 
diff --git a/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp b/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
index 1ff05bad0..9e0969a97 100644
--- a/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
@@ -68,7 +68,7 @@ namespace boost { namespace fusion
 
     template 
     inline typename result_of::has_key::type
-    has_key(Sequence const& seq)
+    has_key(Sequence const&)
     {
         typedef typename result_of::has_key::type result;
         return result();
diff --git a/project/jni/boost/include/boost/fusion/support.hpp b/project/jni/boost/include/boost/fusion/support.hpp
index 765b777d9..50bf924f9 100644
--- a/project/jni/boost/include/boost/fusion/support.hpp
+++ b/project/jni/boost/include/boost/fusion/support.hpp
@@ -19,5 +19,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/support/as_const.hpp b/project/jni/boost/include/boost/fusion/support/as_const.hpp
new file mode 100644
index 000000000..bb2a96a65
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/support/as_const.hpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#ifndef BOOST_FUSION_SUPPORT_AS_CONST_HPP
+#define BOOST_FUSION_SUPPORT_AS_CONST_HPP
+
+namespace boost { namespace fusion { namespace extension
+{
+    // A customization point that allows certain wrappers around
+    // Fusion sequence elements (e.g. adt_attribute_proxy) to be
+    // unwrapped in contexts where the element only needs to be
+    // read. The library wraps accesses to Fusion elements in
+    // such contexts with calls to this function. Users can
+    // specialize this function for their own wrappers.
+    template 
+    const T& as_const(const T& obj)
+    {
+        return obj;
+    }
+
+}}}
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/support/detail/access.hpp b/project/jni/boost/include/boost/fusion/support/detail/access.hpp
index 03c9c3191..ced7cea18 100644
--- a/project/jni/boost/include/boost/fusion/support/detail/access.hpp
+++ b/project/jni/boost/include/boost/fusion/support/detail/access.hpp
@@ -15,7 +15,7 @@ namespace boost { namespace fusion { namespace detail
     template 
     struct ref_result
     {
-        typedef typename add_reference::type type;
+        typedef typename add_reference::type type;
     };
 
     template 
@@ -23,7 +23,7 @@ namespace boost { namespace fusion { namespace detail
     {
         typedef typename 
             add_reference<
-                typename add_const::type
+                typename add_const::type
             >::type 
         type;
     };
diff --git a/project/jni/boost/include/boost/fusion/support/is_segmented.hpp b/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
index ba571dc53..6e62eac43 100644
--- a/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
@@ -7,6 +7,7 @@
 #if !defined(FUSION_IS_SEGMENTED_03202006_0015)
 #define FUSION_IS_SEGMENTED_03202006_0015
 
+#include 
 #include 
 
 namespace boost { namespace fusion 
@@ -41,8 +42,10 @@ namespace boost { namespace fusion
     {
         template 
         struct is_segmented
-          : extension::is_segmented_impl::type>::
-                template apply
+          : mpl::bool_<
+                (bool)extension::is_segmented_impl::type>::
+                    template apply::type::value
+            >
         {
         };
     }
diff --git a/project/jni/boost/include/boost/fusion/support/is_sequence.hpp b/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
index 2f0ee4333..184bbbb6d 100644
--- a/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
@@ -59,9 +59,11 @@ namespace boost { namespace fusion
     {
         template 
         struct is_sequence
-          : extension::is_sequence_impl<
+          : mpl::bool_<
+                (bool)extension::is_sequence_impl<
                 typename fusion::detail::tag_of::type
-            >::template apply
+                >::template apply::type::value
+            >
         {};
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/support/is_view.hpp b/project/jni/boost/include/boost/fusion/support/is_view.hpp
index dbcc93a9b..4ec9e0652 100644
--- a/project/jni/boost/include/boost/fusion/support/is_view.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_view.hpp
@@ -7,6 +7,7 @@
 #if !defined(FUSION_IS_VIEW_03202006_0015)
 #define FUSION_IS_VIEW_03202006_0015
 
+#include 
 #include 
 #include 
 
@@ -54,8 +55,10 @@ namespace boost { namespace fusion
     {
         template 
         struct is_view :
-            extension::is_view_impl::type>::
-                template apply::type
+            mpl::bool_<
+                (bool)extension::is_view_impl::type>::
+                    template apply::type::value
+            >
         {};
     }
 }}
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
index 53306dabf..6abb03368 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
index ec01d4b7f..234936c58 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
index 02fd8f7fe..5898c6b97 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp b/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
index 489d95538..9bf459c4e 100644
--- a/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
+++ b/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 //  Invariants:
 //  - Each segmented iterator has a stack
@@ -45,11 +47,19 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::push_back::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_back
+        >::type
     push_back(Sequence const& seq, T const& x);
 
     template 
-    typename result_of::push_front::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_front
+        >::type
     push_front(Sequence const& seq, T const& x);
 }}
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/area.hpp b/project/jni/boost/include/boost/geometry/algorithms/area.hpp
index 919ab66fe..514134e0f 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/area.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/area.hpp
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -26,6 +28,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -49,41 +52,33 @@ namespace boost { namespace geometry
 namespace detail { namespace area
 {
 
-template
 struct box_area
 {
-    typedef typename coordinate_type::type return_type;
-
-    static inline return_type apply(Box const& box, Strategy const&)
+    template 
+    static inline typename coordinate_type::type
+    apply(Box const& box, Strategy const&)
     {
         // Currently only works for 2D Cartesian boxes
         assert_dimension();
 
-        return_type const dx = get(box)
-                - get(box);
-        return_type const dy = get(box)
-                - get(box);
-
-        return dx * dy;
+        return (get(box) - get(box))
+             * (get(box) - get(box));
     }
 };
 
 
 template
 <
-    typename Ring,
     iterate_direction Direction,
-    closure_selector Closure,
-    typename Strategy
+    closure_selector Closure
 >
 struct ring_area
 {
-    BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy) );
-
-    typedef typename Strategy::return_type type;
-
-    static inline type apply(Ring const& ring, Strategy const& strategy)
+    template 
+    static inline typename Strategy::return_type
+    apply(Ring const& ring, Strategy const& strategy)
     {
+        BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy) );
         assert_dimension();
 
         // Ignore warning (because using static method sometimes) on strategy
@@ -92,10 +87,10 @@ struct ring_area
         // An open ring has at least three points,
         // A closed ring has at least four points,
         // if not, there is no (zero) area
-        if (boost::size(ring)
+        if (int(boost::size(ring))
                 < core_detail::closure::minimum_ring_size::value)
         {
-            return type();
+            return typename Strategy::return_type();
         }
 
         typedef typename reversible_view::type rview_type;
@@ -136,71 +131,75 @@ namespace dispatch
 template
 <
     typename Geometry,
-    typename Strategy = typename strategy::area::services::default_strategy
-                                 <
-                                     typename cs_tag
-                                     <
-                                         typename point_type::type
-                                     >::type,
-                                     typename point_type::type
-                                 >::type,
     typename Tag = typename tag::type
 >
-struct area
-    : detail::calculate_null
-        <
-            typename Strategy::return_type,
-            Geometry,
-            Strategy
-        > {};
+struct area : detail::calculate_null
+{
+    template 
+    static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy)
+    {
+        return calculate_null::apply(geometry, strategy);
+    }
+};
 
 
-template
-<
-    typename Geometry,
-    typename Strategy
->
-struct area
-    : detail::area::box_area
+template 
+struct area, void>
+{
+    template 
+    struct visitor: boost::static_visitor
+    {
+        Strategy const& m_strategy;
+
+        visitor(Strategy const& strategy): m_strategy(strategy) {}
+
+        template 
+        typename Strategy::return_type operator()(Geometry const& geometry) const
+        {
+            return dispatch::area::apply(geometry, m_strategy);
+        }
+    };
+
+    template 
+    static inline typename Strategy::return_type
+    apply(Variant const& variant_geometry, Strategy const& strategy)
+    {
+        return boost::apply_visitor(visitor(strategy), variant_geometry);
+    }
+};
+
+
+template 
+struct area : detail::area::box_area
 {};
 
 
-template
-<
-    typename Ring,
-    typename Strategy
->
-struct area
+template 
+struct area
     : detail::area::ring_area
         <
-            Ring,
             order_as_direction::value>::value,
-            geometry::closure::value,
-            Strategy
+            geometry::closure::value
         >
 {};
 
 
-template
-<
-    typename Polygon,
-    typename Strategy
->
-struct area
-    : detail::calculate_polygon_sum
-        <
+template 
+struct area : detail::calculate_polygon_sum
+{
+    template 
+    static inline typename Strategy::return_type apply(Polygon const& polygon, Strategy const& strategy)
+    {
+        return calculate_polygon_sum::apply<
             typename Strategy::return_type,
-            Polygon,
-            Strategy,
             detail::area::ring_area
                 <
-                    typename ring_type::type,
                     order_as_direction::value>::value,
-                    geometry::closure::value,
-                    Strategy
+                    geometry::closure::value
                 >
-        >
-{};
+            >(polygon, strategy);
+    }
+};
 
 
 } // namespace dispatch
@@ -243,10 +242,7 @@ inline typename default_area_result::type area(Geometry const& geometr
 
     // detail::throw_on_empty_input(geometry);
         
-    return dispatch::area
-        <
-            Geometry
-        >::apply(geometry, strategy_type());
+    return dispatch::area::apply(geometry, strategy_type());
 }
 
 /*!
@@ -281,11 +277,7 @@ inline typename Strategy::return_type area(
 
     // detail::throw_on_empty_input(geometry);
     
-    return dispatch::area
-        <
-            Geometry,
-            Strategy
-        >::apply(geometry, strategy);
+    return dispatch::area::apply(geometry, strategy);
 }
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp b/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
index e22e36add..2edce0a09 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
@@ -20,6 +20,7 @@
 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,15 +76,23 @@ inline void buffer_box(BoxIn const& box_in, T const& distance, BoxOut& box_out)
 namespace dispatch
 {
 
-template 
-struct buffer {};
+template
+<
+    typename Input,
+    typename Output,
+    typename TagIn = typename tag::type,
+    typename TagOut = typename tag::type
+>
+struct buffer: not_implemented
+{};
 
 
-template 
-struct buffer
+template 
+struct buffer
 {
-    static inline void apply(BoxIn const& box_in, T const& distance,
-                T const& , BoxIn& box_out)
+    template 
+    static inline void apply(BoxIn const& box_in, Distance const& distance,
+                Distance const& , BoxIn& box_out)
     {
         detail::buffer::buffer_box(box_in, distance, box_out);
     }
@@ -122,10 +131,7 @@ inline void buffer(Input const& geometry_in, Output& geometry_out,
 
     dispatch::buffer
         <
-            typename tag::type,
-            typename tag::type,
             Input,
-            Distance,
             Output
         >::apply(geometry_in, distance, chord_length, geometry_out);
 }
@@ -152,10 +158,7 @@ Output return_buffer(Input const& geometry, T const& distance, T const& chord_le
 
     dispatch::buffer
         <
-            typename tag::type,
-            typename tag::type,
             Input,
-            T,
             Output
         >::apply(geometry, distance, chord_length, geometry_out);
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp b/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
index 69ad9fe82..9be51f409 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,9 +78,9 @@ public:
 namespace detail { namespace centroid
 {
 
-template
 struct centroid_point
 {
+    template
     static inline void apply(Point const& point, PointCentroid& centroid,
             Strategy const&)
     {
@@ -127,9 +128,9 @@ struct centroid_box_calculator
 };
 
 
-template
 struct centroid_box
 {
+    template
     static inline void apply(Box const& box, Point& centroid,
             Strategy const&)
     {
@@ -173,9 +174,10 @@ inline bool range_ok(Range const& range, Point& centroid)
 /*!
     \brief Calculate the centroid of a ring.
 */
-template
+template 
 struct centroid_range_state
 {
+    template
     static inline void apply(Ring const& ring,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
@@ -196,21 +198,17 @@ struct centroid_range_state
     }
 };
 
-template
+template 
 struct centroid_range
 {
+    template
     static inline void apply(Range const& range, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(range, centroid))
         {
             typename Strategy::state_type state;
-            centroid_range_state
-                <
-                    Range,
-                    Closure,
-                    Strategy
-                >::apply(range, strategy, state);
+            centroid_range_state::apply(range, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -222,20 +220,14 @@ struct centroid_range
     \note Because outer ring is clockwise, inners are counter clockwise,
     triangle approach is OK and works for polygons with rings.
 */
-template
 struct centroid_polygon_state
 {
-    typedef typename ring_type::type ring_type;
-
+    template
     static inline void apply(Polygon const& poly,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
-        typedef centroid_range_state
-            <
-                ring_type,
-                geometry::closure::value,
-                Strategy
-            > per_ring;
+        typedef typename ring_type::type ring_type;
+        typedef centroid_range_state::value> per_ring;
 
         per_ring::apply(exterior_ring(poly), strategy, state);
 
@@ -248,20 +240,16 @@ struct centroid_polygon_state
     }
 };
 
-template
 struct centroid_polygon
 {
+    template
     static inline void apply(Polygon const& poly, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(exterior_ring(poly), centroid))
         {
             typename Strategy::state_type state;
-            centroid_polygon_state
-                <
-                    Polygon,
-                    Strategy
-                >::apply(poly, strategy, state);
+            centroid_polygon_state::apply(poly, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -278,58 +266,35 @@ namespace dispatch
 
 template
 <
-    typename Tag,
     typename Geometry,
-    typename Point,
-    typename Strategy
+    typename Tag = typename tag::type
 >
-struct centroid {};
-
-template
-<
-    typename Geometry,
-    typename Point,
-    typename Strategy
->
-struct centroid
-    : detail::centroid::centroid_point
+struct centroid: not_implemented
 {};
 
-template
-<
-    typename Box,
-    typename Point,
-    typename Strategy
->
-struct centroid
-    : detail::centroid::centroid_box
+template 
+struct centroid
+    : detail::centroid::centroid_point
 {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_range
-        <
-            Ring,
-            Point,
-            geometry::closure::value,
-            Strategy
-        >
+template 
+struct centroid
+    : detail::centroid::centroid_box
 {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_range
-        <
-            Linestring,
-            Point,
-            closed,
-            Strategy
-        >
+template 
+struct centroid
+    : detail::centroid::centroid_range::value>
+{};
+
+template 
+struct centroid
+    : detail::centroid::centroid_range
  {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_polygon
+template 
+struct centroid
+    : detail::centroid::centroid_polygon
  {};
 
 } // namespace dispatch
@@ -365,13 +330,7 @@ inline void centroid(Geometry const& geometry, Point& c,
 
     // Call dispatch apply method. That one returns true if centroid
     // should be taken from state.
-    dispatch::centroid
-        <
-            typename tag::type,
-            Geometry,
-            Point,
-            Strategy
-        >::apply(geometry, c, strategy);
+    dispatch::centroid::apply(geometry, c, strategy);
 }
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp b/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
index 56b87c8c1..d31efe9e4 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
@@ -40,18 +40,13 @@ namespace boost { namespace geometry
 namespace detail { namespace convex_hull
 {
 
-template
-<
-    typename Geometry,
-    order_selector Order,
-    typename Strategy
->
+template 
 struct hull_insert
 {
 
     // Member template function (to avoid inconvenient declaration
     // of output-iterator-type, from hull_to_geometry)
-    template 
+    template 
     static inline OutputIterator apply(Geometry const& geometry,
             OutputIterator out, Strategy const& strategy)
     {
@@ -63,22 +58,15 @@ struct hull_insert
     }
 };
 
-template
-<
-    typename Geometry,
-    typename Strategy
->
 struct hull_to_geometry
 {
-    template 
+    template 
     static inline void apply(Geometry const& geometry, OutputGeometry& out,
             Strategy const& strategy)
     {
         hull_insert
             <
-                Geometry,
-                geometry::point_order::value,
-                Strategy
+                geometry::point_order::value
             >::apply(geometry,
                 std::back_inserter(
                     // Handle linestring, ring and polygon the same:
@@ -113,21 +101,16 @@ namespace dispatch
 template
 <
     typename Geometry,
-    typename Strategy = typename detail::convex_hull::default_strategy::type,
     typename Tag = typename tag::type
 >
 struct convex_hull
-    : detail::convex_hull::hull_to_geometry
+    : detail::convex_hull::hull_to_geometry
 {};
 
-template
-<
-    typename Box,
-    typename Strategy
->
-struct convex_hull
+template 
+struct convex_hull
 {
-    template 
+    template 
     static inline void apply(Box const& box, OutputGeometry& out,
             Strategy const& )
     {
@@ -149,13 +132,9 @@ struct convex_hull
 
 
 
-template
-<
-    order_selector Order,
-    typename Geometry, typename Strategy
->
+template 
 struct convex_hull_insert
-    : detail::convex_hull::hull_insert
+    : detail::convex_hull::hull_insert
 {};
 
 
@@ -181,11 +160,7 @@ inline void convex_hull(Geometry const& geometry,
         return;
     }
 
-    dispatch::convex_hull
-        <
-            Geometry,
-            Strategy
-        >::apply(geometry, out, strategy);
+    dispatch::convex_hull::apply(geometry, out, strategy);
 }
 
 
@@ -232,8 +207,7 @@ inline OutputIterator convex_hull_insert(Geometry const& geometry,
 
     return dispatch::convex_hull_insert
         <
-            geometry::point_order::value,
-            Geometry, Strategy
+            geometry::point_order::value
         >::apply(geometry, out, strategy);
 }
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/correct.hpp b/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
index 583e395f8..39249e7de 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
@@ -119,10 +119,8 @@ struct correct_ring
 
     typedef detail::area::ring_area
             <
-                Ring,
                 order_as_direction::value>::value,
-                geometry::closure::value,
-                strategy_type
+                geometry::closure::value
             > ring_area_type;
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
index 4b48d62fc..3ebca8350 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
@@ -21,9 +21,9 @@ namespace boost { namespace geometry
 namespace detail
 {
 
-template
 struct calculate_null
 {
+    template
     static inline ReturnType apply(Geometry const& , Strategy const&)
     {
         return ReturnType();
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
index 2ad349080..dd0399bb1 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
@@ -26,16 +26,9 @@ namespace detail
 {
 
 
-template
-<
-    typename ReturnType,
-    typename Polygon,
-    typename Strategy,
-    typename Policy
->
 class calculate_polygon_sum
 {
-    template 
+    template 
     static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
     {
         ReturnType sum = ReturnType();
@@ -47,10 +40,11 @@ class calculate_polygon_sum
     }
 
 public :
+    template 
     static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
     {
         return Policy::apply(exterior_ring(poly), strategy)
-            + sum_interior_rings(interior_rings(poly), strategy)
+            + sum_interior_rings(interior_rings(poly), strategy)
             ;
     }
 };
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
index 2ced5b1ce..e944e5169 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
@@ -26,6 +26,7 @@
 #include 
 #include 
 
+#include 
 
 #include 
 
@@ -165,6 +166,19 @@ struct box_box
 };
 
 
+template
+<
+    typename Geometry1, typename Geometry2
+>
+struct reverse_covered_by
+{
+    static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
+    {
+        return ! geometry::covered_by(geometry1, geometry2);
+    }
+};
+
+
 
 /*!
     \brief Internal utility function to detect of boxes are disjoint
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
index b10017c20..7cb01fa9b 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 
 
 namespace boost { namespace geometry
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp
new file mode 100644
index 000000000..d23f1e4c2
--- /dev/null
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp
@@ -0,0 +1,371 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
+
+#include 
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+// TODO: move this to /util/
+template 
+static inline std::pair ordered_pair(T const& first, T const& second)
+{
+    return first < second ? std::make_pair(first, second) : std::make_pair(second, first);
+}
+
+template 
+inline void debug_left_turn(AngleInfo const& ai, AngleInfo const& previous)
+{
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+    std::cout << "Angle: " << (ai.incoming ? "i" : "o") 
+        << " " << si(ai.seg_id) 
+        << " " << (math::r2d * (ai.angle) )
+        << " turn: " << ai.turn_index << "[" << ai.operation_index << "]"
+        ;
+
+    if (ai.turn_index != previous.turn_index
+        || ai.operation_index != previous.operation_index)
+    {
+        std::cout << " diff: " << math::r2d * math::abs(previous.angle - ai.angle);
+    }
+    std::cout << std::endl;
+#endif
+}
+
+template 
+inline void debug_left_turn(std::string const& caption, AngleInfo const& ai, AngleInfo const& previous,
+            int code = -99, int code2 = -99, int code3 = -99, int code4 = -99)
+{
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+    std::cout << " " << caption
+            << " turn: " << ai.turn_index << "[" << ai.operation_index << "]"
+            << " " << si(ai.seg_id) 
+            << " " << (ai.incoming ? "i" : "o") 
+            << " " << (math::r2d * (ai.angle) )
+            << " turn: " << previous.turn_index << "[" << previous.operation_index << "]"
+            << " " << si(previous.seg_id) 
+            << " " << (previous.incoming ? "i" : "o") 
+            << " " << (math::r2d * (previous.angle) )
+            ;
+
+    if (code != -99)
+    {
+        std::cout << " code: " << code << " , " << code2 << " , " << code3 << " , " << code4;
+    }
+    std::cout << std::endl;
+#endif
+}
+
+
+template 
+inline bool include_operation(Operation const& op, 
+                segment_identifier const& outgoing_seg_id,
+                segment_identifier const& incoming_seg_id)
+{
+    return op.seg_id == outgoing_seg_id
+        && op.other_id == incoming_seg_id
+        && (op.operation == detail::overlay::operation_union
+            ||op.operation == detail::overlay::operation_continue)
+            ;
+}
+
+template 
+inline bool process_include(segment_identifier const& outgoing_seg_id, segment_identifier const& incoming_seg_id,
+                int turn_index, Turn& turn,
+                std::set& keep_indices, int priority)
+{
+    bool result = false;
+    for (int i = 0; i < 2; i++)
+    {
+        if (include_operation(turn.operations[i], outgoing_seg_id, incoming_seg_id))
+        {
+            turn.operations[i].include_in_occupation_map = true;
+            if (priority > turn.priority)
+            {
+                turn.priority = priority;
+            }
+            keep_indices.insert(turn_index);
+            result = true;
+        }
+    }
+    return result;
+}
+
+template 
+inline bool include_left_turn_of_all(
+                AngleInfo const& outgoing, AngleInfo const& incoming,
+                Turns& turns, TurnSegmentIndices const& turn_segment_indices,
+                std::set& keep_indices, int priority)
+{
+    segment_identifier const& outgoing_seg_id = turns[outgoing.turn_index].operations[outgoing.operation_index].seg_id;
+    segment_identifier const& incoming_seg_id = turns[incoming.turn_index].operations[incoming.operation_index].seg_id;
+
+    if (outgoing.turn_index == incoming.turn_index)
+    {
+        return process_include(outgoing_seg_id, incoming_seg_id, outgoing.turn_index, turns[outgoing.turn_index], keep_indices, priority);
+    }
+
+    bool result = false;
+    std::pair pair = ordered_pair(outgoing_seg_id, incoming_seg_id);
+    typename boost::range_iterator::type it = turn_segment_indices.find(pair);
+    if (it != turn_segment_indices.end())
+    {
+        for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
+        {
+            if (process_include(outgoing_seg_id, incoming_seg_id, *sit, turns[*sit], keep_indices, priority))
+            {
+                result = true;
+            }
+        }
+    }
+    return result;
+}
+
+template 
+inline bool corresponds(Turn const& turn, segment_identifier const& seg_id)
+{
+    return turn.operations[Index].operation == detail::overlay::operation_union
+        && turn.operations[Index].seg_id == seg_id;
+}
+
+
+template 
+inline bool prefer_by_other(Turns const& turns,
+            TurnSegmentIndices const& turn_segment_indices,
+            std::set& indices)
+{
+    std::map map;
+    for (std::set::const_iterator sit = indices.begin();
+        sit != indices.end();
+        ++sit)
+    {
+        map[turns[*sit].operations[0].seg_id]++;
+        map[turns[*sit].operations[1].seg_id]++;
+    }
+
+    std::set segment_occuring_once;
+    for (std::map::const_iterator mit = map.begin(); 
+        mit != map.end();++mit)
+    {
+        if (mit->second == 1)
+        {
+            segment_occuring_once.insert(mit->first);
+        }
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER
+        std::cout << si(mit->first) << " " << mit->second << std::endl;
+#endif
+    }
+
+    if (segment_occuring_once.size() == 2)
+    {
+        // Try to find within all turns a turn with these two segments
+
+        std::set::const_iterator soo_it = segment_occuring_once.begin();
+        segment_identifier front = *soo_it;
+        soo_it++;
+        segment_identifier back = *soo_it;
+
+        std::pair pair = ordered_pair(front, back);
+
+        typename boost::range_iterator::type it = turn_segment_indices.find(pair);
+        if (it != turn_segment_indices.end())
+        {
+            // debug_turns_by_indices("Found", it->second);
+            // Check which is the union/continue
+            segment_identifier good;
+            for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
+            {
+                if (turns[*sit].operations[0].operation == detail::overlay::operation_union)
+                {
+                    good = turns[*sit].operations[0].seg_id;
+                }
+                else if (turns[*sit].operations[1].operation == detail::overlay::operation_union)
+                {
+                    good = turns[*sit].operations[1].seg_id;
+                }
+            }
+
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER
+            std::cout << "Good: " << si(good) << std::endl;
+#endif
+
+            // Find in indexes-to-keep this segment with the union. Discard the other one
+            std::set ok_indices;
+            for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+            {
+                if (corresponds<0>(turns[*sit], good) || corresponds<1>(turns[*sit], good))
+                {
+                    ok_indices.insert(*sit);
+                }
+            }
+            if (ok_indices.size() > 0 && ok_indices.size() < indices.size())
+            {
+                indices = ok_indices;
+                std::cout << "^";
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
+template 
+inline void prefer_by_priority(Turns const& turns, std::set& indices)
+{
+    // Find max prio
+    int min_prio = 1024, max_prio = 0;
+    for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+    {
+        if (turns[*sit].priority > max_prio)
+        {
+            max_prio = turns[*sit].priority;
+        }
+        if (turns[*sit].priority < min_prio)
+        {
+            min_prio = turns[*sit].priority;
+        }
+    }
+
+    if (min_prio == max_prio)
+    {
+        return;
+    }
+
+    // Only keep indices with high prio
+    std::set ok_indices;
+    for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+    {
+        if (turns[*sit].priority >= max_prio)
+        {
+            ok_indices.insert(*sit);
+        }
+    }
+    if (ok_indices.size() > 0 && ok_indices.size() < indices.size())
+    {
+        indices = ok_indices;
+        std::cout << "%";
+    }
+}
+
+template 
+inline void calculate_left_turns(Angles const& angles, 
+                Turns& turns, TurnSegmentIndices const& turn_segment_indices,
+                std::set& keep_indices)
+{
+    bool debug_indicate_size = false;
+
+    typedef typename strategy::side::services::default_strategy
+        <
+            typename cs_tag::type
+        >::type side_strategy;
+
+    std::size_t i = 0;
+    std::size_t n = boost::size(angles);
+
+    typedef geometry::ever_circling_range_iterator circling_iterator;
+    circling_iterator cit(angles);
+
+    debug_left_turn(*cit, *cit);
+    for(circling_iterator prev = cit++; i < n; prev = cit++, i++)
+    {
+        debug_left_turn(*cit, *prev);
+
+        bool const include = ! geometry::math::equals(prev->angle, cit->angle)
+            && ! prev->incoming
+            && cit->incoming;
+
+        if (include)
+        {
+            // Go back to possibly include more same left outgoing angles:
+            // Because we check on side too we can take a large "epsilon"
+            circling_iterator back = prev - 1;
+
+            typename AngleInfo::angle_type eps = 0.00001;
+            int b = 1;
+            for(std::size_t d = 0; 
+                    math::abs(prev->angle - back->angle) < eps 
+                        && ! back->incoming 
+                        && d < n;
+                d++)
+            {
+                --back;
+                ++b;
+            }
+
+            // Same but forward to possibly include more incoming angles
+            int f = 1;
+            circling_iterator forward = cit + 1;
+            for(std::size_t d = 0;
+                    math::abs(cit->angle - forward->angle) < eps 
+                        && forward->incoming 
+                        && d < n;
+                    d++)
+            {
+                ++forward;
+                ++f;
+            }
+
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+            std::cout << "HANDLE " << b << "/" << f << " ANGLES" << std::endl;
+#endif
+            for(circling_iterator bit = prev; bit != back; --bit)
+            {
+                int code = side_strategy::apply(bit->direction_point, prev->intersection_point, prev->direction_point);
+                int code2 = side_strategy::apply(prev->direction_point, bit->intersection_point, bit->direction_point);
+                for(circling_iterator fit = cit; fit != forward; ++fit)
+                {
+                    int code3 = side_strategy::apply(fit->direction_point, cit->intersection_point, cit->direction_point);
+                    int code4 = side_strategy::apply(cit->direction_point, fit->intersection_point, fit->direction_point);
+
+                    int priority = 2;
+                    if (code == -1 && code2 == 1)
+                    {
+                        // This segment is lying right of the other one.
+                        // Cannot ignore it (because of robustness, see a.o. #rt_p21 from unit test).
+                        // But if we find more we can prefer later by priority
+                        // (a.o. necessary for #rt_o2 from unit test)
+                        priority = 1;
+                    }
+
+                    bool included = include_left_turn_of_all(*bit, *fit, turns, turn_segment_indices, keep_indices, priority);
+                    debug_left_turn(included ? "KEEP" : "SKIP", *fit, *bit, code, code2, code3, code4);
+                }
+            }
+        }
+    }
+
+    if (debug_indicate_size)
+    {
+        std::cout << " size=" << keep_indices.size();
+    }
+
+    if (keep_indices.size() >= 2)
+    {
+        prefer_by_other(turns, turn_segment_indices, keep_indices);
+    }
+    if (keep_indices.size() >= 2)
+    {
+            prefer_by_priority(turns, keep_indices);
+    }
+}
+
+} // namespace detail
+#endif // DOXYGEN_NO_DETAIL
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp
new file mode 100644
index 000000000..6d15f2dd6
--- /dev/null
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp
@@ -0,0 +1,329 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP
+
+#if ! defined(NDEBUG)
+//  #define BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+#endif
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+template 
+class relaxed_less
+{
+    typedef typename geometry::coordinate_type

::type coordinate_type; + + coordinate_type epsilon; + +public : + + inline relaxed_less() + { + // TODO: adapt for ttmath, and maybe build the map in another way + // (e.g. exact constellations of segment-id's), maybe adaptive. + epsilon = std::numeric_limits::epsilon() * 100.0; + } + + inline bool operator()(P const& a, P const& b) const + { + coordinate_type const dx = math::abs(geometry::get<0>(a) - geometry::get<0>(b)); + coordinate_type const dy = math::abs(geometry::get<1>(a) - geometry::get<1>(b)); + + + if (dx < epsilon && dy < epsilon) + { + return false; + } + if (dx < epsilon) + { + return geometry::get<1>(a) < geometry::get<1>(b); + } + + return geometry::get<0>(a) < geometry::get<0>(b); + } + + inline bool equals(P const& a, P const& b) const + { + typedef typename geometry::coordinate_type

::type coordinate_type; + + coordinate_type const dx = math::abs(geometry::get<0>(a) - geometry::get<0>(b)); + coordinate_type const dy = math::abs(geometry::get<1>(a) - geometry::get<1>(b)); + + return dx < epsilon && dy < epsilon; + }; +}; + + +template +inline T calculate_angle(P1 const& from_point, P2 const& to_point) +{ + typedef P1 vector_type; + vector_type v = from_point; + geometry::subtract_point(v, to_point); + return atan2(geometry::get<1>(v), geometry::get<0>(v)); +} + +template +inline Iterator advance_circular(Iterator it, Vector const& vector, segment_identifier& seg_id, bool forward = true) +{ + int const increment = forward ? 1 : -1; + if (it == boost::begin(vector) && increment < 0) + { + it = boost::end(vector); + seg_id.segment_index = boost::size(vector); + } + it += increment; + seg_id.segment_index += increment; + if (it == boost::end(vector)) + { + seg_id.segment_index = 0; + it = boost::begin(vector); + } + return it; +} + +template +struct angle_info +{ + typedef T angle_type; + typedef Point point_type; + + segment_identifier seg_id; + int turn_index; + int operation_index; + Point intersection_point; + Point direction_point; + T angle; + bool incoming; +}; + +template +class occupation_info +{ + typedef std::vector collection_type; + + struct angle_sort + { + inline bool operator()(AngleInfo const& left, AngleInfo const& right) const + { + // In this case we can compare even double using equals + // return geometry::math::equals(left.angle, right.angle) + return left.angle == right.angle + ? int(left.incoming) < int(right.incoming) + : left.angle < right.angle + ; + } + }; + +public : + collection_type angles; +private : + bool m_occupied; + bool m_calculated; + + inline bool is_occupied() + { + if (boost::size(angles) <= 1) + { + return false; + } + + std::sort(angles.begin(), angles.end(), angle_sort()); + + typedef geometry::closing_iterator closing_iterator; + closing_iterator vit(angles); + closing_iterator end(angles, true); + + closing_iterator prev = vit++; + for( ; vit != end; prev = vit++) + { + if (! geometry::math::equals(prev->angle, vit->angle) + && ! prev->incoming + && vit->incoming) + { + return false; + } + } + return true; + } + +public : + inline occupation_info() + : m_occupied(false) + , m_calculated(false) + {} + + template + inline void add(PointC const& map_point, Point1 const& direction_point, Point2 const& intersection_point, + int turn_index, int operation_index, + segment_identifier const& seg_id, bool incoming) + { + //std::cout << "-> adding angle " << geometry::wkt(direction_point) << " .. " << geometry::wkt(intersection_point) << " " << int(incoming) << std::endl; + if (geometry::equals(direction_point, intersection_point)) + { + //std::cout << "EQUAL! Skipping" << std::endl; + return; + } + + AngleInfo info; + info.incoming = incoming; + info.angle = calculate_angle(direction_point, map_point); + info.seg_id = seg_id; + info.turn_index = turn_index; + info.operation_index = operation_index; + info.intersection_point = intersection_point; + info.direction_point = direction_point; + angles.push_back(info); + + m_calculated = false; + } + + inline bool occupied() + { + if (! m_calculated) + { + m_occupied = is_occupied(); + m_calculated = true; + } + return m_occupied; + } + + template + inline void get_left_turns( + Turns& turns, TurnSegmentIndices const& turn_segment_indices, + std::set& keep_indices) + { + std::sort(angles.begin(), angles.end(), angle_sort()); + calculate_left_turns(angles, turns, turn_segment_indices, keep_indices); + } +}; + + +template +inline void add_incoming_and_outgoing_angles(Point const& map_point, Point const& intersection_point, + Ring const& ring, + int turn_index, + int operation_index, + segment_identifier seg_id, + Info& info) +{ + typedef typename boost::range_iterator + < + Ring const + >::type iterator_type; + + int const n = boost::size(ring); + if (seg_id.segment_index >= n || seg_id.segment_index < 0) + { + return; + } + + segment_identifier real_seg_id = seg_id; + iterator_type it = boost::begin(ring) + seg_id.segment_index; + + // TODO: if we use turn-info ("to", "middle"), we know if to advance without resorting to equals + relaxed_less comparator; + + if (comparator.equals(intersection_point, *it)) + { + // It should be equal only once. But otherwise we skip it (in "add") + it = advance_circular(it, ring, seg_id, false); + } + + info.add(map_point, *it, intersection_point, turn_index, operation_index, real_seg_id, true); + + if (comparator.equals(intersection_point, *it)) + { + it = advance_circular(it, ring, real_seg_id); + } + else + { + // Don't upgrade the ID + it = advance_circular(it, ring, seg_id); + } + for (int defensive_check = 0; + comparator.equals(intersection_point, *it) && defensive_check < n; + defensive_check++) + { + it = advance_circular(it, ring, real_seg_id); + } + + info.add(map_point, *it, intersection_point, turn_index, operation_index, real_seg_id, false); +} + + +// Map in two senses of the word: it is a std::map where the key is a point. +// Per point an "occupation_info" record is kept +// Used for the buffer (but will also be used for intersections/unions having complex self-tangencies) +template +class occupation_map +{ +public : + typedef std::map > map_type; + + map_type map; + std::set turn_indices; + + inline OccupationInfo& find_or_insert(Point const& point, Point& mapped_point) + { + typename map_type::iterator it = map.find(point); + if (it == boost::end(map)) + { + std::pair pair + = map.insert(std::make_pair(point, OccupationInfo())); + it = pair.first; + } + mapped_point = it->first; + return it->second; + } + + inline bool contains(Point const& point) const + { + typename map_type::const_iterator it = map.find(point); + return it != boost::end(map); + } + + inline bool contains_turn_index(int index) const + { + return turn_indices.count(index) > 0; + } + + inline void insert_turn_index(int index) + { + turn_indices.insert(index); + } +}; + + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp index eb3e60e48..5ff0b57d6 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP +#include +#include #include #include @@ -73,6 +75,21 @@ inline OutputIterator add_rings(SelectionMap const& map, OutputIterator out) { typedef typename SelectionMap::const_iterator iterator; + typedef typename SelectionMap::mapped_type property_type; + typedef typename property_type::area_type area_type; + + area_type const zero = 0; + std::size_t const min_num_points = core_detail::closure::minimum_ring_size + < + geometry::closure + < + typename boost::range_value + < + RingCollection const + >::type + >::value + >::value; + for (iterator it = boost::begin(map); it != boost::end(map); @@ -99,7 +116,15 @@ inline OutputIterator add_rings(SelectionMap const& map, *child_it, mit->second.reversed, true); } } - *out++ = result; + + // Only add rings if they satisfy minimal requirements. + // This cannot be done earlier (during traversal), not + // everything is figured out yet (sum of positive/negative rings) + if (geometry::num_points(result) >= min_num_points + && math::larger(geometry::area(result), zero)) + { + *out++ = result; + } } } return out; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp index 133530563..5063f49eb 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp @@ -130,7 +130,7 @@ struct assign_visitor return; } - if (outer.real_area > 0) + if (math::larger(outer.real_area, 0)) { if (inner.real_area < 0 || m_check_for_orientation) { @@ -317,13 +317,14 @@ template > inline void assign_parents(Geometry const& geometry, RingCollection const& collection, - RingMap& ring_map) + RingMap& ring_map, + bool check_for_orientation) { // Call it with an empty geometry // (ring_map should be empty for source_id==1) Geometry empty; - assign_parents(geometry, empty, collection, ring_map, true); + assign_parents(geometry, empty, collection, ring_map, check_for_orientation); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp index 3e6a8897f..2003d2350 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp @@ -32,9 +32,18 @@ struct calculate_distance_policy { static bool const include_no_turn = false; static bool const include_degenerate = false; + static bool const include_opposite = false; - template - static inline void apply(Info& info, Point1 const& p1, Point2 const& p2) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& info, Point1 const& p1, Point2 const& p2, + IntersectionInfo const&, DirInfo const&) { info.operations[0].enriched.distance = geometry::comparable_distance(info.point, p1); diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp index 05bd721e7..51955b515 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp @@ -77,12 +77,23 @@ struct convert_ring } else { - interior_rings(destination).resize( - interior_rings(destination).size() + 1); - geometry::convert(source, interior_rings(destination).back()); - if (reverse) + // Avoid adding interior rings which are invalid + // because of its number of points: + std::size_t const min_num_points + = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >::value; + + if (geometry::num_points(source) >= min_num_points) { - boost::reverse(interior_rings(destination).back()); + interior_rings(destination).resize( + interior_rings(destination).size() + 1); + geometry::convert(source, interior_rings(destination).back()); + if (reverse) + { + boost::reverse(interior_rings(destination).back()); + } } } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index 379444428..5e18d0453 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -55,14 +55,14 @@ struct copy_segment_point_range if (second) { index++; - if (index >= boost::size(range)) + if (index >= int(boost::size(range))) { index = 0; } } // Exception? - if (index >= boost::size(range)) + if (index >= int(boost::size(range))) { return false; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index b0183a3ac..805f3923e 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -78,7 +78,7 @@ struct copy_segments_ring int const from_index = seg_id.segment_index + 1; // Sanity check - BOOST_ASSERT(from_index < boost::size(view)); + BOOST_ASSERT(from_index < int(boost::size(view))); ec_iterator it(boost::begin(view), boost::end(view), boost::begin(view) + from_index); @@ -89,7 +89,7 @@ struct copy_segments_ring typedef typename boost::range_difference::type size_type; size_type const count = from_index <= to_index ? to_index - from_index + 1 - : boost::size(view) - from_index + to_index + 1; + : int(boost::size(view)) - from_index + to_index + 1; for (size_type i = 0; i < count; ++i, ++it) { @@ -117,7 +117,7 @@ struct copy_segments_linestring int const from_index = seg_id.segment_index + 1; // Sanity check - if (from_index > to_index || from_index < 0 || to_index >= boost::size(ls)) + if (from_index > to_index || from_index < 0 || to_index >= int(boost::size(ls))) { return; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp index 0bec81694..0cc34255c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp @@ -28,6 +28,7 @@ inline char method_char(detail::overlay::method_type const& method) case method_touch_interior : return 'm'; case method_collinear : return 'c'; case method_equal : return 'e'; + case method_error : return '!'; default : return '?'; } } @@ -42,6 +43,7 @@ inline char operation_char(detail::overlay::operation_type const& operation) case operation_intersection : return 'i'; case operation_blocked : return 'x'; case operation_continue : return 'c'; + case operation_opposite : return 'o'; default : return '?'; } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp index 087092a5f..b110cc960 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp @@ -279,12 +279,12 @@ class follow { // In case of turn point at the same location, we want to have continue/blocked LAST // because that should be followed (intersection) or skipped (difference). - // By chance the enumeration is ordered like that but we keep the safe way here. inline int operation_order(Turn const& turn) const { operation_type const& operation = turn.operations[0].operation; switch(operation) { + case operation_opposite : return 0; case operation_none : return 0; case operation_union : return 1; case operation_intersection : return 2; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp index ad4766550..c2c698057 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp @@ -83,7 +83,7 @@ struct get_ring BOOST_ASSERT ( id.ring_index >= -1 - && id.ring_index < boost::size(interior_rings(polygon)) + && id.ring_index < int(boost::size(interior_rings(polygon))) ); return id.ring_index < 0 ? exterior_ring(polygon) diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index 663d70d9a..b8320d9b7 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -250,9 +250,15 @@ struct touch : public base_turn_handler int const side_pk_q2 = SideStrategy::apply(qj, qk, pk); int const side_pk_p = SideStrategy::apply(pi, pj, pk); int const side_qk_q = SideStrategy::apply(qi, qj, qk); + + bool const both_continue = side_pk_p == 0 && side_qk_q == 0; + bool const robustness_issue_in_continue = both_continue && side_pk_q2 != 0; + bool const q_turns_left = side_qk_q == 1; bool const block_q = side_qk_p1 == 0 - && ! same(side_qi_p1, side_qk_q); + && ! same(side_qi_p1, side_qk_q) + && ! robustness_issue_in_continue + ; // If Pk at same side as Qi/Qk // (the "or" is for collinear case) @@ -278,7 +284,7 @@ struct touch : public base_turn_handler if (side_pk_q1 == 0) { ti.operations[0].operation = operation_blocked; - // Q turns right -> union (both independant), + // Q turns right -> union (both independent), // Q turns left -> intersection ti.operations[1].operation = block_q ? operation_blocked : q_turns_left ? operation_intersection @@ -463,6 +469,45 @@ struct equal : public base_turn_handler }; +template +< + typename TurnInfo, + typename AssignPolicy +> +struct equal_opposite : public base_turn_handler +{ + template + < + typename Point1, + typename Point2, + typename OutputIterator, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Point1 const& pi, Point2 const& qi, + /* by value: */ TurnInfo tp, + OutputIterator& out, + IntersectionInfo const& intersection_info, + DirInfo const& dir_info) + { + // For equal-opposite segments, normally don't do anything. + if (AssignPolicy::include_opposite) + { + tp.method = method_equal; + for (int i = 0; i < 2; i++) + { + tp.operations[i].operation = operation_opposite; + } + for (unsigned int i = 0; i < intersection_info.count; i++) + { + geometry::convert(intersection_info.intersections[i], tp.point); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); + *out++ = tp; + } + } + } +}; + template < typename TurnInfo, @@ -494,6 +539,13 @@ struct collinear : public base_turn_handler - if P arrives and P turns right: intersection for P - if Q arrives and Q turns left: union for Q (=intersection for P) - if Q arrives and Q turns right: intersection for Q (=union for P) + + ROBUSTNESS: p and q are collinear, so you would expect + that side qk//p1 == pk//q1. But that is not always the case + in near-epsilon ranges. Then decision logic is different. + If p arrives, q is further, so the angle qk//p1 is (normally) + more precise than pk//p1 + */ template < @@ -516,12 +568,18 @@ struct collinear : public base_turn_handler // Should not be 0, this is checked before BOOST_ASSERT(arrival != 0); + int const side_p = SideStrategy::apply(pi, pj, pk); + int const side_q = SideStrategy::apply(qi, qj, qk); + // If p arrives, use p, else use q int const side_p_or_q = arrival == 1 - ? SideStrategy::apply(pi, pj, pk) - : SideStrategy::apply(qi, qj, qk) + ? side_p + : side_q ; + int const side_pk = SideStrategy::apply(qi, qj, pk); + int const side_qk = SideStrategy::apply(pi, pj, qk); + // See comments above, // resulting in a strange sort of mathematic rule here: // The arrival-info multiplied by the relevant side @@ -529,7 +587,15 @@ struct collinear : public base_turn_handler int const product = arrival * side_p_or_q; - if(product == 0) + // Robustness: side_p is supposed to be equal to side_pk (because p/q are collinear) + // and side_q to side_qk + bool const robustness_issue = side_pk != side_p || side_qk != side_q; + + if (robustness_issue) + { + handle_robustness(ti, arrival, side_p, side_q, side_pk, side_qk); + } + else if(product == 0) { both(ti, operation_continue); } @@ -538,6 +604,38 @@ struct collinear : public base_turn_handler ui_else_iu(product == 1, ti); } } + + static inline void handle_robustness(TurnInfo& ti, int arrival, + int side_p, int side_q, int side_pk, int side_qk) + { + // We take the longer one, i.e. if q arrives in p (arrival == -1), + // then p exceeds q and we should take p for a union... + + bool use_p_for_union = arrival == -1; + + // ... unless one of the sides consistently directs to the other side + int const consistent_side_p = side_p == side_pk ? side_p : 0; + int const consistent_side_q = side_q == side_qk ? side_q : 0; + if (arrival == -1 && (consistent_side_p == -1 || consistent_side_q == 1)) + { + use_p_for_union = false; + } + if (arrival == 1 && (consistent_side_p == 1 || consistent_side_q == -1)) + { + use_p_for_union = true; + } + + //std::cout << "ROBUSTNESS -> Collinear " + // << " arr: " << arrival + // << " dir: " << side_p << " " << side_q + // << " rev: " << side_pk << " " << side_qk + // << " cst: " << cside_p << " " << cside_q + // << std::boolalpha << " " << use_p_for_union + // << std::endl; + + ui_else_iu(use_p_for_union, ti); + } + }; template @@ -583,6 +681,7 @@ private : TurnInfo& tp, IntersectionInfo const& intersection_info) { int const side_rk_r = SideStrategy::apply(ri, rj, rk); + operation_type blocked = operation_blocked; switch(side_rk_r) { @@ -596,15 +695,24 @@ private : break; case 0 : // No turn on opposite collinear: block, do not traverse - // But this "xx" is ignored here, it is useless to include - // two operation blocked, so the whole point does not need + // But this "xx" is usually ignored, it is useless to include + // two operations blocked, so the whole point does not need // to be generated. // So return false to indicate nothing is to be done. - return false; + if (AssignPolicy::include_opposite) + { + tp.operations[Index].operation = operation_opposite; + blocked = operation_opposite; + } + else + { + return false; + } + break; } // The other direction is always blocked when collinear opposite - tp.operations[1 - Index].operation = operation_blocked; + tp.operations[1 - Index].operation = blocked; // If P arrives within Q, set info on P (which is done above, index=0), // this turn-info belongs to the second intersection point, index=1 @@ -633,32 +741,45 @@ public: IntersectionInfo const& intersection_info, DirInfo const& dir_info) { - /* - std::cout << "arrivals: " - << dir_info.arrival[0] - << "/" << dir_info.arrival[1] - << std::endl; - */ - TurnInfo tp = tp_model; tp.method = method_collinear; - // If P arrives within Q, there is a turn dependant on P + // If P arrives within Q, there is a turn dependent on P if (dir_info.arrival[0] == 1 && set_tp<0>(pi, pj, pk, tp, intersection_info)) { - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); *out++ = tp; } - // If Q arrives within P, there is a turn dependant on Q + // If Q arrives within P, there is a turn dependent on Q if (dir_info.arrival[1] == 1 && set_tp<1>(qi, qj, qk, tp, intersection_info)) { - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); *out++ = tp; } + + if (AssignPolicy::include_opposite) + { + // Handle cases not yet handled above + if ((dir_info.arrival[1] == -1 && dir_info.arrival[0] == 0) + || (dir_info.arrival[0] == -1 && dir_info.arrival[1] == 0)) + { + for (int i = 0; i < 2; i++) + { + tp.operations[i].operation = operation_opposite; + } + for (unsigned int i = 0; i < intersection_info.count; i++) + { + geometry::convert(intersection_info.intersections[i], tp.point); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); + *out++ = tp; + } + } + } + } }; @@ -722,9 +843,17 @@ struct assign_null_policy { static bool const include_no_turn = false; static bool const include_degenerate = false; + static bool const include_opposite = false; - template - static inline void apply(Info& , Point1 const& , Point2 const& ) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& , Point1 const& , Point2 const&, IntersectionInfo const&, DirInfo const&) {} }; @@ -763,8 +892,9 @@ struct get_turn_info typedef typename si::segment_intersection_strategy_type strategy; - - + // Intersect pi-pj with qi-qj + // The points pk and qk are only used do determine more information + // about the turn. template static inline OutputIterator apply( Point1 const& pi, Point1 const& pj, Point1 const& pk, @@ -796,7 +926,7 @@ struct get_turn_info { only_convert::apply(tp, result.template get<0>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -824,7 +954,7 @@ struct get_turn_info policy::template apply<1>(qi, qj, qk, pi, pj, pk, tp, result.template get<0>(), result.template get<1>()); } - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -838,7 +968,7 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -853,7 +983,7 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -871,10 +1001,18 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } - // If they ARE opposite, don't do anything. + else + { + equal_opposite + < + TurnInfo, + AssignPolicy + >::apply(pi, qi, + tp, out, result.template get<0>(), result.template get<1>()); + } } break; case 'c' : @@ -906,7 +1044,7 @@ struct get_turn_info tp, result.template get<0>(), result.template get<1>()); } - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } else @@ -927,7 +1065,7 @@ struct get_turn_info if (AssignPolicy::include_degenerate) { only_convert::apply(tp, result.template get<0>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 5740a8b7b..26629043c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -495,7 +495,7 @@ struct get_turns_cs int source_id1, Range const& range, int source_id2, Box const& box, Turns& turns, - InterruptPolicy& , + InterruptPolicy& interrupt_policy, int multi_index = -1, int ring_index = -1) { if (boost::size(range) <= 1) @@ -557,7 +557,7 @@ struct get_turns_cs get_turns_with_box(seg_id, source_id2, *prev, *it, *next, bp[0], bp[1], bp[2], bp[3], - turns); + turns, interrupt_policy); // Future performance enhancement: // return if told by the interrupt policy } @@ -596,7 +596,8 @@ private: box_point_type const& bp2, box_point_type const& bp3, // Output - Turns& turns) + Turns& turns, + InterruptPolicy& interrupt_policy) { // Depending on code some relations can be left out @@ -622,6 +623,12 @@ private: ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3); TurnPolicy::apply(rp0, rp1, rp2, bp3, bp0, bp1, ti, std::back_inserter(turns)); + + if (InterruptPolicy::enabled) + { + interrupt_policy.apply(turns); + } + } }; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp index 1e878ca52..84ec16f23 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp @@ -252,6 +252,32 @@ private : : order == 1; } + inline bool consider_ix_ix(Indexed const& left, Indexed const& right + , std::string const& // header + ) const + { + // Take first intersection, then blocked. + if (left.subject.operation == operation_intersection + && right.subject.operation == operation_blocked) + { + return true; + } + else if (left.subject.operation == operation_blocked + && right.subject.operation == operation_intersection) + { + return false; + } + + // Default case, should not occur + +#ifdef BOOST_GEOMETRY_DEBUG_ENRICH + std::cout << "ix/ix unhandled" << std::endl; +#endif + //debug_consider(0, left, right, header, false, "-> return", ret); + + return left.index < right.index; + } + inline bool consider_iu_iu(Indexed const& left, Indexed const& right, std::string const& header) const @@ -446,6 +472,11 @@ public : { return consider_iu_iu(left, right, "iu/iu"); } + else if (m_turn_points[left.index].combination(operation_intersection, operation_blocked) + && m_turn_points[right.index].combination(operation_intersection, operation_blocked)) + { + return consider_ix_ix(left, right, "ix/ix"); + } else if (m_turn_points[left.index].both(operation_intersection) && m_turn_points[right.index].both(operation_intersection)) { @@ -493,7 +524,7 @@ public : << "/" << operation_char(m_turn_points[right.index].operations[0].operation) << operation_char(m_turn_points[right.index].operations[1].operation) << " " << " Take " << left.index << " < " << right.index - << std::cout; + << std::endl; #endif return default_order; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index 8bca790d7..f0307eaf8 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -41,14 +41,14 @@ namespace boost { namespace geometry namespace detail { namespace intersection { -template -< - typename Segment1, typename Segment2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_segment_segment_point { + template + < + typename Segment1, typename Segment2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Segment1 const& segment1, Segment2 const& segment2, OutputIterator out, Strategy const& ) @@ -77,14 +77,14 @@ struct intersection_segment_segment_point } }; -template -< - typename Linestring1, typename Linestring2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_linestring_linestring_point { + template + < + typename Linestring1, typename Linestring2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Linestring1 const& linestring1, Linestring2 const& linestring2, OutputIterator out, Strategy const& ) @@ -112,22 +112,12 @@ struct intersection_linestring_linestring_point */ template < - typename LineString, typename Areal, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_linestring_with_areal { - typedef detail::overlay::follow - < - LineStringOut, - LineString, - Areal, - OverlayType - > follower; - #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW) template static inline void debug_follow(Turn const& turn, Operation op, @@ -145,6 +135,11 @@ struct intersection_of_linestring_with_areal } #endif + template + < + typename LineString, typename Areal, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(LineString const& linestring, Areal const& areal, OutputIterator out, Strategy const& ) @@ -154,6 +149,14 @@ struct intersection_of_linestring_with_areal return out; } + typedef detail::overlay::follow + < + LineStringOut, + LineString, + Areal, + OverlayType + > follower; + typedef typename point_type::type point_type; typedef detail::overlay::traversal_turn_info turn_info; @@ -220,18 +223,22 @@ namespace dispatch template < - // tag dispatching: - typename TagIn1, typename TagIn2, typename TagOut, - // orientation - // metafunction finetuning helpers: - bool Areal1, bool Areal2, bool ArealOut, // real types typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + // orientation + bool Reverse1 = detail::overlay::do_reverse::value>::value, + bool Reverse2 = detail::overlay::do_reverse::value>::value, + bool ReverseOut = detail::overlay::do_reverse::value>::value, + // tag dispatching: + typename TagIn1 = typename geometry::tag::type, + typename TagIn2 = typename geometry::tag::type, + typename TagOut = typename geometry::tag::type, + // metafunction finetuning helpers: + bool Areal1 = geometry::is_areal::value, + bool Areal2 = geometry::is_areal::value, + bool ArealOut = geometry::is_areal::value > struct intersection_insert { @@ -245,122 +252,103 @@ struct intersection_insert template < - typename TagIn1, typename TagIn2, typename TagOut, typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename TagIn1, typename TagIn2, typename TagOut > struct intersection_insert < - TagIn1, TagIn2, TagOut, - true, true, true, Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + TagIn1, TagIn2, TagOut, + true, true, true > : detail::overlay::overlay - + {}; // Any areal type with box: template < - typename TagIn, typename TagOut, typename Geometry, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename TagIn, typename TagOut > struct intersection_insert < - TagIn, box_tag, TagOut, - true, true, true, Geometry, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + TagIn, box_tag, TagOut, + true, true, true > : detail::overlay::overlay - + {}; template < typename Segment1, typename Segment2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - segment_tag, segment_tag, point_tag, - false, false, false, Segment1, Segment2, + GeometryOut, + OverlayType, Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - OverlayType, Strategy - > : detail::intersection::intersection_segment_segment_point - < - Segment1, Segment2, - OutputIterator, GeometryOut, - Strategy - > + segment_tag, segment_tag, point_tag, + false, false, false + > : detail::intersection::intersection_segment_segment_point {}; template < typename Linestring1, typename Linestring2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, linestring_tag, point_tag, - false, false, false, Linestring1, Linestring2, + GeometryOut, + OverlayType, Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - OverlayType, Strategy - > : detail::intersection::intersection_linestring_linestring_point - < - Linestring1, Linestring2, - OutputIterator, GeometryOut, - Strategy - > + linestring_tag, linestring_tag, point_tag, + false, false, false + > : detail::intersection::intersection_linestring_linestring_point {}; template < typename Linestring, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, box_tag, linestring_tag, - false, true, false, Linestring, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + linestring_tag, box_tag, linestring_tag, + false, true, false > { + template static inline OutputIterator apply(Linestring const& linestring, Box const& box, OutputIterator out, Strategy const& ) { @@ -375,27 +363,23 @@ struct intersection_insert template < typename Linestring, typename Polygon, - bool ReverseLinestring, bool ReversePolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReversePolygon, bool ReverseOut > struct intersection_insert < - linestring_tag, polygon_tag, linestring_tag, - false, true, false, Linestring, Polygon, - ReverseLinestring, ReversePolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReversePolygon, ReverseOut, + linestring_tag, polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, Polygon, ReversePolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -403,49 +387,44 @@ struct intersection_insert template < typename Linestring, typename Ring, - bool ReverseLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - linestring_tag, ring_tag, linestring_tag, - false, true, false, Linestring, Ring, - ReverseLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReverseRing, ReverseOut, + linestring_tag, ring_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, Ring, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; template < typename Segment, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - segment_tag, box_tag, linestring_tag, - false, true, false, Segment, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + segment_tag, box_tag, linestring_tag, + false, true, false > { + template static inline OutputIterator apply(Segment const& segment, Box const& box, OutputIterator out, Strategy const& ) { @@ -460,25 +439,24 @@ struct intersection_insert template < - typename Tag1, typename Tag2, - bool Areal1, bool Areal2, typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename PointOut, + typename PointOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename Tag1, typename Tag2, + bool Areal1, bool Areal2 > struct intersection_insert < - Tag1, Tag2, point_tag, - Areal1, Areal2, false, Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, PointOut, + PointOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + Tag1, Tag2, point_tag, + Areal1, Areal2, false > { + template static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, OutputIterator out, Strategy const& ) { @@ -504,29 +482,22 @@ struct intersection_insert template < - typename GeometryTag1, typename GeometryTag2, typename GeometryTag3, - bool Areal1, bool Areal2, bool ArealOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename Geometry1, typename Geometry2, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert_reversed { + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, OutputIterator out, Strategy const& strategy) { return intersection_insert < - GeometryTag2, GeometryTag1, GeometryTag3, - Areal2, Areal1, ArealOut, - Geometry2, Geometry1, - Reverse2, Reverse1, ReverseOut, - OutputIterator, GeometryOut, + Geometry2, Geometry1, GeometryOut, OverlayType, - Strategy + Reverse2, Reverse1, ReverseOut >::apply(g2, g1, out, strategy); } }; @@ -561,35 +532,20 @@ inline OutputIterator insert(Geometry1 const& geometry1, geometry::reverse_dispatch::type::value, geometry::dispatch::intersection_insert_reversed < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, + GeometryOut, + OverlayType, overlay::do_reverse::value>::value, overlay::do_reverse::value, ReverseSecond>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - OverlayType, - Strategy + overlay::do_reverse::value>::value >, geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, ReverseSecond>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, ReverseSecond>::value > >::type::apply(geometry1, geometry2, out, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp index ab5b6d123..8b89d39c5 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp @@ -134,12 +134,12 @@ template < typename Geometry1, typename Geometry2, bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, - overlay_type Direction, - typename Strategy + typename GeometryOut, + overlay_type Direction > struct overlay { + template static inline OutputIterator apply( Geometry1 const& geometry1, Geometry2 const& geometry2, OutputIterator out, @@ -233,7 +233,7 @@ std::cout << "traverse" << std::endl; std::cout << "map_turns: " << timer.elapsed() << std::endl; #endif - typedef ring_properties::type> properties; + typedef ring_properties::type> properties; std::map selected; select_rings(geometry1, geometry2, map, selected, ! turn_points.empty()); diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index 12daafa0c..02dd01d6c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include #include #include @@ -233,6 +235,7 @@ public : detail::overlay::operation_type operation, Turns& turns, Rings& rings) { + typedef typename boost::range_value::type ring_type; typedef typename boost::range_iterator::type turn_iterator; typedef typename boost::range_value::type turn_type; typedef typename boost::range_iterator @@ -240,6 +243,12 @@ public : typename turn_type::container_type >::type turn_operation_iterator_type; + std::size_t const min_num_points + = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >::value; + std::size_t size_at_start = boost::size(rings); typename Backtrack::state_type state; @@ -267,7 +276,7 @@ public : { set_visited_for_continue(*it, *iit); - typename boost::range_value::type current_output; + ring_type current_output; detail::overlay::append_no_duplicates(current_output, it->point, true); @@ -376,7 +385,10 @@ public : { iit->visited.set_finished(); detail::overlay::debug_traverse(*current, *iit, "->Finished"); - rings.push_back(current_output); + if (geometry::num_points(current_output) >= min_num_points) + { + rings.push_back(current_output); + } } } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp index aa6b428f1..89a60b21a 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp @@ -28,7 +28,8 @@ enum operation_type operation_union, operation_intersection, operation_blocked, - operation_continue + operation_continue, + operation_opposite }; @@ -102,6 +103,12 @@ struct turn_info { return has12(type, type); } + + inline bool has(operation_type type) const + { + return this->operations[0].operation == type + || this->operations[1].operation == type; + } inline bool combination(operation_type type1, operation_type type2) const { @@ -114,10 +121,13 @@ struct turn_info { return both(operation_blocked); } + inline bool opposite() const + { + return both(operation_opposite); + } inline bool any_blocked() const { - return this->operations[0].operation == operation_blocked - || this->operations[1].operation == operation_blocked; + return has(operation_blocked); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp index 7a7de2cdd..45ff52ccb 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp @@ -153,12 +153,12 @@ class partition_one_collection static inline void next_level(Box const& box, InputCollection const& collection, index_vector_type const& input, - int level, int min_elements, + int level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { if (boost::size(input) > 0) { - if (boost::size(input) > min_elements && level < 100) + if (std::size_t(boost::size(input)) > min_elements && level < 100) { sub_divide::apply(box, collection, input, level + 1, min_elements, policy, box_policy); @@ -176,7 +176,7 @@ public : InputCollection const& collection, index_vector_type const& input, int level, - int min_elements, + std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); @@ -230,13 +230,13 @@ class partition_two_collections index_vector_type const& input1, InputCollection const& collection2, index_vector_type const& input2, - int level, int min_elements, + int level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { if (boost::size(input1) > 0 && boost::size(input2) > 0) { - if (boost::size(input1) > min_elements - && boost::size(input2) > min_elements + if (std::size_t(boost::size(input1)) > min_elements + && std::size_t(boost::size(input2)) > min_elements && level < 100) { sub_divide::apply(box, collection1, input1, collection2, @@ -257,7 +257,7 @@ public : InputCollection const& collection1, index_vector_type const& input1, InputCollection const& collection2, index_vector_type const& input2, int level, - int min_elements, + std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); @@ -335,11 +335,11 @@ public : template static inline void apply(InputCollection const& collection, VisitPolicy& visitor, - int min_elements = 16, + std::size_t min_elements = 16, VisitBoxPolicy box_visitor = visit_no_policy() ) { - if (boost::size(collection) > min_elements) + if (std::size_t(boost::size(collection)) > min_elements) { index_vector_type index_vector; Box total; @@ -377,12 +377,12 @@ public : static inline void apply(InputCollection const& collection1, InputCollection const& collection2, VisitPolicy& visitor, - int min_elements = 16, + std::size_t min_elements = 16, VisitBoxPolicy box_visitor = visit_no_policy() ) { - if (boost::size(collection1) > min_elements - && boost::size(collection2) > min_elements) + if (std::size_t(boost::size(collection1)) > min_elements + && std::size_t(boost::size(collection2)) > min_elements) { index_vector_type index_vector1, index_vector2; Box total; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp index 33177924a..b7e15ba3f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp @@ -25,6 +25,7 @@ #include #include +#include #include @@ -50,7 +51,8 @@ struct get_point template struct midpoint_helper { - static inline bool apply(Point& p, Point const& p1, Point const& p2) + template + static inline bool apply(Point& p, InputPoint const& p1, InputPoint const& p2) { typename coordinate_type::type const two = 2; set(p, @@ -63,7 +65,8 @@ struct midpoint_helper template struct midpoint_helper { - static inline bool apply(Point& , Point const& , Point const& ) + template + static inline bool apply(Point& , InputPoint const& , InputPoint const& ) { return true; } @@ -102,7 +105,7 @@ struct point_on_range if (n > 0) { - point = *boost::begin(range); + geometry::detail::conversion::convert_point_to_point(*boost::begin(range), point); return true; } return false; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 36bcbdd6e..a6e6837fe 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -254,7 +254,7 @@ struct sectionalize_part Range const& range, ring_identifier ring_id) { - if (boost::size(range) <= index) + if (int(boost::size(range)) <= index) { return; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/difference.hpp b/project/jni/boost/include/boost/geometry/algorithms/difference.hpp index 480dd928d..2f32b344c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/difference.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/difference.hpp @@ -56,19 +56,11 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1, return geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, true>::value >::apply(geometry1, geometry2, out, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp b/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp index f36b8dbdd..b2de6e01d 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -44,15 +45,57 @@ namespace boost { namespace geometry namespace detail { namespace disjoint { +template +struct check_each_ring_for_within +{ + bool has_within; + Geometry const& m_geometry; + + inline check_each_ring_for_within(Geometry const& g) + : has_within(false) + , m_geometry(g) + {} + + template + inline void apply(Range const& range) + { + typename geometry::point_type::type p; + geometry::point_on_border(p, range); + if (geometry::within(p, m_geometry)) + { + has_within = true; + } + } +}; + +template +inline bool rings_containing(FirstGeometry const& geometry1, + SecondGeometry const& geometry2) +{ + check_each_ring_for_within checker(geometry1); + geometry::detail::for_each_range(geometry2, checker); + return checker.has_within; +} + + struct assign_disjoint_policy { // We want to include all points: static bool const include_no_turn = true; static bool const include_degenerate = true; + static bool const include_opposite = true; // We don't assign extra info: - template - static inline void apply(Info& , Point1 const& , Point2 const& ) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& , Point1 const& , Point2 const&, + IntersectionInfo const&, DirInfo const&) {} }; @@ -107,8 +150,6 @@ struct disjoint_segment } }; - - template struct general_areal { @@ -119,20 +160,10 @@ struct general_areal return false; } - typedef typename geometry::point_type::type point_type; - // If there is no intersection of segments, they might located // inside each other - point_type p1; - geometry::point_on_border(p1, geometry1); - if (geometry::within(p1, geometry2)) - { - return false; - } - - typename geometry::point_type::type p2; - geometry::point_on_border(p2, geometry2); - if (geometry::within(p2, geometry1)) + if (rings_containing(geometry1, geometry2) + || rings_containing(geometry2, geometry1)) { return false; } @@ -153,68 +184,82 @@ namespace dispatch template < - typename GeometryTag1, typename GeometryTag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + std::size_t DimensionCount = dimension::type::value, + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type, + bool Reverse = reverse_dispatch::type::value > struct disjoint : detail::disjoint::general_areal {}; -template -struct disjoint - : detail::disjoint::point_point -{}; - - -template -struct disjoint - : detail::disjoint::box_box -{}; - - -template -struct disjoint - : detail::disjoint::point_box -{}; - -template -struct disjoint - : detail::disjoint::disjoint_linear -{}; - -template -struct disjoint - : detail::disjoint::disjoint_segment -{}; - -template -struct disjoint - : detail::disjoint::disjoint_linear -{}; - - +// If reversal is needed, perform it template < - typename GeometryTag1, typename GeometryTag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + std::size_t DimensionCount, + typename Tag1, typename Tag2 > -struct disjoint_reversed +struct disjoint + : disjoint { static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) { return disjoint < - GeometryTag2, GeometryTag1, Geometry2, Geometry1, - DimensionCount + DimensionCount, + Tag2, Tag1 >::apply(g2, g1); } }; +template +struct disjoint + : detail::disjoint::point_point +{}; + + +template +struct disjoint + : detail::disjoint::box_box +{}; + + +template +struct disjoint + : detail::disjoint::point_box +{}; + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +template +struct disjoint + : detail::disjoint::disjoint_linear +{}; + +template +struct disjoint + : detail::disjoint::disjoint_segment +{}; + +template +struct disjoint + : detail::disjoint::disjoint_linear +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -241,26 +286,7 @@ inline bool disjoint(Geometry1 const& geometry1, Geometry2 const >(); - return boost::mpl::if_c - < - reverse_dispatch::type::value, - dispatch::disjoint_reversed - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - >, - dispatch::disjoint - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - > - >::type::apply(geometry1, geometry2); + return dispatch::disjoint::apply(geometry1, geometry2); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/distance.hpp b/project/jni/boost/include/boost/geometry/algorithms/distance.hpp index eca3b03c7..c5a65ba15 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/distance.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/distance.hpp @@ -130,7 +130,7 @@ struct point_to_range // check if other segments are closer for (++prev, ++it; it != boost::end(view); ++prev, ++it) { - return_type const ds = ps_strategy.apply(point, *prev, *it); + return_type const ds = eps_strategy.apply(point, *prev, *it); if (geometry::math::equals(ds, zero)) { return ds; @@ -369,7 +369,10 @@ struct distance < segment_tag, Point, - typename point_type::type + typename point_type::type, + typename cs_tag::type, + typename cs_tag::type>::type, + Strategy >::type ps_strategy_type; return detail::distance::point_to_range diff --git a/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp b/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp index da34f6a78..ee88fe888 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP #define BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP -#include #include #include #include #include +#include #include #include #include @@ -35,9 +35,9 @@ namespace detail { namespace envelope /// Calculate envelope of an 2D or 3D segment -template struct envelope_expand_one { + template static inline void apply(Geometry const& geometry, Box& mbr) { assign_inverse(mbr); @@ -63,10 +63,10 @@ inline void envelope_range_additional(Range const& range, Box& mbr) /// Generic range dispatching struct -template struct envelope_range { /// Calculate envelope of range using a strategy + template static inline void apply(Range const& range, Box& mbr) { assign_inverse(mbr); @@ -82,122 +82,54 @@ namespace dispatch { -// Note, the strategy is for future use (less/greater -> compare spherical -// using other methods), defaults are OK for now. -// However, they are already in the template methods - template < - typename Tag1, typename Tag2, - typename Geometry, typename Box, - typename StrategyLess, typename StrategyGreater + typename Geometry, + typename Tag = typename tag::type > -struct envelope -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +struct envelope: not_implemented +{}; -template -< - typename Point, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - point_tag, box_tag, - Point, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename BoxIn, typename BoxOut, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - box_tag, box_tag, - BoxIn, BoxOut, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename Segment, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - segment_tag, box_tag, - Segment, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename Linestring, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - linestring_tag, box_tag, - Linestring, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Ring, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - ring_tag, box_tag, - Ring, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Polygon, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - polygon_tag, box_tag, - Polygon, Box, - StrategyLess, StrategyGreater - > +template +struct envelope + : detail::envelope::envelope_range { + template static inline void apply(Polygon const& poly, Box& mbr) { // For polygon, inspecting outer ring is sufficient - - detail::envelope::envelope_range - < - typename ring_type::type, - Box - >::apply(exterior_ring(poly), mbr); + detail::envelope::envelope_range::apply(exterior_ring(poly), mbr); } }; @@ -228,12 +160,7 @@ inline void envelope(Geometry const& geometry, Box& mbr) concept::check(); concept::check(); - dispatch::envelope - < - typename tag::type, typename tag::type, - Geometry, Box, - void, void - >::apply(geometry, mbr); + dispatch::envelope::apply(geometry, mbr); } @@ -259,12 +186,7 @@ inline Box return_envelope(Geometry const& geometry) concept::check(); Box mbr; - dispatch::envelope - < - typename tag::type, typename tag::type, - Geometry, Box, - void, void - >::apply(geometry, mbr); + dispatch::envelope::apply(geometry, mbr); return mbr; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/equals.hpp b/project/jni/boost/include/boost/geometry/algorithms/equals.hpp index 6b094f76d..d9502bb3f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/equals.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/equals.hpp @@ -18,8 +18,6 @@ #include #include -#include -#include #include #include @@ -30,6 +28,7 @@ #include #include +#include // For trivial checks #include @@ -51,13 +50,12 @@ namespace detail { namespace equals template < - typename Box1, - typename Box2, std::size_t Dimension, std::size_t DimensionCount > struct box_box { + template static inline bool apply(Box1 const& box1, Box2 const& box2) { if (!geometry::math::equals(get(box1), get(box2)) @@ -65,13 +63,14 @@ struct box_box { return false; } - return box_box::apply(box1, box2); + return box_box::apply(box1, box2); } }; -template -struct box_box +template +struct box_box { + template static inline bool apply(Box1 const& , Box2 const& ) { return true; @@ -103,9 +102,10 @@ struct length_check }; -template +template struct equals_by_collection { + template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2) { if (! TrivialCheck::apply(geometry1, geometry2)) @@ -152,17 +152,42 @@ namespace dispatch template < - typename Tag1, typename Tag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type, + std::size_t DimensionCount = dimension::type::value, + bool Reverse = reverse_dispatch::type::value > -struct equals +struct equals: not_implemented {}; -template -struct equals +// If reversal is needed, perform it +template +< + typename Geometry1, typename Geometry2, + typename Tag1, typename Tag2, + std::size_t DimensionCount +> +struct equals + : equals +{ + static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) + { + return equals + < + Geometry2, Geometry1, + Tag2, Tag1, + DimensionCount, + false + >::apply(g2, g1); + } +}; + + +template +struct equals : geometry::detail::not_ < P1, @@ -172,93 +197,48 @@ struct equals {}; -template -struct equals - : detail::equals::box_box +template +struct equals + : detail::equals::box_box<0, DimensionCount> {}; -template -struct equals - : detail::equals::equals_by_collection - < - Ring1, Ring2, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon1, Polygon2, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - LineString1, LineString2, - detail::equals::length_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon, Ring, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Ring, Box, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon, Box, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -< - typename Tag1, typename Tag2, - typename Geometry1, - typename Geometry2, - std::size_t DimensionCount -> -struct equals_reversed -{ - static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) - { - return equals - < - Tag2, Tag1, - Geometry2, Geometry1, - DimensionCount - >::apply(g2, g1); - } -}; - - } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -289,26 +269,7 @@ inline bool equals(Geometry1 const& geometry1, Geometry2 const& geometry2) Geometry2 const >(); - return boost::mpl::if_c - < - reverse_dispatch::type::value, - dispatch::equals_reversed - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - >, - dispatch::equals - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - > - >::type::apply(geometry1, geometry2); + return dispatch::equals::apply(geometry1, geometry2); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/expand.hpp b/project/jni/boost/include/boost/geometry/algorithms/expand.hpp index da7442b59..2e1531bf0 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/expand.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/expand.hpp @@ -19,6 +19,7 @@ #include +#include #include #include @@ -38,26 +39,26 @@ namespace detail { namespace expand template < - typename Box, typename Point, typename StrategyLess, typename StrategyGreater, std::size_t Dimension, std::size_t DimensionCount > struct point_loop { - typedef typename strategy::compare::detail::select_strategy - < - StrategyLess, 1, Point, Dimension - >::type less_type; - - typedef typename strategy::compare::detail::select_strategy - < - StrategyGreater, -1, Point, Dimension - >::type greater_type; - - typedef typename select_coordinate_type::type coordinate_type; - + template static inline void apply(Box& box, Point const& source) { + typedef typename strategy::compare::detail::select_strategy + < + StrategyLess, 1, Point, Dimension + >::type less_type; + + typedef typename strategy::compare::detail::select_strategy + < + StrategyGreater, -1, Point, Dimension + >::type greater_type; + + typedef typename select_coordinate_type::type coordinate_type; + less_type less; greater_type greater; @@ -75,7 +76,6 @@ struct point_loop point_loop < - Box, Point, StrategyLess, StrategyGreater, Dimension + 1, DimensionCount >::apply(box, source); @@ -85,49 +85,47 @@ struct point_loop template < - typename Box, typename Point, typename StrategyLess, typename StrategyGreater, std::size_t DimensionCount > struct point_loop < - Box, Point, StrategyLess, StrategyGreater, DimensionCount, DimensionCount > { + template static inline void apply(Box&, Point const&) {} }; template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater, std::size_t Index, std::size_t Dimension, std::size_t DimensionCount > struct indexed_loop { - typedef typename strategy::compare::detail::select_strategy - < - StrategyLess, 1, Box, Dimension - >::type less_type; - - typedef typename strategy::compare::detail::select_strategy - < - StrategyGreater, -1, Box, Dimension - >::type greater_type; - - typedef typename select_coordinate_type - < - Box, - Geometry - >::type coordinate_type; - - + template static inline void apply(Box& box, Geometry const& source) { + typedef typename strategy::compare::detail::select_strategy + < + StrategyLess, 1, Box, Dimension + >::type less_type; + + typedef typename strategy::compare::detail::select_strategy + < + StrategyGreater, -1, Box, Dimension + >::type greater_type; + + typedef typename select_coordinate_type + < + Box, + Geometry + >::type coordinate_type; + less_type less; greater_type greater; @@ -145,7 +143,6 @@ struct indexed_loop indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, Index, Dimension + 1, DimensionCount >::apply(box, source); @@ -155,17 +152,16 @@ struct indexed_loop template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater, std::size_t Index, std::size_t DimensionCount > struct indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, Index, DimensionCount, DimensionCount > { + template static inline void apply(Box&, Geometry const&) {} }; @@ -174,23 +170,21 @@ struct indexed_loop // Changes a box such that the other box is also contained by the box template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater > struct expand_indexed { + template static inline void apply(Box& box, Geometry const& geometry) { indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, 0, 0, dimension::type::value >::apply(box, geometry); indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, 1, 0, dimension::type::value >::apply(box, geometry); @@ -206,11 +200,13 @@ namespace dispatch template < - typename Tag, - typename BoxOut, typename Geometry, - typename StrategyLess, typename StrategyGreater + typename GeometryOut, typename Geometry, + typename StrategyLess = strategy::compare::default_strategy, + typename StrategyGreater = strategy::compare::default_strategy, + typename TagOut = typename tag::type, + typename Tag = typename tag::type > -struct expand +struct expand: not_implemented {}; @@ -220,10 +216,9 @@ template typename BoxOut, typename Point, typename StrategyLess, typename StrategyGreater > -struct expand +struct expand : detail::expand::point_loop < - BoxOut, Point, StrategyLess, StrategyGreater, 0, dimension::type::value > @@ -236,9 +231,8 @@ template typename BoxOut, typename BoxIn, typename StrategyLess, typename StrategyGreater > -struct expand - : detail::expand::expand_indexed - +struct expand + : detail::expand::expand_indexed {}; template @@ -246,9 +240,8 @@ template typename Box, typename Segment, typename StrategyLess, typename StrategyGreater > -struct expand - : detail::expand::expand_indexed - +struct expand + : detail::expand::expand_indexed {}; @@ -279,13 +272,7 @@ inline void expand(Box& box, Geometry const& geometry, { concept::check_concepts_and_equal_dimensions(); - dispatch::expand - < - typename tag::type, - Box, - Geometry, - StrategyLess, StrategyGreater - >::apply(box, geometry); + dispatch::expand::apply(box, geometry); } ***/ @@ -305,13 +292,7 @@ inline void expand(Box& box, Geometry const& geometry) { concept::check_concepts_and_equal_dimensions(); - dispatch::expand - < - typename tag::type, - Box, Geometry, - strategy::compare::default_strategy, - strategy::compare::default_strategy - >::apply(box, geometry); + dispatch::expand::apply(box, geometry); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp b/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp index 671f26a70..06a400cf6 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp @@ -18,8 +18,10 @@ #include #include +#include #include +#include #include #include #include @@ -39,53 +41,55 @@ namespace detail { namespace for_each { -template struct fe_point_per_point { - static inline Functor apply( - typename add_const_if_c::type& point, Functor f) + template + static inline void apply(Point& point, Functor& f) { f(point); - return f; } }; -template struct fe_point_per_segment { - static inline Functor apply( - typename add_const_if_c::type& , Functor f) + template + static inline void apply(Point& , Functor& f) { // TODO: if non-const, we should extract the points from the segment // and call the functor on those two points - return f; } }; -template struct fe_range_per_point { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + template + static inline void apply(Range& range, Functor& f) { - return (std::for_each(boost::begin(range), boost::end(range), f)); + // The previous implementation called the std library: + // return (std::for_each(boost::begin(range), boost::end(range), f)); + // But that is not accepted for capturing lambda's. + // It needs to do it like that to return the state of Functor f (f is passed by value in std::for_each). + + // So we now loop manually. + + for (typename boost::range_iterator::type it = boost::begin(range); it != boost::end(range); ++it) + { + f(*it); + } } }; -template struct fe_range_per_segment { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + template + static inline void apply(Range& range, Functor& f) { typedef typename add_const_if_c < - IsConst, + is_const::value, typename point_type::type >::type point_type; @@ -97,65 +101,41 @@ struct fe_range_per_segment f(s); previous = it++; } - - return f; } }; -template struct fe_polygon_per_point { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + template + static inline void apply(Polygon& poly, Functor& f) { - typedef fe_range_per_point - < - typename ring_type::type, - Functor, - IsConst - > per_ring; + fe_range_per_point::apply(exterior_ring(poly), f); - f = per_ring::apply(exterior_ring(poly), f); - - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - f = per_ring::apply(*it, f); + fe_range_per_point::apply(*it, f); } - - return f; } }; -template struct fe_polygon_per_segment { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + template + static inline void apply(Polygon& poly, Functor& f) { - typedef fe_range_per_segment - < - typename ring_type::type, - Functor, - IsConst - > per_ring; + fe_range_per_segment::apply(exterior_ring(poly), f); - f = per_ring::apply(exterior_ring(poly), f); - - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - f = per_ring::apply(*it, f); + fe_range_per_segment::apply(*it, f); } - - return f; } }; @@ -171,68 +151,66 @@ namespace dispatch template < - typename Tag, typename Geometry, - typename Functor, - bool IsConst + typename Tag = typename tag_cast::type, multi_tag>::type > -struct for_each_point {}; - - -template -struct for_each_point - : detail::for_each::fe_point_per_point +struct for_each_point: not_implemented {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_point_per_point {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point {}; -template -struct for_each_point - : detail::for_each::fe_polygon_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point +{}; + + +template +struct for_each_point + : detail::for_each::fe_polygon_per_point {}; template < - typename Tag, typename Geometry, - typename Functor, - bool IsConst + typename Tag = typename tag_cast::type, multi_tag>::type > -struct for_each_segment {}; +struct for_each_segment: not_implemented +{}; -template -struct for_each_segment - : detail::for_each::fe_point_per_segment +template +struct for_each_segment + : detail::for_each::fe_point_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_polygon_per_segment +template +struct for_each_segment + : detail::for_each::fe_polygon_per_segment {}; @@ -240,35 +218,6 @@ struct for_each_segment #endif // DOXYGEN_NO_DISPATCH -/*! -\brief \brf_for_each{point} -\details \det_for_each{point} -\ingroup for_each -\param geometry \param_geometry -\param f \par_for_each_f{const point} -\tparam Geometry \tparam_geometry -\tparam Functor \tparam_functor - -\qbk{distinguish,const version} -\qbk{[include reference/algorithms/for_each_point.qbk]} -\qbk{[heading Example]} -\qbk{[for_each_point_const] [for_each_point_const_output]} -*/ -template -inline Functor for_each_point(Geometry const& geometry, Functor f) -{ - concept::check(); - - return dispatch::for_each_point - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - true - >::apply(geometry, f); -} - - /*! \brief \brf_for_each{point} \details \det_for_each{point} @@ -281,48 +230,15 @@ inline Functor for_each_point(Geometry const& geometry, Functor f) \qbk{[include reference/algorithms/for_each_point.qbk]} \qbk{[heading Example]} \qbk{[for_each_point] [for_each_point_output]} +\qbk{[for_each_point_const] [for_each_point_const_output]} */ template inline Functor for_each_point(Geometry& geometry, Functor f) { concept::check(); - return dispatch::for_each_point - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - false - >::apply(geometry, f); -} - - -/*! -\brief \brf_for_each{segment} -\details \det_for_each{segment} -\ingroup for_each -\param geometry \param_geometry -\param f \par_for_each_f{const segment} -\tparam Geometry \tparam_geometry -\tparam Functor \tparam_functor - -\qbk{distinguish,const version} -\qbk{[include reference/algorithms/for_each_segment.qbk]} -\qbk{[heading Example]} -\qbk{[for_each_segment_const] [for_each_segment_const_output]} -*/ -template -inline Functor for_each_segment(Geometry const& geometry, Functor f) -{ - concept::check(); - - return dispatch::for_each_segment - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - true - >::apply(geometry, f); + dispatch::for_each_point::apply(geometry, f); + return f; } @@ -336,19 +252,16 @@ inline Functor for_each_segment(Geometry const& geometry, Functor f) \tparam Functor \tparam_functor \qbk{[include reference/algorithms/for_each_segment.qbk]} +\qbk{[heading Example]} +\qbk{[for_each_segment_const] [for_each_segment_const_output]} */ template inline Functor for_each_segment(Geometry& geometry, Functor f) { concept::check(); - return dispatch::for_each_segment - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - false - >::apply(geometry, f); + dispatch::for_each_segment::apply(geometry, f); + return f; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp b/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp index 8d3dd68b3..3125752db 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp @@ -22,15 +22,14 @@ namespace boost { namespace geometry namespace detail { namespace intersection { -template -< - typename Box1, typename Box2, - typename BoxOut, - typename Strategy, - std::size_t Dimension, std::size_t DimensionCount -> +template struct intersection_box_box { + template + < + typename Box1, typename Box2, typename BoxOut, + typename Strategy + > static inline bool apply(Box1 const& box1, Box2 const& box2, BoxOut& box_out, Strategy const& strategy) @@ -50,23 +49,19 @@ struct intersection_box_box set(box_out, min1 < min2 ? min2 : min1); set(box_out, max1 > max2 ? max2 : max1); - return intersection_box_box - < - Box1, Box2, BoxOut, Strategy, - Dimension + 1, DimensionCount - >::apply(box1, box2, box_out, strategy); + return intersection_box_box + ::apply(box1, box2, box_out, strategy); } }; -template -< - typename Box1, typename Box2, - typename BoxOut, - typename Strategy, - std::size_t DimensionCount -> -struct intersection_box_box +template +struct intersection_box_box { + template + < + typename Box1, typename Box2, typename BoxOut, + typename Strategy + > static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&) { return true; @@ -86,15 +81,14 @@ namespace dispatch // By default, all is forwarded to the intersection_insert-dispatcher template < - typename Tag1, typename Tag2, typename TagOut, typename Geometry1, typename Geometry2, - typename GeometryOut, - typename Strategy + typename Tag1 = typename geometry::tag::type, + typename Tag2 = typename geometry::tag::type, + bool Reverse = reverse_dispatch::type::value > struct intersection { - typedef std::back_insert_iterator output_iterator; - + template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, GeometryOut& geometry_out, @@ -104,17 +98,8 @@ struct intersection intersection_insert < - Tag1, Tag2, typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - detail::overlay::do_reverse::value, false>::value, - detail::overlay::do_reverse::value, false>::value, - detail::overlay::do_reverse::value>::value, - output_iterator, OneOut, - overlay_intersection, - Strategy + Geometry1, Geometry2, OneOut, + overlay_intersection >::apply(geometry1, geometry2, std::back_inserter(geometry_out), strategy); return true; @@ -123,50 +108,50 @@ struct intersection }; +// If reversal is needed, perform it template < - typename Box1, typename Box2, - typename BoxOut, - typename Strategy + typename Geometry1, typename Geometry2, + typename Tag1, typename Tag2 > struct intersection - < - box_tag, box_tag, box_tag, - Box1, Box2, BoxOut, - Strategy - > : public detail::intersection::intersection_box_box - < - Box1, Box2, BoxOut, - Strategy, - 0, geometry::dimension::value - > -{}; - - -template < - typename Tag1, typename Tag2, typename TagOut, - typename Geometry1, typename Geometry2, - typename GeometryOut, - typename Strategy + Geometry1, Geometry2, + Tag1, Tag2, + true > -struct intersection_reversed + : intersection { - static inline bool apply(Geometry1 const& geometry1, - Geometry2 const& geometry2, - GeometryOut& geometry_out, - Strategy const& strategy) + template + static inline bool apply( + Geometry1 const& g1, + Geometry2 const& g2, + GeometryOut& out, + Strategy const& strategy) { - return intersection - < - Tag2, Tag1, TagOut, - Geometry2, Geometry1, - GeometryOut, Strategy - >::apply(geometry2, geometry1, geometry_out, strategy); + return intersection< + Geometry2, Geometry1, + Tag2, Tag1, + false + >::apply(g2, g1, out, strategy); } }; +template +< + typename Box1, typename Box2, bool Reverse +> +struct intersection + < + Box1, Box2, + box_tag, box_tag, + Reverse + > : public detail::intersection::intersection_box_box + < + 0, geometry::dimension::value + > +{}; } // namespace dispatch @@ -210,24 +195,10 @@ inline bool intersection(Geometry1 const& geometry1, > strategy; - return boost::mpl::if_c - < - geometry::reverse_dispatch::type::value, - dispatch::intersection_reversed - < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - Geometry1, Geometry2, GeometryOut, strategy - >, - dispatch::intersection - < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - Geometry1, Geometry2, GeometryOut, strategy - > - >::type::apply(geometry1, geometry2, geometry_out, strategy()); + return dispatch::intersection< + Geometry1, + Geometry2 + >::apply(geometry1, geometry2, geometry_out, strategy()); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/length.hpp b/project/jni/boost/include/boost/geometry/algorithms/length.hpp index de53a39e8..b537186a3 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/length.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/length.hpp @@ -43,9 +43,10 @@ namespace detail { namespace length { -template +template struct segment_length { + template static inline typename default_length_result::type apply( Segment const& segment, Strategy const& strategy) { @@ -63,11 +64,12 @@ struct segment_length \note for_each could be used here, now that point_type is changed by boost range iterator */ -template +template struct range_length { typedef typename default_length_result::type return_type; + template static inline return_type apply( Range const& range, Strategy const& strategy) { @@ -106,28 +108,31 @@ namespace dispatch { -template +template ::type> struct length : detail::calculate_null - < - typename default_length_result::type, - Geometry, - Strategy - > -{}; +{ + typedef typename default_length_result::type return_type; + + template + static inline return_type apply(Geometry const& geometry, Strategy const& strategy) + { + return calculate_null::apply(geometry, strategy); + } +}; -template -struct length - : detail::length::range_length +template +struct length + : detail::length::range_length {}; // RING: length is currently 0; it might be argued that it is the "perimeter" -template -struct length - : detail::length::segment_length +template +struct length + : detail::length::segment_length {}; @@ -159,12 +164,7 @@ inline typename default_length_result::type length( point_tag, typename point_type::type >::type strategy_type; - return dispatch::length - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, strategy_type()); + return dispatch::length::apply(geometry, strategy_type()); } @@ -190,12 +190,7 @@ inline typename default_length_result::type length( // detail::throw_on_empty_input(geometry); - return dispatch::length - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, strategy); + return dispatch::length::apply(geometry, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp index 20f35e90d..58afe4b97 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -35,19 +35,22 @@ namespace dispatch { -template -struct num_geometries -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +template +< + typename Geometry, + typename Tag = typename tag_cast + < + typename tag::type, + single_tag, + multi_tag + >::type +> +struct num_geometries: not_implemented +{}; template -struct num_geometries +struct num_geometries { static inline std::size_t apply(Geometry const&) { @@ -76,16 +79,7 @@ inline std::size_t num_geometries(Geometry const& geometry) { concept::check(); - return dispatch::num_geometries - < - typename tag_cast - < - typename tag::type, - single_tag, - multi_tag - >::type, - Geometry - >::apply(geometry); + return dispatch::num_geometries::apply(geometry); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp index 2149f4657..e815f5981 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp @@ -32,7 +32,7 @@ namespace dispatch { -template +template ::type> struct num_interior_rings { static inline std::size_t apply(Geometry const& ) @@ -44,7 +44,7 @@ struct num_interior_rings template -struct num_interior_rings +struct num_interior_rings { static inline std::size_t apply(Polygon const& polygon) { @@ -74,11 +74,7 @@ struct num_interior_rings template inline std::size_t num_interior_rings(Geometry const& geometry) { - return dispatch::num_interior_rings - < - typename tag::type, - Geometry - >::apply(geometry); + return dispatch::num_interior_rings::apply(geometry); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp index c480068f4..e5a7aef6d 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp @@ -16,7 +16,6 @@ #include -#include #include #include @@ -27,6 +26,7 @@ #include #include +#include #include @@ -38,9 +38,9 @@ namespace detail { namespace num_points { -template struct range_count { + template static inline std::size_t apply(Range const& range, bool add_for_open) { std::size_t n = boost::size(range); @@ -60,30 +60,31 @@ struct range_count } }; -template +template struct other_count { + template static inline std::size_t apply(Geometry const&, bool) { return D; } }; -template -struct polygon_count +struct polygon_count: private range_count { + template static inline std::size_t apply(Polygon const& poly, bool add_for_open) { typedef typename geometry::ring_type::type ring_type; - std::size_t n = range_count::apply( + std::size_t n = range_count::apply( exterior_ring(poly), add_for_open); typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - n += range_count::apply(*it, add_for_open); + n += range_count::apply(*it, add_for_open); } return n; @@ -98,44 +99,42 @@ struct polygon_count namespace dispatch { -template -struct num_points -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; - -template -struct num_points - : detail::num_points::other_count +template +< + typename Geometry, + typename Tag = typename tag_cast::type, multi_tag>::type +> +struct num_points: not_implemented {}; template -struct num_points - : detail::num_points::other_count +struct num_points + : detail::num_points::other_count<1> {}; template -struct num_points - : detail::num_points::other_count +struct num_points + : detail::num_points::other_count<4> {}; template -struct num_points - : detail::num_points::range_count +struct num_points + : detail::num_points::other_count<2> {}; template -struct num_points - : detail::num_points::range_count +struct num_points + : detail::num_points::range_count {}; template -struct num_points - : detail::num_points::polygon_count +struct num_points + : detail::num_points::range_count +{}; + +template +struct num_points + : detail::num_points::polygon_count {}; } // namespace dispatch @@ -158,11 +157,7 @@ inline std::size_t num_points(Geometry const& geometry, bool add_for_open = fals { concept::check(); - return dispatch::num_points - < - typename tag_cast::type, multi_tag>::type, - Geometry - >::apply(geometry, add_for_open); + return dispatch::num_points::apply(geometry, add_for_open); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp b/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp index 2f854b4fd..d417a4b1f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp @@ -17,10 +17,10 @@ #include -#include - #include +#include + #include namespace boost { namespace geometry @@ -32,13 +32,12 @@ namespace detail { namespace overlaps template < - typename Box1, - typename Box2, std::size_t Dimension, std::size_t DimensionCount > struct box_box_loop { + template static inline void apply(Box1 const& b1, Box2 const& b2, bool& overlaps, bool& one_in_two, bool& two_in_one) { @@ -84,8 +83,6 @@ struct box_box_loop box_box_loop < - Box1, - Box2, Dimension + 1, DimensionCount >::apply(b1, b2, overlaps, one_in_two, two_in_one); @@ -94,24 +91,19 @@ struct box_box_loop template < - typename Box1, - typename Box2, std::size_t DimensionCount > -struct box_box_loop +struct box_box_loop { + template static inline void apply(Box1 const& , Box2 const&, bool&, bool&, bool&) { } }; -template -< - typename Box1, - typename Box2 -> struct box_box { + template static inline bool apply(Box1 const& b1, Box2 const& b2) { bool overlaps = true; @@ -119,8 +111,6 @@ struct box_box bool within2 = true; box_box_loop < - Box1, - Box2, 0, dimension::type::value >::apply(b1, b2, overlaps, within1, within2); @@ -148,24 +138,18 @@ namespace dispatch template < - typename Tag1, - typename Tag2, typename Geometry1, - typename Geometry2 + typename Geometry2, + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type > -struct overlaps -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +struct overlaps: not_implemented +{}; template -struct overlaps - : detail::overlaps::box_box +struct overlaps + : detail::overlaps::box_box {}; @@ -190,8 +174,6 @@ inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2) return dispatch::overlaps < - typename tag::type, - typename tag::type, Geometry1, Geometry2 >::apply(geometry1, geometry2); diff --git a/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp b/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp index adeb0b05b..b70517e3e 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp @@ -33,40 +33,43 @@ namespace dispatch { // Default perimeter is 0.0, specializations implement calculated values -template +template ::type> struct perimeter : detail::calculate_null - < - typename default_length_result::type, - Geometry, - Strategy - > -{}; +{ + typedef typename default_length_result::type return_type; -template -struct perimeter + template + static inline return_type apply(Geometry const& geometry, Strategy const& strategy) + { + return calculate_null::apply(geometry, strategy); + } +}; + +template +struct perimeter : detail::length::range_length < Geometry, - Strategy, closure::value > {}; -template -struct perimeter - : detail::calculate_polygon_sum - < - typename default_length_result::type, - Polygon, - Strategy, - detail::length::range_length +template +struct perimeter : detail::calculate_polygon_sum +{ + typedef typename default_length_result::type return_type; + typedef detail::length::range_length < typename ring_type::type, - Strategy, closure::value - > - > -{}; + > policy; + + template + static inline return_type apply(Polygon const& polygon, Strategy const& strategy) + { + return calculate_polygon_sum::apply(polygon, strategy); + } +}; // box,n-sphere: to be implemented @@ -100,12 +103,7 @@ inline typename default_length_result::type perimeter( // detail::throw_on_empty_input(geometry); - return dispatch::perimeter - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, strategy_type()); + return dispatch::perimeter::apply(geometry, strategy_type()); } /*! @@ -130,12 +128,7 @@ inline typename default_length_result::type perimeter( // detail::throw_on_empty_input(geometry); - return dispatch::perimeter - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, strategy); + return dispatch::perimeter::apply(geometry, strategy); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp b/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp index bf0ef2d9a..1e1168a5a 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp @@ -32,9 +32,9 @@ namespace detail { namespace reverse { -template struct range_reverse { + template static inline void apply(Range& range) { std::reverse(boost::begin(range), boost::end(range)); @@ -42,21 +42,20 @@ struct range_reverse }; -template -struct polygon_reverse +struct polygon_reverse: private range_reverse { + template static inline void apply(Polygon& polygon) { typedef typename geometry::ring_type::type ring_type; - typedef range_reverse per_range; - per_range::apply(exterior_ring(polygon)); + range_reverse::apply(exterior_ring(polygon)); typename interior_return_type::type rings = interior_rings(polygon); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - per_range::apply(*it); + range_reverse::apply(*it); } } }; @@ -71,11 +70,7 @@ namespace dispatch { -template -< - typename Tag, - typename Geometry -> +template ::type> struct reverse { static inline void apply(Geometry&) @@ -84,20 +79,20 @@ struct reverse template -struct reverse - : detail::reverse::range_reverse +struct reverse + : detail::reverse::range_reverse {}; template -struct reverse - : detail::reverse::range_reverse +struct reverse + : detail::reverse::range_reverse {}; template -struct reverse - : detail::reverse::polygon_reverse +struct reverse + : detail::reverse::polygon_reverse {}; @@ -121,11 +116,7 @@ inline void reverse(Geometry& geometry) { concept::check(); - dispatch::reverse - < - typename tag::type, - Geometry - >::apply(geometry); + dispatch::reverse::apply(geometry); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp b/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp index 225321d30..7e3aca401 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp @@ -33,6 +33,7 @@ #include #include +#include #include @@ -43,12 +44,11 @@ namespace boost { namespace geometry namespace detail { namespace simplify { -template struct simplify_range_insert { - template + template static inline void apply(Range const& range, OutputIterator out, - Distance const& max_distance, Strategy const& strategy) + Distance const& max_distance, Strategy const& strategy) { if (boost::size(range) <= 2 || max_distance < 0) { @@ -62,12 +62,11 @@ struct simplify_range_insert }; -template struct simplify_copy { - template + template static inline void apply(Range const& range, Range& out, - Distance const& , Strategy const& ) + Distance const& , Strategy const& ) { std::copy ( @@ -77,10 +76,10 @@ struct simplify_copy }; -template +template struct simplify_range { - template + template static inline void apply(Range const& range, Range& out, Distance const& max_distance, Strategy const& strategy) { @@ -101,14 +100,11 @@ struct simplify_range if (boost::size(range) <= int(Minimum) || max_distance < 0.0) { - simplify_copy::apply - ( - range, out, max_distance, strategy - ); + simplify_copy::apply(range, out, max_distance, strategy); } else { - simplify_range_insert::apply + simplify_range_insert::apply ( range, std::back_inserter(out), max_distance, strategy ); @@ -116,10 +112,9 @@ struct simplify_range } }; -template struct simplify_polygon { - template + template static inline void apply(Polygon const& poly_in, Polygon& poly_out, Distance const& max_distance, Strategy const& strategy) { @@ -133,9 +128,9 @@ struct simplify_polygon // Note that if there are inner rings, and distance is too large, // they might intersect with the outer ring in the output, // while it didn't in the input. - simplify_range::apply(exterior_ring(poly_in), - exterior_ring(poly_out), - max_distance, strategy); + simplify_range::apply(exterior_ring(poly_in), + exterior_ring(poly_out), + max_distance, strategy); traits::resize < @@ -154,8 +149,7 @@ struct simplify_polygon it_in != boost::end(rings_in); ++it_in, ++it_out) { - simplify_range::apply(*it_in, - *it_out, max_distance, strategy); + simplify_range::apply(*it_in, *it_out, max_distance, strategy); } } }; @@ -169,15 +163,18 @@ struct simplify_polygon namespace dispatch { -template -struct simplify -{ -}; +template +< + typename Geometry, + typename Tag = typename tag::type +> +struct simplify: not_implemented +{}; -template -struct simplify +template +struct simplify { - template + template static inline void apply(Point const& point, Point& out, Distance const& , Strategy const& ) { @@ -186,22 +183,15 @@ struct simplify }; -template -struct simplify - : detail::simplify::simplify_range - < - Linestring, - Strategy, - 2 - > +template +struct simplify + : detail::simplify::simplify_range<2> {}; -template -struct simplify +template +struct simplify : detail::simplify::simplify_range < - Ring, - Strategy, core_detail::closure::minimum_ring_size < geometry::closure::value @@ -209,38 +199,29 @@ struct simplify > {}; -template -struct simplify +template +struct simplify : detail::simplify::simplify_polygon - < - Polygon, - Strategy - > {}; -template -struct simplify_insert -{ -}; - - -template -struct simplify_insert - : detail::simplify::simplify_range_insert - < - Linestring, - Strategy - > +template +< + typename Geometry, + typename Tag = typename tag::type +> +struct simplify_insert: not_implemented {}; -template -struct simplify_insert + +template +struct simplify_insert + : detail::simplify::simplify_range_insert +{}; + +template +struct simplify_insert : detail::simplify::simplify_range_insert - < - Ring, - Strategy - > {}; @@ -275,12 +256,7 @@ inline void simplify(Geometry const& geometry, Geometry& out, geometry::clear(out); - dispatch::simplify - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, out, max_distance, strategy); + dispatch::simplify::apply(geometry, out, max_distance, strategy); } @@ -348,12 +324,7 @@ inline void simplify_insert(Geometry const& geometry, OutputIterator out, concept::check(); BOOST_CONCEPT_ASSERT( (geometry::concept::SimplifyStrategy) ); - dispatch::simplify_insert - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, out, max_distance, strategy); + dispatch::simplify_insert::apply(geometry, out, max_distance, strategy); } /*! @@ -387,12 +358,7 @@ inline void simplify_insert(Geometry const& geometry, OutputIterator out, point_type, ds_strategy_type > strategy_type; - dispatch::simplify_insert - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, out, max_distance, strategy_type()); + dispatch::simplify_insert::apply(geometry, out, max_distance, strategy_type()); } }} // namespace detail::simplify diff --git a/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp b/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp index 6394576de..28affc43c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp @@ -59,35 +59,20 @@ inline OutputIterator sym_difference_insert(Geometry1 const& geometry1, out = geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, true>::value >::apply(geometry1, geometry2, out, strategy); out = geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry2, Geometry1, + GeometryOut, + overlay_difference, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value >::apply(geometry2, geometry1, out, strategy); return out; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/touches.hpp b/project/jni/boost/include/boost/geometry/algorithms/touches.hpp new file mode 100644 index 000000000..7d424af42 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/algorithms/touches.hpp @@ -0,0 +1,181 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP +#define BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP + + +#include + +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace geometry +{ + +namespace detail { namespace touches +{ + +template +inline bool ok_for_touch(Turn const& turn) +{ + return turn.both(detail::overlay::operation_union) + || turn.both(detail::overlay::operation_blocked) + || turn.combination(detail::overlay::operation_union, detail::overlay::operation_blocked) + ; +} + +template +inline bool has_only_turns(Turns const& turns) +{ + bool has_touch = false; + typedef typename boost::range_iterator::type iterator_type; + for (iterator_type it = boost::begin(turns); it != boost::end(turns); ++it) + { + if (it->has(detail::overlay::operation_intersection)) + { + return false; + } + + switch(it->method) + { + case detail::overlay::method_crosses: + return false; + case detail::overlay::method_equal: + // Segment spatially equal means: at the right side + // the polygon internally overlaps. So return false. + return false; + case detail::overlay::method_touch: + case detail::overlay::method_touch_interior: + case detail::overlay::method_collinear: + if (ok_for_touch(*it)) + { + has_touch = true; + } + else + { + return false; + } + break; + case detail::overlay::method_none : + case detail::overlay::method_disjoint : + case detail::overlay::method_error : + break; + } + } + return has_touch; +} + +}} + +/*! +\brief \brief_check{has at least one touching point (self-tangency)} +\note This function can be called for one geometry (self-tangency) and + also for two geometries (touch) +\ingroup touches +\tparam Geometry \tparam_geometry +\param geometry \param_geometry +\return \return_check{is self-touching} + +\qbk{distinguish,one geometry} +\qbk{[def __one_parameter__]} +\qbk{[include reference/algorithms/touches.qbk]} +*/ +template +inline bool touches(Geometry const& geometry) +{ + concept::check(); + + typedef detail::overlay::turn_info + < + typename geometry::point_type::type + > turn_info; + + typedef detail::overlay::get_turn_info + < + typename point_type::type, + typename point_type::type, + turn_info, + detail::overlay::assign_null_policy + > policy_type; + + std::deque turns; + detail::self_get_turn_points::no_interrupt_policy policy; + detail::self_get_turn_points::get_turns + < + Geometry, + std::deque, + policy_type, + detail::self_get_turn_points::no_interrupt_policy + >::apply(geometry, turns, policy); + + return detail::touches::has_only_turns(turns); +} + + +/*! +\brief \brief_check2{have at least one touching point (tangent - non overlapping)} +\ingroup touches +\tparam Geometry1 \tparam_geometry +\tparam Geometry2 \tparam_geometry +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\return \return_check2{touch each other} + +\qbk{distinguish,two geometries} +\qbk{[include reference/algorithms/touches.qbk]} + */ +template +inline bool touches(Geometry1 const& geometry1, Geometry2 const& geometry2) +{ + concept::check(); + concept::check(); + + + typedef detail::overlay::turn_info + < + typename geometry::point_type::type + > turn_info; + + typedef detail::overlay::get_turn_info + < + typename point_type::type, + typename point_type::type, + turn_info, + detail::overlay::assign_null_policy + > policy_type; + + std::deque turns; + detail::get_turns::no_interrupt_policy policy; + boost::geometry::get_turns + < + false, false, + detail::overlay::assign_null_policy + >(geometry1, geometry2, turns, policy); + + return detail::touches::has_only_turns(turns) + && ! geometry::detail::disjoint::rings_containing(geometry1, geometry2) + && ! geometry::detail::disjoint::rings_containing(geometry2, geometry1) + ; +} + + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP diff --git a/project/jni/boost/include/boost/geometry/algorithms/transform.hpp b/project/jni/boost/include/boost/geometry/algorithms/transform.hpp index 22b45dc77..52d195fe8 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/transform.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/transform.hpp @@ -41,9 +41,9 @@ namespace boost { namespace geometry namespace detail { namespace transform { -template struct transform_point { + template static inline bool apply(Point1 const& p1, Point2& p2, Strategy const& strategy) { @@ -52,9 +52,9 @@ struct transform_point }; -template struct transform_box { + template static inline bool apply(Box1 const& b1, Box2& b2, Strategy const& strategy) { @@ -91,9 +91,9 @@ struct transform_box } }; -template struct transform_box_or_segment { + template static inline bool apply(Geometry1 const& source, Geometry2& target, Strategy const& strategy) { @@ -133,12 +133,7 @@ inline bool transform_range_out(Range const& range, it != boost::end(range); ++it) { - if (! transform_point - < - typename point_type::type, - PointOut, - Strategy - >::apply(*it, point_out, strategy)) + if (! transform_point::apply(*it, point_out, strategy)) { return false; } @@ -148,9 +143,9 @@ inline bool transform_range_out(Range const& range, } -template struct transform_polygon { + template static inline bool apply(Polygon1 const& poly1, Polygon2& poly2, Strategy const& strategy) { @@ -211,9 +206,9 @@ struct select_strategy >::type type; }; -template struct transform_range { + template static inline bool apply(Range1 const& range1, Range2& range2, Strategy const& strategy) { @@ -236,50 +231,50 @@ namespace dispatch template < - typename Tag1, typename Tag2, typename Geometry1, typename Geometry2, - typename Strategy + typename Tag1 = typename tag_cast::type, multi_tag>::type, + typename Tag2 = typename tag_cast::type, multi_tag>::type > struct transform {}; -template -struct transform - : detail::transform::transform_point +template +struct transform + : detail::transform::transform_point { }; -template +template struct transform < - linestring_tag, linestring_tag, - Linestring1, Linestring2, Strategy + Linestring1, Linestring2, + linestring_tag, linestring_tag > - : detail::transform::transform_range + : detail::transform::transform_range { }; -template -struct transform - : detail::transform::transform_range +template +struct transform + : detail::transform::transform_range { }; -template -struct transform - : detail::transform::transform_polygon +template +struct transform + : detail::transform::transform_polygon { }; -template -struct transform - : detail::transform::transform_box +template +struct transform + : detail::transform::transform_box { }; -template -struct transform - : detail::transform::transform_box_or_segment +template +struct transform + : detail::transform::transform_box_or_segment { }; @@ -310,14 +305,7 @@ inline bool transform(Geometry1 const& geometry1, Geometry2& geometry2, concept::check(); concept::check(); - typedef dispatch::transform - < - typename tag_cast::type, multi_tag>::type, - typename tag_cast::type, multi_tag>::type, - Geometry1, - Geometry2, - Strategy - > transform_type; + typedef dispatch::transform transform_type; return transform_type::apply(geometry1, geometry2, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/union.hpp b/project/jni/boost/include/boost/geometry/algorithms/union.hpp index 28d8e5dc0..479f556a1 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/union.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/union.hpp @@ -10,14 +10,13 @@ #define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP -#include - #include #include #include #include #include +#include #include @@ -30,78 +29,70 @@ namespace dispatch template < - // tag dispatching: - typename TagIn1, typename TagIn2, typename TagOut, - // metafunction finetuning helpers: - bool Areal1, bool Areal2, bool ArealOut, - // real types - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, - typename GeometryOut, - typename Strategy + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1 = typename tag::type, + typename TagIn2 = typename tag::type, + typename TagOut = typename tag::type, + bool Areal1 = geometry::is_areal::value, + bool Areal2 = geometry::is_areal::value, + bool ArealOut = geometry::is_areal::value, + bool Reverse1 = detail::overlay::do_reverse::value>::value, + bool Reverse2 = detail::overlay::do_reverse::value>::value, + bool ReverseOut = detail::overlay::do_reverse::value>::value, + bool Reverse = geometry::reverse_dispatch::type::value > -struct union_insert -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPES - , (types) - ); -}; - - -template -< - typename TagIn1, typename TagIn2, typename TagOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, - typename GeometryOut, - typename Strategy -> -struct union_insert - < - TagIn1, TagIn2, TagOut, - true, true, true, - Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - Strategy - > : detail::overlay::overlay - +struct union_insert: not_implemented {}; +// If reversal is needed, perform it first template < - typename GeometryTag1, typename GeometryTag2, typename GeometryTag3, - bool Areal1, bool Areal2, bool ArealOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, - typename Strategy + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1, typename TagIn2, typename TagOut, + bool Reverse1, bool Reverse2, bool ReverseOut > -struct union_insert_reversed +struct union_insert + < + Geometry1, Geometry2, GeometryOut, + TagIn1, TagIn2, TagOut, + true, true, true, + Reverse1, Reverse2, ReverseOut, + true + >: union_insert { + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, OutputIterator out, Strategy const& strategy) { return union_insert < - GeometryTag2, GeometryTag1, GeometryTag3, - Areal2, Areal1, ArealOut, - Geometry2, Geometry1, - Reverse2, Reverse1, ReverseOut, - OutputIterator, GeometryOut, - Strategy + Geometry2, Geometry1, GeometryOut >::apply(g2, g1, out, strategy); } }; +template +< + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1, typename TagIn2, typename TagOut, + bool Reverse1, bool Reverse2, bool ReverseOut +> +struct union_insert + < + Geometry1, Geometry2, GeometryOut, + TagIn1, TagIn2, TagOut, + true, true, true, + Reverse1, Reverse2, ReverseOut, + false + > : detail::overlay::overlay + +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -121,40 +112,10 @@ inline OutputIterator insert(Geometry1 const& geometry1, OutputIterator out, Strategy const& strategy) { - return boost::mpl::if_c - < - geometry::reverse_dispatch::type::value, - dispatch::union_insert_reversed - < - typename tag::type, - typename tag::type, - typename tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - Strategy - >, - dispatch::union_insert - < - typename tag::type, - typename tag::type, - typename tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - Strategy - > - >::type::apply(geometry1, geometry2, out, strategy); + return dispatch::union_insert + < + Geometry1, Geometry2, GeometryOut + >::apply(geometry1, geometry2, out, strategy); } /*! diff --git a/project/jni/boost/include/boost/geometry/algorithms/unique.hpp b/project/jni/boost/include/boost/geometry/algorithms/unique.hpp index 3bbf479f9..e11dc13c4 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/unique.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/unique.hpp @@ -34,9 +34,9 @@ namespace detail { namespace unique { -template struct range_unique { + template static inline void apply(Range& range, ComparePolicy const& policy) { typename boost::range_iterator::type it @@ -52,21 +52,20 @@ struct range_unique }; -template struct polygon_unique { + template static inline void apply(Polygon& polygon, ComparePolicy const& policy) { typedef typename geometry::ring_type::type ring_type; - typedef range_unique per_range; - per_range::apply(exterior_ring(polygon), policy); + range_unique::apply(exterior_ring(polygon), policy); typename interior_return_type::type rings = interior_rings(polygon); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - per_range::apply(*it, policy); + range_unique::apply(*it, policy); } } }; @@ -85,32 +84,32 @@ namespace dispatch template < - typename Tag, typename Geometry, - typename ComparePolicy + typename Tag = typename tag::type > struct unique { + template static inline void apply(Geometry&, ComparePolicy const& ) {} }; -template -struct unique - : detail::unique::range_unique +template +struct unique + : detail::unique::range_unique {}; -template -struct unique - : detail::unique::range_unique +template +struct unique + : detail::unique::range_unique {}; -template -struct unique - : detail::unique::polygon_unique +template +struct unique + : detail::unique::polygon_unique {}; @@ -139,12 +138,7 @@ inline void unique(Geometry& geometry) > policy; - dispatch::unique - < - typename tag::type, - Geometry, - policy - >::apply(geometry, policy()); + dispatch::unique::apply(geometry, policy()); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/within.hpp b/project/jni/boost/include/boost/geometry/algorithms/within.hpp index 0e0cb68d5..f1f0993d7 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/within.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/within.hpp @@ -65,7 +65,7 @@ struct point_in_ring static inline int apply(Point const& point, Ring const& ring, Strategy const& strategy) { - if (boost::size(ring) + if (int(boost::size(ring)) < core_detail::closure::minimum_ring_size::value) { return -1; diff --git a/project/jni/boost/include/boost/geometry/core/access.hpp b/project/jni/boost/include/boost/geometry/core/access.hpp index a463b8cdc..cdc8ff9cf 100644 --- a/project/jni/boost/include/boost/geometry/core/access.hpp +++ b/project/jni/boost/include/boost/geometry/core/access.hpp @@ -18,12 +18,13 @@ #include #include -#include #include +#include #include #include #include +#include namespace boost { namespace geometry @@ -79,6 +80,52 @@ struct indexed_access {}; } // namespace traits +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + +template +< + typename Geometry, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access_non_pointer +{ + static inline CoordinateType get(Geometry const& geometry) + { + return traits::indexed_access::get(geometry); + } + static inline void set(Geometry& b, CoordinateType const& value) + { + traits::indexed_access::set(b, value); + } +}; + +template +< + typename Geometry, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access_pointer +{ + static inline CoordinateType get(Geometry const* geometry) + { + return traits::indexed_access::type, Index, Dimension>::get(*geometry); + } + static inline void set(Geometry* geometry, CoordinateType const& value) + { + traits::indexed_access::type, Index, Dimension>::set(*geometry, value); + } +}; + + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + #ifndef DOXYGEN_NO_DISPATCH namespace core_dispatch @@ -89,7 +136,9 @@ template typename Tag, typename Geometry, typename - CoordinateType, std::size_t Dimension + CoordinateType, + std::size_t Dimension, + typename IsPointer > struct access { @@ -103,7 +152,8 @@ template typename Geometry, typename CoordinateType, std::size_t Index, - std::size_t Dimension + std::size_t Dimension, + typename IsPointer > struct indexed_access { @@ -112,7 +162,7 @@ struct indexed_access }; template -struct access +struct access { static inline CoordinateType get(Point const& point) { @@ -124,6 +174,20 @@ struct access } }; +template +struct access +{ + static inline CoordinateType get(Point const* point) + { + return traits::access::type, Dimension>::get(*point); + } + static inline void set(Point* p, CoordinateType const& value) + { + traits::access::type, Dimension>::set(*p, value); + } +}; + + template < typename Box, @@ -131,17 +195,21 @@ template std::size_t Index, std::size_t Dimension > -struct indexed_access -{ - static inline CoordinateType get(Box const& box) - { - return traits::indexed_access::get(box); - } - static inline void set(Box& b, CoordinateType const& value) - { - traits::indexed_access::set(b, value); - } -}; +struct indexed_access + : detail::indexed_access_non_pointer +{}; + +template +< + typename Box, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access + : detail::indexed_access_pointer +{}; + template < @@ -150,17 +218,21 @@ template std::size_t Index, std::size_t Dimension > -struct indexed_access -{ - static inline CoordinateType get(Segment const& segment) - { - return traits::indexed_access::get(segment); - } - static inline void set(Segment& segment, CoordinateType const& value) - { - traits::indexed_access::set(segment, value); - } -}; +struct indexed_access + : detail::indexed_access_non_pointer +{}; + + +template +< + typename Segment, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access + : detail::indexed_access_pointer +{}; } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH @@ -199,14 +271,13 @@ inline typename coordinate_type::type get(Geometry const& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::access < typename tag::type, - ncg_type, - typename coordinate_type::type, - Dimension + typename geometry::util::bare_type::type, + typename coordinate_type::type, + Dimension, + typename boost::is_pointer::type > coord_access_type; return coord_access_type::get(geometry); @@ -234,14 +305,13 @@ inline void set(Geometry& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::access < typename tag::type, - ncg_type, - typename coordinate_type::type, - Dimension + typename geometry::util::bare_type::type, + typename coordinate_type::type, + Dimension, + typename boost::is_pointer::type > coord_access_type; coord_access_type::set(geometry, value); @@ -269,15 +339,14 @@ inline typename coordinate_type::type get(Geometry const& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::indexed_access < typename tag::type, - ncg_type, - typename coordinate_type::type, + typename geometry::util::bare_type::type, + typename coordinate_type::type, Index, - Dimension + Dimension, + typename boost::is_pointer::type > coord_access_type; return coord_access_type::get(geometry); @@ -306,14 +375,14 @@ inline void set(Geometry& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::indexed_access < - typename tag::type, ncg_type, - typename coordinate_type::type, + typename tag::type, + typename geometry::util::bare_type::type, + typename coordinate_type::type, Index, - Dimension + Dimension, + typename boost::is_pointer::type > coord_access_type; coord_access_type::set(geometry, value); diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp index 84c11e2a5..2f3c91460 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp @@ -20,9 +20,9 @@ #include #include #include -#include #include +#include namespace boost { namespace geometry { @@ -58,7 +58,7 @@ template struct dimension : dimension::type> {}; template -struct dimension : traits::dimension

{}; +struct dimension : traits::dimension::type> {}; } // namespace core_dispatch #endif @@ -75,7 +75,7 @@ struct dimension : core_dispatch::dimension < typename tag::type, - typename boost::remove_const::type + typename geometry::util::bare_type::type > {}; diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp index c23b8af15..01e5ad1dd 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp @@ -16,8 +16,9 @@ #include -#include + #include +#include namespace boost { namespace geometry @@ -61,10 +62,13 @@ namespace core_dispatch }; - template - struct coordinate_system + template + struct coordinate_system { - typedef typename traits::coordinate_system

::type type; + typedef typename traits::coordinate_system + < + typename geometry::util::bare_type::type + >::type type; }; @@ -82,11 +86,10 @@ namespace core_dispatch template struct coordinate_system { - typedef typename boost::remove_const::type ncg; typedef typename core_dispatch::coordinate_system < typename tag::type, - ncg + typename geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp index 0f901d3f1..d17f66ab7 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp @@ -16,9 +16,10 @@ #include -#include +#include #include +#include #include @@ -63,12 +64,17 @@ struct coordinate_type template struct coordinate_type { - typedef typename traits::coordinate_type::type type; + typedef typename traits::coordinate_type + < + typename geometry::util::bare_type::type + >::type type; }; + } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH + /*! \brief \brief_meta{type, coordinate type (int\, float\, double\, etc), \meta_point_type} \tparam Geometry \tparam_geometry @@ -79,11 +85,11 @@ struct coordinate_type template struct coordinate_type { - typedef typename core_dispatch::coordinate_type - < - typename tag::type, - typename boost::remove_const::type - >::type type; + typedef typename core_dispatch::coordinate_type + < + typename tag::type, + typename geometry::util::bare_type::type + >::type type; }; template diff --git a/project/jni/boost/include/boost/geometry/core/point_type.hpp b/project/jni/boost/include/boost/geometry/core/point_type.hpp index f49a43c56..e148c84a5 100644 --- a/project/jni/boost/include/boost/geometry/core/point_type.hpp +++ b/project/jni/boost/include/boost/geometry/core/point_type.hpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace boost { namespace geometry { @@ -115,11 +116,10 @@ struct point_type template struct point_type { - typedef typename boost::remove_const::type ncg; typedef typename core_dispatch::point_type < typename tag::type, - ncg + typename boost::geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/core/tag.hpp b/project/jni/boost/include/boost/geometry/core/tag.hpp index 5a99c9707..4c790fdc9 100644 --- a/project/jni/boost/include/boost/geometry/core/tag.hpp +++ b/project/jni/boost/include/boost/geometry/core/tag.hpp @@ -16,9 +16,9 @@ #include -#include #include +#include namespace boost { namespace geometry @@ -47,6 +47,7 @@ struct tag } // namespace traits + /*! \brief \brief_meta{type, tag, \meta_geometry_type} \details With Boost.Geometry, tags are the driving force of the tag dispatching @@ -61,7 +62,7 @@ struct tag { typedef typename traits::tag < - typename boost::remove_const::type + typename geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/geometries/variant.hpp b/project/jni/boost/include/boost/geometry/geometries/variant.hpp new file mode 100644 index 000000000..9db11d5a8 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/geometries/variant.hpp @@ -0,0 +1,34 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP +#define BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP + + +#include + + +namespace boost { namespace geometry { + + +template +struct point_type > + : point_type +{}; + + +} // namespace geometry +} // namespace boost + + +#endif // BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP diff --git a/project/jni/boost/include/boost/geometry/geometry.hpp b/project/jni/boost/include/boost/geometry/geometry.hpp index 22d08e2a4..b696b652c 100644 --- a/project/jni/boost/include/boost/geometry/geometry.hpp +++ b/project/jni/boost/include/boost/geometry/geometry.hpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp b/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp index 03921096e..566669e26 100644 --- a/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp +++ b/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp @@ -95,67 +95,115 @@ private: bool m_skip_first; }; - - template -class ever_circling_range_iterator - : public boost::iterator_adaptor - < - ever_circling_range_iterator, - typename boost::range_iterator::type - > +struct ever_circling_range_iterator + : public boost::iterator_facade + < + ever_circling_range_iterator, + typename boost::range_value::type const, + boost::random_access_traversal_tag + > { -public : - typedef typename boost::range_iterator::type iterator_type; + /// Constructor including the range it is based on + explicit inline ever_circling_range_iterator(Range& range) + : m_range(&range) + , m_iterator(boost::begin(range)) + , m_size(boost::size(range)) + , m_index(0) + {} - explicit inline ever_circling_range_iterator(Range& range, - bool skip_first = false) - : m_range(range) - , m_skip_first(skip_first) + /// Default constructor + explicit inline ever_circling_range_iterator() + : m_range(NULL) + , m_size(0) + , m_index(0) + {} + + inline ever_circling_range_iterator& operator=(ever_circling_range_iterator const& source) { - this->base_reference() = boost::begin(m_range); + m_range = source.m_range; + m_iterator = source.m_iterator; + m_size = source.m_size; + m_index = source.m_index; + return *this; } - explicit inline ever_circling_range_iterator(Range& range, iterator_type start, - bool skip_first = false) - : m_range(range) - , m_skip_first(skip_first) - { - this->base_reference() = start; - } - - /// Navigate to a certain position, should be in [start .. end], if at end - /// it will circle again. - inline void moveto(iterator_type it) - { - this->base_reference() = it; - check_end(); - } + typedef std::ptrdiff_t difference_type; private: - friend class boost::iterator_core_access; - inline void increment(bool possibly_skip = true) + inline typename boost::range_value::type const& dereference() const { - (this->base_reference())++; - check_end(possibly_skip); + return *m_iterator; } - inline void check_end(bool possibly_skip = true) + inline difference_type distance_to(ever_circling_range_iterator const& other) const { - if (this->base_reference() == boost::end(m_range)) + return other.m_index - this->m_index; + } + + inline bool equal(ever_circling_range_iterator const& other) const + { + return this->m_range == other.m_range + && this->m_index == other.m_index; + } + + inline void increment() + { + ++m_index; + if (m_index >= 0 && m_index < m_size) { - this->base_reference() = boost::begin(m_range); - if (m_skip_first && possibly_skip) - { - increment(false); - } + ++m_iterator; + } + else + { + update_iterator(); } } - Range& m_range; - bool m_skip_first; + inline void decrement() + { + --m_index; + if (m_index >= 0 && m_index < m_size) + { + --m_iterator; + } + else + { + update_iterator(); + } + } + + inline void advance(difference_type n) + { + if (m_index >= 0 && m_index < m_size + && m_index + n >= 0 && m_index + n < m_size) + { + m_index += n; + m_iterator += n; + } + else + { + m_index += n; + update_iterator(); + } + } + + inline void update_iterator() + { + while (m_index < 0) + { + m_index += m_size; + } + m_index = m_index % m_size; + this->m_iterator = boost::begin(*m_range) + m_index; + } + + Range* m_range; + typename boost::range_iterator::type m_iterator; + difference_type m_size; + difference_type m_index; }; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp index 669568635..7d0206109 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp @@ -30,21 +30,20 @@ namespace boost { namespace geometry #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { -template -struct area - : detail::multi_sum - < - typename Strategy::return_type, - MultiGeometry, - Strategy, - area - < - typename boost::range_value::type, - Strategy, - polygon_tag - > - > -{}; +template +struct area : detail::multi_sum +{ + template + static inline typename Strategy::return_type + apply(MultiGeometry const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename Strategy::return_type, + area::type> + >(multi, strategy); + } +}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp index 855ed22fd..e990f4eff 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp @@ -35,13 +35,9 @@ namespace detail { namespace centroid \brief Building block of a multi-point, to be used as Policy in the more generec centroid_multi */ -template -< - typename Point, - typename Strategy -> struct centroid_multi_point_state { + template static inline void apply(Point const& point, Strategy const& strategy, typename Strategy::state_type& state) { @@ -59,15 +55,10 @@ struct centroid_multi_point_state detail::centroid::centroid_multi */ -template -< - typename Multi, - typename Point, - typename Strategy, - typename Policy -> +template struct centroid_multi { + template static inline void apply(Multi const& multi, Point& centroid, Strategy const& strategy) { @@ -104,65 +95,28 @@ struct centroid_multi namespace dispatch { -template -< - typename MultiLinestring, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiLinestring, - Point, - Strategy, - detail::centroid::centroid_range_state - < - typename boost::range_value::type, - closed, - Strategy - > + detail::centroid::centroid_range_state > {}; -template -< - typename MultiPolygon, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiPolygon, - Point, - Strategy, detail::centroid::centroid_polygon_state - < - typename boost::range_value::type, - Strategy - > > {}; -template -< - typename MultiPoint, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiPoint, - Point, - Strategy, detail::centroid::centroid_multi_point_state - < - typename boost::range_value::type, - Strategy - > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp index a47685ceb..704c3e6a9 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp @@ -23,15 +23,9 @@ namespace boost { namespace geometry namespace detail { -template -< - typename ReturnType, - typename MultiGeometry, - typename Strategy, - typename Policy -> struct multi_sum { + template static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy) { ReturnType sum = ReturnType(); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp index 1093a8456..72be5ddbf 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp @@ -42,7 +42,7 @@ struct copy_segment_point_multi BOOST_ASSERT ( seg_id.multi_index >= 0 - && seg_id.multi_index < boost::size(multi) + && seg_id.multi_index < int(boost::size(multi)) ); // Call the single-version diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp index a234e240d..f474b12fd 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp @@ -44,7 +44,7 @@ struct copy_segments_multi BOOST_ASSERT ( seg_id.multi_index >= 0 - && seg_id.multi_index < boost::size(multi_geometry) + && seg_id.multi_index < int(boost::size(multi_geometry)) ); // Call the single-version diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp index 8cdd7ed97..e23acf99b 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp @@ -35,7 +35,7 @@ struct get_ring BOOST_ASSERT ( id.multi_index >= 0 - && id.multi_index < boost::size(multi_polygon) + && id.multi_index < int(boost::size(multi_polygon)) ); return get_ring::apply(id, multi_polygon[id.multi_index]); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp index 04d76422c..ac462ed4c 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp @@ -31,13 +31,13 @@ namespace detail { namespace point_on_border template < - typename MultiGeometry, typename Point, + typename MultiGeometry, typename Policy > struct point_on_multi { - static inline bool apply(MultiGeometry const& multi, Point& point) + static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) { // Take a point on the first multi-geometry // (i.e. the first that is not empty) @@ -48,7 +48,7 @@ struct point_on_multi it != boost::end(multi); ++it) { - if (Policy::apply(*it, point)) + if (Policy::apply(point, *it, midpoint)) { return true; } @@ -69,16 +69,16 @@ namespace dispatch { -template -struct point_on_border +template +struct point_on_border : detail::point_on_border::point_on_multi < - Multi, Point, + Multi, detail::point_on_border::point_on_polygon < - typename boost::range_value::type, - Point + Point, + typename boost::range_value::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index cf4bf5d83..28a4805ed 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -46,7 +46,7 @@ struct full_section_multi BOOST_ASSERT ( section.ring_id.multi_index >= 0 - && section.ring_id.multi_index < boost::size(multi) + && section.ring_id.multi_index < int(boost::size(multi)) ); return Policy::apply(multi[section.ring_id.multi_index], section); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp new file mode 100644 index 000000000..7d1bed794 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp @@ -0,0 +1,41 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2012 Bruno Lalande, Paris, France. +// Copyright (c) 2012 Mateusz Loskot, London, UK. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP +#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP + + +#include +#include + + +namespace boost { namespace geometry +{ + + +#ifndef DOXYGEN_NO_DISPATCH +namespace dispatch +{ + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +} // namespace dispatch + + +#endif // DOXYGEN_NO_DISPATCH + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp index 1876b5f91..026fc71e6 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp @@ -34,9 +34,9 @@ namespace detail { namespace envelope { -template struct envelope_multi_linestring { + template static inline void apply(MultiLinestring const& mp, Box& mbr) { assign_inverse(mbr); @@ -52,9 +52,9 @@ struct envelope_multi_linestring // version for multi_polygon: outer ring's of all polygons -template struct envelope_multi_polygon { + template static inline void apply(MultiPolygon const& mp, Box& mbr) { assign_inverse(mbr); @@ -78,32 +78,20 @@ struct envelope_multi_polygon namespace dispatch { -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_multi_linestring +template +struct envelope + : detail::envelope::envelope_multi_linestring {}; -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_multi_polygon +template +struct envelope + : detail::envelope::envelope_multi_polygon {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp index a307ebae8..8c47672d9 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp @@ -29,33 +29,27 @@ namespace dispatch { -template +template struct equals < - multi_polygon_tag, multi_polygon_tag, MultiPolygon1, MultiPolygon2, - 2 + multi_polygon_tag, multi_polygon_tag, + 2, + Reverse > - : detail::equals::equals_by_collection - < - MultiPolygon1, MultiPolygon2, - detail::equals::area_check - > + : detail::equals::equals_by_collection {}; -template +template struct equals < - polygon_tag, multi_polygon_tag, Polygon, MultiPolygon, - 2 + polygon_tag, multi_polygon_tag, + 2, + Reverse > - : detail::equals::equals_by_collection - < - Polygon, MultiPolygon, - detail::equals::area_check - > + : detail::equals::equals_by_collection {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp index 1be38e0a7..adf12dbba 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp @@ -36,24 +36,16 @@ namespace detail { namespace for_each // Implementation of multi, for both point and segment, // just calling the single version. -template -< - typename MultiGeometry, - typename Functor, - bool IsConst, - typename Policy -> +template struct for_each_multi { - static inline Functor apply( - typename add_const_if_c::type& multi, - Functor f) + template + static inline void apply(MultiGeometry& multi, Functor& f) { for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it) { - f = Policy::apply(*it, f); + Policy::apply(*it, f); } - return f; } }; @@ -66,55 +58,35 @@ struct for_each_multi namespace dispatch { -template -< - typename MultiGeometry, - typename Functor, - bool IsConst -> -struct for_each_point +template +struct for_each_point : detail::for_each::for_each_multi < - MultiGeometry, - Functor, - IsConst, // Specify the dispatch of the single-version as policy for_each_point < - typename single_tag_of + typename add_const_if_c < - typename tag::type - >::type, - typename boost::range_value::type, - Functor, - IsConst + is_const::value, + typename boost::range_value::type + >::type > > {}; -template -< - typename MultiGeometry, - typename Functor, - bool IsConst -> -struct for_each_segment +template +struct for_each_segment : detail::for_each::for_each_multi < - MultiGeometry, - Functor, - IsConst, // Specify the dispatch of the single-version as policy for_each_segment < - typename single_tag_of + typename add_const_if_c < - typename tag::type - >::type, - typename boost::range_value::type, - Functor, - IsConst + is_const::value, + typename boost::range_value::type + >::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp index 31e74a79b..0027a4e15 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp @@ -36,14 +36,14 @@ namespace detail { namespace intersection { -template -< - typename MultiLinestring1, typename MultiLinestring2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_multi_linestring_multi_linestring_point { + template + < + typename MultiLinestring1, typename MultiLinestring2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring1 const& ml1, MultiLinestring2 const& ml2, OutputIterator out, Strategy const& strategy) @@ -64,12 +64,8 @@ struct intersection_multi_linestring_multi_linestring_point it2 != boost::end(ml2); ++it2) { - out = intersection_linestring_linestring_point - < - typename boost::range_value::type, - typename boost::range_value::type, - OutputIterator, PointOut, Strategy - >::apply(*it1, *it2, out, strategy); + out = intersection_linestring_linestring_point + ::apply(*it1, *it2, out, strategy); } } @@ -78,14 +74,14 @@ struct intersection_multi_linestring_multi_linestring_point }; -template -< - typename Linestring, typename MultiLinestring, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_linestring_multi_linestring_point { + template + < + typename Linestring, typename MultiLinestring, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Linestring const& linestring, MultiLinestring const& ml, OutputIterator out, Strategy const& strategy) @@ -97,12 +93,8 @@ struct intersection_linestring_multi_linestring_point it != boost::end(ml); ++it) { - out = intersection_linestring_linestring_point - < - Linestring, - typename boost::range_value::type, - OutputIterator, PointOut, Strategy - >::apply(linestring, *it, out, strategy); + out = intersection_linestring_linestring_point + ::apply(linestring, *it, out, strategy); } return out; @@ -114,14 +106,17 @@ struct intersection_linestring_multi_linestring_point // is second (above) or first (below) argument, it is not trivial to merge them. template < - typename MultiLinestring, typename Areal, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_multi_linestring_with_areal { + template + < + typename MultiLinestring, typename Areal, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal, OutputIterator out, Strategy const& strategy) @@ -135,9 +130,7 @@ struct intersection_of_multi_linestring_with_areal { out = intersection_of_linestring_with_areal < - typename boost::range_value::type, - Areal, ReverseAreal, - OutputIterator, LineStringOut, OverlayType, Strategy + ReverseAreal, LineStringOut, OverlayType >::apply(*it, areal, out, strategy); } @@ -149,38 +142,38 @@ struct intersection_of_multi_linestring_with_areal // This one calls the one above with reversed arguments template < - typename Areal, typename MultiLinestring, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_areal_with_multi_linestring { + template + < + typename Areal, typename MultiLinestring, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml, OutputIterator out, Strategy const& strategy) { return intersection_of_multi_linestring_with_areal < - MultiLinestring, Areal, ReverseAreal, - OutputIterator, LineStringOut, - OverlayType, - Strategy + ReverseAreal, LineStringOut, OverlayType >::apply(ml, areal, out, strategy); } }; -template -< - typename MultiLinestring, typename Box, - typename OutputIterator, typename LinestringOut, - typename Strategy -> +template struct clip_multi_linestring { + template + < + typename MultiLinestring, typename Box, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring const& multi_linestring, Box const& box, OutputIterator out, Strategy const& ) { @@ -211,25 +204,21 @@ namespace dispatch template < typename MultiLinestring1, typename MultiLinestring2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, multi_linestring_tag, point_tag, - false, false, false, MultiLinestring1, MultiLinestring2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + multi_linestring_tag, multi_linestring_tag, point_tag, + false, false, false > : detail::intersection::intersection_multi_linestring_multi_linestring_point < - MultiLinestring1, MultiLinestring2, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -237,25 +226,21 @@ struct intersection_insert template < typename Linestring, typename MultiLinestring, - typename OutputIterator, typename GeometryOut, - bool Reverse1, bool Reverse2, bool ReverseOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, multi_linestring_tag, point_tag, - false, false, false, Linestring, MultiLinestring, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + linestring_tag, multi_linestring_tag, point_tag, + false, false, false > : detail::intersection::intersection_linestring_multi_linestring_point < - Linestring, MultiLinestring, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -263,25 +248,21 @@ struct intersection_insert template < typename MultiLinestring, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, box_tag, linestring_tag, - false, true, false, MultiLinestring, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + multi_linestring_tag, box_tag, linestring_tag, + false, true, false > : detail::intersection::clip_multi_linestring < - MultiLinestring, Box, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -289,27 +270,23 @@ struct intersection_insert template < typename Linestring, typename MultiPolygon, - bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut > struct intersection_insert < - linestring_tag, multi_polygon_tag, linestring_tag, - false, true, false, Linestring, MultiPolygon, - ReverseLinestring, ReverseMultiPolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReverseMultiPolygon, ReverseOut, + linestring_tag, multi_polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, MultiPolygon, ReverseMultiPolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -319,27 +296,23 @@ struct intersection_insert template < typename Polygon, typename MultiLinestring, - bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut > struct intersection_insert < - polygon_tag, multi_linestring_tag, linestring_tag, - true, false, false, Polygon, MultiLinestring, - ReversePolygon, ReverseMultiLinestring, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReversePolygon, ReverseMultiLinestring, ReverseOut, + polygon_tag, multi_linestring_tag, linestring_tag, + true, false, false > : detail::intersection::intersection_of_areal_with_multi_linestring < - Polygon, MultiLinestring, ReversePolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -347,54 +320,46 @@ struct intersection_insert template < typename MultiLinestring, typename Ring, - bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, ring_tag, linestring_tag, - false, true, false, MultiLinestring, Ring, - ReverseMultiLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseRing, ReverseOut, + multi_linestring_tag, ring_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, Ring, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; template < typename MultiLinestring, typename Polygon, - bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, polygon_tag, linestring_tag, - false, true, false, MultiLinestring, Polygon, - ReverseMultiLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseRing, ReverseOut, + multi_linestring_tag, polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, Polygon, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -403,27 +368,23 @@ struct intersection_insert template < typename MultiLinestring, typename MultiPolygon, - bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, multi_polygon_tag, linestring_tag, - false, true, false, MultiLinestring, MultiPolygon, - ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut, + multi_linestring_tag, multi_polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, MultiPolygon, ReverseMultiPolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp index 51ff9ef3c..ef5fb3c97 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp @@ -30,21 +30,25 @@ namespace boost { namespace geometry namespace dispatch { -template -struct length - : detail::multi_sum - < - typename default_length_result::type, - MultiLinestring, - Strategy, - detail::length::range_length - < - typename boost::range_value::type, - Strategy, - closed // no need to close it explicitly - > - > -{}; +template +struct length : detail::multi_sum +{ + template + static inline typename default_length_result::type + apply(MultiLinestring const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename default_length_result::type, + detail::length::range_length + < + typename boost::range_value::type, + closed // no need to close it explicitly + > + >(multi, strategy); + + } +}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp index 213339a18..cc59655be 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp @@ -32,7 +32,7 @@ namespace dispatch { template -struct num_geometries +struct num_geometries { static inline std::size_t apply(MultiGeometry const& multi_geometry) { diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp index 87b0bdea9..8390fe77a 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp @@ -34,7 +34,7 @@ namespace dispatch template -struct num_interior_rings +struct num_interior_rings { static inline std::size_t apply(MultiPolygon const& multi_polygon) { diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp index 5ea53854e..1cc82b2f0 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp @@ -30,9 +30,9 @@ namespace detail { namespace num_points { -template struct multi_count { + template static inline size_t apply(MultiGeometry const& geometry, bool add_for_open) { typedef typename boost::range_value::type geometry_type; @@ -46,11 +46,7 @@ struct multi_count it != boost::end(geometry); ++it) { - n += dispatch::num_points - < - typename tag::type, - geometry_type - >::apply(*it, add_for_open); + n += dispatch::num_points::apply(*it, add_for_open); } return n; } @@ -67,8 +63,8 @@ namespace dispatch template -struct num_points - : detail::num_points::multi_count {}; +struct num_points + : detail::num_points::multi_count {}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp index 147f6fcc3..6a13f90e3 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp @@ -30,21 +30,20 @@ namespace boost { namespace geometry #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { -template -struct perimeter - : detail::multi_sum - < - typename default_length_result::type, - MultiPolygon, - Strategy, - perimeter - < - polygon_tag, - typename boost::range_value::type, - Strategy - > - > -{}; +template +struct perimeter : detail::multi_sum +{ + template + static inline typename default_length_result::type + apply(MultiPolygon const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename default_length_result::type, + perimeter::type> + >(multi, strategy); + } +}; } // namespace dispatch #endif diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp index f8a9442ac..910f1e3d1 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp @@ -34,27 +34,21 @@ namespace dispatch template -struct reverse +struct reverse : detail::multi_modify < Geometry, detail::reverse::range_reverse - < - typename boost::range_value::type - > > {}; template -struct reverse +struct reverse : detail::multi_modify < Geometry, detail::reverse::polygon_reverse - < - typename boost::range_value::type - > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp index dc3c7b593..1706c69f4 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp @@ -31,9 +31,10 @@ namespace boost { namespace geometry namespace detail { namespace simplify { -template +template struct simplify_multi { + template static inline void apply(MultiGeometry const& multi, MultiGeometry& out, double max_distance, Strategy const& strategy) { @@ -63,47 +64,21 @@ struct simplify_multi namespace dispatch { -template -struct simplify +template +struct simplify : detail::simplify::simplify_copy - < - MultiPoint, - Strategy - > - {}; -template -struct simplify - : detail::simplify::simplify_multi - < - MultiLinestring, - Strategy, - detail::simplify::simplify_range - < - typename boost::range_value::type, - Strategy, - 2 - > - > - +template +struct simplify + : detail::simplify::simplify_multi > {}; -template -struct simplify - : detail::simplify::simplify_multi - < - MultiPolygon, - Strategy, - detail::simplify::simplify_polygon - < - typename boost::range_value::type, - Strategy - > - > - +template +struct simplify + : detail::simplify::simplify_multi {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp index 09926778f..110e96958 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp @@ -31,10 +31,10 @@ namespace detail { namespace transform /*! \brief Is able to transform any multi-geometry, calling the single-version as policy */ -template +template struct transform_multi { - template + template static inline bool apply(Multi1 const& multi1, Multi2& multi2, S const& strategy) { traits::resize::apply(multi2, boost::size(multi1)); @@ -65,30 +65,18 @@ struct transform_multi namespace dispatch { -template +template struct transform < - multi_tag, multi_tag, Multi1, Multi2, - Strategy + multi_tag, multi_tag > : detail::transform::transform_multi < - Multi1, - Multi2, transform < - typename single_tag_of - < - typename tag::type - >::type, - typename single_tag_of - < - typename tag::type - >::type, typename boost::range_value::type, - typename boost::range_value::type, - Strategy + typename boost::range_value::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp index 5067e71f3..bda2234a6 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp @@ -30,9 +30,10 @@ namespace detail { namespace unique { -template +template struct multi_unique { + template static inline void apply(MultiGeometry& multi, ComparePolicy const& compare) { for (typename boost::range_iterator::type @@ -62,33 +63,15 @@ namespace dispatch // possible for multi-points as well, removing points at the same location. -template -struct unique - : detail::unique::multi_unique - < - MultiLineString, - ComparePolicy, - detail::unique::range_unique - < - typename boost::range_value::type, - ComparePolicy - > - > +template +struct unique + : detail::unique::multi_unique {}; -template -struct unique - : detail::unique::multi_unique - < - MultiPolygon, - ComparePolicy, - detail::unique::polygon_unique - < - typename boost::range_value::type, - ComparePolicy - > - > +template +struct unique + : detail::unique::multi_unique {}; diff --git a/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp b/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp index 3c75fd804..218ddf999 100644 --- a/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp +++ b/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp @@ -58,6 +58,69 @@ struct multi_parser handle_close_parenthesis(it, tokens.end(), wkt); } + + check_end(it, tokens.end(), wkt); + } +}; + +template +struct noparenthesis_point_parser +{ + static inline void apply(tokenizer::iterator& it, tokenizer::iterator end, + std::string const& wkt, P& point) + { + parsing_assigner::value>::apply(it, end, point, wkt); + } +}; + +template +struct multi_point_parser +{ + static inline void apply(std::string const& wkt, MultiGeometry& geometry) + { + traits::clear::apply(geometry); + + tokenizer tokens(wkt, boost::char_separator(" ", ",()")); + tokenizer::iterator it; + + if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) + { + handle_open_parenthesis(it, tokens.end(), wkt); + + // If first point definition starts with "(" then parse points as (x y) + // otherwise as "x y" + bool using_brackets = (it != tokens.end() && *it == "("); + + while(it != tokens.end() && *it != ")") + { + traits::resize::apply(geometry, boost::size(geometry) + 1); + + if (using_brackets) + { + point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, geometry.back()); + } + else + { + noparenthesis_point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, geometry.back()); + } + + if (it != tokens.end() && *it == ",") + { + // Skip "," after point is parsed + ++it; + } + } + + handle_close_parenthesis(it, tokens.end(), wkt); + } + + check_end(it, tokens.end(), wkt); } }; @@ -69,10 +132,9 @@ namespace dispatch template struct read_wkt - : detail::wkt::multi_parser + : detail::wkt::multi_point_parser < MultiGeometry, - detail::wkt::point_parser, detail::wkt::prefix_multipoint > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/multi.hpp b/project/jni/boost/include/boost/geometry/multi/multi.hpp index db33a9dd0..df10392cb 100644 --- a/project/jni/boost/include/boost/geometry/multi/multi.hpp +++ b/project/jni/boost/include/boost/geometry/multi/multi.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp b/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp index 9090d8b51..cfbaf7dd1 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp @@ -126,7 +126,9 @@ struct segments_direction typedef typename select_most_precise::type rtype; + template static inline return_type segments_intersect(side_info const& sides, + R const&, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, S1 const& s1, S2 const& s2) diff --git a/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp b/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp index afd1dde50..d7d519905 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp @@ -36,56 +36,33 @@ struct segments_intersection_points typedef ReturnType return_type; typedef S1 segment_type1; typedef S2 segment_type2; + typedef typename select_calculation_type < S1, S2, CalculationType >::type coordinate_type; + template static inline return_type segments_intersect(side_info const&, + R const& r, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, S1 const& s1, S2 const& s2) { - return_type result; typedef typename geometry::coordinate_type < typename return_type::point_type - >::type coordinate_type; + >::type return_coordinate_type; - // Get the same type, but at least a double (also used for divisions) - typedef typename select_most_precise - < - coordinate_type, double - >::type promoted_type; - - promoted_type const s1x = get<0, 0>(s1); - promoted_type const s1y = get<0, 1>(s1); - - // Calculate other determinants - Cramers rule - promoted_type const wx = get<0, 0>(s1) - get<0, 0>(s2); - promoted_type const wy = get<0, 1>(s1) - get<0, 1>(s2); - promoted_type const d = detail::determinant(dx1, dy1, dx2, dy2); - promoted_type const da = detail::determinant(dx2, dy2, wx, wy); - - // r: ratio 0-1 where intersection divides A/B - promoted_type r = da / d; - promoted_type const zero = promoted_type(); - promoted_type const one = 1; - // Handle robustness issues - if (r < zero) - { - r = zero; - } - else if (r > one) - { - r = one; - } + coordinate_type const s1x = get<0, 0>(s1); + coordinate_type const s1y = get<0, 1>(s1); + return_type result; result.count = 1; set<0>(result.intersections[0], - boost::numeric_cast(s1x + r * promoted_type(dx1))); + boost::numeric_cast(R(s1x) + r * R(dx1))); set<1>(result.intersections[0], - boost::numeric_cast(s1y + r * promoted_type(dy1))); + boost::numeric_cast(R(s1y) + r * R(dy1))); return result; } diff --git a/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp b/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp index 853a8a26a..f6713c44c 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp @@ -49,16 +49,18 @@ struct segments_tupled // Get the same type, but at least a double typedef typename select_most_precise::type rtype; + template static inline return_type segments_intersect(side_info const& sides, + R const& r, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, segment_type1 const& s1, segment_type2 const& s2) { return boost::make_tuple ( - Policy1::segments_intersect(sides, + Policy1::segments_intersect(sides, r, dx1, dy1, dx2, dy2, s1, s2), - Policy2::segments_intersect(sides, + Policy2::segments_intersect(sides, r, dx1, dy1, dx2, dy2, s1, s2) ); } diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index 2bf7b7767..564010f0a 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -41,21 +41,17 @@ namespace strategy { namespace intersection namespace detail { -template -struct segment_arrange +template +static inline void segment_arrange(Segment const& s, T& s_1, T& s_2, bool& swapped) { - template - static inline void apply(Segment const& s, T& s_1, T& s_2, bool& swapped) + s_1 = get<0, Dimension>(s); + s_2 = get<1, Dimension>(s); + if (s_1 > s_2) { - s_1 = get<0, Dimension>(s); - s_2 = get<1, Dimension>(s); - if (s_1 > s_2) - { - std::swap(s_1, s_2); - swapped = true; - } + std::swap(s_1, s_2); + swapped = true; } -}; +} template inline typename geometry::point_type::type get_from_index( @@ -121,34 +117,36 @@ struct relate_cartesian_segments coordinate_type const& dx_a, coordinate_type const& dy_a, coordinate_type const& dx_b, coordinate_type const& dy_b) { - // 1) Handle "disjoint", common case. - // per dimension, 2 cases: a_1----------a_2 b_1-------b_2 or B left of A - coordinate_type ax_1, ax_2, bx_1, bx_2; - bool ax_swapped = false, bx_swapped = false; - detail::segment_arrange::apply(a, ax_1, ax_2, ax_swapped); - detail::segment_arrange::apply(b, bx_1, bx_2, bx_swapped); - if (ax_2 < bx_1 || ax_1 > bx_2) - { - return Policy::disjoint(); - } - - // 1b) In Y-dimension - coordinate_type ay_1, ay_2, by_1, by_2; - bool ay_swapped = false, by_swapped = false; - detail::segment_arrange::apply(a, ay_1, ay_2, ay_swapped); - detail::segment_arrange::apply(b, by_1, by_2, by_swapped); - if (ay_2 < by_1 || ay_1 > by_2) - { - return Policy::disjoint(); - } - typedef side::side_by_triangle side; side_info sides; - // 2) Calculate sides - // Note: Do NOT yet calculate the determinant here, but use the SIDE strategy. - // Determinant calculation is not robust; side (orient) can be made robust - // (and is much robuster even without measures) + coordinate_type const zero = 0; + bool const a_is_point = math::equals(dx_a, zero) && math::equals(dy_a, zero); + bool const b_is_point = math::equals(dx_b, zero) && math::equals(dy_b, zero); + + if(a_is_point && b_is_point) + { + if(math::equals(get<1,0>(a), get<1,0>(b)) && math::equals(get<1,1>(a), get<1,1>(b))) + { + Policy::degenerate(a, true); + } + else + { + return Policy::disjoint(); + } + } + + bool collinear_use_first = math::abs(dx_a) + math::abs(dx_b) >= math::abs(dy_a) + math::abs(dy_b); + + sides.set<0> + ( + side::apply(detail::get_from_index<0>(b) + , detail::get_from_index<1>(b) + , detail::get_from_index<0>(a)), + side::apply(detail::get_from_index<0>(b) + , detail::get_from_index<1>(b) + , detail::get_from_index<1>(a)) + ); sides.set<1> ( side::apply(detail::get_from_index<0>(a) @@ -159,115 +157,368 @@ struct relate_cartesian_segments , detail::get_from_index<1>(b)) ); - if (sides.same<1>()) + bool collinear = sides.collinear(); + + robustness_verify_collinear(a, b, a_is_point, b_is_point, sides, collinear); + robustness_verify_meeting(a, b, sides, collinear, collinear_use_first); + + if (sides.same<0>() || sides.same<1>()) { // Both points are at same side of other segment, we can leave - return Policy::disjoint(); - } - - // 2b) For other segment - sides.set<0> - ( - side::apply(detail::get_from_index<0>(b) - , detail::get_from_index<1>(b) - , detail::get_from_index<0>(a)), - side::apply(detail::get_from_index<0>(b) - , detail::get_from_index<1>(b) - , detail::get_from_index<1>(a)) - ); - - if (sides.same<0>()) - { - return Policy::disjoint(); + if (robustness_verify_same_side(a, b, sides)) + { + return Policy::disjoint(); + } } // Degenerate cases: segments of single point, lying on other segment, non disjoint - coordinate_type const zero = 0; - if (math::equals(dx_a, zero) && math::equals(dy_a, zero)) + if (a_is_point) { return Policy::degenerate(a, true); } - if (math::equals(dx_b, zero) && math::equals(dy_b, zero)) + if (b_is_point) { return Policy::degenerate(b, false); } - bool collinear = sides.collinear(); - - // Get the same type, but at least a double (also used for divisions) typedef typename select_most_precise < coordinate_type, double >::type promoted_type; - // Calculate the determinant/2D cross product - // (Note, because we only check on zero, - // the order a/b does not care) - promoted_type const d = geometry::detail::determinant - < - promoted_type - >(dx_a, dy_a, dx_b, dy_b); - - // Determinant d should be nonzero. - // If it is zero, we have an robustness issue here, - // (and besides that we cannot divide by it) - promoted_type const pt_zero = promoted_type(); - if(math::equals(d, pt_zero) && ! collinear) + // r: ratio 0-1 where intersection divides A/B + // (only calculated for non-collinear segments) + promoted_type r; + if (! collinear) { -#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION - std::cout << "Determinant zero? Type : " - << typeid(coordinate_type).name() - << std::endl; + // Calculate determinants - Cramers rule + coordinate_type const wx = get<0, 0>(a) - get<0, 0>(b); + coordinate_type const wy = get<0, 1>(a) - get<0, 1>(b); + coordinate_type const d = geometry::detail::determinant(dx_a, dy_a, dx_b, dy_b); + coordinate_type const da = geometry::detail::determinant(dx_b, dy_b, wx, wy); - std::cout << " dx_a : " << dx_a << std::endl; - std::cout << " dy_a : " << dy_a << std::endl; - std::cout << " dx_b : " << dx_b << std::endl; - std::cout << " dy_b : " << dy_b << std::endl; - - std::cout << " side a <-> b.first : " << sides.get<0,0>() << std::endl; - std::cout << " side a <-> b.second: " << sides.get<0,1>() << std::endl; - std::cout << " side b <-> a.first : " << sides.get<1,0>() << std::endl; - std::cout << " side b <-> a.second: " << sides.get<1,1>() << std::endl; -#endif - - if (sides.as_collinear()) + coordinate_type const zero = coordinate_type(); + if (math::equals(d, zero)) { + // This is still a collinear case (because of FP imprecision this can occur here) + // sides.debug(); sides.set<0>(0,0); sides.set<1>(0,0); collinear = true; } else { - return Policy::error("Determinant zero!"); + r = promoted_type(da) / promoted_type(d); + + if (! robustness_verify_r(a, b, r)) + { + return Policy::disjoint(); + } + + robustness_handle_meeting(a, b, sides, dx_a, dy_a, wx, wy, d, r); + + if (robustness_verify_disjoint_at_one_collinear(a, b, sides)) + { + return Policy::disjoint(); + } + } } if(collinear) { - // Segments are collinear. We'll find out how. - if (math::equals(dx_b, zero)) + if (collinear_use_first) { - // Vertical -> Check y-direction - return relate_collinear(a, b, - ay_1, ay_2, by_1, by_2, - ay_swapped, by_swapped); + return relate_collinear<0>(a, b); } else { - // Check x-direction - return relate_collinear(a, b, - ax_1, ax_2, bx_1, bx_2, - ax_swapped, bx_swapped); + // Y direction contains larger segments (maybe dx is zero) + return relate_collinear<1>(a, b); } } - return Policy::segments_intersect(sides, + return Policy::segments_intersect(sides, r, dx_a, dy_a, dx_b, dy_b, a, b); } private : + + // Ratio should lie between 0 and 1 + // Also these three conditions might be of FP imprecision, the segments were actually (nearly) collinear + template + static inline bool robustness_verify_r( + segment_type1 const& a, segment_type2 const& b, + T& r) + { + T const zero = 0; + T const one = 1; + if (r < zero || r > one) + { + if (verify_disjoint<0>(a, b) || verify_disjoint<1>(a, b)) + { + // Can still be disjoint (even if not one is left or right from another) + // This is e.g. in case #snake4 of buffer test. + return false; + } + + //std::cout << "ROBUSTNESS: correction of r " << r << std::endl; + // sides.debug(); + + // ROBUSTNESS: the r value can in epsilon-cases much larger than 1, while (with perfect arithmetic) + // it should be one. It can be 1.14 or even 1.98049 or 2 (while still intersecting) + + // If segments are crossing (we can see that with the sides) + // and one is inside the other, there must be an intersection point. + // We correct for that. + // This is (only) in case #ggl_list_20110820_christophe in unit tests + + // If segments are touching (two sides zero), of course they should intersect + // This is (only) in case #buffer_rt_i in the unit tests) + + // If one touches in the middle, they also should intersect (#buffer_rt_j) + + // Note that even for ttmath r is occasionally > 1, e.g. 1.0000000000000000000000036191231203575 + + if (r > one) + { + r = one; + } + else if (r < zero) + { + r = zero; + } + } + return true; + } + + static inline void robustness_verify_collinear( + segment_type1 const& a, segment_type2 const& b, + bool a_is_point, bool b_is_point, + side_info& sides, + bool& collinear) + { + if ((sides.zero<0>() && ! b_is_point && ! sides.zero<1>()) || (sides.zero<1>() && ! a_is_point && ! sides.zero<0>())) + { + // If one of the segments is collinear, the other must be as well. + // So handle it as collinear. + // (In float/double epsilon margins it can easily occur that one or two of them are -1/1) + // sides.debug(); + sides.set<0>(0,0); + sides.set<1>(0,0); + collinear = true; + } + } + + static inline void robustness_verify_meeting( + segment_type1 const& a, segment_type2 const& b, + side_info& sides, + bool& collinear, bool& collinear_use_first) + { + if (sides.meeting()) + { + // If two segments meet each other at their segment-points, two sides are zero, + // the other two are not (unless collinear but we don't mean those here). + // However, in near-epsilon ranges it can happen that two sides are zero + // but they do not meet at their segment-points. + // In that case they are nearly collinear and handled as such. + if (! point_equals + ( + select(sides.zero_index<0>(), a), + select(sides.zero_index<1>(), b) + ) + ) + { + sides.set<0>(0,0); + sides.set<1>(0,0); + collinear = true; + + if (collinear_use_first && analyse_equal<0>(a, b)) + { + collinear_use_first = false; + } + else if (! collinear_use_first && analyse_equal<1>(a, b)) + { + collinear_use_first = true; + } + + } + } + } + + // Verifies and if necessary correct missed touch because of robustness + // This is the case at multi_polygon_buffer unittest #rt_m + static inline bool robustness_verify_same_side( + segment_type1 const& a, segment_type2 const& b, + side_info& sides) + { + int corrected = 0; + if (sides.one_touching<0>()) + { + if (point_equals( + select(sides.zero_index<0>(), a), + select(0, b) + )) + { + sides.correct_to_zero<1, 0>(); + corrected = 1; + } + if (point_equals + ( + select(sides.zero_index<0>(), a), + select(1, b) + )) + { + sides.correct_to_zero<1, 1>(); + corrected = 2; + } + } + else if (sides.one_touching<1>()) + { + if (point_equals( + select(sides.zero_index<1>(), b), + select(0, a) + )) + { + sides.correct_to_zero<0, 0>(); + corrected = 3; + } + if (point_equals + ( + select(sides.zero_index<1>(), b), + select(1, a) + )) + { + sides.correct_to_zero<0, 1>(); + corrected = 4; + } + } + + return corrected == 0; + } + + static inline bool robustness_verify_disjoint_at_one_collinear( + segment_type1 const& a, segment_type2 const& b, + side_info const& sides) + { + if (sides.one_of_all_zero()) + { + if (verify_disjoint<0>(a, b) || verify_disjoint<1>(a, b)) + { + return true; + } + } + return false; + } + + + // If r is one, or zero, segments should meet and their endpoints. + // Robustness issue: check if this is really the case. + // It turns out to be no problem, see buffer test #rt_s1 (and there are many cases generated) + // It generates an "ends in the middle" situation which is correct. + template + static inline void robustness_handle_meeting(segment_type1 const& a, segment_type2 const& b, + side_info& sides, + T const& dx_a, T const& dy_a, T const& wx, T const& wy, + T const& d, R const& r) + { + return; + + T const db = geometry::detail::determinant(dx_a, dy_a, wx, wy); + + R const zero = 0; + R const one = 1; + if (math::equals(r, zero) || math::equals(r, one)) + { + R rb = db / d; + if (rb <= 0 || rb >= 1 || math::equals(rb, 0) || math::equals(rb, 1)) + { + if (sides.one_zero<0>() && ! sides.one_zero<1>()) // or vice versa + { +#if defined(BOOST_GEOMETRY_COUNT_INTERSECTION_EQUAL) + extern int g_count_intersection_equal; + g_count_intersection_equal++; +#endif + sides.debug(); + std::cout << "E r=" << r << " r.b=" << rb << " "; + } + } + } + } + + template + static inline bool verify_disjoint(segment_type1 const& a, + segment_type2 const& b) + { + coordinate_type a_1, a_2, b_1, b_2; + bool a_swapped = false, b_swapped = false; + detail::segment_arrange(a, a_1, a_2, a_swapped); + detail::segment_arrange(b, b_1, b_2, b_swapped); + return math::smaller(a_2, b_1) || math::larger(a_1, b_2); + } + + template + static inline typename point_type::type select(int index, Segment const& segment) + { + return index == 0 + ? detail::get_from_index<0>(segment) + : detail::get_from_index<1>(segment) + ; + } + + // We cannot use geometry::equals here. Besides that this will be changed + // to compare segment-coordinate-values directly (not necessary to retrieve point first) + template + static inline bool point_equals(Point1 const& point1, Point2 const& point2) + { + return math::equals(get<0>(point1), get<0>(point2)) + && math::equals(get<1>(point1), get<1>(point2)) + ; + } + + // We cannot use geometry::equals here. Besides that this will be changed + // to compare segment-coordinate-values directly (not necessary to retrieve point first) + template + static inline bool point_equality(Point1 const& point1, Point2 const& point2, + bool& equals_0, bool& equals_1) + { + equals_0 = math::equals(get<0>(point1), get<0>(point2)); + equals_1 = math::equals(get<1>(point1), get<1>(point2)); + return equals_0 && equals_1; + } + + template + static inline bool analyse_equal(segment_type1 const& a, segment_type2 const& b) + { + coordinate_type const a_1 = geometry::get<0, Dimension>(a); + coordinate_type const a_2 = geometry::get<1, Dimension>(a); + coordinate_type const b_1 = geometry::get<0, Dimension>(b); + coordinate_type const b_2 = geometry::get<1, Dimension>(b); + return math::equals(a_1, b_1) + || math::equals(a_2, b_1) + || math::equals(a_1, b_2) + || math::equals(a_2, b_2) + ; + } + + template + static inline return_type relate_collinear(segment_type1 const& a, + segment_type2 const& b) + { + coordinate_type a_1, a_2, b_1, b_2; + bool a_swapped = false, b_swapped = false; + detail::segment_arrange(a, a_1, a_2, a_swapped); + detail::segment_arrange(b, b_1, b_2, b_swapped); + if (math::smaller(a_2, b_1) || math::larger(a_1, b_2)) + //if (a_2 < b_1 || a_1 > b_2) + { + return Policy::disjoint(); + } + return relate_collinear(a, b, a_1, a_2, b_1, b_2, a_swapped, b_swapped); + } + /// Relate segments known collinear static inline return_type relate_collinear(segment_type1 const& a , segment_type2 const& b @@ -296,25 +547,28 @@ private : // Handle "equal", in polygon neighbourhood comparisons a common case - // Check if segments are equal... - bool const a1_eq_b1 = math::equals(get<0, 0>(a), get<0, 0>(b)) - && math::equals(get<0, 1>(a), get<0, 1>(b)); - bool const a2_eq_b2 = math::equals(get<1, 0>(a), get<1, 0>(b)) - && math::equals(get<1, 1>(a), get<1, 1>(b)); - if (a1_eq_b1 && a2_eq_b2) + bool const opposite = a_swapped ^ b_swapped; + bool const both_swapped = a_swapped && b_swapped; + + // Check if segments are equal or opposite equal... + bool const swapped_a1_eq_b1 = math::equals(a_1, b_1); + bool const swapped_a2_eq_b2 = math::equals(a_2, b_2); + + if (swapped_a1_eq_b1 && swapped_a2_eq_b2) { - return Policy::segment_equal(a, false); + return Policy::segment_equal(a, opposite); } - // ... or opposite equal - bool const a1_eq_b2 = math::equals(get<0, 0>(a), get<1, 0>(b)) - && math::equals(get<0, 1>(a), get<1, 1>(b)); - bool const a2_eq_b1 = math::equals(get<1, 0>(a), get<0, 0>(b)) - && math::equals(get<1, 1>(a), get<0, 1>(b)); - if (a1_eq_b2 && a2_eq_b1) - { - return Policy::segment_equal(a, true); - } + bool const swapped_a2_eq_b1 = math::equals(a_2, b_1); + bool const swapped_a1_eq_b2 = math::equals(a_1, b_2); + + bool const a1_eq_b1 = both_swapped ? swapped_a2_eq_b2 : a_swapped ? swapped_a2_eq_b1 : b_swapped ? swapped_a1_eq_b2 : swapped_a1_eq_b1; + bool const a2_eq_b2 = both_swapped ? swapped_a1_eq_b1 : a_swapped ? swapped_a1_eq_b2 : b_swapped ? swapped_a2_eq_b1 : swapped_a2_eq_b2; + + bool const a1_eq_b2 = both_swapped ? swapped_a2_eq_b1 : a_swapped ? swapped_a2_eq_b2 : b_swapped ? swapped_a1_eq_b1 : swapped_a1_eq_b2; + bool const a2_eq_b1 = both_swapped ? swapped_a1_eq_b2 : a_swapped ? swapped_a1_eq_b1 : b_swapped ? swapped_a2_eq_b2 : swapped_a2_eq_b1; + + // The rest below will return one or two intersections. @@ -322,7 +576,7 @@ private : // For IM it is important to know which relates to which. So this information is given, // without performance penalties to intersection calculation - bool const has_common_points = a1_eq_b1 || a1_eq_b2 || a2_eq_b1 || a2_eq_b2; + bool const has_common_points = swapped_a1_eq_b1 || swapped_a1_eq_b2 || swapped_a2_eq_b1 || swapped_a2_eq_b2; // "Touch" -> one intersection point -> one but not two common points @@ -342,7 +596,7 @@ private : // #4: a2<----a1 b1--->b2 (no arrival at all) // Where the arranged forms have two forms: // a_1-----a_2/b_1-------b_2 or reverse (B left of A) - if (has_common_points && (math::equals(a_2, b_1) || math::equals(b_2, a_1))) + if ((swapped_a2_eq_b1 || swapped_a1_eq_b2) && ! swapped_a1_eq_b1 && ! swapped_a2_eq_b2) { if (a2_eq_b1) return Policy::collinear_touch(get<1, 0>(a), get<1, 1>(a), 0, -1); if (a1_eq_b2) return Policy::collinear_touch(get<0, 0>(a), get<0, 1>(a), -1, 0); @@ -402,7 +656,6 @@ private : if (a1_eq_b1) return Policy::collinear_interior_boundary_intersect(a_in_b ? a : b, a_in_b, arrival_a, -arrival_a, false); } - bool const opposite = a_swapped ^ b_swapped; // "Inside", a completely within b or b completely within a @@ -464,7 +717,6 @@ private : the picture might seem wrong but it (supposed to be) is right. */ - bool const both_swapped = a_swapped && b_swapped; if (b_1 < a_2 && a_2 < b_2) { // Left column, from bottom to top @@ -486,7 +738,7 @@ private : ; } // Nothing should goes through. If any we have made an error - // Robustness: it can occur here... + // std::cout << "Robustness issue, non-logical behaviour" << std::endl; return Policy::error("Robustness issue, non-logical behaviour"); } }; diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp index e704a3310..13d416844 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp @@ -75,23 +75,27 @@ template class projected_point { public : - typedef typename strategy::distance::services::return_type::type calculation_type; - -private : - // The three typedefs below are necessary to calculate distances // from segments defined in integer coordinates. // Integer coordinates can still result in FP distances. // There is a division, which must be represented in FP. // So promote. - typedef typename promote_floating_point::type fp_type; + typedef typename promote_floating_point + < + typename strategy::distance::services::return_type + < + Strategy + >::type + >::type calculation_type; + +private : // A projected point of points in Integer coordinates must be able to be // represented in FP. typedef model::point < - fp_type, + calculation_type, dimension::value, typename coordinate_system::type > fp_point_type; @@ -139,19 +143,19 @@ public : boost::ignore_unused_variable_warning(strategy); calculation_type const zero = calculation_type(); - fp_type const c1 = dot_product(w, v); + calculation_type const c1 = dot_product(w, v); if (c1 <= zero) { return strategy.apply(p, p1); } - fp_type const c2 = dot_product(v, v); + calculation_type const c2 = dot_product(v, v); if (c2 <= c1) { return strategy.apply(p, p2); } // See above, c1 > 0 AND c2 > c1 so: c2 != 0 - fp_type const b = c1 / c2; + calculation_type const b = c1 / c2; fp_strategy_type fp_strategy = strategy::distance::services::get_similar diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index 51d272266..c62cf749e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -42,8 +42,8 @@ struct compute_pythagoras { static inline T apply(Point1 const& p1, Point2 const& p2) { - T const c1 = boost::numeric_cast(get(p2)); - T const c2 = boost::numeric_cast(get(p1)); + T const c1 = boost::numeric_cast(get(p1)); + T const c2 = boost::numeric_cast(get(p2)); T const d = c1 - c2; return d * d + compute_pythagoras::apply(p1, p2); } diff --git a/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp b/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp index a878b26c8..a5aae7703 100644 --- a/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp @@ -53,7 +53,7 @@ struct default_strategy { BOOST_MPL_ASSERT_MSG ( - false, NOT_IMPLEMENTED_FOR_THIS_TYPES + false, NOT_IMPLEMENTED_FOR_THESE_TYPES , (types) ); }; diff --git a/project/jni/boost/include/boost/geometry/strategies/side_info.hpp b/project/jni/boost/include/boost/geometry/strategies/side_info.hpp index 3fc43b8d9..f3a9da0df 100644 --- a/project/jni/boost/include/boost/geometry/strategies/side_info.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/side_info.hpp @@ -44,6 +44,19 @@ public : sides[Which].second = second; } + template + inline void correct_to_zero() + { + if (Index == 0) + { + sides[Which].first = 0; + } + else + { + sides[Which].second = 0; + } + } + template inline int get() const { @@ -67,21 +80,81 @@ public : && sides[1].second == 0; } - // If one of the segments is collinear, the other must be as well. - // So handle it as collinear. - // (In floating point margins it can occur that one of them is 1!) - inline bool as_collinear() const + inline bool crossing() const { - return sides[0].first * sides[0].second == 0 - || sides[1].first * sides[1].second == 0; + return sides[0].first * sides[0].second == -1 + && sides[1].first * sides[1].second == -1; } + inline bool touching() const + { + return (sides[0].first * sides[1].first == -1 + && sides[0].second == 0 && sides[1].second == 0) + || (sides[1].first * sides[0].first == -1 + && sides[1].second == 0 && sides[0].second == 0); + } + + template + inline bool one_touching() const + { + // This is normally a situation which can't occur: + // If one is completely left or right, the other cannot touch + return one_zero() + && sides[1 - Which].first * sides[1 - Which].second == 1; + } + + inline bool meeting() const + { + // Two of them (in each segment) zero, two not + return one_zero<0>() && one_zero<1>(); + } + + template + inline bool zero() const + { + return sides[Which].first == 0 && sides[Which].second == 0; + } + + template + inline bool one_zero() const + { + return (sides[Which].first == 0 && sides[Which].second != 0) + || (sides[Which].first != 0 && sides[Which].second == 0); + } + + inline bool one_of_all_zero() const + { + int const sum = std::abs(sides[0].first) + + std::abs(sides[0].second) + + std::abs(sides[1].first) + + std::abs(sides[1].second); + return sum == 3; + } + + + template + inline int zero_index() const + { + return sides[Which].first == 0 ? 0 : 1; + } + + + inline void debug() const + { + std::cout << sides[0].first << " " + << sides[0].second << " " + << sides[1].first << " " + << sides[1].second + << std::endl; + } + + inline void reverse() { std::swap(sides[0], sides[1]); } -private : +//private : std::pair sides[2]; }; diff --git a/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp b/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp index ba589223e..7b353020e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp @@ -101,23 +101,56 @@ public : { // http://williams.best.vwh.net/avform.htm#XTE return_type d1 = m_strategy.apply(sp1, p); + return_type d3 = m_strategy.apply(sp1, sp2); + + if (geometry::math::equals(d3, 0.0)) + { + // "Degenerate" segment, return either d1 or d2 + return d1; + } - // Actually, calculation of d2 not necessary if we know that the projected point is on the great circle... return_type d2 = m_strategy.apply(sp2, p); return_type crs_AD = course(sp1, p); return_type crs_AB = course(sp1, sp2); - return_type XTD = m_radius * geometry::math::abs(asin(sin(d1 / m_radius) * sin(crs_AD - crs_AB))); + return_type crs_BA = crs_AB - geometry::math::pi(); + return_type crs_BD = course(sp2, p); + return_type d_crs1 = crs_AD - crs_AB; + return_type d_crs2 = crs_BD - crs_BA; + + // d1, d2, d3 are in principle not needed, only the sign matters + return_type projection1 = cos( d_crs1 ) * d1 / d3; + return_type projection2 = cos( d_crs2 ) * d2 / d3; #ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK -std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl; -std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl; -std::cout << "XTD: " << XTD << " d1: " << d1 << " d2: " << d2 << std::endl; + std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl; + std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl; + std::cout << "Course " << dsv(sp2) << " to " << dsv(p) << " " << crs_BD * geometry::math::r2d << std::endl; + std::cout << "Projection AD-AB " << projection1 << " : " << d_crs1 * geometry::math::r2d << std::endl; + std::cout << "Projection BD-BA " << projection2 << " : " << d_crs2 * geometry::math::r2d << std::endl; #endif + if(projection1 > 0.0 && projection2 > 0.0) + { + return_type XTD = m_radius * geometry::math::abs( asin( sin( d1 / m_radius ) * sin( d_crs1 ) )); - // Return shortest distance, either to projected point on segment sp1-sp2, or to sp1, or to sp2 - return return_type((std::min)((std::min)(d1, d2), XTD)); + #ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK + std::cout << "Projection ON the segment" << std::endl; + std::cout << "XTD: " << XTD << " d1: " << d1 << " d2: " << d2 << std::endl; +#endif + + // Return shortest distance, projected point on segment sp1-sp2 + return return_type(XTD); + } + else + { +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK + std::cout << "Projection OUTSIDE the segment" << std::endl; +#endif + + // Return shortest distance, project either on point sp1 or sp2 + return return_type( (std::min)( d1 , d2 ) ); + } } inline return_type radius() const { return m_radius; } diff --git a/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp b/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp index 7a1f06016..61a408c61 100644 --- a/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include #include #include @@ -251,6 +253,23 @@ namespace detail return false; } + template + inline bool cartesian_to_spherical_equatorial3(T x, T y, T z, P& p) + { + assert_dimension(); + + // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_Cartesian_coordinates + T const r = sqrt(x * x + y * y + z * z); + set<2>(p, r); + set_from_radian<0>(p, atan2(y, x)); + if (r > 0.0) + { + set_from_radian<1>(p, asin(z / r)); + return true; + } + return false; + } + } // namespace detail #endif // DOXYGEN_NO_DETAIL @@ -361,6 +380,16 @@ struct from_cartesian_3_to_spherical_polar_3 } }; +template +struct from_cartesian_3_to_spherical_equatorial_3 +{ + inline bool apply(P1 const& p1, P2& p2) const + { + assert_dimension(); + return detail::cartesian_to_spherical_equatorial3(get<0>(p1), get<1>(p1), get<2>(p1), p2); + } +}; + #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS namespace services @@ -454,6 +483,11 @@ struct default_strategy type; }; +template +struct default_strategy +{ + typedef from_cartesian_3_to_spherical_equatorial_3 type; +}; } // namespace services diff --git a/project/jni/boost/include/boost/geometry/strategies/within.hpp b/project/jni/boost/include/boost/geometry/strategies/within.hpp index 0852a22d2..d625bc40e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/within.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/within.hpp @@ -52,7 +52,7 @@ struct default_strategy { BOOST_MPL_ASSERT_MSG ( - false, NOT_IMPLEMENTED_FOR_THIS_TYPES + false, NOT_IMPLEMENTED_FOR_THESE_TYPES , (types) ); }; diff --git a/project/jni/boost/include/boost/geometry/util/bare_type.hpp b/project/jni/boost/include/boost/geometry/util/bare_type.hpp new file mode 100644 index 000000000..1b49de643 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/util/bare_type.hpp @@ -0,0 +1,38 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2012 Bruno Lalande, Paris, France. +// Copyright (c) 2012 Mateusz Loskot, London, UK. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP +#define BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP + +#include + + +namespace boost { namespace geometry +{ + +namespace util +{ + +template +struct bare_type +{ + typedef typename boost::remove_const + < + typename boost::remove_pointer::type + >::type type; +}; + + +} // namespace util + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP diff --git a/project/jni/boost/include/boost/geometry/util/math.hpp b/project/jni/boost/include/boost/geometry/util/math.hpp index edfa961b1..95cbdf2ce 100644 --- a/project/jni/boost/include/boost/geometry/util/math.hpp +++ b/project/jni/boost/include/boost/geometry/util/math.hpp @@ -44,11 +44,43 @@ struct equals template struct equals { + static inline Type get_max(Type const& a, Type const& b, Type const& c) + { + return (std::max)((std::max)(a, b), c); + } + static inline bool apply(Type const& a, Type const& b) { + if (a == b) + { + return true; + } + // See http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.17, // FUTURE: replace by some boost tool or boost::test::close_at_tolerance - return std::abs(a - b) <= std::numeric_limits::epsilon() * std::abs(a); + return std::abs(a - b) <= std::numeric_limits::epsilon() * get_max(std::abs(a), std::abs(b), 1.0); + } +}; + +template +struct smaller +{ + static inline bool apply(Type const& a, Type const& b) + { + return a < b; + } +}; + +template +struct smaller +{ + static inline bool apply(Type const& a, Type const& b) + { + if (equals::apply(a, b)) + { + return false; + } + return a < b; } }; @@ -116,6 +148,28 @@ inline bool equals_with_epsilon(T1 const& a, T2 const& b) >::apply(a, b); } +template +inline bool smaller(T1 const& a, T2 const& b) +{ + typedef typename select_most_precise::type select_type; + return detail::smaller + < + select_type, + boost::is_floating_point::type::value + >::apply(a, b); +} + +template +inline bool larger(T1 const& a, T2 const& b) +{ + typedef typename select_most_precise::type select_type; + return detail::smaller + < + select_type, + boost::is_floating_point::type::value + >::apply(b, a); +} + double const d2r = geometry::math::pi() / 180.0; diff --git a/project/jni/boost/include/boost/get_pointer.hpp b/project/jni/boost/include/boost/get_pointer.hpp index a0cd5c0b1..b27b98a60 100644 --- a/project/jni/boost/include/boost/get_pointer.hpp +++ b/project/jni/boost/include/boost/get_pointer.hpp @@ -3,13 +3,15 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef GET_POINTER_DWA20021219_HPP -# define GET_POINTER_DWA20021219_HPP +#define GET_POINTER_DWA20021219_HPP + +#include // In order to avoid circular dependencies with Boost.TR1 // we make sure that our include of doesn't try to // pull in the TR1 headers: that's why we use this header // rather than including directly: -# include // std::auto_ptr +#include // std::auto_ptr namespace boost { @@ -27,6 +29,19 @@ template T * get_pointer(std::auto_ptr const& p) return p.get(); } +#if !defined( BOOST_NO_CXX11_SMART_PTR ) + +template T * get_pointer( std::unique_ptr const& p ) +{ + return p.get(); +} + +template T * get_pointer( std::shared_ptr const& p ) +{ + return p.get(); +} + +#endif } // namespace boost diff --git a/project/jni/boost/include/boost/graph/adj_list_serialize.hpp b/project/jni/boost/include/boost/graph/adj_list_serialize.hpp index c1ff4111d..01db50282 100644 --- a/project/jni/boost/include/boost/graph/adj_list_serialize.hpp +++ b/project/jni/boost/include/boost/graph/adj_list_serialize.hpp @@ -61,6 +61,8 @@ inline void save( ar << serialization::make_nvp("v" , indices[target(e,graph)]); ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } + + ar << serialization::make_nvp("graph_property", get_property(graph, graph_all_t()) ); } @@ -95,6 +97,7 @@ inline void load( boost::tie(e,inserted) = add_edge(verts[u], verts[v], graph); ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } + ar >> serialization::make_nvp("graph_property", get_property(graph, graph_all_t()) ); } template diff --git a/project/jni/boost/include/boost/graph/adjacency_list.hpp b/project/jni/boost/include/boost/graph/adjacency_list.hpp index 5034fec5a..6738fa22c 100644 --- a/project/jni/boost/include/boost/graph/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_list.hpp @@ -51,11 +51,6 @@ namespace boost { // adjacency_list, and the container_gen traits class which is used // to map the selectors to the container type used to implement the // graph. - // - // The main container_gen traits class uses partial specialization, - // so we also include a workaround. - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #if !defined BOOST_NO_SLIST struct slistS {}; @@ -130,93 +125,6 @@ namespace boost { typedef boost::unordered_multiset type; }; -#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#if !defined BOOST_NO_SLIST - struct slistS { - template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::slist type; }; - }; -#endif - - struct vecS { - template - struct bind_ { typedef std::vector type; }; - }; - - struct listS { - template - struct bind_ { typedef std::list type; }; - }; - - struct setS { - template - struct bind_ { typedef std::set > type; }; - }; - - - struct mapS { - template - struct bind_ { typedef std::set > type; }; - }; - - struct multisetS { - template - struct bind_ { typedef std::multiset > type; }; - }; - - struct multimapS { - template - struct bind_ { typedef std::multiset > type; }; - }; - - struct hash_setS { - template - struct bind_ { typedef boost::unordered_set type; }; - }; - - struct hash_mapS { - template - struct bind_ { typedef boost::unordered_set type; }; - }; - - struct hash_multisetS { - template - struct bind_ { typedef boost::unordered_multiset type; }; - }; - - struct hash_multimapS { - template - struct bind_ { typedef boost::unordered_multiset type; }; - }; - - template struct container_selector { - typedef vecS type; - }; - -#define BOOST_CONTAINER_SELECTOR(NAME) \ - template <> struct container_selector { \ - typedef NAME type; \ - } - - BOOST_CONTAINER_SELECTOR(vecS); - BOOST_CONTAINER_SELECTOR(listS); - BOOST_CONTAINER_SELECTOR(mapS); - BOOST_CONTAINER_SELECTOR(setS); - BOOST_CONTAINER_SELECTOR(multisetS); - BOOST_CONTAINER_SELECTOR(hash_mapS); -#if !defined BOOST_NO_SLIST - BOOST_CONTAINER_SELECTOR(slistS); -#endif - - template - struct container_gen { - typedef typename container_selector::type Select; - typedef typename Select:: template bind_::type type; - }; - -#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template struct parallel_edge_traits { }; @@ -280,6 +188,7 @@ namespace boost { } // namespace detail + template struct is_distributed_selector: mpl::false_ {}; //=========================================================================== @@ -354,13 +263,7 @@ namespace boost { adjacency_list, VertexListS, OutEdgeListS, DirectedS, -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typename detail::retag_property_list::type, - typename detail::retag_property_list::type, -#else VertexProperty, EdgeProperty, -#endif GraphProperty, EdgeListS>::type, // Support for named vertices public graph::maybe_named_graph< @@ -371,25 +274,14 @@ namespace boost { VertexProperty> { public: -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; -#else typedef GraphProperty graph_property_type; - typedef no_graph_bundle graph_bundled; + typedef typename lookup_one_property::type graph_bundled; typedef VertexProperty vertex_property_type; - typedef no_vertex_bundle vertex_bundled; + typedef typename lookup_one_property::type vertex_bundled; typedef EdgeProperty edge_property_type; - typedef no_edge_bundle edge_bundled; -#endif + typedef typename lookup_one_property::type edge_bundled; private: typedef adjacency_list self; @@ -502,20 +394,20 @@ namespace boost { #define ADJLIST adjacency_list template - inline void set_property(ADJLIST& g, Tag, Value const& value) { - get_property_value(*g.m_property, Tag()) = value; + inline void set_property(ADJLIST& g, Tag tag, Value const& value) { + get_property_value(*g.m_property, tag) = value; } template inline typename graph_property::type& - get_property(ADJLIST& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST& g, Tag tag) { + return get_property_value(*g.m_property, tag); } template inline typename graph_property::type const& - get_property(ADJLIST const& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST const& g, Tag tag) { + return get_property_value(*g.m_property, tag); } // dwa 09/25/00 - needed to be more explicit so reverse_graph would work. @@ -545,58 +437,6 @@ namespace boost { return e.m_target; } - // Support for bundled properties -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - inline - typename property_map, T Bundle::*>::type - get(T Bundle::* p, adjacency_list& g) - { - typedef typename property_map, T Bundle::*>::type - result_type; - return result_type(&g, p); - } - - template - inline - typename property_map, T Bundle::*>::const_type - get(T Bundle::* p, adjacency_list const & g) - { - typedef typename property_map, T Bundle::*>::const_type - result_type; - return result_type(&g, p); - } - - template - inline T - get(T Bundle::* p, adjacency_list const & g, const Key& key) - { - return get(get(p, g), key); - } - - template - inline void - put(T Bundle::* p, adjacency_list& g, const Key& key, const T& value) - { - put(get(p, g), key, value); - } - -#endif - // Mutability Traits template struct graph_mutability_traits { diff --git a/project/jni/boost/include/boost/graph/adjacency_list_io.hpp b/project/jni/boost/include/boost/graph/adjacency_list_io.hpp index 91b0b465d..aaba8a43c 100644 --- a/project/jni/boost/include/boost/graph/adjacency_list_io.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_list_io.hpp @@ -40,7 +40,7 @@ namespace boost { template std::istream& operator >> ( std::istream& in, property& p ) { - in >> p.m_value >> *(static_cast(&p)); // houpla !! + in >> p.m_value >> p.m_base; // houpla !! return in; } @@ -65,7 +65,7 @@ template void get ( property& p, const V& v, Stag s ) { - get( *(static_cast(&p)),v,s ); + get( p.m_base,v,s ); } template @@ -82,7 +82,7 @@ void getSubset ( property& p, const property& s ) { get( p, s.m_value, Stag() ); - getSubset( p, Snext(s) ); + getSubset( p, s.m_base ); } template PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { - typename property_map::type ps = get(Tag(), *graph); + typename property_map::const_type ps = get(Tag(), *graph); out << ps[ v ] <<" "; PropertyPrinter print(*graph); print(out, v); @@ -248,7 +248,7 @@ struct PropertyPrinter > template PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { - typename property_map::type ps = get(Tag(), *graph); + typename property_map::const_type ps = get(Tag(), *graph); out << ps[ v ] <<" "; PropertyPrinter print(*graph); print(out, v); diff --git a/project/jni/boost/include/boost/graph/adjacency_matrix.hpp b/project/jni/boost/include/boost/graph/adjacency_matrix.hpp index 47d8d5f28..65cf27a57 100644 --- a/project/jni/boost/include/boost/graph/adjacency_matrix.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_matrix.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,10 @@ #include #include #include -#include +#include +#include +#include +#include namespace boost { @@ -484,25 +488,14 @@ namespace boost { BOOST_STATIC_ASSERT(!(is_same::value)); #endif -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; -#else typedef GraphProperty graph_property_type; - typedef no_graph_bundle graph_bundled; + typedef typename lookup_one_property::type graph_bundled; typedef VertexProperty vertex_property_type; - typedef no_vertex_bundle vertex_bundled; + typedef typename lookup_one_property::type vertex_bundled; typedef EdgeProperty edge_property_type; - typedef no_edge_bundle edge_bundled; -#endif + typedef typename lookup_one_property::type edge_bundled; public: // should be private typedef typename mpl::if_::type, @@ -640,16 +633,16 @@ namespace boost { #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) - { return get(vertex_bundle, *this)[v]; } + { return get(vertex_bundle, *this, v); } const vertex_bundled& operator[](vertex_descriptor v) const - { return get(vertex_bundle, *this)[v]; } + { return get(vertex_bundle, *this, v); } edge_bundled& operator[](edge_descriptor e) - { return get(edge_bundle, *this)[e]; } + { return get(edge_bundle, *this, e); } const edge_bundled& operator[](edge_descriptor e) const - { return get(edge_bundle, *this)[e]; } + { return get(edge_bundle, *this, e); } graph_bundled& operator[](graph_bundle_t) { return get_property(*this); } @@ -1035,256 +1028,194 @@ namespace boost { //========================================================================= // Functions required by the PropertyGraph concept + template + struct adj_mat_pm_helper; + + template + struct adj_mat_pm_helper { + typedef typename graph_traits >::vertex_descriptor arg_type; + typedef typed_identity_property_map vi_map_type; + typedef iterator_property_map::iterator, vi_map_type> all_map_type; + typedef iterator_property_map::const_iterator, vi_map_type> all_map_const_type; + typedef transform_value_property_map< + detail::lookup_one_property_f, + all_map_type> + type; + typedef transform_value_property_map< + detail::lookup_one_property_f, + all_map_const_type> + const_type; + typedef typename property_traits::reference single_nonconst_type; + typedef typename property_traits::reference single_const_type; + + static type get_nonconst(adjacency_matrix& g, Prop prop) { + return type(prop, all_map_type(g.m_vertex_properties.begin(), vi_map_type())); + } + + static const_type get_const(const adjacency_matrix& g, Prop prop) { + return const_type(prop, all_map_const_type(g.m_vertex_properties.begin(), vi_map_type())); + } + + static single_nonconst_type get_nonconst_one(adjacency_matrix& g, Prop prop, arg_type v) { + return lookup_one_property::lookup(g.m_vertex_properties[v], prop); + } + + static single_const_type get_const_one(const adjacency_matrix& g, Prop prop, arg_type v) { + return lookup_one_property::lookup(g.m_vertex_properties[v], prop); + } + }; + + template + struct adj_mat_pm_helper { + typedef typename graph_traits >::edge_descriptor edge_descriptor; + + template + struct lookup_property_from_edge { + Tag tag; + lookup_property_from_edge(Tag tag): tag(tag) {} + typedef typename boost::mpl::if_::type ep_type_nonref; + typedef ep_type_nonref& ep_type; + typedef typename lookup_one_property::type& result_type; + result_type operator()(edge_descriptor e) const { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + }; + + typedef function_property_map< + lookup_property_from_edge, + typename graph_traits >::edge_descriptor> type; + typedef function_property_map< + lookup_property_from_edge, + typename graph_traits >::edge_descriptor> const_type; + typedef edge_descriptor arg_type; + typedef typename lookup_property_from_edge::result_type single_nonconst_type; + typedef typename lookup_property_from_edge::result_type single_const_type; + + static type get_nonconst(adjacency_matrix& g, Tag tag) { + return type(tag); + } + + static const_type get_const(const adjacency_matrix& g, Tag tag) { + return const_type(tag); + } + + static single_nonconst_type get_nonconst_one(adjacency_matrix& g, Tag tag, edge_descriptor e) { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + + static single_const_type get_const_one(const adjacency_matrix& g, Tag tag, edge_descriptor e) { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + }; + + template + struct property_map, Tag> + : adj_mat_pm_helper, Tag>::type> {}; + + template + typename property_map, Tag>::type + get(Tag tag, adjacency_matrix& g) { + return property_map, Tag>::get_nonconst(g, tag); + } + + template + typename property_map, Tag>::const_type + get(Tag tag, const adjacency_matrix& g) { + return property_map, Tag>::get_const(g, tag); + } + + template + typename property_map, Tag>::single_nonconst_type + get(Tag tag, adjacency_matrix& g, typename property_map, Tag>::arg_type a) { + return property_map, Tag>::get_nonconst_one(g, tag, a); + } + + template + typename property_map, Tag>::single_const_type + get(Tag tag, const adjacency_matrix& g, typename property_map, Tag>::arg_type a) { + return property_map, Tag>::get_const_one(g, tag, a); + } + + template + void + put(Tag tag, + adjacency_matrix& g, + typename property_map, Tag>::arg_type a, + typename property_map, Tag>::single_const_type val) { + property_map, Tag>::get_nonconst_one(g, tag, a) = val; + } + // O(1) template inline void - set_property(adjacency_matrix& g, Tag, const Value& value) + set_property(adjacency_matrix& g, Tag tag, const Value& value) { - get_property_value(g.m_property, Tag()) = value; + get_property_value(g.m_property, tag) = value; } template inline typename graph_property, Tag>::type& - get_property(adjacency_matrix& g, Tag) + get_property(adjacency_matrix& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template inline const typename graph_property, Tag>::type& - get_property(const adjacency_matrix& g, Tag) + get_property(const adjacency_matrix& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } //========================================================================= // Vertex Property Map - template - class adj_matrix_vertex_property_map - : public put_get_helper > - { - public: - typedef T value_type; - typedef R reference; - typedef Vertex key_type; - typedef boost::lvalue_property_map_tag category; - adj_matrix_vertex_property_map() { } - adj_matrix_vertex_property_map(GraphPtr g) : m_g(g) { } - inline reference operator[](key_type v) const { - return get_property_value(m_g->m_vertex_properties[v], Tag()); - } - GraphPtr m_g; + template + struct property_map, vertex_index_t> { + typedef typename adjacency_matrix::vertex_descriptor Vertex; + typedef typed_identity_property_map type; + typedef type const_type; }; - template - struct adj_matrix_vertex_id_map - : public boost::put_get_helper > - { - typedef Vertex value_type; - typedef Vertex reference; - typedef Vertex key_type; - typedef boost::readable_property_map_tag category; - adj_matrix_vertex_id_map() { } - template - inline adj_matrix_vertex_id_map(const Graph&) { } - inline value_type operator[](key_type v) const { return v; } - }; - - namespace detail { - - struct adj_matrix_any_vertex_pa { - template - struct bind_ { - typedef typename property_value::type Value; - typedef typename boost::graph_traits::vertex_descriptor Vertex; - - typedef adj_matrix_vertex_property_map type; - typedef adj_matrix_vertex_property_map const_type; - }; - }; - struct adj_matrix_id_vertex_pa { - template - struct bind_ { - typedef typename Graph::vertex_descriptor Vertex; - typedef adj_matrix_vertex_id_map type; - typedef adj_matrix_vertex_id_map const_type; - }; - }; - - template - struct adj_matrix_choose_vertex_pa_helper { - typedef adj_matrix_any_vertex_pa type; - }; - template <> - struct adj_matrix_choose_vertex_pa_helper { - typedef adj_matrix_id_vertex_pa type; - }; - - template - struct adj_matrix_choose_vertex_pa { - typedef typename adj_matrix_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; - - struct adj_matrix_vertex_property_selector { - template - struct bind_ { - typedef adj_matrix_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; - }; - - } // namespace detail - - template <> - struct vertex_property_selector { - typedef detail::adj_matrix_vertex_property_selector type; - }; - - //========================================================================= - // Edge Property Map - - - template - class adj_matrix_edge_property_map - : public put_get_helper > - { - public: - typedef T value_type; - typedef R reference; - typedef detail::matrix_edge_desc_impl key_type; - typedef boost::lvalue_property_map_tag category; - inline reference operator[](key_type e) const { - Property& p = *(Property*)e.get_property(); - return get_property_value(p, Tag()); - } - }; - struct adj_matrix_edge_property_selector { - template - struct bind_ { - typedef typename property_value::type T; - typedef typename Graph::vertex_descriptor Vertex; - typedef adj_matrix_edge_property_map type; - typedef adj_matrix_edge_property_map const_type; - }; - }; - template <> - struct edge_property_selector { - typedef adj_matrix_edge_property_selector type; - }; - - //========================================================================= - // Functions required by PropertyGraph - - namespace detail { - - template - typename boost::property_map, - Property>::type - get_dispatch(adjacency_matrix& g, Property, - vertex_property_tag) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map, - Property>::type PA; - return PA(&g); - } - template - typename boost::property_map, - Property>::type - get_dispatch(adjacency_matrix&, Property, - edge_property_tag) - { - typedef typename boost::property_map, - Property>::type PA; - return PA(); - } - template - typename boost::property_map, - Property>::const_type - get_dispatch(const adjacency_matrix& g, Property, - vertex_property_tag) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map, - Property>::const_type PA; - return PA(&g); - } - template - typename boost::property_map, - Property>::const_type - get_dispatch(const adjacency_matrix&, Property, - edge_property_tag) - { - typedef typename boost::property_map, - Property>::const_type PA; - return PA(); - } - - } // namespace detail - - template - inline - typename property_map, Property>::type - get(Property p, adjacency_matrix& g) - { - typedef typename property_kind::type Kind; - return detail::get_dispatch(g, p, Kind()); + template + typename property_map, vertex_index_t>::const_type + get(vertex_index_t, adjacency_matrix&) { + return typename property_map, vertex_index_t>::const_type(); } - template - inline - typename property_map, Property>::const_type - get(Property p, const adjacency_matrix& g) - { - typedef typename property_kind::type Kind; - return detail::get_dispatch(g, p, Kind()); + template + typename adjacency_matrix::vertex_descriptor + get(vertex_index_t, + adjacency_matrix&, + typename adjacency_matrix::vertex_descriptor v) { + return v; } - template - inline - typename property_traits< - typename property_map, Property>::const_type - >::value_type - get(Property p, const adjacency_matrix& g, - const Key& key) - { - return get(get(p, g), key); + template + typename property_map, vertex_index_t>::const_type + get(vertex_index_t, const adjacency_matrix&) { + return typename property_map, vertex_index_t>::const_type(); } - template - inline void - put(Property p, adjacency_matrix& g, - const Key& key, const Value& value) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map::type Map; - Map pmap = get(p, g); - put(pmap, key, value); + template + typename adjacency_matrix::vertex_descriptor + get(vertex_index_t, + const adjacency_matrix&, + typename adjacency_matrix::vertex_descriptor v) { + return v; } //========================================================================= @@ -1298,63 +1229,10 @@ namespace boost { return n; } - // Support for bundled properties -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - inline - typename property_map, - T Bundle::*>::type - get(T Bundle::* p, adjacency_matrix& g) - { - typedef typename property_map, - T Bundle::*>::type - result_type; - return result_type(&g, p); - } - - template - inline - typename property_map, - T Bundle::*>::const_type - get(T Bundle::* p, adjacency_matrix const & g) - { - typedef typename property_map, - T Bundle::*>::const_type - result_type; - return result_type(&g, p); - } - - template - inline T - get(T Bundle::* p, adjacency_matrix const & g, - const Key& key) - { - return get(get(p, g), key); - } - - template - inline void - put(T Bundle::* p, adjacency_matrix& g, - const Key& key, const T& value) - { - put(get(p, g), key, value); - } - -#endif - -#define ADJMAT_PARAMS \ - typename D, typename VP, typename EP, typename GP, typename A -#define ADJMAT adjacency_matrix -template -struct graph_mutability_traits { - typedef mutable_edge_property_graph_tag category; +template +struct graph_mutability_traits > { + typedef mutable_edge_property_graph_tag category; }; -#undef ADJMAT_PARAMS -#undef ADJMAT } // namespace boost diff --git a/project/jni/boost/include/boost/graph/astar_search.hpp b/project/jni/boost/include/boost/graph/astar_search.hpp index 316e70639..7d6da7c3c 100644 --- a/project/jni/boost/include/boost/graph/astar_search.hpp +++ b/project/jni/boost/include/boost/graph/astar_search.hpp @@ -22,9 +22,12 @@ #include #include #include +#include #include +#include #include #include +#include #include namespace boost { @@ -158,8 +161,10 @@ namespace boost { template void tree_edge(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { m_vis.edge_relaxed(e, g); @@ -173,8 +178,10 @@ namespace boost { template void gray_target(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { put(m_cost, target(e, g), @@ -189,8 +196,10 @@ namespace boost { template void black_target(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { m_vis.edge_relaxed(e, g); @@ -216,7 +225,6 @@ namespace boost { ColorMap m_color; BinaryFunction m_combine; BinaryPredicate m_compare; - bool m_decreased; C m_zero; }; @@ -260,6 +268,77 @@ namespace boost { breadth_first_visit(g, s, Q, bfs_vis, color); } + namespace graph_detail { + template + struct select1st { + typedef std::pair argument_type; + typedef A result_type; + A operator()(const std::pair& p) const {return p.first;} + }; + } + + template + inline void + astar_search_no_init_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + CompareFunction compare, CombineFunction combine, + CostInf /*inf*/, CostZero zero) + { + typedef typename graph_traits::vertex_descriptor + Vertex; + typedef typename property_traits::value_type Distance; + typedef d_ary_heap_indirect< + std::pair, + 4, + null_property_map, std::size_t>, + function_property_map, std::pair >, + CompareFunction> + MutableQueue; + MutableQueue Q( + make_function_property_map >(graph_detail::select1st()), + null_property_map, std::size_t>(), + compare); + + vis.discover_vertex(s, g); + Q.push(std::make_pair(get(cost, s), s)); + while (!Q.empty()) { + Vertex v; + Distance v_rank; + boost::tie(v_rank, v) = Q.top(); + Q.pop(); + vis.examine_vertex(v, g); + BGL_FORALL_OUTEDGES_T(v, e, g, VertexListGraph) { + Vertex w = target(e, g); + vis.examine_edge(e, g); + Distance e_weight = get(weight, e); + if (compare(e_weight, zero)) + BOOST_THROW_EXCEPTION(negative_edge()); + bool decreased = + relax(e, g, weight, predecessor, distance, + combine, compare); + Distance w_d = combine(get(distance, v), e_weight); + if (decreased) { + vis.edge_relaxed(e, g); + Distance w_rank = combine(get(distance, w), h(w)); + put(cost, w, w_rank); + vis.discover_vertex(w, g); + Q.push(std::make_pair(w_rank, w)); + } else { + vis.edge_not_relaxed(e, g); + } + } + vis.finish_vertex(v, g); + } + } // Non-named parameter interface template + inline void + astar_search_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + CompareFunction compare, CombineFunction combine, + CostInf inf, CostZero zero) + { + + typename graph_traits::vertex_iterator ui, ui_end; + for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(cost, *ui, inf); + put(predecessor, *ui, *ui); + vis.initialize_vertex(*ui, g); + } + put(distance, s, zero); + put(cost, s, h(s)); + + astar_search_no_init_tree + (g, s, h, vis, predecessor, cost, distance, weight, + compare, combine, inf, zero); + + } + // Named parameter interfaces template + void + astar_search_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, const bgl_named_params& params) + { + using namespace boost::graph::keywords; + typedef bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + + // Distance type is the value type of the distance map if there is one, + // otherwise the value type of the weight map. + typedef + typename detail::override_const_property_result< + arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type + weight_map_type; + typedef typename boost::property_traits::value_type W; + typedef + typename detail::map_maker::map_type + distance_map_type; + typedef typename boost::property_traits::value_type D; + const D inf = arg_pack[_distance_inf | (std::numeric_limits::max)()]; + + astar_search_tree + (g, s, h, + arg_pack[_visitor | make_astar_visitor(null_visitor())], + arg_pack[_predecessor_map | dummy_property_map()], + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::make_property_map_from_arg_pack_gen(W())(g, arg_pack), + detail::override_const_property(arg_pack, _weight_map, g, edge_weight), + arg_pack[_distance_compare | std::less()], + arg_pack[_distance_combine | closed_plus(inf)], + inf, + arg_pack[_distance_zero | D()]); + } + template @@ -367,8 +520,39 @@ namespace boost { detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), detail::override_const_property(arg_pack, _weight_map, g, edge_weight), - detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index), detail::make_color_map_from_arg_pack(g, arg_pack), + detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index), + arg_pack[_distance_compare | std::less()], + arg_pack[_distance_combine | closed_plus(inf)], + inf, + arg_pack[_distance_zero | D()]); + } + + template + void + astar_search_no_init_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, const bgl_named_params& params) + { + using namespace boost::graph::keywords; + typedef bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + typedef + typename detail::override_const_property_result< + arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type + weight_map_type; + typedef typename boost::property_traits::value_type D; + const D inf = arg_pack[_distance_inf | (std::numeric_limits::max)()]; + astar_search_no_init_tree + (g, s, h, + arg_pack[_visitor | make_astar_visitor(null_visitor())], + arg_pack[_predecessor_map | dummy_property_map()], + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::override_const_property(arg_pack, _weight_map, g, edge_weight), arg_pack[_distance_compare | std::less()], arg_pack[_distance_combine | closed_plus(inf)], inf, diff --git a/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp b/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp index c80ebe7c7..e102d9220 100644 --- a/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp +++ b/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp @@ -171,7 +171,7 @@ namespace boost { bool bellman_dispatch2 (VertexAndEdgeListGraph& g, - detail::error_property_not_found, + param_not_found, Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance, const bgl_named_params& params) { diff --git a/project/jni/boost/include/boost/graph/betweenness_centrality.hpp b/project/jni/boost/include/boost/graph/betweenness_centrality.hpp index 052f0633c..a4de17533 100644 --- a/project/jni/boost/include/boost/graph/betweenness_centrality.hpp +++ b/project/jni/boost/include/boost/graph/betweenness_centrality.hpp @@ -498,14 +498,14 @@ namespace detail { namespace graph { }; template<> - struct brandes_betweenness_centrality_dispatch1 + struct brandes_betweenness_centrality_dispatch1 { template static void run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, - error_property_not_found) + param_not_found) { brandes_betweenness_centrality_dispatch2(g, centrality, edge_centrality_map, vertex_index); @@ -532,7 +532,7 @@ brandes_betweenness_centrality(const Graph& g, { typedef bgl_named_params named_params; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew; detail::graph::brandes_betweenness_centrality_dispatch1::run( g, choose_param(get_param(params, vertex_centrality), diff --git a/project/jni/boost/include/boost/graph/biconnected_components.hpp b/project/jni/boost/include/boost/graph/biconnected_components.hpp index 9586f9a21..1669f6952 100644 --- a/project/jni/boost/include/boost/graph/biconnected_components.hpp +++ b/project/jni/boost/include/boost/graph/biconnected_components.hpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace boost { @@ -28,17 +29,23 @@ namespace boost { template struct biconnected_components_visitor : public dfs_visitor<> { biconnected_components_visitor - (ComponentMap comp, std::size_t& c, DiscoverTimeMap dtm, + (ComponentMap comp, std::size_t& c, + std::size_t& children_of_root, DiscoverTimeMap dtm, std::size_t& dfs_time, LowPointMap lowpt, PredecessorMap pred, - OutputIterator out, Stack& S, DFSVisitor vis) - : comp(comp), c(c), children_of_root(0), dtm(dtm), - dfs_time(dfs_time), lowpt(lowpt), - pred(pred), out(out), S(S), vis(vis) { } + OutputIterator out, Stack& S, + ArticulationVector& is_articulation_point, IndexMap index_map, + DFSVisitor vis) + : comp(comp), c(c), children_of_root(children_of_root), + dtm(dtm), dfs_time(dfs_time), lowpt(lowpt), + pred(pred), out(out), S(S), + is_articulation_point(is_articulation_point), + index_map(index_map), vis(vis) { } template void initialize_vertex(const Vertex& u, Graph& g) @@ -89,8 +96,7 @@ namespace boost typename boost::graph_traits::vertex_descriptor src = source(e, g); typename boost::graph_traits::vertex_descriptor tgt = target(e, g); - if ( ( tgt != get(pred, src) || get(pred, src) == src ) && - get(dtm, tgt) < get(dtm, src) ) { + if ( tgt != get(pred, src) ) { S.push(e); put(lowpt, src, min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, src), @@ -111,40 +117,41 @@ namespace boost BOOST_USING_STD_MIN(); Vertex parent = get(pred, u); if (parent == u) { // Root of tree is special - if (children_of_root >= 2) { - *out++ = u; - } - return; - } - put(lowpt, parent, - min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, parent), + is_articulation_point[get(index_map, u)] = (children_of_root > 1); + } else { + put(lowpt, parent, + min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, parent), get(lowpt, u))); - if ( get(lowpt, u) >= get(dtm, parent) ) { - if ( get(pred, parent) != parent ) { - *out++ = parent; - } - while ( get(dtm, source(S.top(), g)) >= get(dtm, u) ) { + if ( get(lowpt, u) >= get(dtm, parent) ) { + is_articulation_point[get(index_map, parent)] = true; + while ( get(dtm, source(S.top(), g)) >= get(dtm, u) ) { + put(comp, S.top(), c); + S.pop(); + } + BOOST_ASSERT (source(S.top(), g) == parent); + BOOST_ASSERT (target(S.top(), g) == u); put(comp, S.top(), c); S.pop(); + ++c; } - assert (source(S.top(), g) == parent); - assert (target(S.top(), g) == u); - put(comp, S.top(), c); - S.pop(); - ++c; + } + if ( is_articulation_point[get(index_map, u)] ) { + *out++ = u; } vis.finish_vertex(u, g); } ComponentMap comp; std::size_t& c; - std::size_t children_of_root; + std::size_t& children_of_root; DiscoverTimeMap dtm; std::size_t& dfs_time; LowPointMap lowpt; PredecessorMap pred; OutputIterator out; Stack& S; + ArticulationVector& is_articulation_point; + IndexMap index_map; DFSVisitor vis; }; @@ -168,14 +175,16 @@ namespace boost vertex_t> )); std::size_t num_components = 0; + std::size_t children_of_root; std::size_t dfs_time = 0; - std::stack S; + std::stack S; + std::vector is_articulation_point(num_vertices(g)); - biconnected_components_visitor, - DFSVisitor> - vis(comp, num_components, dtm, dfs_time, lowpt, pred, out, - S, dfs_vis); + biconnected_components_visitor, + std::vector, VertexIndexMap, DFSVisitor> + vis(comp, num_components, children_of_root, dtm, dfs_time, + lowpt, pred, out, S, is_articulation_point, index_map, dfs_vis); depth_first_search(g, visitor(vis).vertex_index_map(index_map)); @@ -201,7 +210,7 @@ namespace boost }; template <> - struct bicomp_dispatch3 + struct bicomp_dispatch3 { template& params, - error_property_not_found) + param_not_found) { typedef typename graph_traits::vertex_descriptor vertex_t; std::vector pred(num_vertices(g)); @@ -235,8 +244,7 @@ namespace boost DiscoverTimeMap dtm, const bgl_named_params& params, LowPointMap lowpt) { - typedef typename property_value< bgl_named_params, - vertex_predecessor_t>::type dispatch_type; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch3::apply (g, comp, out, index_map, dtm, lowpt, params, @@ -246,7 +254,7 @@ namespace boost template <> - struct bicomp_dispatch2 + struct bicomp_dispatch2 { template apply (const Graph& g, ComponentMap comp, OutputIterator out, VertexIndexMap index_map, DiscoverTimeMap dtm, const bgl_named_params& params, - error_property_not_found) + param_not_found) { typedef typename graph_traits::vertices_size_type vertices_size_type; std::vector lowpt(num_vertices(g)); vertices_size_type vst(0); - typedef typename property_value< bgl_named_params, - vertex_predecessor_t>::type dispatch_type; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch3::apply (g, comp, out, index_map, dtm, @@ -280,8 +287,7 @@ namespace boost ComponentMap comp, OutputIterator out, VertexIndexMap index_map, const bgl_named_params& params, DiscoverTimeMap dtm) { - typedef typename property_value< bgl_named_params, - vertex_lowpoint_t>::type dispatch_type; + typedef typename get_param_type< vertex_lowpoint_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch2::apply (g, comp, out, index_map, dtm, params, @@ -290,21 +296,20 @@ namespace boost }; template <> - struct bicomp_dispatch1 + struct bicomp_dispatch1 { template static std::pair apply(const Graph& g, ComponentMap comp, OutputIterator out, VertexIndexMap index_map, - const bgl_named_params& params, error_property_not_found) + const bgl_named_params& params, param_not_found) { typedef typename graph_traits::vertices_size_type vertices_size_type; std::vector discover_time(num_vertices(g)); vertices_size_type vst(0); - typedef typename property_value< bgl_named_params, - vertex_lowpoint_t>::type dispatch_type; + typedef typename get_param_type< vertex_lowpoint_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch2::apply (g, comp, out, index_map, @@ -321,14 +326,14 @@ namespace boost biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out, DiscoverTimeMap dtm, LowPointMap lowpt) { - typedef detail::error_property_not_found dispatch_type; + typedef param_not_found dispatch_type; return detail::bicomp_dispatch3::apply (g, comp, out, get(vertex_index, g), dtm, lowpt, bgl_named_params(0), - detail::error_property_not_found()); + param_not_found()); } template & params) { - typedef typename property_value< bgl_named_params, - vertex_discover_time_t>::type dispatch_type; + typedef typename get_param_type< vertex_discover_time_t, bgl_named_params >::type dispatch_type; return detail::bicomp_dispatch1::apply(g, comp, out, choose_const_pmap(get_param(params, vertex_index), g, vertex_index), diff --git a/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp b/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp index 0834c6316..1edc1323e 100644 --- a/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp +++ b/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp @@ -442,11 +442,11 @@ class bk_max_flow { for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ edge_descriptor in_edge = get(m_rev_edge_map, *ei); vertex_descriptor other_node = source(in_edge, m_g); - if(get_tree(other_node) == tColorTraits::black() && has_parent(other_node)){ + if(get_tree(other_node) == tColorTraits::black() && other_node != m_source){ if(get(m_res_cap_map, in_edge) > 0){ add_active_node(other_node); } - if(source(get_edge_to_parent(other_node), m_g) == current_node){ + if(has_parent(other_node) && source(get_edge_to_parent(other_node), m_g) == current_node){ //we are the parent of that node //it has to find a new parent, too set_no_parent(other_node); @@ -483,11 +483,11 @@ class bk_max_flow { for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ const edge_descriptor out_edge = *ei; const vertex_descriptor other_node = target(out_edge, m_g); - if(get_tree(other_node) == tColorTraits::white() && has_parent(other_node)){ + if(get_tree(other_node) == tColorTraits::white() && other_node != m_sink){ if(get(m_res_cap_map, out_edge) > 0){ add_active_node(other_node); } - if(target(get_edge_to_parent(other_node), m_g) == current_node){ + if(has_parent(other_node) && target(get_edge_to_parent(other_node), m_g) == current_node){ //we were it's parent, so it has to find a new one, too set_no_parent(other_node); m_child_orphans.push(other_node); @@ -526,6 +526,9 @@ class bk_max_flow { inline void add_active_node(vertex_descriptor v){ BOOST_ASSERT(get_tree(v) != tColorTraits::gray()); if(get(m_in_active_list_map, v)){ + if (m_last_grow_vertex == v) { + m_last_grow_vertex = graph_traits::null_vertex(); + } return; } else{ put(m_in_active_list_map, v, true); diff --git a/project/jni/boost/include/boost/graph/breadth_first_search.hpp b/project/jni/boost/include/boost/graph/breadth_first_search.hpp index f65e47572..18bc24f5c 100644 --- a/project/jni/boost/include/boost/graph/breadth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/breadth_first_search.hpp @@ -53,11 +53,12 @@ namespace boost { }; + // Multiple-source version template + class ColorMap, class SourceIterator> void breadth_first_visit (const IncidenceGraph& g, - typename graph_traits::vertex_descriptor s, + SourceIterator sources_begin, SourceIterator sources_end, Buffer& Q, BFSVisitor vis, ColorMap color) { BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept )); @@ -70,8 +71,11 @@ namespace boost { typedef color_traits Color; typename GTraits::out_edge_iterator ei, ei_end; - put(color, s, Color::gray()); vis.discover_vertex(s, g); - Q.push(s); + for (; sources_begin != sources_end; ++sources_begin) { + Vertex s = *sources_begin; + put(color, s, Color::gray()); vis.discover_vertex(s, g); + Q.push(s); + } while (! Q.empty()) { Vertex u = Q.top(); Q.pop(); vis.examine_vertex(u, g); for (boost::tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { @@ -89,12 +93,25 @@ namespace boost { } // end while } // breadth_first_visit + // Single-source version + template + void breadth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + typename graph_traits::vertex_descriptor sources[1] = {s}; + breadth_first_visit(g, sources, sources + 1, Q, vis, color); + } - template void breadth_first_search (const VertexListGraph& g, - typename graph_traits::vertex_descriptor s, + SourceIterator sources_begin, SourceIterator sources_end, Buffer& Q, BFSVisitor vis, ColorMap color) { // Initialization @@ -105,7 +122,18 @@ namespace boost { vis.initialize_vertex(*i, g); put(color, *i, Color::white()); } - breadth_first_visit(g, s, Q, vis, color); + breadth_first_visit(g, sources_begin, sources_end, Q, vis, color); + } + + template + void breadth_first_search + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + typename graph_traits::vertex_descriptor sources[1] = {s}; + breadth_first_search(g, sources, sources + 1, Q, vis, color); } namespace graph { struct bfs_visitor_event_not_overridden {}; } @@ -270,13 +298,13 @@ namespace boost { }; template <> - struct bfs_dispatch { + struct bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { null_visitor null_vis; @@ -294,7 +322,7 @@ namespace boost { } // namespace detail - +#if 1 // Named Parameter Variant template void breadth_first_search @@ -307,11 +335,11 @@ namespace boost { // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } +#endif // This version does not initialize colors, user has to. @@ -343,6 +371,33 @@ namespace boost { ); } + namespace graph { + namespace detail { + template + struct breadth_first_search_impl { + typedef void result_type; + template + void operator()(const Graph& g, const Source& source, const ArgPack& arg_pack) { + using namespace boost::graph::keywords; + typename boost::graph_traits::vertex_descriptor sources[1] = {source}; + boost::queue::vertex_descriptor> Q; + boost::breadth_first_search(g, + &sources[0], + &sources[1], + boost::unwrap_ref(arg_pack[_buffer | boost::ref(Q)]), + arg_pack[_visitor | make_bfs_visitor(null_visitor())], + boost::detail::make_color_map_from_arg_pack(g, arg_pack)); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(breadth_first_search, 2, 4) + } + +#if 0 + // Named Parameter Variant + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(breadth_first_search, 2) +#endif + } // namespace boost #ifdef BOOST_GRAPH_USE_MPI diff --git a/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp b/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp index 1466dfe5f..b663cf95f 100644 --- a/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp +++ b/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp @@ -224,7 +224,7 @@ namespace detail // otherwise, iterate over candidates and and test // for maxmimal cliquiness. - typename Container::iterator i, j, end = cands.end(); + typename Container::iterator i, j; for(i = cands.begin(); i != cands.end(); ) { Vertex candidate = *i; @@ -270,7 +270,6 @@ bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min) { BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept )); BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); - BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept )); BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); // Structural requirement only typedef typename graph_traits::vertex_descriptor Vertex; typedef typename graph_traits::vertex_iterator VertexIterator; diff --git a/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp b/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp index ef6ae5c9c..4d026986c 100644 --- a/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp +++ b/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp @@ -13,7 +13,6 @@ #include #include #include -#include //for next and prior #include #include diff --git a/project/jni/boost/include/boost/graph/clustering_coefficient.hpp b/project/jni/boost/include/boost/graph/clustering_coefficient.hpp index dad4695a7..5345ed999 100644 --- a/project/jni/boost/include/boost/graph/clustering_coefficient.hpp +++ b/project/jni/boost/include/boost/graph/clustering_coefficient.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP #define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp b/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp index caa27a906..33c267254 100644 --- a/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp +++ b/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp @@ -37,16 +37,15 @@ #include #include #include +#include #include +#include #include #include #include -#include - -#ifdef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -# error The Compressed Sparse Row graph only supports bundled properties. -# error You will need a compiler that conforms better to the C++ standard. -#endif +#include +#include +#include namespace boost { @@ -139,7 +138,7 @@ namespace detail { typedef boost::iterator_facade, T, std::random_access_iterator_tag, const T&> base_type; T saved_value; const T& dereference() const {return saved_value;} - bool equal(default_construct_iterator i) const {return true;} + bool equal(default_construct_iterator /*i*/) const {return true;} void increment() {} void decrement() {} void advance(typename base_type::difference_type) {} @@ -195,8 +194,8 @@ class compressed_sparse_row_graph::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProperty graph_property_type; + typedef typename lookup_one_property::type graph_bundled; typedef detail::compressed_sparse_row_structure forward_type; @@ -746,8 +745,8 @@ class compressed_sparse_row_graph::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProperty graph_property_type; + typedef typename lookup_one_property::type graph_bundled; // typedef GraphProperty graph_property_type; typedef detail::compressed_sparse_row_structure forward_type; @@ -933,6 +932,7 @@ class compressed_sparse_row_graph - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); - } - - template - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, typed_identity_property_map()); - } - - // Add edges from a sorted (smallest sources first) range of pairs - template - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator()); - } - - template - void - add_edges_sorted_internal_global( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator(), global_to_local); - } - - template - void - add_edges_sorted_internal_global( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); - } - - // Add edges from a range of (source, target) pairs that are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - const GlobalToLocal& global_to_local) { - typedef compressed_sparse_row_graph Graph; - typedef typename boost::graph_traits::vertex_descriptor vertex_t; - typedef typename boost::graph_traits::vertices_size_type vertex_num; - typedef typename boost::graph_traits::edges_size_type edge_num; - typedef std::vector > edge_vector_t; - edge_vector_t new_edges(first, last); - if (new_edges.empty()) return; - std::sort(new_edges.begin(), new_edges.end()); - this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); - } - - template - inline void - add_edges_internal(InputIterator first, InputIterator last) { - this->add_edges_internal(first, last, typed_identity_property_map()); - } - - // Add edges from a range of (source, target) pairs and edge properties that - // are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - EPIterator ep_iter, EPIterator ep_iter_end, - const GlobalToLocal& global_to_local) { - typedef compressed_sparse_row_graph Graph; - typedef typename boost::graph_traits::vertex_descriptor vertex_t; - typedef typename boost::graph_traits::vertices_size_type vertex_num; - typedef typename boost::graph_traits::edges_size_type edge_num; - typedef std::pair vertex_pair; - typedef std::vector< - boost::tuple > - edge_vector_t; - edge_vector_t new_edges - (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), - boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); - if (new_edges.empty()) return; - std::sort(new_edges.begin(), new_edges.end(), - boost::detail::compare_first< - std::less >()); - m_forward.add_edges_sorted_internal - (boost::make_transform_iterator( - new_edges.begin(), - boost::detail::my_tuple_get_class<0, vertex_pair>()), - boost::make_transform_iterator( - new_edges.end(), - boost::detail::my_tuple_get_class<0, vertex_pair>()), - boost::make_transform_iterator( - new_edges.begin(), - boost::detail::my_tuple_get_class - <1, edge_bundled>()), - global_to_local); - } - - // Add edges from a range of (source, target) pairs and edge properties that - // are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - EPIterator ep_iter, EPIterator ep_iter_end) { - this->add_edges_internal(first, last, ep_iter, ep_iter_end, typed_identity_property_map()); + set_up_backward_property_links(); } using inherited_vertex_properties::operator[]; @@ -1134,7 +1017,6 @@ add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_ Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); EdgeIndex numedges = g.m_forward.m_rowstart.back(); g.m_forward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); - g.m_backward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); g.vertex_properties().resize(num_vertices(g)); return old_num_verts_plus_one - 1; } @@ -1383,56 +1265,148 @@ edges(const BOOST_CSR_GRAPH_TYPE& g) // Graph properties template inline void -set_property(BOOST_CSR_GRAPH_TYPE& g, Tag, const Value& value) +set_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag, const Value& value) { - get_property_value(g.m_property, Tag()) = value; + get_property_value(g.m_property, tag) = value; } template inline typename graph_property::type& -get_property(BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template inline const typename graph_property::type& -get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); +} + +template +struct csr_property_map_helper {}; +// Kind == void for invalid property tags, so we can use that to SFINAE out + +template +struct csr_property_map_helper { + typedef vertex_all_t all_tag; + typedef typename property_traits::type>::key_type key_type; + typedef VertexProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +template +struct csr_property_map_helper { + typedef edge_all_t all_tag; + typedef typename property_traits::type>::key_type key_type; + typedef EdgeProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +template +struct csr_property_map_helper { + typedef graph_all_t all_tag; + typedef BOOST_CSR_GRAPH_TYPE* key_type; + typedef GraphProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +// disable_if isn't truly necessary but required to avoid ambiguity with specializations below +template +struct property_map >::type>: + csr_property_map_helper< + BOOST_CSR_GRAPH_TYPE, + Tag, + typename detail::property_kind_from_graph + ::type> {}; + +template +typename property_map::type +get(Tag tag, BOOST_CSR_GRAPH_TYPE& g) { + return typename property_map::type(tag, get(typename property_map::all_tag(), g)); +} + +template +typename property_map::const_type +get(Tag tag, const BOOST_CSR_GRAPH_TYPE& g) { + return typename property_map::const_type(tag, get(typename property_map::all_tag(), g)); +} + +template +typename property_traits::type>::reference +get(Tag tag, BOOST_CSR_GRAPH_TYPE& g, typename property_map::key_type k) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::type outer_pm; + return lookup_one_property::value_type, Tag>::lookup(get(all_tag(), g, k), tag); +} + +template +typename property_traits::const_type>::reference +get(Tag tag, const BOOST_CSR_GRAPH_TYPE& g, typename property_map::key_type k) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::const_type outer_pm; + return lookup_one_property::value_type, Tag>::lookup(get(all_tag(), g, k), tag); +} + +template +void +put(Tag tag, + BOOST_CSR_GRAPH_TYPE& g, + typename property_map::key_type k, + typename lookup_one_property::plist_type, Tag>::type val) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::type outer_pm; + lookup_one_property::plist_type, Tag>::lookup(get(all_tag(), g, k), tag) = val; } template -struct property_map +struct property_map >::type> { typedef typed_identity_property_map type; typedef type const_type; }; template -struct property_map +struct property_map >::type> { typedef detail::csr_edge_index_map type; typedef type const_type; }; template -struct property_map +struct property_map >::type> { typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::vertex_map_type type; typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::const_vertex_map_type const_type; }; template -struct property_map +struct property_map >::type> { typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::edge_map_type type; typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::const_edge_map_type const_type; }; +template +struct property_map >::type> +{ + typedef boost::ref_property_map type; + typedef boost::ref_property_map const_type; +}; + template inline typed_identity_property_map get(vertex_index_t, const BOOST_CSR_GRAPH_TYPE&) @@ -1448,6 +1422,21 @@ get(vertex_index_t, return v; } +template +inline typed_identity_property_map +get(vertex_index_t, BOOST_CSR_GRAPH_TYPE&) +{ + return typed_identity_property_map(); +} + +template +inline Vertex +get(vertex_index_t, + BOOST_CSR_GRAPH_TYPE&, Vertex v) +{ + return v; +} + template inline typename property_map::const_type get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&) @@ -1466,125 +1455,144 @@ get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&, } template -inline typename property_map::type -get(vertex_bundle_t, BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(edge_index_t, BOOST_CSR_GRAPH_TYPE&) +{ + typedef typename property_map::const_type + result_type; + return result_type(); +} + +template +inline EdgeIndex +get(edge_index_t, BOOST_CSR_GRAPH_TYPE&, + typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e) +{ + return e.idx; +} + +template +inline typename property_map::type +get(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g) { return g.get_vertex_bundle(get(vertex_index, g)); } template -inline typename property_map::const_type -get(vertex_bundle_t, const BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(vertex_all_t, const BOOST_CSR_GRAPH_TYPE& g) { return g.get_vertex_bundle(get(vertex_index, g)); } template inline VertexProperty& -get(vertex_bundle_t, +get(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g, Vertex v) { - return get(vertex_bundle, g)[v]; + return get(vertex_all, g)[v]; } template inline const VertexProperty& -get(vertex_bundle_t, +get(vertex_all_t, const BOOST_CSR_GRAPH_TYPE& g, Vertex v) { - return get(vertex_bundle, g)[v]; + return get(vertex_all, g)[v]; } template inline void -put(vertex_bundle_t, +put(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g, Vertex v, const VertexProperty& val) { - put(get(vertex_bundle, g), v, val); + put(get(vertex_all, g), v, val); } template -inline typename property_map::type -get(edge_bundle_t, BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::type +get(edge_all_t, BOOST_CSR_GRAPH_TYPE& g) { return g.m_forward.get_edge_bundle(get(edge_index, g)); } template -inline typename property_map::const_type -get(edge_bundle_t, const BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(edge_all_t, const BOOST_CSR_GRAPH_TYPE& g) { return g.m_forward.get_edge_bundle(get(edge_index, g)); } template inline EdgeProperty& -get(edge_bundle_t, +get(edge_all_t, BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e) { - return get(edge_bundle, g)[e]; + return get(edge_all, g)[e]; } template inline const EdgeProperty& -get(edge_bundle_t, +get(edge_all_t, const BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e) { - return get(edge_bundle, g)[e]; + return get(edge_all, g)[e]; } template inline void -put(edge_bundle_t, +put(edge_all_t, BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e, const EdgeProperty& val) { - put(get(edge_bundle, g), e, val); + put(get(edge_all, g), e, val); } -template -inline -typename property_map::type -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g) +template +inline typename property_map::type +get(graph_all_t, BOOST_CSR_GRAPH_TYPE& g) { - typedef typename property_map::type - result_type; - return result_type(&g, p); + return typename property_map::type(g.m_property); } -template -inline -typename property_map::const_type -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g) +template +inline typename property_map::const_type +get(graph_all_t, const BOOST_CSR_GRAPH_TYPE& g) { - typedef typename property_map::const_type - result_type; - return result_type(&g, p); + return typename property_map::const_type(g.m_property); } -template -inline T -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g, - const Key& key) +template +inline GraphProperty& +get(graph_all_t, + BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*) { - return get(get(p, g), key); + return g.m_property; } -template +template +inline const GraphProperty& +get(graph_all_t, + const BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*) +{ + return g.m_property; +} + +template inline void -put(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g, - const Key& key, const T& value) +put(graph_all_t, + BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*, + const GraphProperty& val) { - put(get(p, g), key, value); + g.m_property = val; } #undef BOOST_CSR_GRAPH_TYPE diff --git a/project/jni/boost/include/boost/graph/copy.hpp b/project/jni/boost/include/boost/graph/copy.hpp index 0dc6c664a..21bb0fb01 100644 --- a/project/jni/boost/include/boost/graph/copy.hpp +++ b/project/jni/boost/include/boost/graph/copy.hpp @@ -280,7 +280,7 @@ namespace boost { typedef choose_copier_parameter type; }; template <> - struct choose_edge_copy { + struct choose_edge_copy { typedef choose_default_edge_copier type; }; template @@ -314,7 +314,7 @@ namespace boost { typedef choose_copier_parameter type; }; template <> - struct choose_vertex_copy { + struct choose_vertex_copy { typedef choose_default_vertex_copier type; }; template diff --git a/project/jni/boost/include/boost/graph/core_numbers.hpp b/project/jni/boost/include/boost/graph/core_numbers.hpp index 3db59c72b..33764c4f4 100644 --- a/project/jni/boost/include/boost/graph/core_numbers.hpp +++ b/project/jni/boost/include/boost/graph/core_numbers.hpp @@ -11,8 +11,7 @@ #ifndef BOOST_GRAPH_CORE_NUMBERS_HPP #define BOOST_GRAPH_CORE_NUMBERS_HPP -#include -#include +#include #include #include #include @@ -159,7 +158,8 @@ namespace boost { if (get(c,u) > v_cn) { // remove the edge put(c,u,get(c,u)-get(wm,*oi)); - Q.update(u); + if (Q.contains(u)) + Q.update(u); } } vis.finish_vertex(v,g); @@ -175,13 +175,14 @@ namespace boost { { typedef typename property_traits::value_type D; typedef std::less Cmp; - typedef indirect_cmp IndirectCmp; - IndirectCmp icmp(c, Cmp()); // build the mutable queue typedef typename graph_traits::vertex_descriptor vertex; - typedef mutable_queue, IndirectCmp, - IndexMap> MutableQueue; - MutableQueue Q(num_vertices(g), icmp, im); + std::vector index_in_heap_data(num_vertices(g)); + typedef iterator_property_map::iterator, IndexMap> + index_in_heap_map_type; + index_in_heap_map_type index_in_heap_map(index_in_heap_data.begin(), im); + typedef d_ary_heap_indirect MutableQueue; + MutableQueue Q(c, index_in_heap_map, Cmp()); typename graph_traits::vertex_iterator vi,vi_end; for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { Q.push(*vi); diff --git a/project/jni/boost/include/boost/graph/depth_first_search.hpp b/project/jni/boost/include/boost/graph/depth_first_search.hpp index d38ad603d..34d73a2fd 100644 --- a/project/jni/boost/include/boost/graph/depth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/depth_first_search.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -198,7 +199,7 @@ namespace boost { put(color, u, Color::white()); vis.initialize_vertex(u, g); } - if (start_vertex != implicit_cast(*vertices(g).first)){ vis.start_vertex(start_vertex, g); + if (start_vertex != detail::get_default_starting_vertex(g)){ vis.start_vertex(start_vertex, g); detail::depth_first_visit_impl(g, start_vertex, vis, color, detail::nontruth2()); } @@ -221,7 +222,7 @@ namespace boost { if (verts.first == verts.second) return; - depth_first_search(g, vis, color, *verts.first); + depth_first_search(g, vis, color, detail::get_default_starting_vertex(g)); } template @@ -282,27 +283,27 @@ namespace boost { } typedef dfs_visitor<> default_dfs_visitor; - // Named Parameter Variant - template - void - depth_first_search(const VertexListGraph& g, - const bgl_named_params& params) - { - typedef typename boost::graph_traits::vertex_iterator vi; - std::pair verts = vertices(g); - if (verts.first == verts.second) - return; - using namespace boost::graph::keywords; - typedef bgl_named_params params_type; - BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) - depth_first_search - (g, - arg_pack[_visitor | make_dfs_visitor(null_visitor())], - boost::detail::make_color_map_from_arg_pack(g, arg_pack), - arg_pack[_root_vertex | *vertices(g).first] - ); + // Boost.Parameter named parameter variant + namespace graph { + namespace detail { + template + struct depth_first_search_impl { + typedef void result_type; + template + void operator()(const Graph& g, const ArgPack& arg_pack) const { + using namespace boost::graph::keywords; + boost::depth_first_search(g, + arg_pack[_visitor | make_dfs_visitor(null_visitor())], + boost::detail::make_color_map_from_arg_pack(g, arg_pack), + arg_pack[_root_vertex || boost::detail::get_default_starting_vertex_t(g)]); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(depth_first_search, 1, 4) } + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(depth_first_search, 1) + template void depth_first_visit (const IncidenceGraph& g, diff --git a/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp b/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp index 100c44ba7..619593675 100644 --- a/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp @@ -37,11 +37,6 @@ #include #include -// Symbol truncation problems with MSVC, trying to shorten names. -#define stored_edge se_ -#define stored_edge_property sep_ -#define stored_edge_iter sei_ - /* Outline for this file: @@ -67,11 +62,6 @@ */ -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -# define Graph Graph_ -#endif - namespace boost { namespace detail { @@ -319,14 +309,16 @@ namespace boost { public: typedef Property property_type; inline stored_ra_edge_iter() { } - inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), - EdgeVec* edge_vec = 0) + inline explicit stored_ra_edge_iter(Vertex v) // Only used for comparisons + : stored_edge(v), m_i(0), m_vec(0){ } + inline stored_ra_edge_iter(Vertex v, Iter i, EdgeVec* edge_vec) : stored_edge(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 { + BOOST_ASSERT ((m_vec != 0)); 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: std::size_t m_i; EdgeVec* m_vec; @@ -727,8 +719,10 @@ namespace boost { typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == &p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -736,10 +730,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == &p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -760,8 +754,10 @@ namespace boost { no_property* p = (no_property*)e.get_property(); typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -769,10 +765,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -811,6 +807,7 @@ namespace boost { typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end(); + BOOST_ASSERT ((i != end)); if (i != end) { g.m_edges.erase((*i).get_iter()); el.erase(i); @@ -991,24 +988,12 @@ namespace boost { typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast(g_); - typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator - ei = el.begin(), ei_end = el.end(); - for (; ei != ei_end; /* Increment below */ ) { - bool is_self_loop = (*ei).get_target() == u; - // Don't erase from our own incidence list in the case of a self-loop - // since we're clearing it anyway. - if (!is_self_loop) { - detail::erase_from_incidence_list - (g.out_edge_list((*ei).get_target()), u, Cat()); - typename Config::OutEdgeList::iterator ei_copy = ei; - ++ei; - if (!is_self_loop) g.m_edges.erase((*ei_copy).get_iter()); - } else { - ++ei; - } + while (true) { + typename Config::out_edge_iterator ei, ei_end; + boost::tie(ei, ei_end) = out_edges(u, g); + if (ei == ei_end) break; + remove_edge(*ei, g); } - g.out_edge_list(u).clear(); } // O(1) for allow_parallel_edge_tag // O(log(E/V)) for disallow_parallel_edge_tag @@ -1511,10 +1496,16 @@ namespace boost { typedef typename Config::edges_size_type edges_size_type; typedef typename Config::degree_size_type degree_size_type; typedef typename Config::StoredEdge StoredEdge; + typedef typename Config::vertex_property_type vertex_property_type; typedef typename Config::edge_property_type edge_property_type; + typedef typename Config::graph_property_type graph_property_type; typedef typename Config::global_edgelist_selector global_edgelist_selector; + + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; + typedef typename lookup_one_property::type graph_bundled; }; template @@ -1645,43 +1636,43 @@ namespace boost { inline typename boost::property_map::type - get_dispatch(adj_list_helper&, Property, + get_dispatch(adj_list_helper&, Property p, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; - return PA(); + return PA(p); } template inline typename boost::property_map::const_type - get_dispatch(const adj_list_helper&, Property, + get_dispatch(const adj_list_helper&, Property p, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::const_type PA; - return PA(); + return PA(p); } template inline typename boost::property_map::type - get_dispatch(adj_list_helper& g, Property, + get_dispatch(adj_list_helper& g, Property p, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; - return PA(&static_cast(g)); + return PA(&static_cast(g), p); } template inline typename boost::property_map::const_type - get_dispatch(const adj_list_helper& g, Property, + get_dispatch(const adj_list_helper& g, Property p, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::const_type PA; const Graph& cg = static_cast(g); - return PA(&cg); + return PA(&cg, p); } } // namespace detail @@ -1691,7 +1682,7 @@ namespace boost { inline typename boost::property_map::type get(Property p, adj_list_helper& g) { - typedef typename property_kind::type Kind; + typedef typename detail::property_kind_from_graph, Property>::type Kind; return detail::get_dispatch(g, p, Kind()); } template @@ -1699,7 +1690,7 @@ namespace boost { typename boost::property_map::const_type get(Property p, const adj_list_helper& g) { - typedef typename property_kind::type Kind; + typedef typename detail::property_kind_from_graph, Property>::type Kind; return detail::get_dispatch(g, p, Kind()); } @@ -2427,15 +2418,15 @@ namespace boost { typedef Reference reference; typedef typename Graph::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - inline adj_list_vertex_property_map() { } - inline adj_list_vertex_property_map(const Graph*) { } + inline adj_list_vertex_property_map(const Graph* = 0, Tag tag = Tag()): m_tag(tag) { } inline Reference operator[](key_type v) const { StoredVertex* sv = (StoredVertex*)v; - return get_property_value(sv->m_property, Tag()); + return get_property_value(sv->m_property, m_tag); } inline Reference operator()(key_type v) const { return this->operator[](v); } + Tag m_tag; }; template @@ -2449,8 +2440,7 @@ namespace boost { typedef PropRef reference; typedef typename Graph::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - inline adj_list_vertex_all_properties_map() { } - inline adj_list_vertex_all_properties_map(const Graph*) { } + inline adj_list_vertex_all_properties_map(const Graph* = 0, vertex_all_t = vertex_all_t()) { } inline PropRef operator[](key_type v) const { StoredVertex* sv = (StoredVertex*)v; return sv->m_property; @@ -2473,15 +2463,15 @@ namespace boost { typedef Reference reference; typedef typename boost::graph_traits::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - vec_adj_list_vertex_property_map() { } - vec_adj_list_vertex_property_map(GraphPtr g) : m_g(g) { } + vec_adj_list_vertex_property_map(GraphPtr g = 0, Tag tag = Tag()) : m_g(g), m_tag(tag) { } inline Reference operator[](key_type v) const { - return get_property_value(m_g->m_vertices[v].m_property, Tag()); + return get_property_value(m_g->m_vertices[v].m_property, m_tag); } inline Reference operator()(key_type v) const { return this->operator[](v); } GraphPtr m_g; + Tag m_tag; }; template @@ -2495,8 +2485,7 @@ namespace boost { typedef PropertyRef reference; typedef typename boost::graph_traits::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - vec_adj_list_vertex_all_properties_map() { } - vec_adj_list_vertex_all_properties_map(GraphPtr g) : m_g(g) { } + vec_adj_list_vertex_all_properties_map(GraphPtr g = 0, vertex_all_t = vertex_all_t()) : m_g(g) { } inline PropertyRef operator[](key_type v) const { return m_g->m_vertices[v].m_property; } @@ -2542,7 +2531,7 @@ namespace boost { typedef boost::readable_property_map_tag category; inline vec_adj_list_vertex_id_map() { } template - inline vec_adj_list_vertex_id_map(const Graph&) { } + inline vec_adj_list_vertex_id_map(const Graph&, vertex_index_t) { } inline value_type operator[](key_type v) const { return v; } inline value_type operator()(key_type v) const { return v; } }; @@ -2579,21 +2568,14 @@ namespace boost { }; }; namespace detail { - template - struct adj_list_choose_vertex_pa_helper { - typedef adj_list_any_vertex_pa type; - }; - template <> - struct adj_list_choose_vertex_pa_helper { - typedef adj_list_all_vertex_pa type; - }; template - struct adj_list_choose_vertex_pa { - typedef typename adj_list_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct adj_list_choose_vertex_pa + : boost::mpl::if_< + boost::is_same, + adj_list_all_vertex_pa, + adj_list_any_vertex_pa>::type + ::template bind_ + {}; template @@ -2609,12 +2591,9 @@ namespace boost { typedef vec_adj_list_all_vertex_pa type; }; template - struct vec_adj_list_choose_vertex_pa { - typedef typename vec_adj_list_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct vec_adj_list_choose_vertex_pa + : vec_adj_list_choose_vertex_pa_helper::type::template bind_ + {}; } // namespace detail //========================================================================= @@ -2629,13 +2608,16 @@ namespace boost { Tag> > { + Tag tag; + explicit adj_list_edge_property_map(Tag tag = Tag()): tag(tag) {} + typedef Value value_type; typedef Ref reference; typedef detail::edge_desc_impl key_type; typedef boost::lvalue_property_map_tag category; inline Ref operator[](key_type e) const { Property& p = *(Property*)e.get_property(); - return get_property_value(p, Tag()); + return get_property_value(p, tag); } inline Ref operator()(key_type e) const { return this->operator[](e); @@ -2650,6 +2632,7 @@ namespace boost { PropPtr, Vertex> > { + explicit adj_list_edge_all_properties_map(edge_all_t = edge_all_t()) {} typedef Property value_type; typedef PropRef reference; typedef detail::edge_desc_impl key_type; @@ -2701,19 +2684,12 @@ namespace boost { typedef adj_list_all_edge_pmap type; }; template - struct adj_list_choose_edge_pmap { - typedef typename adj_list_choose_edge_pmap_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct adj_list_choose_edge_pmap + : adj_list_choose_edge_pmap_helper::type::template bind_ + {}; struct adj_list_edge_property_selector { template - struct bind_ { - typedef adj_list_choose_edge_pmap Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_: adj_list_choose_edge_pmap {}; }; } // namespace detail @@ -2730,11 +2706,9 @@ namespace boost { struct adj_list_vertex_property_selector { template - struct bind_ { - typedef detail::adj_list_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_ + : detail::adj_list_choose_vertex_pa + {}; }; template <> struct vertex_property_selector { @@ -2743,11 +2717,7 @@ namespace boost { struct vec_adj_list_vertex_property_selector { template - struct bind_ { - typedef detail::vec_adj_list_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_: detail::vec_adj_list_choose_vertex_pa {}; }; template <> struct vertex_property_selector { @@ -2793,15 +2763,6 @@ namespace boost { #endif -#undef stored_edge -#undef stored_edge_property -#undef stored_edge_iter - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -#undef Graph -#endif - #endif // BOOST_GRAPH_DETAIL_DETAIL_ADJACENCY_LIST_CCT /* diff --git a/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp b/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp index 75ac96204..56495f343 100644 --- a/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp +++ b/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -44,7 +44,6 @@ #include #include #include -#include namespace boost { diff --git a/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp b/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp index ba58647a3..cf930fc18 100644 --- a/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp +++ b/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp @@ -20,6 +20,11 @@ #include #include +// WARNING: it is not safe to copy a d_ary_heap_indirect and then modify one of +// the copies. The class is required to be copyable so it can be passed around +// (without move support from C++11), but it deep-copies the heap contents yet +// shallow-copies the index_in_heap_map. + namespace boost { // Swap two elements in a property map without assuming they model @@ -121,18 +126,21 @@ namespace boost { } Value& top() { + BOOST_ASSERT (!this->empty()); return data[0]; } const Value& top() const { + BOOST_ASSERT (!this->empty()); return data[0]; } void pop() { + BOOST_ASSERT (!this->empty()); put(index_in_heap, data[0], (size_type)(-1)); if (data.size() != 1) { data[0] = data.back(); - put(index_in_heap, data[0], 0); + put(index_in_heap, data[0], (size_type)(0)); data.pop_back(); preserve_heap_property_down(); verify_heap(); diff --git a/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp b/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp index b359a73de..ca6266a52 100644 --- a/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp +++ b/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp @@ -60,6 +60,7 @@ count_starts // Put the degree of each vertex v into m_rowstart[v + 1] for (KeyIterator i = begin; i != end; ++i) { if (key_filter(*i)) { + BOOST_ASSERT (key_transform(*i) < numkeys); ++starts[key_transform(*i) + 1]; } } @@ -99,6 +100,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) { if (key_filter(*i)) { vertices_size_type source = key_transform(*i); + BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; values1_out[insert_pos] = *v1i; @@ -137,6 +139,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) { if (key_filter(*i)) { vertices_size_type source = key_transform(*i); + BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; values1_out[insert_pos] = *v1i; @@ -163,6 +166,7 @@ histogram_sort_inplace(KeyIterator key_begin, std::vector insert_positions(rowstart, rowstart + numkeys); // 2. Swap the sources and targets into place for (size_t i = 0; i < rowstart[numkeys]; ++i) { + BOOST_ASSERT (key_transform(key_begin[i]) < numkeys); // While edge i is not in the right bucket: while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { // Add a slot in the right bucket @@ -197,6 +201,7 @@ histogram_sort_inplace(KeyIterator key_begin, std::vector insert_positions(rowstart, rowstart + numkeys); // 2. Swap the sources and targets into place for (size_t i = 0; i < rowstart[numkeys]; ++i) { + BOOST_ASSERT (key_transform(key_begin[i]) < numkeys); // While edge i is not in the right bucket: while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { // Add a slot in the right bucket diff --git a/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp b/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp index e1f874b2c..4494625c6 100644 --- a/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp +++ b/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp @@ -253,7 +253,7 @@ class indexed_edge_properties typedef secret const_edge_map_type; secret operator[](secret) { return secret(); } - void write_by_index(std::size_t idx, const no_property& prop) {} + void write_by_index(std::size_t /*idx*/, const no_property& /*prop*/) {} edge_map_type get_edge_bundle(const IndexMap& = IndexMap()) const { return edge_map_type(); @@ -270,7 +270,7 @@ class indexed_edge_properties public: void push_back(const edge_push_back_type&) { } - void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) {} + void move_range(std::size_t /*src_begin*/, std::size_t /*src_end*/, std::size_t /*dest_begin*/) {} typedef dummy_no_property_iterator iterator; iterator begin() {return dummy_no_property_iterator();} diff --git a/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp b/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp new file mode 100644 index 000000000..4319d9d89 --- /dev/null +++ b/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp @@ -0,0 +1,26 @@ +// Copyright 2012 The Trustees of Indiana University. + +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Jeremiah Willcock +// Andrew Lumsdaine + +// Selector to determine whether a selector is distributedS (can only be true +// if has been included) so that we can +// disable various sequential-graph-only traits specializations for distributed +// graphs. + +#ifndef BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP +#define BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP + +#include + +namespace boost { + namespace detail { + template struct is_distributed_selector: boost::mpl::false_ {}; + } +} + +#endif // BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP diff --git a/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp b/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp index 6eb106093..a0c0973f9 100644 --- a/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp +++ b/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp @@ -218,9 +218,9 @@ namespace graph_detail { #define LABELED_GRAPH_PARAMS typename G, typename L, typename S #define LABELED_GRAPH labeled_graph -// Specialize mutability traits for for the labeled graph. +// Specialize mutability traits for the labeled graph. // This specialization depends on the mutability of the underlying graph type. -// If the underlying graph is fully mutable, this this is also fully mutable. +// If the underlying graph is fully mutable, this is also fully mutable. // Otherwise, it's different. template struct graph_mutability_traits< LABELED_GRAPH > { diff --git a/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp b/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp index 4e8b22e5e..994646988 100644 --- a/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp +++ b/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp @@ -604,7 +604,9 @@ bool read_graphviz_spirit(MultiPassIterator begin, MultiPassIterator end, scanner_t scan(begin, end, policies); - return p.parse(scan); + bool ok = p.parse(scan); + m_graph.finish_building_graph(); + return ok; } } // namespace boost diff --git a/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp b/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp index 90a64a2cd..33acc07e3 100644 --- a/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp +++ b/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp @@ -111,7 +111,7 @@ namespace boost { // Shit, can't implement this without knowing the size of the // universe. template - void set_compliment(const std::set& x, + void set_compliment(const std::set& /*x*/, std::set& z) { z.clear(); diff --git a/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp b/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp index ca2a1ebd8..c5ce6b6d4 100644 --- a/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp +++ b/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp @@ -113,16 +113,17 @@ namespace boost { distance_weight_combine, distance_compare); if (was_edge_relaxed) { - vertex_queue.update(neighbor_vertex); visitor.edge_relaxed(current_edge, graph); + if (is_neighbor_undiscovered) { + visitor.discover_vertex(neighbor_vertex, graph); + vertex_queue.push(neighbor_vertex); + } else { + vertex_queue.update(neighbor_vertex); + } } else { visitor.edge_not_relaxed(current_edge, graph); } - if (is_neighbor_undiscovered) { - visitor.discover_vertex(neighbor_vertex, graph); - vertex_queue.push(neighbor_vertex); - } } // end out edge iteration visitor.finish_vertex(min_vertex, graph); diff --git a/project/jni/boost/include/boost/graph/directed_graph.hpp b/project/jni/boost/include/boost/graph/directed_graph.hpp index 0bf025190..585308d18 100644 --- a/project/jni/boost/include/boost/graph/directed_graph.hpp +++ b/project/jni/boost/include/boost/graph/directed_graph.hpp @@ -7,9 +7,12 @@ #ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP #define BOOST_GRAPH_DIRECTED_GRAPH_HPP -#include #include #include +#include +#include +#include +#include namespace boost { @@ -28,29 +31,26 @@ struct directed_graph_tag { }; */ template < typename VertexProp = no_property, - typename EdgeProp= no_property, - typename GraphProp= no_property> + typename EdgeProp = no_property, + typename GraphProp = no_property> class directed_graph { public: - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; - -private: - // Wrap the user-specified properties with an index. - typedef property vertex_property; - typedef property edge_property; + typedef GraphProp graph_property_type; + typedef VertexProp vertex_property_type; + typedef EdgeProp edge_property_type; + typedef typename lookup_one_property::type graph_bundled; + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; +public: + // Embed indices into the vertex type. + typedef property internal_vertex_property; + typedef property internal_edge_property; public: typedef adjacency_list< listS, listS, bidirectionalS, - vertex_property, edge_property, GraphProp, + internal_vertex_property, internal_edge_property, GraphProp, listS > graph_type; @@ -83,8 +83,8 @@ public: typedef typename graph_type::edge_parallel_category edge_parallel_category; typedef typename graph_type::traversal_category traversal_category; - typedef unsigned vertex_index_type; - typedef unsigned edge_index_type; + typedef std::size_t vertex_index_type; + typedef std::size_t edge_index_type; directed_graph(GraphProp const& p = GraphProp()) : m_graph(p), m_num_vertices(0), m_num_edges(0), m_max_vertex_index(0) @@ -140,6 +140,7 @@ public: vertices_size_type num_vertices() const { return m_num_vertices; } + private: // This helper function manages the attribution of vertex indices. vertex_descriptor make_index(vertex_descriptor v) { @@ -153,7 +154,7 @@ public: { return make_index(boost::add_vertex(m_graph)); } vertex_descriptor add_vertex(vertex_property_type const& p) - { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + { return make_index(boost::add_vertex(internal_vertex_property(0u, p), m_graph)); } void clear_vertex(vertex_descriptor v) { @@ -189,7 +190,7 @@ public: std::pair add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) - { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + { return make_index(boost::add_edge(u, v, internal_edge_property(0u, p), m_graph)); } void remove_edge(vertex_descriptor u, vertex_descriptor v) { @@ -519,37 +520,32 @@ remove_in_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH& g) { return remove_in_edge_if(v, pred, g.impl()); } -// Helper code for working with property maps -namespace detail -{ - struct directed_graph_vertex_property_selector { - template - struct bind_ { - typedef typename DirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; +template +struct property_map: property_map {}; - struct directed_graph_edge_property_selector { - template - struct bind_ { - typedef typename DirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; -} +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; -template <> -struct vertex_property_selector -{ typedef detail::directed_graph_vertex_property_selector type; }; - -template <> -struct edge_property_selector -{ typedef detail::directed_graph_edge_property_selector type; }; +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; // PropertyGraph concepts template @@ -562,6 +558,26 @@ inline typename property_map::const_type get(Property p, DIRECTED_GRAPH const& g) { return get(p, g.impl()); } +template +inline typename property_map::type +get(vertex_all_t, DIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::const_type +get(vertex_all_t, DIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::type +get(edge_all_t, DIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(edge_all, g.impl())); } + +template +inline typename property_map::const_type +get(edge_all_t, DIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(edge_all, g.impl())); } + template inline typename property_traits< typename property_map< @@ -571,10 +587,40 @@ inline typename property_traits< get(Property p, DIRECTED_GRAPH const& g, Key const& k) { return get(p, g.impl(), k); } +template +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, vertex_all_t + >::const_type +>::value_type +get(vertex_all_t, DIRECTED_GRAPH const& g, Key const& k) +{ return get(vertex_all, g.impl(), k).m_base; } + +template +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, edge_all_t + >::const_type +>::value_type +get(edge_all_t, DIRECTED_GRAPH const& g, Key const& k) +{ return get(edge_all, g.impl(), k).m_base; } + template inline void put(Property p, DIRECTED_GRAPH& g, Key const& k, Value const& v) { put(p, g.impl(), k, v); } +template +inline void put(vertex_all_t, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(vertex_all, g.impl(), k, + typename DIRECTED_GRAPH::internal_vertex_property(get(vertex_index, g.impl(), k), v)); +} + +template +inline void put(edge_all_t, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(edge_all, g.impl(), k, + typename DIRECTED_GRAPH::internal_vertex_property(get(edge_index, g.impl(), k), v)); +} + template typename graph_property::type& get_property(DIRECTED_GRAPH& g, Property p) @@ -590,35 +636,6 @@ void set_property(DIRECTED_GRAPH& g, Property p, Value v) { return set_property(g.impl(), p, v); } -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - -template -inline typename property_map::type -get(Type Bundle::* p, DIRECTED_GRAPH& g) { - typedef typename property_map< - DIRECTED_GRAPH, Type Bundle::* - >::type return_type; - return return_type(&g, p); -} - -template -inline typename property_map::const_type -get(Type Bundle::* p, DIRECTED_GRAPH const& g) { - typedef typename property_map< - DIRECTED_GRAPH, Type Bundle::* - >::const_type return_type; - return return_type(&g, p); -} - -template -inline Type get(Type Bundle::* p, DIRECTED_GRAPH const& g, Key const& k) -{ return get(p, g.impl(), k); } - -template -inline void put(Type Bundle::* p, DIRECTED_GRAPH& g, Key const& k, Value const& v) -{ put(p, g.impl(), k, v); } -#endif - // Vertex index management template diff --git a/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp b/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp index d0bbbfe55..264ede512 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp @@ -1882,6 +1882,30 @@ namespace boost { } //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + // Opposite of above. + edge_property_type split_edge_property(const base_edge_property_type& p) + { return split_edge_property(p, directed_selector()); } + + edge_property_type + split_edge_property(const base_edge_property_type& p, directedS) + { + return p.m_base; + } + + edge_property_type + split_edge_property(const base_edge_property_type& p, bidirectionalS) + { + return p.m_base; + } + + edge_property_type + split_edge_property(const base_edge_property_type& p, undirectedS) + { + return p.m_base.m_base; + } + //--------------------------------------------------------------------- + /** The set of messages that can be transmitted and received by * a distributed adjacency list. This list will eventually be * exhaustive, but is currently quite limited. diff --git a/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp b/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp index 064aaba19..5401f1240 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp @@ -237,8 +237,8 @@ PBGL_DISTRIB_ADJLIST_TYPE || get(vertex_to_processor, src) != src.owner || get(vertex_to_processor, tgt) != tgt.owner) redistributed_edges[get(vertex_to_processor, source(*ei, *this))] - .push_back(redistributed_edge(*ei, get(edge_all_t(), base(), - ei->local))); + .push_back(redistributed_edge(*ei, split_edge_property(get(edge_all_t(), base(), + ei->local)))); } inplace_all_to_all(pg, redistributed_edges); diff --git a/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp b/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp index 9325d610c..d904c5a90 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp @@ -833,12 +833,7 @@ void save_edges(Archive& ar, Graph const& g, DirectedS) typedef typename graph_traits< Graph>::edge_descriptor edge_descriptor; - // We retag the property list here so that bundled properties are - // properly placed into property. - typedef typename boost::detail::retag_property_list< - edge_bundle_t, - typename Graph::edge_property_type>::type - edge_property_type; + typedef typename Graph::edge_property_type edge_property_type; int E = num_edges(g); ar << BOOST_SERIALIZATION_NVP(E); @@ -947,12 +942,6 @@ template template void PBGL_DISTRIB_ADJLIST_TYPE::save(std::string const& filename) const { - // We retag the property list here so that bundled properties are - // properly placed into property. - typedef typename boost::detail::retag_property_list< - vertex_bundle_t, vertex_property_type - >::type vertex_property_type; - typedef typename config_type::VertexListS vertex_list_selector; process_group_type pg = process_group(); diff --git a/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp b/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp index b6ca7d06e..04d249a5b 100644 --- a/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp +++ b/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp @@ -1389,7 +1389,7 @@ namespace graph { namespace parallel { namespace detail { }; template<> - struct brandes_betweenness_centrality_dispatch1 + struct brandes_betweenness_centrality_dispatch1 { template @@ -1397,7 +1397,7 @@ namespace graph { namespace parallel { namespace detail { run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, Buffer sources, typename graph_traits::edges_size_type delta, - boost::detail::error_property_not_found) + boost::param_not_found) { boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( g, centrality, edge_centrality_map, vertex_index, sources, delta); @@ -1417,7 +1417,8 @@ brandes_betweenness_centrality(const Graph& g, typedef queue::vertex_descriptor> queue_t; queue_t q; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew_param; + typedef typename detail::choose_impl_result::type ew; graph::parallel::detail::brandes_betweenness_centrality_dispatch1::run( g, choose_param(get_param(params, vertex_centrality), @@ -1427,7 +1428,7 @@ brandes_betweenness_centrality(const Graph& g, choose_const_pmap(get_param(params, vertex_index), g, vertex_index), choose_param(get_param(params, buffer_param_t()), boost::ref(q)), choose_param(get_param(params, lookahead_t()), 0), - get_param(params, edge_weight)); + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); } template @@ -1605,14 +1606,14 @@ namespace detail { namespace graph { }; template<> - struct non_distributed_brandes_betweenness_centrality_dispatch1 + struct non_distributed_brandes_betweenness_centrality_dispatch1 { template static void run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, - Buffer sources, detail::error_property_not_found) + Buffer sources, param_not_found) { non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, vertex_index, sources); @@ -1631,7 +1632,8 @@ non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Gra typedef queue queue_t; queue_t q; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew_param; + typedef typename detail::choose_impl_result::type ew; detail::graph::non_distributed_brandes_betweenness_centrality_dispatch1::run( pg, g, choose_param(get_param(params, vertex_centrality), @@ -1640,7 +1642,7 @@ non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Gra dummy_property_map()), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), choose_param(get_param(params, buffer_param_t()), boost::ref(q)), - get_param(params, edge_weight)); + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); } template diff --git a/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp b/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp index c987585f5..36e2df8bb 100644 --- a/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp @@ -118,7 +118,7 @@ namespace boost { typename graph_traits::vertex_descriptor s, ColorMap color, BFSVisitor vis, - error_property_not_found, + boost::param_not_found, VertexIndexMap vertex_index) { using boost::graph::parallel::process_group; diff --git a/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp b/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp index 01d32cfb8..33861c47b 100644 --- a/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp +++ b/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -365,30 +365,22 @@ class compressed_sparse_row_graph< // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) { - std::pair locator - = get(vertex_global, *this, v); - BOOST_ASSERT(locator.first == process_id(m_process_group)); - return base().m_vertex_properties[locator.second]; + return get(vertex_bundle, *this, v); } const vertex_bundled& operator[](vertex_descriptor v) const { - std::pair locator - = get(vertex_global, *this, v); - BOOST_ASSERT(locator.first == process_id(m_process_group)); - return base().m_process_group[locator.second]; + return get(vertex_bundle, *this, v); } edge_bundled& operator[](edge_descriptor e) { - BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); - return base().m_edge_properties[e.idx]; + return get(edge_bundle, *this, e); } const edge_bundled& operator[](edge_descriptor e) const { - BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); - return base().m_edge_properties[e.idx]; + return get(edge_bundle, *this, e); } // Create a vertex descriptor from a process ID and a local index. @@ -1757,19 +1749,22 @@ class csr_edge_global_map public: // ----------------------------------------------------------------- // Readable Property Map concept requirements - typedef std::pair value_type; - typedef value_type reference; typedef detail::csr_edge_descriptor key_type; + typedef std::pair > value_type; + typedef value_type reference; typedef readable_property_map_tag category; }; template -inline std::pair +inline std::pair > get(csr_edge_global_map pm, typename csr_edge_global_map::key_type k) { const int local_index_bits = sizeof(Vertex) * CHAR_BIT - processor_bits; - return std::pair(k.src >> local_index_bits, k.idx); + const Vertex local_index_mask = Vertex(-1) >> processor_bits; + return std::pair > + ((k.src >> local_index_bits), + detail::csr_edge_descriptor(k.src & local_index_mask, k.idx)); } template @@ -1796,7 +1791,7 @@ get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) template inline std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) { @@ -1818,7 +1813,7 @@ get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) template inline std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) { @@ -1827,12 +1822,16 @@ get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, const int local_index_bits = sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + const typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type local_index_mask = + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type(-1) >> processor_bits; typedef std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> result_type; - return result_type(k.src >> local_index_bits, k.idx); + return result_type(k.src >> local_index_bits, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor + (k.src & local_index_mask, k.idx)); } // ----------------------------------------------------------------- @@ -1847,7 +1846,8 @@ class property_map typedef local_property_map< typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type, global_map, - identity_property_map> type; + typename property_map::type + > type; typedef type const_type; }; @@ -1859,7 +1859,7 @@ get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) typedef typename property_map ::type result_type; return result_type(g.process_group(), get(edge_global, g), - identity_property_map()); + get(edge_index, g.base())); } template @@ -1878,7 +1878,7 @@ get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) typedef typename property_map ::const_type result_type; return result_type(g.process_group(), get(edge_global, g), - identity_property_map()); + get(edge_index, g.base())); } template @@ -1889,204 +1889,67 @@ get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, return k.idx; } -/* Common traits for getting vertex_bundle and edge_bundle maps */ +template +class property_map { + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE graph_type; + typedef typename graph_type::process_group_type process_group_type; + typedef typename graph_type::base_type base_graph_type; + typedef typename property_map::type + local_pmap; + typedef typename property_map::const_type + local_const_pmap; -namespace detail { - template struct get_bundles; + typedef graph_traits traits; + typedef typename graph_traits::vertex_descriptor local_vertex; + typedef typename property_traits::key_type local_key_type; - template - class get_bundles { - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; + typedef typename property_traits::value_type value_type; - // Extract the global property map for our key type. - typedef typename property_map::const_type vertex_global_map; - typedef typename property_traits::value_type vertex_locator; - typedef typename property_map::const_type edge_global_map; - typedef typename property_traits::value_type edge_locator; + typedef typename property_map::const_type + vertex_global_map; + typedef typename property_map::const_type + edge_global_map; - // Build the local property map - typedef bundle_property_map, - typename vertex_locator::second_type, - VertexProperty, - T> vertex_local_pmap; - - // Build the local const property map - typedef bundle_property_map, - typename vertex_locator::second_type, - VertexProperty, - const T> vertex_local_const_pmap; - - // Build the local property map - typedef bundle_property_map, - typename edge_locator::second_type, - EdgeProperty, - T> edge_local_pmap; - - // Build the local const property map - typedef bundle_property_map, - typename edge_locator::second_type, - EdgeProperty, - const T> edge_local_const_pmap; - - public: - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_pmap> vertex_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_const_pmap> vertex_map_const_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_pmap> edge_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_const_pmap> edge_map_const_type; - - }; - - template struct get_full_bundles; - - template - class get_full_bundles { // For vertex_bundle_t and edge_bundle_t - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; - - // Extract the global property map for our key type. - typedef typename property_map::const_type vertex_global_map; - typedef typename property_traits::value_type vertex_locator; - typedef typename property_map::const_type edge_global_map; - typedef typename property_traits::value_type edge_locator; - - // Build the local property maps - typedef typename property_map::type vertex_local_pmap; - typedef typename property_map::const_type vertex_local_const_pmap; - typedef typename property_map::type edge_local_pmap; - typedef typename property_map::const_type edge_local_const_pmap; - - public: - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_pmap> vertex_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_const_pmap> vertex_map_const_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_pmap> edge_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_const_pmap> edge_map_const_type; - - }; -} - -template -struct property_map -{ - typedef typename detail::get_full_bundles::vertex_map_type type; - typedef typename detail::get_full_bundles::vertex_map_const_type const_type; -}; - -template -struct property_map -{ - typedef typename detail::get_full_bundles::edge_map_type type; - typedef typename detail::get_full_bundles::edge_map_const_type const_type; -}; - -// ----------------------------------------------------------------- -// Bundled Properties -template -class property_map -{ - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; + typedef typename mpl::if_::type, + vertex_property_tag>, + vertex_global_map, edge_global_map>::type + global_map; public: - typedef typename mpl::if_, - typename detail::get_bundles::vertex_map_type, - typename detail::get_bundles::edge_map_type> - ::type type; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; - typedef typename mpl::if_, - typename detail::get_bundles::vertex_map_const_type, - typename detail::get_bundles::edge_map_const_type> - ::type const_type; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; }; -namespace detail { - // Retrieve the local bundle_property_map corresponding to a - // non-const vertex property. - template - inline bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, T> - get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::true_) - { - typedef bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, T> result_type; - return result_type(&g.base().vertex_properties().m_vertex_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // const vertex property. - template - inline bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, const T> - get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::true_) - { - typedef bundle_property_map< - const std::vector, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, const T> result_type; - return result_type(&g.base().vertex_properties().m_vertex_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // non-const edge property. - template - inline bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, T> - get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::false_) - { - typedef bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, T> result_type; - return result_type(&g.base().edge_properties().m_edge_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // const edge property. - template - inline bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, const T> - get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::false_) - { - typedef bundle_property_map< - const std::vector, - typename Graph::edges_size_type, - typename Graph::edge_bundled, const T> result_type; - return result_type(&g.base().edge_properties().m_edge_properties, p); - } -} - -template -typename property_map::type -get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +template +typename property_map::type +get(Tag tag, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) { typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename property_map::type result_type; - - // Resolver + typedef typename property_map::type result_type; typedef typename property_traits::value_type value_type; - typedef typename property_reduce::template apply + typedef typename property_reduce::template apply + reduce; + + typedef typename mpl::if_::type, + vertex_property_tag>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(tag, g.base()), reduce()); +} + +template +typename property_map::const_type +get(Tag tag, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map::const_type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply reduce; typedef typename property_traits::key_type descriptor; @@ -2096,35 +1959,7 @@ get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) global_map_t; return result_type(g.process_group(), get(global_map_t(), g), - detail::get_distrib_csr_bundle - (p, g, mpl::bool_::value>()), - reduce()); -} - -template -typename property_map::const_type -get(T Bundle::* p, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) -{ - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename property_map::const_type result_type; - - // Resolver - typedef typename property_traits::value_type value_type; - typedef typename property_reduce::template apply - reduce; - - typedef typename property_traits::key_type descriptor; - typedef typename graph_traits::vertex_descriptor vertex_descriptor; - typedef typename mpl::if_, - vertex_global_t, edge_global_t>::type - global_map_t; - - return result_type(g.process_group(), get(global_map_t(), g), - detail::get_distrib_csr_bundle - (p, g, mpl::bool_::value>()), - reduce()); + get(tag, g.base()), reduce()); } namespace mpi { diff --git a/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp b/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp index f72fa11a5..acfd19440 100644 --- a/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp +++ b/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp @@ -49,7 +49,7 @@ namespace boost { }; template<> - struct parallel_dijkstra_impl2< ::boost::detail::error_property_not_found > + struct parallel_dijkstra_impl2< ::boost::param_not_found > { template::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, - ::boost::detail::error_property_not_found, + ::boost::param_not_found, WeightMap weight, IndexMap index_map, ColorMap color_map, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis) @@ -95,7 +95,7 @@ namespace boost { }; template<> - struct parallel_dijkstra_impl< ::boost::detail::error_property_not_found > + struct parallel_dijkstra_impl< ::boost::param_not_found > { private: template::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, Lookahead lookahead, WeightMap weight, IndexMap index_map, - ::boost::detail::error_property_not_found, + ::boost::param_not_found, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis) { @@ -190,8 +190,7 @@ namespace boost { IndexMap> DefColorMap; DefColorMap color_map(color.begin(), index_map); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type color_map_type; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type color_map_type; graph::detail::parallel_dijkstra_impl ::run(g, s, predecessor, distance, diff --git a/project/jni/boost/include/boost/graph/distributed/page_rank.hpp b/project/jni/boost/include/boost/graph/distributed/page_rank.hpp index c2c230d38..1fc43ed68 100644 --- a/project/jni/boost/include/boost/graph/distributed/page_rank.hpp +++ b/project/jni/boost/include/boost/graph/distributed/page_rank.hpp @@ -93,6 +93,7 @@ page_rank_impl(const Graph& g, RankMap rank_map, Done done, ::const_type vertex_owner_map; typename property_map::const_type owner = get(vertex_owner, g); + (void)owner; typedef typename boost::graph::parallel::process_group_type ::type process_group_type; diff --git a/project/jni/boost/include/boost/graph/distributed/selector.hpp b/project/jni/boost/include/boost/graph/distributed/selector.hpp index 2e26c1690..937bdf8ab 100644 --- a/project/jni/boost/include/boost/graph/distributed/selector.hpp +++ b/project/jni/boost/include/boost/graph/distributed/selector.hpp @@ -13,6 +13,8 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include + namespace boost { /* The default local selector for a distributedS selector. */ @@ -31,6 +33,12 @@ namespace boost { typedef LocalS local_selector; typedef DistributionS distribution; }; + + namespace detail { + template + struct is_distributed_selector >: mpl::true_ {}; + } + } #endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP diff --git a/project/jni/boost/include/boost/graph/eccentricity.hpp b/project/jni/boost/include/boost/graph/eccentricity.hpp index a8b3e4854..63797a830 100644 --- a/project/jni/boost/include/boost/graph/eccentricity.hpp +++ b/project/jni/boost/include/boost/graph/eccentricity.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_ECCENTRICITY_HPP #define BOOST_GRAPH_ECCENTRICITY_HPP -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp b/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp index 43cc592d2..8f86fb202 100644 --- a/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp +++ b/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp @@ -52,21 +52,21 @@ namespace boost { // find minimum residual capacity along the augmenting path FlowValue delta = (std::numeric_limits::max)(); - e = p[sink]; + e = get(p, sink); do { BOOST_USING_STD_MIN(); - delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[e]); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, get(residual_capacity, e)); u = source(e, g); - e = p[u]; + e = get(p, u); } while (u != src); // push delta units of flow along the augmenting path - e = p[sink]; + e = get(p, sink); do { - residual_capacity[e] -= delta; - residual_capacity[reverse_edge[e]] += delta; + put(residual_capacity, e, get(residual_capacity, e) - delta); + put(residual_capacity, get(reverse_edge, e), get(residual_capacity, get(reverse_edge, e)) + delta); u = source(e, g); - e = p[u]; + e = get(p, u); } while (u != src); } @@ -94,22 +94,22 @@ namespace boost { typename graph_traits::out_edge_iterator ei, e_end; for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - res[*ei] = cap[*ei]; + put(res, *ei, get(cap, *ei)); - color[sink] = Color::gray(); - while (color[sink] != Color::white()) { + put(color, sink, Color::gray()); + while (get(color, sink) != Color::white()) { boost::queue Q; breadth_first_search (detail::residual_graph(g, res), src, Q, make_bfs_visitor(record_edge_predecessors(pred, on_tree_edge())), color); - if (color[sink] != Color::white()) + if (get(color, sink) != Color::white()) detail::augment(g, src, sink, pred, res, rev); } // while typename property_traits::value_type flow = 0; for (boost::tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) - flow += (cap[*ei] - res[*ei]); + flow += (get(cap, *ei) - get(res, *ei)); return flow; } // edmonds_karp_max_flow() @@ -140,7 +140,7 @@ namespace boost { } }; template<> - struct edmonds_karp_dispatch2 { + struct edmonds_karp_dispatch2 { template static typename edge_capacity_value::type apply @@ -149,7 +149,7 @@ namespace boost { typename graph_traits::vertex_descriptor sink, PredMap pred, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertices_size_type size_type; @@ -183,13 +183,13 @@ namespace boost { const bgl_named_params& params, PredMap pred) { - typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; return edmonds_karp_dispatch2::apply (g, src, sink, pred, params, get_param(params, vertex_color)); } }; template<> - struct edmonds_karp_dispatch1 { + struct edmonds_karp_dispatch1 { template static typename edge_capacity_value::type @@ -198,7 +198,7 @@ namespace boost { typename graph_traits::vertex_descriptor src, typename graph_traits::vertex_descriptor sink, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertices_size_type size_type; @@ -206,7 +206,7 @@ namespace boost { num_vertices(g) : 1; std::vector pred_vec(n); - typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; return edmonds_karp_dispatch2::apply (g, src, sink, make_iterator_property_map(pred_vec.begin(), choose_const_pmap @@ -227,7 +227,7 @@ namespace boost { typename graph_traits::vertex_descriptor sink, const bgl_named_params& params) { - typedef typename property_value< bgl_named_params, vertex_predecessor_t>::type Pred; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type Pred; return detail::edmonds_karp_dispatch1::apply (g, src, sink, params, get_param(params, vertex_predecessor)); } diff --git a/project/jni/boost/include/boost/graph/filtered_graph.hpp b/project/jni/boost/include/boost/graph/filtered_graph.hpp index 66cead609..74fea4611 100644 --- a/project/jni/boost/include/boost/graph/filtered_graph.hpp +++ b/project/jni/boost/include/boost/graph/filtered_graph.hpp @@ -195,7 +195,6 @@ namespace boost { typedef filtered_graph_tag graph_tag; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Bundled properties support template typename graph::detail::bundled_result::type& @@ -206,11 +205,10 @@ namespace boost { typename graph::detail::bundled_result::type const& operator[](Descriptor x) const { return this->m_g[x]; } -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES static vertex_descriptor null_vertex() { - return Graph::null_vertex(); + return Traits::null_vertex(); } //private: @@ -222,26 +220,21 @@ namespace boost { template - struct vertex_property_type > { - typedef typename vertex_property_type::type type; - }; + struct vertex_property_type >: + vertex_property_type {}; template - struct edge_property_type > { - typedef typename edge_property_type::type type; - }; + struct edge_property_type >: + edge_property_type {}; template - struct graph_property_type > { - typedef typename graph_property_type::type type; - }; + struct graph_property_type >: + graph_property_type {}; - -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template struct vertex_bundle_type > @@ -256,7 +249,6 @@ namespace boost { struct graph_bundle_type > : graph_bundle_type { }; -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES //=========================================================================== // Non-member functions for the Filtered Edge Graph diff --git a/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp b/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp index 4ce502e83..bab353f33 100644 --- a/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp +++ b/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp @@ -363,7 +363,7 @@ namespace detail { }; template<> - struct fr_force_directed_layout + struct fr_force_directed_layout { template& params) { typedef typename Topology::point_difference_type PointDiff; @@ -404,8 +404,7 @@ fruchterman_reingold_force_directed_layout const Topology& topology, const bgl_named_params& params) { - typedef typename property_value, - vertex_displacement_t>::type D; + typedef typename get_param_type >::type D; detail::fr_force_directed_layout::run (g, position, topology, diff --git a/project/jni/boost/include/boost/graph/graph_archetypes.hpp b/project/jni/boost/include/boost/graph/graph_archetypes.hpp index 9b364bb81..81f9c2c8a 100644 --- a/project/jni/boost/include/boost/graph/graph_archetypes.hpp +++ b/project/jni/boost/include/boost/graph/graph_archetypes.hpp @@ -53,6 +53,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template V source(const typename incidence_graph_archetype::edge_descriptor&, @@ -105,6 +107,8 @@ namespace boost { // should use a different namespace for this typedef void out_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template @@ -154,6 +158,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template diff --git a/project/jni/boost/include/boost/graph/graph_concepts.hpp b/project/jni/boost/include/boost/graph/graph_concepts.hpp index 8cb7cbb2f..f03afeea3 100644 --- a/project/jni/boost/include/boost/graph/graph_concepts.hpp +++ b/project/jni/boost/include/boost/graph/graph_concepts.hpp @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include #include @@ -55,12 +58,10 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_concept(Graph,(G)) { typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::directed_category directed_category; - typedef typename graph_traits::edge_parallel_category - edge_parallel_category; - - typedef typename graph_traits::traversal_category - traversal_category; + typedef typename graph_traits::edge_parallel_category edge_parallel_category; + typedef typename graph_traits::traversal_category traversal_category; BOOST_CONCEPT_USAGE(Graph) { @@ -75,11 +76,12 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); : Graph { typedef typename graph_traits::edge_descriptor edge_descriptor; - typedef typename graph_traits::out_edge_iterator - out_edge_iterator; + typedef typename graph_traits::out_edge_iterator out_edge_iterator; + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::traversal_category traversal_category; - typedef typename graph_traits::traversal_category - traversal_category; + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); BOOST_CONCEPT_USAGE(IncidenceGraph) { BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); @@ -123,6 +125,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = in_edges(v, g); n = in_degree(v, g); e = *p.first; @@ -153,6 +157,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = adjacent_vertices(v, g); v = *p.first; const_constraints(g); @@ -178,6 +184,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK // 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 @@ -227,6 +236,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = edges(g); e = *p.first; u = source(e, g); diff --git a/project/jni/boost/include/boost/graph/graph_test.hpp b/project/jni/boost/include/boost/graph/graph_test.hpp index 7b3a5402b..69d89f34f 100644 --- a/project/jni/boost/include/boost/graph/graph_test.hpp +++ b/project/jni/boost/include/boost/graph/graph_test.hpp @@ -325,10 +325,10 @@ namespace boost { template void test_readable_vertex_property_graph - (const std::vector& vertex_prop, PropertyTag, const Graph& g) + (const std::vector& vertex_prop, PropertyTag tag, const Graph& g) { typedef typename property_map::const_type const_Map; - const_Map pmap = get(PropertyTag(), g); + const_Map pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator @@ -339,7 +339,7 @@ namespace boost { ++bgl_first_9) { //BGL_FORALL_VERTICES_T(v, g, Graph) { typename property_traits::value_type - pval1 = get(pmap, v), pval2 = get(PropertyTag(), g, v); + pval1 = get(pmap, v), pval2 = get(tag, g, v); BOOST_CHECK(pval1 == pval2); BOOST_CHECK(pval1 == *i++); } @@ -350,7 +350,7 @@ namespace boost { (const std::vector& vertex_prop, PropertyTag tag, Graph& g) { typedef typename property_map::type PMap; - PMap pmap = get(PropertyTag(), g); + PMap pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; @@ -368,7 +368,7 @@ namespace boost { typename std::vector::const_iterator j = vertex_prop.begin(); BGL_FORALL_VERTICES_T(v, g, Graph) - put(PropertyTag(), g, v, *j++); + put(tag, g, v, *j++); test_readable_vertex_property_graph(vertex_prop, tag, g); } diff --git a/project/jni/boost/include/boost/graph/graph_traits.hpp b/project/jni/boost/include/boost/graph/graph_traits.hpp index fad82f9d2..ceb0c2ac5 100644 --- a/project/jni/boost/include/boost/graph/graph_traits.hpp +++ b/project/jni/boost/include/boost/graph/graph_traits.hpp @@ -15,8 +15,12 @@ #include /* Primarily for std::pair */ #include #include +#include #include #include +#include +#include +#include #include #include #include @@ -25,23 +29,47 @@ namespace boost { + namespace detail { +#define BOOST_GRAPH_MEMBER_OR_VOID(name) \ + BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \ + template struct BOOST_JOIN(get_member_, name) {typedef typename T::name type;}; \ + template struct BOOST_JOIN(get_opt_member_, name): \ + boost::mpl::eval_if_c< \ + BOOST_JOIN(has_, name)::value, \ + BOOST_JOIN(get_member_, name), \ + boost::mpl::identity > \ + {}; + 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 struct graph_traits { +#define BOOST_GRAPH_PULL_OPT_MEMBER(name) \ + typedef typename detail::BOOST_JOIN(get_opt_member_, name)::type name; + typedef typename G::vertex_descriptor vertex_descriptor; typedef typename G::edge_descriptor edge_descriptor; - typedef typename G::adjacency_iterator adjacency_iterator; - typedef typename G::out_edge_iterator out_edge_iterator; - typedef typename G::in_edge_iterator in_edge_iterator; - typedef typename G::vertex_iterator vertex_iterator; - typedef typename G::edge_iterator edge_iterator; + BOOST_GRAPH_PULL_OPT_MEMBER(adjacency_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(out_edge_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(in_edge_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(vertex_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(edge_iterator) typedef typename G::directed_category directed_category; typedef typename G::edge_parallel_category edge_parallel_category; typedef typename G::traversal_category traversal_category; - typedef typename G::vertices_size_type vertices_size_type; - typedef typename G::edges_size_type edges_size_type; - typedef typename G::degree_size_type degree_size_type; + BOOST_GRAPH_PULL_OPT_MEMBER(vertices_size_type) + BOOST_GRAPH_PULL_OPT_MEMBER(edges_size_type) + BOOST_GRAPH_PULL_OPT_MEMBER(degree_size_type) +#undef BOOST_GRAPH_PULL_OPT_MEMBER static inline vertex_descriptor null_vertex(); }; @@ -218,28 +246,31 @@ namespace boost { //?? not the right place ?? Lee typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; - // Forward declare graph_bundle_t property name (from - // boost/graph/properties.hpp, which includes this file) for - // bundled_result. - enum graph_bundle_t {graph_bundle}; + namespace detail { + BOOST_MPL_HAS_XXX_TRAIT_DEF(graph_property_type) + BOOST_MPL_HAS_XXX_TRAIT_DEF(edge_property_type) + BOOST_MPL_HAS_XXX_TRAIT_DEF(vertex_property_type) + + template struct get_graph_property_type {typedef typename G::graph_property_type type;}; + template struct get_edge_property_type {typedef typename G::edge_property_type type;}; + template struct get_vertex_property_type {typedef typename G::vertex_property_type type;}; + } template - struct graph_property_type { - typedef typename G::graph_property_type type; - }; + struct graph_property_type + : boost::mpl::eval_if, + detail::get_graph_property_type, + no_property> {}; template - struct edge_property_type { - typedef typename G::edge_property_type type; - }; + struct edge_property_type + : boost::mpl::eval_if, + detail::get_edge_property_type, + no_property> {}; template - struct vertex_property_type { - typedef typename G::vertex_property_type type; - }; - - struct no_bundle { }; - struct no_graph_bundle : no_bundle { }; - struct no_vertex_bundle : no_bundle { }; - struct no_edge_bundle : no_bundle { }; + struct vertex_property_type + : boost::mpl::eval_if, + detail::get_vertex_property_type, + no_property> {}; template struct graph_bundle_type { @@ -281,7 +312,7 @@ namespace boost { // A helper metafunction for determining whether or not a type is // bundled. template - struct is_no_bundle : mpl::bool_::value> + struct is_no_bundle : mpl::bool_::value> { }; } // namespace graph_detail diff --git a/project/jni/boost/include/boost/graph/graphml.hpp b/project/jni/boost/include/boost/graph/graphml.hpp index 2239d9666..be73def30 100644 --- a/project/jni/boost/include/boost/graph/graphml.hpp +++ b/project/jni/boost/include/boost/graph/graphml.hpp @@ -204,14 +204,14 @@ template const char* mutate_graph_impl::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; void BOOST_GRAPH_DECL -read_graphml(std::istream& in, mutate_graph& g); +read_graphml(std::istream& in, mutate_graph& g, size_t desired_idx); template void -read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp) +read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp, size_t desired_idx = 0) { mutate_graph_impl mg(g,dp); - read_graphml(in, mg); + read_graphml(in, mg, desired_idx); } template @@ -262,7 +262,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { std::string key_id = "key" + lexical_cast(key_count++); - if (i->second->key() == typeid(Graph)) + if (i->second->key() == typeid(Graph*)) graph_key_ids[i->first] = key_id; else if (i->second->key() == typeid(vertex_descriptor)) vertex_key_ids[i->first] = key_id; @@ -273,7 +273,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, std::string type_name = "string"; mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); out << " second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" + << (i->second->key() == typeid(Graph*) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" << " attr.name=\"" << i->first << "\"" << " attr.type=\"" << type_name << "\"" << " />\n"; @@ -287,10 +287,12 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, // Output graph data for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { - if (i->second->key() == typeid(Graph)) + if (i->second->key() == typeid(Graph*)) { + // The const_cast here is just to get typeid correct for property + // map key; the graph should not be mutated using it. out << " first] << "\">" - << encode_char_entities(i->second->get_string(g)) << "\n"; + << encode_char_entities(i->second->get_string(const_cast(&g))) << "\n"; } } diff --git a/project/jni/boost/include/boost/graph/graphviz.hpp b/project/jni/boost/include/boost/graph/graphviz.hpp index 718220ffe..aedce5553 100644 --- a/project/jni/boost/include/boost/graph/graphviz.hpp +++ b/project/jni/boost/include/boost/graph/graphviz.hpp @@ -25,10 +25,14 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include namespace boost { @@ -713,6 +717,9 @@ class mutate_graph virtual void // RG: need new second parameter to support BGL subgraphs set_graph_property(const id_t& key, const id_t& value) = 0; + + virtual void + finish_building_graph() = 0; }; template @@ -781,6 +788,8 @@ class mutate_graph_impl : public mutate_graph put(key, dp_, &graph_, value); } + void finish_building_graph() {} + protected: MutableGraph& graph_; @@ -790,6 +799,109 @@ class mutate_graph_impl : public mutate_graph std::map bgl_edges; }; +template +class mutate_graph_impl > + : public mutate_graph +{ + typedef compressed_sparse_row_graph CSRGraph; + typedef typename graph_traits::vertices_size_type bgl_vertex_t; + typedef typename graph_traits::edges_size_type bgl_edge_t; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + public: + mutate_graph_impl(CSRGraph& graph, dynamic_properties& dp, + std::string node_id_prop) + : graph_(graph), dp_(dp), vertex_count(0), node_id_prop_(node_id_prop) { } + + ~mutate_graph_impl() {} + + void finish_building_graph() { + typedef compressed_sparse_row_graph TempCSRGraph; + TempCSRGraph temp(edges_are_unsorted_multi_pass, + edges_to_add.begin(), edges_to_add.end(), + counting_iterator(0), + vertex_count); + set_property(temp, graph_all, get_property(graph_, graph_all)); + graph_.assign(temp); // Copies structure, not properties + std::vector edge_permutation_from_sorting(num_edges(temp)); + BGL_FORALL_EDGES_T(e, temp, TempCSRGraph) { + edge_permutation_from_sorting[temp[e]] = e; + } + typedef boost::tuple v_prop; + BOOST_FOREACH(const v_prop& t, vertex_props) { + put(boost::get<0>(t), dp_, boost::get<1>(t), boost::get<2>(t)); + } + typedef boost::tuple e_prop; + BOOST_FOREACH(const e_prop& t, edge_props) { + put(boost::get<0>(t), dp_, edge_permutation_from_sorting[boost::get<1>(t)], boost::get<2>(t)); + } + } + + bool is_directed() const + { + return + boost::is_convertible< + typename boost::graph_traits::directed_category, + boost::directed_tag>::value; + } + + virtual void do_add_vertex(const node_t& node) + { + // Add the node to the graph. + bgl_vertex_t v = vertex_count++; + + // Set up a mapping from name to BGL vertex. + bgl_nodes.insert(std::make_pair(node, v)); + + // node_id_prop_ allows the caller to see the real id names for nodes. + vertex_props.push_back(boost::make_tuple(node_id_prop_, v, node)); + } + + void + do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) + { + bgl_edge_t result = edges_to_add.size(); + edges_to_add.push_back(std::make_pair(bgl_nodes[source], bgl_nodes[target])); + bgl_edges.insert(std::make_pair(edge, result)); + } + + void + set_node_property(const id_t& key, const node_t& node, const id_t& value) + { + vertex_props.push_back(boost::make_tuple(key, bgl_nodes[node], value)); + } + + void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) + { + edge_props.push_back(boost::make_tuple(key, bgl_edges[edge], value)); + } + + void + set_graph_property(const id_t& key, const id_t& value) + { + /* RG: pointer to graph prevents copying */ + put(key, dp_, &graph_, value); + } + + + protected: + CSRGraph& graph_; + dynamic_properties& dp_; + bgl_vertex_t vertex_count; + std::string node_id_prop_; + std::vector > vertex_props; + std::vector > edge_props; + std::vector > edges_to_add; + std::map bgl_nodes; + std::map bgl_edges; +}; + } } } // end namespace boost::detail::graph #ifdef BOOST_GRAPH_USE_SPIRIT_PARSER diff --git a/project/jni/boost/include/boost/graph/grid_graph.hpp b/project/jni/boost/include/boost/graph/grid_graph.hpp index f63f3d01e..9a09fca34 100644 --- a/project/jni/boost/include/boost/graph/grid_graph.hpp +++ b/project/jni/boost/include/boost/graph/grid_graph.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -31,11 +30,6 @@ #define BOOST_GRID_GRAPH_TYPE \ grid_graph -#define BOOST_GRID_GRAPH_TYPE_MEM typename BOOST_GRID_GRAPH_TYPE:: - -#define BOOST_GRID_GRAPH_TYPE_TD(mem) \ - typedef typename BOOST_GRID_GRAPH_TYPE::mem mem - #define BOOST_GRID_GRAPH_TRAITS_T \ typename graph_traits @@ -63,14 +57,21 @@ namespace boost { grid_graph_index_map() { } grid_graph_index_map(const Graph& graph) : - m_graph(make_shared(graph)) { } + m_graph(&graph) { } value_type operator[](key_type key) const { return (m_graph->index_of(key)); } + friend inline Index + get(const grid_graph_index_map& index_map, + const typename grid_graph_index_map::key_type& key) + { + return (index_map[key]); + } + protected: - shared_ptr m_graph; + const Graph* m_graph; }; template @@ -107,6 +108,13 @@ namespace boost { value_type operator[](const key_type& key) const { return (value_type(key.second, key.first)); } + + friend inline Descriptor + get(const grid_graph_reverse_edge_map& rev_map, + const typename grid_graph_reverse_edge_map::key_type& key) + { + return (rev_map[key]); + } }; template @@ -443,7 +451,7 @@ namespace boost { vertex_descriptor vertex_at (vertices_size_type vertex_index) const { - array vertex; + boost::array vertex; vertices_size_type index_divider = 1; for (std::size_t dimension_index = 0; @@ -533,6 +541,8 @@ namespace boost { vertex_descriptor source_vertex = source(edge, *this); vertex_descriptor target_vertex = target(edge, *this); + BOOST_ASSERT (source_vertex != target_vertex); + // Determine the dimension where the source and target vertices // differ (should only be one if this is a valid edge). std::size_t different_dimension_index = 0; @@ -733,13 +743,12 @@ namespace boost { // VertexListGraph //================ - template - friend inline std::pair - vertices(const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(vertex_iterator); - BOOST_GRID_GRAPH_TYPE_TD(vertex_function); - BOOST_GRID_GRAPH_TYPE_TD(vertex_index_iterator); + friend inline std::pair + vertices(const type& graph) { + typedef typename type::vertex_iterator vertex_iterator; + typedef typename type::vertex_function vertex_function; + typedef typename type::vertex_index_iterator vertex_index_iterator; return (std::make_pair (vertex_iterator(vertex_index_iterator(0), @@ -748,16 +757,14 @@ namespace boost { vertex_function(&graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type - num_vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::vertices_size_type + num_vertices(const type& graph) { return (graph.num_vertices()); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor - vertex(BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type vertex_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::vertex_descriptor + vertex(typename type::vertices_size_type vertex_index, + const type& graph) { return (graph.vertex_at(vertex_index)); } @@ -766,14 +773,13 @@ namespace boost { // IncidenceGraph //=============== - template - friend inline std::pair - out_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(out_edge_function); - BOOST_GRID_GRAPH_TYPE_TD(out_edge_iterator); + friend inline std::pair + out_edges(typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::degree_iterator degree_iterator; + typedef typename type::out_edge_function out_edge_function; + typedef typename type::out_edge_iterator out_edge_iterator; return (std::make_pair (out_edge_iterator(degree_iterator(0), @@ -782,19 +788,17 @@ namespace boost { out_edge_function(vertex, &graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + friend inline typename type::degree_size_type out_degree - (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.out_degree(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - out_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - BOOST_GRID_GRAPH_TYPE_MEM degree_size_type out_edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + out_edge_at(typename type::vertex_descriptor vertex, + typename type::degree_size_type out_edge_index, + const type& graph) { return (graph.out_edge_at(vertex, out_edge_index)); } @@ -802,14 +806,13 @@ namespace boost { // AdjacencyGraph //=============== - template - friend typename std::pair - adjacent_vertices (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(adjacent_vertex_function); - BOOST_GRID_GRAPH_TYPE_TD(adjacency_iterator); + friend typename std::pair + adjacent_vertices (typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::degree_iterator degree_iterator; + typedef typename type::adjacent_vertex_function adjacent_vertex_function; + typedef typename type::adjacency_iterator adjacency_iterator; return (std::make_pair (adjacency_iterator(degree_iterator(0), @@ -822,26 +825,23 @@ namespace boost { // EdgeListGraph //============== - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type - num_edges(const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edges_size_type + num_edges(const type& graph) { return (graph.num_edges()); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - edge_at(BOOST_GRID_GRAPH_TYPE_MEM edges_size_type edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + edge_at(typename type::edges_size_type edge_index, + const type& graph) { return (graph.edge_at(edge_index)); } - template - friend inline std::pair - edges(const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(edge_index_iterator); - BOOST_GRID_GRAPH_TYPE_TD(edge_function); - BOOST_GRID_GRAPH_TYPE_TD(edge_iterator); + friend inline std::pair + edges(const type& graph) { + typedef typename type::edge_index_iterator edge_index_iterator; + typedef typename type::edge_function edge_function; + typedef typename type::edge_iterator edge_iterator; return (std::make_pair (edge_iterator(edge_index_iterator(0), @@ -854,14 +854,13 @@ namespace boost { // BiDirectionalGraph //=================== - template - friend inline std::pair - in_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(in_edge_function); - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(in_edge_iterator); + friend inline std::pair + in_edges(typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::in_edge_function in_edge_function; + typedef typename type::degree_iterator degree_iterator; + typedef typename type::in_edge_iterator in_edge_iterator; return (std::make_pair (in_edge_iterator(degree_iterator(0), @@ -870,25 +869,22 @@ namespace boost { in_edge_function(vertex, &graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type - in_degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::degree_size_type + in_degree (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.in_degree(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type - degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::degree_size_type + degree (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.out_degree(vertex) * 2); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - in_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - BOOST_GRID_GRAPH_TYPE_MEM degree_size_type in_edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + in_edge_at(typename type::vertex_descriptor vertex, + typename type::degree_size_type in_edge_index, + const type& graph) { return (graph.in_edge_at(vertex, in_edge_index)); } @@ -897,21 +893,20 @@ namespace boost { // Adjacency Matrix //================== - template - friend std::pair - edge (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor source_vertex, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor destination_vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend std::pair + edge (typename type::vertex_descriptor source_vertex, + typename type::vertex_descriptor destination_vertex, + const type& graph) { - std::pair edge_exists = + std::pair edge_exists = std::make_pair(std::make_pair(source_vertex, destination_vertex), false); for (std::size_t dimension_index = 0; dimension_index < Dimensions; ++dimension_index) { - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type dim_difference = 0; - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + typename type::vertices_size_type dim_difference = 0; + typename type::vertices_size_type source_dim = source_vertex[dimension_index], dest_dim = destination_vertex[dimension_index]; @@ -958,77 +953,54 @@ namespace boost { // Index Property Map Functions //============================= - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + friend inline typename type::vertices_size_type get(vertex_index_t, - const BOOST_GRID_GRAPH_TYPE& graph, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex) { + const type& graph, + typename type::vertex_descriptor vertex) { return (graph.index_of(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + friend inline typename type::edges_size_type get(edge_index_t, - const BOOST_GRID_GRAPH_TYPE& graph, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor edge) { + const type& graph, + typename type::edge_descriptor edge) { return (graph.index_of(edge)); } - template friend inline grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type> - get(vertex_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + type, + typename type::vertex_descriptor, + typename type::vertices_size_type> + get(vertex_index_t, const type& graph) { return (grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>(graph)); + type, + typename type::vertex_descriptor, + typename type::vertices_size_type>(graph)); } - template friend inline grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM edges_size_type> - get(edge_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + type, + typename type::edge_descriptor, + typename type::edges_size_type> + get(edge_index_t, const type& graph) { return (grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>(graph)); + type, + typename type::edge_descriptor, + typename type::edges_size_type>(graph)); } - template friend inline grid_graph_reverse_edge_map< - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor> - get(edge_reverse_t, const BOOST_GRID_GRAPH_TYPE& graph) { + typename type::edge_descriptor> + get(edge_reverse_t, const type& graph) { return (grid_graph_reverse_edge_map< - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor>()); + typename type::edge_descriptor>()); } - template - friend inline Index - get(const grid_graph_index_map& index_map, - const typename grid_graph_index_map::key_type& key) - { - return (index_map[key]); - } - template friend struct grid_graph_index_map; - template - friend inline Descriptor - get(const grid_graph_reverse_edge_map& rev_map, - const typename grid_graph_reverse_edge_map::key_type& key) - { - return (rev_map[key]); - } - template friend struct grid_graph_reverse_edge_map; @@ -1037,8 +1009,6 @@ namespace boost { } // namespace boost #undef BOOST_GRID_GRAPH_TYPE -#undef BOOST_GRID_GRAPH_TYPE_TD -#undef BOOST_GRID_GRAPH_TYPE_MEM #undef BOOST_GRID_GRAPH_TEMPLATE_PARAMS #undef BOOST_GRID_GRAPH_TRAITS_T diff --git a/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp b/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp index 8791b4cf1..d0a2aede9 100644 --- a/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp +++ b/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp @@ -9,7 +9,6 @@ #define __IS_KURATOWSKI_SUBGRAPH_HPP__ #include -#include //for next/prior #include //for tie #include #include @@ -176,7 +175,7 @@ namespace boost while (neighbors[v].size() > 0 && neighbors[v].size() < max_size) { - // Find one of v's neighbors u such that that v and u + // Find one of v's neighbors u such that v and u // have no neighbors in common. We'll look for such a // neighbor with a naive cubic-time algorithm since the // max size of any of the neighbor sets we'll consider @@ -301,11 +300,11 @@ namespace boost if (target_graph == detail::tg_k_5) { - return isomorphism(K_5,contracted_graph); + return boost::isomorphism(K_5,contracted_graph); } else //target_graph == tg_k_3_3 { - return isomorphism(K_3_3,contracted_graph); + return boost::isomorphism(K_3_3,contracted_graph); } diff --git a/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp b/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp index 74775b44f..c471cde8b 100644 --- a/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp +++ b/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp @@ -9,7 +9,7 @@ #define __IS_STRAIGHT_LINE_DRAWING_HPP__ #include -#include //for next and prior +#include #include #include #include @@ -19,6 +19,7 @@ #include #include #include +#include @@ -34,12 +35,12 @@ namespace boost // defines how far away from the endpoints of s1 and s2 we want to consider // an intersection. - bool intersects(double x1, double y1, - double x2, double y2, - double a1, double b1, - double a2, double b2, - double epsilon = 0.000001 - ) + inline bool intersects(double x1, double y1, + double x2, double y2, + double a1, double b1, + double a2, double b2, + double epsilon = 0.000001 + ) { if (x1 - x2 == 0) diff --git a/project/jni/boost/include/boost/graph/isomorphism.hpp b/project/jni/boost/include/boost/graph/isomorphism.hpp index bbdd1f7b4..99055f35c 100644 --- a/project/jni/boost/include/boost/graph/isomorphism.hpp +++ b/project/jni/boost/include/boost/graph/isomorphism.hpp @@ -11,8 +11,9 @@ #include #include #include +#include +#include #include -#include #include #include // for make_indirect_pmap #include @@ -134,6 +135,10 @@ namespace boost { bool test_isomorphism() { + // reset isomapping + BGL_FORALL_VERTICES_T(v, G1, Graph1) + f[v] = graph_traits::null_vertex(); + { std::vector invar1_array; BGL_FORALL_VERTICES_T(v, G1, Graph1) @@ -195,69 +200,130 @@ namespace boost { } private: + struct match_continuation { + enum {pos_G2_vertex_loop, pos_fi_adj_loop, pos_dfs_num} position; + typedef typename graph_traits::vertex_iterator vertex_iterator; + std::pair G2_verts; + typedef typename graph_traits::adjacency_iterator adjacency_iterator; + std::pair fi_adj; + edge_iter iter; + int dfs_num_k; + }; + bool match(edge_iter iter, int dfs_num_k) { + std::vector k; + typedef typename graph_traits::vertex_iterator vertex_iterator; + std::pair G2_verts(vertices(G2)); + typedef typename graph_traits::adjacency_iterator adjacency_iterator; + std::pair fi_adj; + vertex1_t i, j; + + recur: if (iter != ordered_edges.end()) { - vertex1_t i = source(*iter, G1), j = target(*iter, G2); + i = source(*iter, G1); + j = target(*iter, G2); if (dfs_num[i] > dfs_num_k) { - vertex1_t kp1 = dfs_vertices[dfs_num_k + 1]; - BGL_FORALL_VERTICES_T(u, G2, Graph2) { - if (invariant1(kp1) == invariant2(u) && in_S[u] == false) { - f[kp1] = u; - in_S[u] = true; - num_edges_on_k = 0; - - if (match(iter, dfs_num_k + 1)) -#if 0 - // dwa 2003/7/11 -- this *HAS* to be a bug! - ; -#endif - return true; + G2_verts = vertices(G2); + while (G2_verts.first != G2_verts.second) { + { + vertex2_t u = *G2_verts.first; + vertex1_t kp1 = dfs_vertices[dfs_num_k + 1]; + if (invariant1(kp1) == invariant2(u) && in_S[u] == false) { + { + f[kp1] = u; + in_S[u] = true; + num_edges_on_k = 0; - in_S[u] = false; + match_continuation new_k; + new_k.position = match_continuation::pos_G2_vertex_loop; + new_k.G2_verts = G2_verts; + new_k.iter = iter; + new_k.dfs_num_k = dfs_num_k; + k.push_back(new_k); + ++dfs_num_k; + goto recur; + } + } } +G2_loop_k: ++G2_verts.first; } } else if (dfs_num[j] > dfs_num_k) { - vertex1_t k = dfs_vertices[dfs_num_k]; - num_edges_on_k -= - count_if(adjacent_vertices(f[k], G2), make_indirect_pmap(in_S)); - - for (int jj = 0; jj < dfs_num_k; ++jj) { - vertex1_t j = dfs_vertices[jj]; - num_edges_on_k -= count(adjacent_vertices(f[j], G2), f[k]); + { + vertex1_t vk = dfs_vertices[dfs_num_k]; + num_edges_on_k -= + count_if(adjacent_vertices(f[vk], G2), make_indirect_pmap(in_S)); + + for (int jj = 0; jj < dfs_num_k; ++jj) { + vertex1_t j = dfs_vertices[jj]; + num_edges_on_k -= count(adjacent_vertices(f[j], G2), f[vk]); + } } if (num_edges_on_k != 0) - return false; - BGL_FORALL_ADJ_T(f[i], v, G2, Graph2) - if (invariant2(v) == invariant1(j) && in_S[v] == false) { - f[j] = v; - in_S[v] = true; - num_edges_on_k = 1; - BOOST_USING_STD_MAX(); - int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); - if (match(boost::next(iter), next_k)) - return true; - in_S[v] = false; + goto return_point_false; + fi_adj = adjacent_vertices(f[i], G2); + while (fi_adj.first != fi_adj.second) { + { + vertex2_t v = *fi_adj.first; + if (invariant2(v) == invariant1(j) && in_S[v] == false) { + f[j] = v; + in_S[v] = true; + num_edges_on_k = 1; + BOOST_USING_STD_MAX(); + int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); + match_continuation new_k; + new_k.position = match_continuation::pos_fi_adj_loop; + new_k.fi_adj = fi_adj; + new_k.iter = iter; + new_k.dfs_num_k = dfs_num_k; + ++iter; + dfs_num_k = next_k; + k.push_back(new_k); + goto recur; + } } - - +fi_adj_loop_k:++fi_adj.first; + } } else { if (container_contains(adjacent_vertices(f[i], G2), f[j])) { ++num_edges_on_k; - if (match(boost::next(iter), dfs_num_k)) - return true; + match_continuation new_k; + new_k.position = match_continuation::pos_dfs_num; + k.push_back(new_k); + ++iter; + goto recur; } } } else - return true; - return false; - } + goto return_point_true; + goto return_point_false; + { + return_point_true: return true; + + return_point_false: + if (k.empty()) return false; + const match_continuation& this_k = k.back(); + switch (this_k.position) { + case match_continuation::pos_G2_vertex_loop: {G2_verts = this_k.G2_verts; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*G2_verts.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto G2_loop_k;} + case match_continuation::pos_fi_adj_loop: {fi_adj = this_k.fi_adj; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*fi_adj.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto fi_adj_loop_k;} + case match_continuation::pos_dfs_num: {k.pop_back(); goto return_point_false;} + default: { + BOOST_ASSERT(!"Bad position"); +#ifdef UNDER_CE + exit(-1); +#else + abort(); +#endif + } + } + } + } }; @@ -404,39 +470,68 @@ namespace boost { index_map1, index_map2 ); } + + template + struct make_degree_invariant { + const G& g; + const Index& index; + make_degree_invariant(const G& g, const Index& index): g(g), index(index) {} + typedef typename boost::graph_traits::degree_size_type degree_size_type; + typedef shared_array_property_map prop_map_type; + typedef degree_vertex_invariant result_type; + result_type operator()() const { + prop_map_type pm = make_shared_array_property_map(num_vertices(g), degree_size_type(), index); + compute_in_degree(g, pm); + return result_type(pm, g); + } + }; } // namespace detail + namespace graph { + namespace detail { + template + struct isomorphism_impl { + typedef bool result_type; + template + bool operator()(const Graph1& g1, const Graph2& g2, const ArgPack& arg_pack) const { + using namespace boost::graph::keywords; + typedef typename boost::detail::override_const_property_result::type index1_map_type; + typedef typename boost::detail::override_const_property_result::type index2_map_type; + index1_map_type index1_map = boost::detail::override_const_property(arg_pack, _vertex_index1_map, g1, boost::vertex_index); + index2_map_type index2_map = boost::detail::override_const_property(arg_pack, _vertex_index2_map, g2, boost::vertex_index); + typedef typename graph_traits::vertex_descriptor vertex2_t; + typename std::vector::size_type n = (typename std::vector::size_type)num_vertices(g1); + std::vector f(n); + typename boost::parameter::lazy_binding< + ArgPack, + tag::vertex_invariant1, + boost::detail::make_degree_invariant >::type + invariant1 = + arg_pack[_vertex_invariant1 || boost::detail::make_degree_invariant(g1, index1_map)]; + typename boost::parameter::lazy_binding< + ArgPack, + tag::vertex_invariant2, + boost::detail::make_degree_invariant >::type + invariant2 = + arg_pack[_vertex_invariant2 || boost::detail::make_degree_invariant(g2, index2_map)]; + return boost::isomorphism + (g1, g2, + choose_param(arg_pack[_isomorphism_map | boost::param_not_found()], + make_shared_array_property_map(num_vertices(g1), vertex2_t(), index1_map)), + invariant1, + invariant2, + arg_pack[_vertex_max_invariant | (invariant2.max)()], + index1_map, + index2_map); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(isomorphism, 2, 6) + } // Named parameter interface - template - bool isomorphism(const Graph1& g1, - const Graph2& g2, - const bgl_named_params& params) - { - typedef typename graph_traits::vertex_descriptor vertex2_t; - typename std::vector::size_type n = num_vertices(g1); - std::vector f(n); - return detail::isomorphism_impl - (g1, g2, - choose_param(get_param(params, vertex_isomorphism_t()), - make_safe_iterator_property_map(f.begin(), f.size(), - choose_const_pmap(get_param(params, vertex_index1), - g1, vertex_index), vertex2_t())), - choose_const_pmap(get_param(params, vertex_index1), g1, vertex_index), - choose_const_pmap(get_param(params, vertex_index2), g2, vertex_index), - params - ); - } - - // All defaults interface - template - bool isomorphism(const Graph1& g1, const Graph2& g2) - { - return isomorphism(g1, g2, - bgl_named_params(0));// bogus named param - } - + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(isomorphism, 2) // Verify that the given mapping iso_map from the vertices of g1 to the // vertices of g2 describes an isomorphism. diff --git a/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp b/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp index 32e2b5cdc..b8da0fe19 100644 --- a/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp +++ b/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp @@ -121,8 +121,6 @@ namespace boost { (g2, *u, pred, d, w_hat, id2, compare, combine, inf, zero,dvis); for (boost::tie(v, v_end) = vertices(g2); v != v_end; ++v) { if (*u != s && *v != s) { - typename Traits1::vertex_descriptor u1, v1; - u1 = verts1[get(id2, *u)]; v1 = verts1[get(id2, *v)]; D[get(id2, *u)-1][get(id2, *v)-1] = combine(get(d, *v), (get(h, *v) - get(h, *u))); } } diff --git a/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp b/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp index f8a210cab..63355c946 100644 --- a/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp +++ b/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp @@ -475,12 +475,12 @@ namespace boost { * from every vertex to every other vertex, which is computed in the * first stages of the algorithm. This value's type must be a model * of BasicMatrix with value type equal to the value type of the - * weight map. The default is a a vector of vectors. + * weight map. The default is a vector of vectors. * * \param spring_strength (UTIL/OUT) will be used to store the * strength of the spring between every pair of vertices. This * value's type must be a model of BasicMatrix with value type equal - * to the value type of the weight map. The default is a a vector of + * to the value type of the weight map. The default is a vector of * vectors. * * \param partial_derivatives (UTIL) will be used to store the diff --git a/project/jni/boost/include/boost/graph/labeled_graph.hpp b/project/jni/boost/include/boost/graph/labeled_graph.hpp index e1a2f7c2d..5b688b02e 100644 --- a/project/jni/boost/include/boost/graph/labeled_graph.hpp +++ b/project/jni/boost/include/boost/graph/labeled_graph.hpp @@ -21,7 +21,7 @@ #include // This file implements a utility for creating mappings from arbitrary -// identifers to the vertices of a graph. +// identifiers to the vertices of a graph. namespace boost { @@ -104,7 +104,7 @@ namespace graph_detail { // Tag dispatch on random access containers (i.e., vectors). This function // basically requires a) that Container is vector

::template result::type& - choose_param(const P& param, const Default& d) { - return detail::choose_param_helper

::apply(param, d); + const P& choose_param(const P& param, const Default&) { + return param; + } + + template + Default choose_param(const param_not_found&, const Default& d) { + return d; } template inline bool is_default_param(const T&) { return false; } - inline bool is_default_param(const detail::error_property_not_found&) + inline bool is_default_param(const param_not_found&) { return true; } namespace detail { + template + struct const_type_as_type {typedef typename T::const_type type;}; + } // namespace detail + - struct choose_parameter { - template - struct bind_ { - typedef const P& const_result_type; - typedef const P& result_type; - typedef P type; - }; + // Use this function instead of choose_param() when you want + // to avoid requiring get(tag, g) when it is not used. + namespace detail { + template + struct choose_impl_result: + boost::mpl::eval_if< + boost::is_same, + boost::mpl::eval_if< + GraphIsConst, + detail::const_type_as_type >, + property_map >, + boost::mpl::identity > {}; - template - static typename bind_::const_result_type - const_apply(const P& p, const Graph&, Tag&) - { return p; } + // Parameters of f are (GraphIsConst, Graph, Param, Tag) + template struct choose_impl_helper; - template - static typename bind_::result_type - apply(const P& p, Graph&, Tag&) - { return p; } - }; - - struct choose_default_param { - template - struct bind_ { - typedef typename property_map::type - result_type; - typedef typename property_map::const_type - const_result_type; - typedef typename property_map::const_type - type; - }; - - template - static typename bind_::const_result_type - const_apply(const P&, const Graph& g, Tag tag) { - return get(tag, g); + template <> struct choose_impl_helper { + template + static typename property_map::type, PropertyTag>::const_type + f(boost::mpl::true_, const Graph& g, const Param&, PropertyTag tag) { + return get(tag, g); } - template - static typename bind_::result_type - apply(const P&, Graph& g, Tag tag) { - return get(tag, g); + + template + static typename property_map::type, PropertyTag>::type + f(boost::mpl::false_, Graph& g, const Param&, PropertyTag tag) { + return get(tag, g); } }; - template - struct choose_property_map { - typedef choose_parameter type; - }; - template <> - struct choose_property_map { - typedef choose_default_param type; + template <> struct choose_impl_helper { + template + static Param f(GraphIsConst, const Graph&, const Param& p, PropertyTag) { + return p; + } }; + } - template - struct choose_pmap_helper { - typedef typename choose_property_map::type Selector; - typedef typename Selector:: template bind_ Bind; - typedef Bind type; - typedef typename Bind::result_type result_type; - typedef typename Bind::const_result_type const_result_type; - typedef typename Bind::type result; - }; + template + typename detail::choose_impl_result::type + choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag) + { + return detail::choose_impl_helper::value> + ::f(boost::mpl::true_(), g, p, tag); + } + + template + typename detail::choose_impl_result::type + choose_pmap(const Param& p, Graph& g, PropertyTag tag) + { + return detail::choose_impl_helper::value> + ::f(boost::mpl::false_(), g, p, tag); + } + + namespace detail { // used in the max-flow algorithms template struct edge_capacity_value { typedef bgl_named_params Params; - typedef typename property_value< Params, edge_capacity_t>::type Param; - typedef typename detail::choose_pmap_helper::result CapacityEdgeMap; + typedef typename detail::choose_impl_result::type, edge_capacity_t>::type CapacityEdgeMap; typedef typename property_traits::value_type type; }; - } // namespace detail - - - // Use this function instead of choose_param() when you want - // to avoid requiring get(tag, g) when it is not used. - template - typename - detail::choose_pmap_helper::const_result_type - choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag) - { - typedef typename - detail::choose_pmap_helper::Selector Choice; - return Choice::const_apply(p, g, tag); - } - - template - typename detail::choose_pmap_helper::result_type - choose_pmap(const Param& p, Graph& g, PropertyTag tag) - { - typedef typename - detail::choose_pmap_helper::Selector Choice; - return Choice::apply(p, g, tag); } // Declare all new tags @@ -353,7 +357,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef convert_bgl_params_to_boost_parameter rest_conv; typedef boost::parameter::aux::arg_list type; static type conv(const T& x) { - return type(tagged_arg_type(x.m_value), rest_conv::conv(x)); + return type(tagged_arg_type(x.m_value), rest_conv::conv(x.m_base)); } }; @@ -362,7 +366,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef convert_bgl_params_to_boost_parameter rest_conv; typedef typename rest_conv::type type; static type conv(const bgl_named_params& x) { - return rest_conv::conv(x); + return rest_conv::conv(x.m_base); } }; @@ -375,7 +379,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template <> struct convert_bgl_params_to_boost_parameter { typedef boost::parameter::aux::empty_arg_list type; - static type conv(const boost::no_property&) {return type();} + static type conv(const boost::no_named_parameters&) {return type();} }; struct bgl_parameter_not_found_type {}; @@ -428,13 +432,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template struct override_property_t { typedef ArgType result_type; - result_type operator()(const Graph& g, const typename boost::add_reference::type a) const {return a;} + result_type operator()(const Graph&, const typename boost::add_reference::type a) const {return a;} }; template struct override_property_t { typedef typename boost::property_map::type result_type; - result_type operator()(const Graph& g, const ArgType& a) const {return get(Prop(), g);} + result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);} }; template @@ -451,7 +455,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template typename override_property_result::type - override_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop prop) { + override_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop) { return override_property_t< typename boost::parameter::value_type::type, Prop, @@ -460,6 +464,78 @@ BOOST_BGL_DECLARE_NAMED_PARAMS >()(g, ap[t | 0]); } + template struct make_arg_pack_type; + template <> struct make_arg_pack_type {typedef boost::parameter::aux::empty_arg_list type;}; + template + struct make_arg_pack_type { + typedef boost::parameter::aux::tagged_argument type; + }; + +#define BOOST_GRAPH_OPENING_PART_OF_PAIR(z, i, n) boost::parameter::aux::arg_list, +#define BOOST_GRAPH_MAKE_PAIR_PARAM(z, i, _) const boost::parameter::aux::tagged_argument& BOOST_PP_CAT(kw, i) + +#define BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION(z, i, _) \ + template \ + struct make_arg_pack_type { \ + typedef \ + BOOST_PP_REPEAT(i, BOOST_GRAPH_OPENING_PART_OF_PAIR, BOOST_PP_DEC(i)) boost::parameter::aux::empty_arg_list BOOST_PP_REPEAT(i, > BOOST_PP_TUPLE_EAT(3), ~) \ + type; \ + }; + BOOST_PP_REPEAT_FROM_TO(2, 11, BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION, ~) +#undef BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(name, nfixed, nnamed_max) \ + /* Entry point for conversion from BGL-style named parameters */ \ + template \ + typename boost::result_of< \ + detail::BOOST_PP_CAT(name, _impl)(BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const ArgPack&) \ + >::type \ + BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const ArgPack& arg_pack) { \ + return detail::BOOST_PP_CAT(name, _impl)()(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } \ + /* Individual functions taking Boost.Parameter-style keyword arguments */ \ + BOOST_PP_REPEAT(BOOST_PP_INC(nnamed_max), BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE, (name)(nfixed)) + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE(z, nnamed, seq) \ + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, BOOST_PP_SEQ_ELEM(0, seq), BOOST_PP_SEQ_ELEM(1, seq)) + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, name, nfixed) \ + template \ + typename boost::result_of< \ + detail::BOOST_PP_CAT(name, _impl) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \ + const typename boost::detail::make_arg_pack_type::type&) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) \ + BOOST_PP_ENUM_TRAILING(nnamed, BOOST_GRAPH_MAKE_PAIR_PARAM, ~)) { \ + return detail::BOOST_PP_CAT(name, _impl)() \ + (BOOST_PP_ENUM_PARAMS(nfixed, param), \ + (boost::parameter::aux::empty_arg_list() BOOST_PP_ENUM_TRAILING_PARAMS(nnamed, kw))); \ + } + +#define BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(name, nfixed) \ + template \ + typename boost::result_of< \ + ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \ + const typename boost::detail::convert_bgl_params_to_boost_parameter >::type &) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const boost::bgl_named_params& old_style_params) { \ + typedef boost::bgl_named_params old_style_params_type; \ + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(old_style_params_type, old_style_params) \ + return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } \ + \ + BOOST_PP_EXPR_IF(nfixed, template <) BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_EXPR_IF(nfixed, >) \ + BOOST_PP_EXPR_IF(nfixed, typename) boost::result_of< \ + ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const boost::parameter::aux::empty_arg_list &) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param)) { \ + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(boost::no_named_parameters, boost::no_named_parameters()) \ + return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } + } namespace detail { @@ -557,7 +633,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef Q priority_queue_type; static priority_queue_type - make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + make_queue(const Graph&, const ArgPack&, KeyT, const Q& q) { return q; } }; @@ -569,7 +645,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef boost::d_ary_heap_indirect::helper::map_type, Compare> priority_queue_type; static priority_queue_type - make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q&) { return priority_queue_type( map_maker::make_map(g, ap, defaultKey), map_maker::make_map(g, ap, typename boost::property_traits::value_type(-1)) @@ -609,6 +685,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { } + template + struct result { + typedef typename remove_const::arg1_type>::type>::type graph_type; + typedef typename remove_const::arg2_type>::type>::type arg_pack_type; + typedef typename priority_queue_maker::priority_queue_type type; + }; + template typename priority_queue_maker::priority_queue_type operator()(const Graph& g, const ArgPack& ap) const { @@ -616,6 +699,25 @@ BOOST_BGL_DECLARE_NAMED_PARAMS } }; + template + typename boost::graph_traits::vertex_descriptor + get_null_vertex(const G&) {return boost::graph_traits::null_vertex();} + + template + typename boost::graph_traits::vertex_descriptor + get_default_starting_vertex(const G& g) { + std::pair::vertex_iterator, typename boost::graph_traits::vertex_iterator> iters = vertices(g); + return (iters.first == iters.second) ? boost::graph_traits::null_vertex() : *iters.first; + } + + template + struct get_default_starting_vertex_t { + typedef typename boost::graph_traits::vertex_descriptor result_type; + const G& g; + get_default_starting_vertex_t(const G& g): g(g) {} + result_type operator()() const {return get_default_starting_vertex(g);} + }; + } // namespace detail } // namespace boost diff --git a/project/jni/boost/include/boost/graph/named_graph.hpp b/project/jni/boost/include/boost/graph/named_graph.hpp index 38f4ca0e1..4c687a086 100644 --- a/project/jni/boost/include/boost/graph/named_graph.hpp +++ b/project/jni/boost/include/boost/graph/named_graph.hpp @@ -11,14 +11,23 @@ #define BOOST_GRAPH_NAMED_GRAPH_HPP #include -#include -#include -#include +#include +#include +#include #include #include +#include #include +#include // for boost::lookup_one_property #include +#include // for boost::make_tuple +#include +#include +#include +#include +#include // for std::equal_to #include // for std::runtime_error +#include // for std::pair namespace boost { namespace graph { @@ -105,7 +114,7 @@ public: typedef vertex_name_type argument_type; typedef VertexProperty result_type; - VertexProperty operator()(const vertex_name_type& name) + VertexProperty operator()(const vertex_name_type&) { boost::throw_exception(std::runtime_error("add_vertex: " "unable to create a vertex from its name")); @@ -155,51 +164,6 @@ struct internal_vertex_constructor > : internal_vertex_constructor { }; #endif -/******************************************************************* - * Named graph-specific metafunctions * - *******************************************************************/ -namespace detail { - /** @internal - * Extracts the type of a bundled vertex property from a vertex - * property. The primary template matches when we have hit the end - * of the @c property<> list. - */ - template - struct extract_bundled_vertex - { - typedef VertexProperty type; - }; - - /** @internal - * Recursively extract the bundled vertex property from a vertex - * property. - */ - template - struct extract_bundled_vertex > - : extract_bundled_vertex - { }; - - /** - * We have found the bundled vertex property type, marked with - * vertex_bundle_t. - */ - template - struct extract_bundled_vertex > - { - typedef T type; - }; - - /** - * Translate @c no_property into @c error_property_not_found when we - * have failed to extract a bundled vertex property type. - */ - template<> - struct extract_bundled_vertex - { - typedef boost::detail::error_property_not_found type; - }; -} - /******************************************************************* * Named graph mixin * *******************************************************************/ @@ -228,7 +192,7 @@ public: typedef typename internal_vertex_name::type extract_name_type; /// The type of the "bundled" property, from which the name can be /// extracted. - typedef typename detail::extract_bundled_vertex::type + typedef typename lookup_one_property::type bundled_vertex_property_type; /// The type of the function object that generates vertex properties @@ -397,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 /// 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 -Vertex + typename disable_if, +Vertex>::type add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, BGL_NAMED_GRAPH& g) { @@ -446,6 +417,35 @@ add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, g.derived()); } +// Overloads to support EdgeMutablePropertyGraph graphs +template +std::pair::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::type const& p, + BGL_NAMED_GRAPH& g) { + return add_edge(u, add_vertex(v_name, g.derived()), p, g.derived()); +} + +template +std::pair::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::type const& p, + BGL_NAMED_GRAPH& g) { + return add_edge(add_vertex(u_name, g.derived()), v, p, g.derived()); +} + +template +std::pair::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::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_PARAMS @@ -477,7 +477,7 @@ struct maybe_named_graph { /// The type of the "bundled" property, from which the name can be /// extracted. - typedef typename detail::extract_bundled_vertex::type + typedef typename lookup_one_property::type bundled_vertex_property_type; /// Notify the named_graph that we have added the given vertex. This diff --git a/project/jni/boost/include/boost/graph/neighbor_bfs.hpp b/project/jni/boost/include/boost/graph/neighbor_bfs.hpp index 4585f2e29..4830dcc4e 100644 --- a/project/jni/boost/include/boost/graph/neighbor_bfs.hpp +++ b/project/jni/boost/include/boost/graph/neighbor_bfs.hpp @@ -250,13 +250,13 @@ namespace boost { }; template <> - struct neighbor_bfs_dispatch { + struct neighbor_bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { std::vector color_vec(num_vertices(g)); null_visitor null_vis; @@ -288,8 +288,7 @@ namespace boost { // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::neighbor_bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } diff --git a/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp b/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp index 6cb7bdb82..86203aaf3 100644 --- a/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp +++ b/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp @@ -12,7 +12,7 @@ #include #include #include -#include //for next and prior +#include #include #include diff --git a/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp b/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp index 71607fcbc..41ba2bc57 100644 --- a/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp +++ b/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp @@ -10,7 +10,7 @@ #include #include -#include //for boost::next +#include #include //for std::min macros #include #include diff --git a/project/jni/boost/include/boost/graph/planar_face_traversal.hpp b/project/jni/boost/include/boost/graph/planar_face_traversal.hpp index bcd565528..6befa43ba 100644 --- a/project/jni/boost/include/boost/graph/planar_face_traversal.hpp +++ b/project/jni/boost/include/boost/graph/planar_face_traversal.hpp @@ -10,8 +10,11 @@ #define __PLANAR_FACE_TRAVERSAL_HPP__ #include -#include //for next and prior +#include +#include +#include #include +#include namespace boost diff --git a/project/jni/boost/include/boost/graph/properties.hpp b/project/jni/boost/include/boost/graph/properties.hpp index bc498bbf9..d540439ef 100644 --- a/project/jni/boost/include/boost/graph/properties.hpp +++ b/project/jni/boost/include/boost/graph/properties.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -68,26 +68,20 @@ namespace boost { struct vertex_property_tag { }; struct edge_property_tag { }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // See examples/edge_property.cpp for how to use this. #define BOOST_INSTALL_PROPERTY(KIND, NAME) \ template <> struct property_kind { \ typedef KIND##_property_tag type; \ } -#else -#define BOOST_INSTALL_PROPERTY(KIND, NAME) \ - template <> struct property_kind { \ - typedef KIND##_property_tag type; \ - } -#endif #define BOOST_DEF_PROPERTY(KIND, NAME) \ enum KIND##_##NAME##_t { KIND##_##NAME }; \ BOOST_INSTALL_PROPERTY(KIND, NAME) - BOOST_DEF_PROPERTY(vertex, all); - BOOST_DEF_PROPERTY(edge, all); - BOOST_DEF_PROPERTY(graph, all); + // These three are defined in boost/pending/property.hpp + BOOST_INSTALL_PROPERTY(vertex, all); + BOOST_INSTALL_PROPERTY(edge, all); + BOOST_INSTALL_PROPERTY(graph, all); BOOST_DEF_PROPERTY(vertex, index); BOOST_DEF_PROPERTY(vertex, index1); BOOST_DEF_PROPERTY(vertex, index2); @@ -128,10 +122,10 @@ namespace boost { BOOST_DEF_PROPERTY(graph, visitor); // These tags are used for property bundles - // BOOST_DEF_PROPERTY(graph, bundle); -- needed in graph_traits.hpp, so enum is defined there + // These three are defined in boost/pending/property.hpp BOOST_INSTALL_PROPERTY(graph, bundle); - BOOST_DEF_PROPERTY(vertex, bundle); - BOOST_DEF_PROPERTY(edge, bundle); + BOOST_INSTALL_PROPERTY(vertex, bundle); + BOOST_INSTALL_PROPERTY(edge, bundle); // These tags are used to denote the owners and local descriptors // for the vertices and edges of a distributed graph. @@ -148,6 +142,25 @@ namespace boost { namespace detail { + template + struct property_kind_from_graph: property_kind {}; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct property_kind_from_graph { + typedef typename boost::mpl::if_< + boost::is_base_of::type>, + vertex_property_tag, + typename boost::mpl::if_< + boost::is_base_of::type>, + edge_property_tag, + typename boost::mpl::if_< + boost::is_base_of::type>, + graph_property_tag, + void>::type>::type>::type type; + }; +#endif + struct dummy_edge_property_selector { template struct bind_ { @@ -192,70 +205,32 @@ namespace boost { }; template - struct edge_property_map { - typedef typename edge_property_type::type Property; - typedef typename graph_tag_or_void::type graph_tag; - typedef typename edge_property_selector::type Selector; - typedef typename Selector::template bind_ - Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct edge_property_map + : edge_property_selector< + typename graph_tag_or_void::type + >::type::template bind_< + Graph, + typename edge_property_type::type, + PropertyTag> + {}; template - class vertex_property_map { - public: - typedef typename vertex_property_type::type Property; - typedef typename graph_tag_or_void::type graph_tag; - typedef typename vertex_property_selector::type Selector; - typedef typename Selector::template bind_ - Bind; - public: - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; - - // This selects the kind of property map, whether is maps from - // edges or from vertices. - // - // It is overly complicated because it's a workaround for - // partial specialization. - struct choose_vertex_property_map { - template - struct bind_ { - typedef vertex_property_map type; - }; - }; - struct choose_edge_property_map { - template - struct bind_ { - typedef edge_property_map type; - }; - }; - template - struct property_map_kind_selector { - // VC++ gets confused if this isn't defined, even though - // this never gets used. - typedef choose_vertex_property_map type; - }; - template <> struct property_map_kind_selector { - typedef choose_vertex_property_map type; - }; - template <> struct property_map_kind_selector { - typedef choose_edge_property_map type; - }; + struct vertex_property_map + : vertex_property_selector< + typename graph_tag_or_void::type + >::type::template bind_< + Graph, + typename vertex_property_type::type, + PropertyTag> + {}; } // namespace detail - template - struct property_map { - // private: - typedef typename property_kind::type Kind; - typedef typename detail::property_map_kind_selector::type Selector; - typedef typename Selector::template bind_ Bind; - typedef typename Bind::type Map; - public: - typedef typename Map::type type; - typedef typename Map::const_type const_type; - }; + template + struct property_map: + mpl::if_< + is_same::type, edge_property_tag>, + detail::edge_property_map, + detail::vertex_property_map >::type + {}; // shortcut for accessing the value type of the property map template @@ -273,16 +248,8 @@ namespace boost { >::type type; }; - template - class vertex_property { - public: - typedef typename Graph::vertex_property_type type; - }; - template - class edge_property { - public: - typedef typename Graph::edge_property_type type; - }; + template struct vertex_property: vertex_property_type {}; + template struct edge_property: edge_property_type {}; template class degree_property_map @@ -383,99 +350,6 @@ namespace boost { # define BOOST_GRAPH_NO_BUNDLED_PROPERTIES #endif -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - struct bundle_property_map - : put_get_helper > - { - typedef Descriptor key_type; - typedef typename remove_const::type value_type; - typedef T& reference; - typedef lvalue_property_map_tag category; - - bundle_property_map() { } - bundle_property_map(Graph* g_, T Bundle::* pm_) : g(g_), pm(pm_) {} - - reference operator[](key_type k) const { return (*g)[k].*pm; } - private: - Graph* g; - T Bundle::* pm; - }; - - namespace detail { - template - struct is_vertex_bundle - : mpl::and_, - mpl::and_ >, - mpl::not_ > > > - { }; - } - - // Specialize the property map template to generate bundled property maps. - template - struct property_map - { - private: - typedef graph_traits traits; - typedef typename Graph::vertex_bundled vertex_bundled; - typedef typename Graph::edge_bundled edge_bundled; - typedef typename mpl::if_c<(detail::is_vertex_bundle::value), - typename traits::vertex_descriptor, - typename traits::edge_descriptor>::type - descriptor; - typedef typename mpl::if_c<(detail::is_vertex_bundle::value), - vertex_bundled, - edge_bundled>::type - actual_bundle; - - public: - typedef bundle_property_map type; - typedef bundle_property_map - const_type; - }; -#endif - -// These metafunctions help implement the process of determining the vertex -// and edge properties of a graph. -namespace graph_detail { - template - struct retagged_property { - typedef typename Retag::type type; - }; - - // Search the normalized PropList (as returned by retagged<>::type) for - // the given bundle. Return the type error if no such bundle can be found. - template - struct retagged_bundle { - typedef typename property_value::type Value; - typedef typename mpl::if_< - is_same, no_bundle, Value - >::type type; - }; - - template - class normal_property { - // Normalize the property into a property list. - typedef detail::retag_property_list List; - public: - // Extract the normalized property and bundle types. - typedef typename retagged_property::type property; - typedef typename retagged_bundle::type bundle; - }; - - template - struct graph_prop : normal_property - { }; - - template - struct vertex_prop : normal_property - { }; - - template - struct edge_prop : normal_property - { }; -} // namespace graph_detail - // NOTE: These functions are declared, but never defined since they need to // be overloaded by graph implementations. However, we need them to be // declared for the functions below. @@ -498,17 +372,11 @@ get_property(Graph& g) { template inline typename graph_property::type const& -get_property(Graph const& g) { +get_property(const Graph& g) { return get_property(g, graph_bundle); } #endif } // namespace boost -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -# undef Graph -# undef RandomAccessIterator -#endif - -#endif /* BOOST_GRAPH_PROPERTIES_HPPA */ +#endif /* BOOST_GRAPH_PROPERTIES_HPP */ diff --git a/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp b/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp index dd2461e7e..9d83ea18c 100644 --- a/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp +++ b/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp @@ -54,6 +54,39 @@ inline constant_property_map make_constant_property(const Value& value) { return constant_property_map(value); } +/** + * Same as above, but pretends to be writable as well. + */ +template +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 +inline constant_writable_property_map +make_constant_writable_property(const Value& value) +{ return constant_writable_property_map(value); } + } /* namespace boost */ #endif diff --git a/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp b/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp index f6273481b..09ff55e34 100644 --- a/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp +++ b/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp @@ -29,7 +29,7 @@ namespace boost // The null_property_map only has a put() function. template - void put(null_property_map& pm, const K& key, const V& value) + void put(null_property_map& /*pm*/, const K& /*key*/, const V& /*value*/) { } // A helper function for intantiating null property maps. diff --git a/project/jni/boost/include/boost/graph/relax.hpp b/project/jni/boost/include/boost/graph/relax.hpp index 468579609..e3866df48 100644 --- a/project/jni/boost/include/boost/graph/relax.hpp +++ b/project/jni/boost/include/boost/graph/relax.hpp @@ -49,20 +49,30 @@ namespace boost { Vertex u = source(e, g), v = target(e, g); typedef typename property_traits::value_type D; typedef typename property_traits::value_type W; - D d_u = get(d, u), d_v = get(d, v); - W w_e = get(w, e); + const D d_u = get(d, u); + const D d_v = get(d, v); + const W& w_e = get(w, e); - // The redundant gets in the return statements are to ensure that extra - // floating-point precision in x87 registers does not lead to relax() - // returning true when the distance did not actually change. + // The seemingly redundant comparisons after the distance puts are to + // ensure that extra floating-point precision in x87 registers does not + // lead to relax() returning true when the distance did not actually + // change. if ( compare(combine(d_u, w_e), d_v) ) { put(d, v, combine(d_u, w_e)); - put(p, v, u); - return compare(get(d, v), d_v); + if (compare(get(d, v), d_v)) { + put(p, v, u); + return true; + } else { + return false; + } } else if (is_undirected && compare(combine(d_v, w_e), d_u)) { put(d, u, combine(d_v, w_e)); - put(p, u, v); - return compare(get(d, u), d_u); + if (compare(get(d, u), d_u)) { + put(p, u, v); + return true; + } else { + return false; + } } else return false; } diff --git a/project/jni/boost/include/boost/graph/reverse_graph.hpp b/project/jni/boost/include/boost/graph/reverse_graph.hpp index 48c4e0576..7985e97f0 100644 --- a/project/jni/boost/include/boost/graph/reverse_graph.hpp +++ b/project/jni/boost/include/boost/graph/reverse_graph.hpp @@ -105,6 +105,7 @@ class reverse_graph { typedef graph_traits Traits; public: typedef BidirectionalGraph base_type; + typedef GraphRef base_ref_type; // Constructor reverse_graph(GraphRef g) : m_g(g) {} @@ -358,47 +359,38 @@ namespace detail { } }; - struct reverse_graph_vertex_property_selector { - template - struct bind_ { - typedef typename ReverseGraph::base_type Graph; - typedef property_map PMap; - typedef typename PMap::type type; - typedef typename PMap::const_type const_type; - }; - }; - - struct reverse_graph_edge_property_selector { - template - struct bind_ { - typedef typename ReverseGraph::base_type Graph; - typedef property_map PMap; - typedef reverse_graph_edge_property_map type; - typedef reverse_graph_edge_property_map const_type; - }; - }; - } // namespace detail -template <> -struct vertex_property_selector { - typedef detail::reverse_graph_vertex_property_selector type; -}; - -template <> -struct edge_property_selector { - typedef detail::reverse_graph_edge_property_selector type; +template +struct property_map, Property> { + typedef boost::is_same::type, edge_property_tag> is_edge_prop; + typedef typename property_map::type orig_type; + typedef typename property_map::const_type orig_const_type; + typedef typename boost::mpl::if_, orig_type>::type type; + typedef typename boost::mpl::if_, orig_const_type>::type const_type; }; template -typename property_map, Property>::type +struct property_map, Property> { + typedef boost::is_same::type, edge_property_tag> is_edge_prop; + typedef typename property_map::const_type orig_const_type; + typedef typename boost::mpl::if_, orig_const_type>::type const_type; + typedef const_type type; +}; + +template +typename disable_if< + is_same, + typename property_map, Property>::type>::type get(Property p, reverse_graph& g) { return typename property_map, Property>::type(get(p, g.m_g)); } template -typename property_map, Property>::const_type +typename disable_if< + is_same, + typename property_map, Property>::const_type>::type get(Property p, const reverse_graph& g) { const BidirGraph& gref = g.m_g; // in case GRef is non-const @@ -406,9 +398,11 @@ get(Property p, const reverse_graph& g) } template -typename property_traits< - typename property_map::const_type ->::value_type +typename disable_if< + is_same, + typename property_traits< + typename property_map, Property>::const_type + >::value_type>::type get(Property p, const reverse_graph& g, const Key& k) { return get(get(p, g), k); @@ -439,7 +433,7 @@ namespace detail { { return m[k]; } -}; +} template struct property_traits > { @@ -459,19 +453,40 @@ struct property_map, edge_underlying_t> { typedef detail::underlying_edge_desc_map_type const_type; }; -template -detail::underlying_edge_desc_map_type::edge_descriptor> +template struct is_reverse_graph: boost::mpl::false_ {}; +template struct is_reverse_graph >: boost::mpl::true_ {}; + +template +typename enable_if, + detail::underlying_edge_desc_map_type::edge_descriptor> >::type get(edge_underlying_t, - const reverse_graph& g) + G&) { - return detail::underlying_edge_desc_map_type::edge_descriptor>(); + return detail::underlying_edge_desc_map_type::edge_descriptor>(); } -template -typename graph_traits::edge_descriptor +template +typename enable_if, typename graph_traits::edge_descriptor>::type get(edge_underlying_t, - const reverse_graph& g, - const typename graph_traits >::edge_descriptor& k) + G&, + const typename graph_traits::edge_descriptor& k) +{ + return k.underlying_descx; +} + +template +typename enable_if, detail::underlying_edge_desc_map_type::edge_descriptor> >::type +get(edge_underlying_t, + const G&) +{ + return detail::underlying_edge_desc_map_type::edge_descriptor>(); +} + +template +typename enable_if, typename graph_traits::edge_descriptor>::type +get(edge_underlying_t, + const G&, + const typename graph_traits::edge_descriptor& k) { return k.underlying_descx; } diff --git a/project/jni/boost/include/boost/graph/stanford_graph.hpp b/project/jni/boost/include/boost/graph/stanford_graph.hpp index 0bb798c0f..89f5e34b2 100644 --- a/project/jni/boost/include/boost/graph/stanford_graph.hpp +++ b/project/jni/boost/include/boost/graph/stanford_graph.hpp @@ -318,13 +318,15 @@ namespace boost { class sgb_vertex_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_vertex_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](Vertex* v) const { - return get_util_field(v, Tag()); + return get_util_field(v, tag); } }; @@ -333,13 +335,15 @@ namespace boost { class sgb_edge_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_edge_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](const sgb_edge& e) const { - return get_util_field(e._arc, Tag()); + return get_util_field(e._arc, tag); } }; diff --git a/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp b/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp index 814eae0ce..060f51b4a 100644 --- a/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp +++ b/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace boost { @@ -218,7 +218,9 @@ namespace boost { typedef boost::bgl_named_params params_type; BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) - BOOST_AUTO(pq, (boost::detail::make_priority_queue_from_arg_pack_gen >(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0)))(g, arg_pack))); + typedef boost::detail::make_priority_queue_from_arg_pack_gen > gen_type; + gen_type gen(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0))); + typename boost::result_of::type pq = gen(g, arg_pack); return boost::detail::stoer_wagner_min_cut(g, weights, diff --git a/project/jni/boost/include/boost/graph/strong_components.hpp b/project/jni/boost/include/boost/graph/strong_components.hpp index ba5d45907..61345bdcb 100644 --- a/project/jni/boost/include/boost/graph/strong_components.hpp +++ b/project/jni/boost/include/boost/graph/strong_components.hpp @@ -131,7 +131,7 @@ namespace boost { template <> - struct strong_comp_dispatch2 { + struct strong_comp_dispatch2 { template inline static typename property_traits::value_type @@ -139,7 +139,7 @@ namespace boost { ComponentMap comp, RootMap r_map, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::vertices_size_type size_type; size_type n = num_vertices(g) > 0 ? num_vertices(g) : 1; @@ -179,7 +179,7 @@ namespace boost { } }; template <> - struct strong_comp_dispatch1 { + struct strong_comp_dispatch1 { template @@ -187,7 +187,7 @@ namespace boost { apply(const Graph& g, ComponentMap comp, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::vertex_descriptor Vertex; typename std::vector::size_type diff --git a/project/jni/boost/include/boost/graph/subgraph.hpp b/project/jni/boost/include/boost/graph/subgraph.hpp index b98c39026..22706bc61 100644 --- a/project/jni/boost/include/boost/graph/subgraph.hpp +++ b/project/jni/boost/include/boost/graph/subgraph.hpp @@ -24,7 +24,9 @@ #include #include -#include +#include +#include +#include namespace boost { @@ -103,13 +105,11 @@ public: typedef typename Traits::in_edge_iterator in_edge_iterator; - typedef typename Graph::edge_property_type edge_property_type; - typedef typename Graph::vertex_property_type vertex_property_type; - typedef typename Graph::vertex_bundled vertex_bundled; - typedef typename Graph::edge_bundled edge_bundled; + typedef typename edge_property_type::type edge_property_type; + typedef typename vertex_property_type::type vertex_property_type; typedef subgraph_tag graph_tag; typedef Graph graph_type; - typedef typename Graph::graph_property_type graph_property_type; + typedef typename graph_property_type::type graph_property_type; // Create the main graph, the root of the subgraph tree subgraph() @@ -131,15 +131,29 @@ public: // copy constructor subgraph(const subgraph& x) - : m_graph(x.m_graph), m_parent(x.m_parent), m_edge_counter(x.m_edge_counter) + : m_parent(x.m_parent), m_edge_counter(x.m_edge_counter) , m_global_vertex(x.m_global_vertex), m_global_edge(x.m_global_edge) { - // Do a deep copy (recursive). - for(typename ChildrenList::const_iterator i = x.m_children.begin(); - i != x.m_children.end(); ++i) + if(x.is_root()) { - m_children.push_back(new subgraph( **i )); + m_graph = x.m_graph; } + // Do a deep copy (recursive). + // Only the root graph is copied, the subgraphs contain + // only references to the global vertices they own. + typename subgraph::children_iterator i,i_end; + boost::tie(i,i_end) = x.children(); + for(; i != i_end; ++i) + { + subgraph child = this->create_subgraph(); + child = *i; + vertex_iterator vi,vi_end; + boost::tie(vi,vi_end) = vertices(*i); + for (;vi!=vi_end;++vi) + { + add_vertex(*vi,child); + } + } } @@ -334,9 +348,6 @@ public: // Probably shouldn't be public.... } }; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -// TODO: I don't think these are required since the default metafunction -// returns Graph::vertex_bundled. template struct vertex_bundle_type > : vertex_bundle_type @@ -346,7 +357,11 @@ template struct edge_bundle_type > : edge_bundle_type { }; -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + +template +struct graph_bundle_type > + : graph_bundle_type +{ }; //=========================================================================== // Functions special to the Subgraph Class @@ -764,7 +779,10 @@ class subgraph_global_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; @@ -772,18 +790,19 @@ public: subgraph_global_property_map() { } - subgraph_global_property_map(GraphPtr g) - : m_g(g) + subgraph_global_property_map(GraphPtr g, Tag tag) + : m_g(g), m_tag(tag) { } reference operator[](key_type e) const { - PropertyMap pmap = get(Tag(), m_g->root().m_graph); + PropertyMap pmap = get(m_tag, m_g->root().m_graph); return m_g->is_root() ? pmap[e] : pmap[m_g->local_to_global(e)]; } GraphPtr m_g; + Tag m_tag; }; /** @@ -799,7 +818,10 @@ class subgraph_local_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; @@ -810,17 +832,18 @@ public: subgraph_local_property_map() { } - subgraph_local_property_map(GraphPtr g) - : m_g(g) + subgraph_local_property_map(GraphPtr g, Tag tag) + : m_g(g), m_tag(tag) { } reference operator[](key_type e) const { // Get property map on the underlying graph. - PropertyMap pmap = get(Tag(), m_g->m_graph); + PropertyMap pmap = get(m_tag, m_g->m_graph); return pmap[e]; } GraphPtr m_g; + Tag m_tag; }; namespace detail { @@ -935,139 +958,37 @@ struct edge_property_selector { typedef detail::subgraph_property_generator type; }; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -/** @internal - * This property map implements local or global bundled property access on - * an underlying graph. The LocalGlobal template template parameter must be - * one of the local_property or global_property templates. - */ -template < - typename Graph, typename Descriptor, typename Bundle, typename T, - template class LocalGlobal> -struct subgraph_lg_bundle_property_map - : put_get_helper< - T&, - subgraph_lg_bundle_property_map - > -{ -private: - typedef LocalGlobal Wrap; -public: - typedef Descriptor key_type; - typedef typename remove_const::type value_type; - typedef T& reference; - typedef lvalue_property_map_tag category; - - subgraph_lg_bundle_property_map() - { } - - subgraph_lg_bundle_property_map(Graph* g, T Bundle::* p) - : m_g(g), m_prop(p) - { } - - reference operator[](key_type k) const - { return (*m_g)[Wrap(k)].*m_prop; } - -private: - Graph* m_g; - T Bundle::* m_prop; -}; - -// Specialize the property map template to generate bundled property maps. -// NOTE: I'm cheating (actually double-dipping) with the local/global subgraph -// property templates. I'm not using them store descriptors, just specialize -// the property map template for specific lookups. -namespace graph_detail { - // Help decoding some of the types required for property map definitions. - template - struct bundled_subgraph_pmap_helper { - typedef subgraph Subgraph; - typedef graph_traits Traits; - typedef typename Subgraph::vertex_bundled VertBundled; - typedef typename Subgraph::edge_bundled EdgeBundled; - - // Deduce the descriptor from the template params - typedef typename mpl::if_< - detail::is_vertex_bundle, - typename Traits::vertex_descriptor, typename Traits::edge_descriptor - >::type Desc; - - // Deduce the bundled property type - typedef typename mpl::if_< - detail::is_vertex_bundle, - VertBundled, EdgeBundled - >::type Prop; - }; -} // namespace graph_detail - -template -struct property_map, local_property > - : graph_detail::bundled_subgraph_pmap_helper -{ -private: - typedef graph_detail::bundled_subgraph_pmap_helper Base; - typedef typename Base::Subgraph Subgraph; - typedef typename Base::Desc Desc; - typedef typename Base::Prop Prop; -public: - typedef subgraph_lg_bundle_property_map< - Subgraph, Desc, Prop, T, local_property - > type; - typedef subgraph_lg_bundle_property_map< - Subgraph const, Desc, Prop, T const, local_property - > const_type; -}; - -template -struct property_map, global_property > - : graph_detail::bundled_subgraph_pmap_helper -{ -private: - typedef graph_detail::bundled_subgraph_pmap_helper Base; - typedef typename Base::Subgraph Subgraph; - typedef typename Base::Desc Desc; - typedef typename Base::Prop Prop; -public: - typedef subgraph_lg_bundle_property_map< - Subgraph, Desc, Prop, T, global_property - > type; - typedef subgraph_lg_bundle_property_map< - Subgraph const, Desc, Prop, T const, global_property - > const_type; -}; -#endif - // ================================================== // get(p, g), get(p, g, k), and put(p, g, k, v) // ================================================== template typename property_map, Property>::type -get(Property, subgraph& g) { +get(Property p, subgraph& g) { typedef typename property_map< subgraph, Property>::type PMap; - return PMap(&g); + return PMap(&g, p); } template typename property_map, Property>::const_type -get(Property, const subgraph& g) { +get(Property p, const subgraph& g) { typedef typename property_map< subgraph, Property>::const_type PMap; - return PMap(&g); + return PMap(&g, p); } template typename property_traits< typename property_map, Property>::const_type >::value_type -get(Property, const subgraph& g, const Key& k) { +get(Property p, const subgraph& g, const Key& k) { typedef typename property_map< subgraph, Property>::const_type PMap; - PMap pmap(&g); + PMap pmap(&g, p); return pmap[k]; } template -void put(Property, subgraph& g, const Key& k, const Value& val) { +void put(Property p, subgraph& g, const Key& k, const Value& val) { typedef typename property_map< subgraph, Property>::type PMap; - PMap pmap(&g); + PMap pmap(&g, p); pmap[k] = val; } @@ -1077,20 +998,20 @@ void put(Property, subgraph& g, const Key& k, const Value& val) { // ================================================== template typename property_map, global_property >::type -get(global_property, subgraph& g) { +get(global_property p, subgraph& g) { typedef typename property_map< subgraph, global_property >::type Map; - return Map(&g); + return Map(&g, p.value); } template typename property_map, global_property >::const_type -get(global_property, const subgraph& g) { +get(global_property p, const subgraph& g) { typedef typename property_map< subgraph, global_property >::const_type Map; - return Map(&g); + return Map(&g, p.value); } // ================================================== @@ -1099,112 +1020,22 @@ get(global_property, const subgraph& g) { // ================================================== template typename property_map, local_property >::type -get(local_property, subgraph& g) { +get(local_property p, subgraph& g) { typedef typename property_map< subgraph, local_property >::type Map; - return Map(&g); + return Map(&g, p.value); } template typename property_map, local_property >::const_type -get(local_property, const subgraph& g) { +get(local_property p, const subgraph& g) { typedef typename property_map< subgraph, local_property >::const_type Map; - return Map(&g); -} - -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -// ================================================== -// get(bundle(p), g) -// ================================================== - -template -inline typename property_map, T Bundle::*>::type -get(T Bundle::* p, subgraph& g) { - typedef typename property_map, T Bundle::*>::type Map; - return Map(&g, p); -} - -template -inline typename property_map, T Bundle::*>::const_type -get(T Bundle::* p, subgraph const& g) { - typedef typename property_map, T Bundle::*>::const_type Map; - return Map(&g, p); -} - -template -inline Type get(Type Bundle::* p, subgraph const& g, Key const& k) -{ return get(get(p, g), k); } - -template -inline void put(Type Bundle::* p, Graph& g, Key const& k, Value const& v) -{ put(get(p, g), k, v); } - -// ========================================================= -// Local bundled, get - -template -inline typename property_map< - subgraph, local_property ->::type -get(local_property p, subgraph& g) { - typedef typename property_map< - subgraph, local_property - >::type Map; return Map(&g, p.value); } -template -inline typename property_map< - subgraph, local_property ->::const_type -get(local_property p, subgraph const& g) { - typedef typename property_map< - subgraph, local_property - >::const_type Map; - return Map(&g, p.value); -} - -template -inline Type get(local_property p, subgraph const& g, - Key const& k) -{ return get(get(p, g), k); } - -// ========================================================= -// Global bundled, get - -template -inline typename property_map< - subgraph, global_property ->::type -get(global_property p, subgraph& g) { - typedef typename property_map< - subgraph, global_property - >::type Map; - return Map(&g, p.value); -} - -template -inline typename property_map< - subgraph, global_property ->::const_type -get(global_property p, subgraph const& g) { - typedef typename property_map< - subgraph, global_property - >::const_type Map; - return Map(&g, p.value); -} - -template -inline Type get(global_property p, subgraph const& g, - Key const& k) -{ return get(get(p, g), k); } - -#endif - template inline typename graph_property::type& get_property(subgraph& g, Tag tag) { diff --git a/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp b/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp index 2e7ebc97c..97ee89c44 100644 --- a/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp +++ b/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp @@ -64,7 +64,7 @@ namespace boost // basically modernized it to use real data structures (no more arrays and matrices). // Oh... and there's explicit control structures - not just gotos. // -// The problem is definitely NP-complete, an an unbounded implementation of this +// The problem is definitely NP-complete, an unbounded implementation of this // will probably run for quite a while on a large graph. The conclusions // of this paper also reference a Paton algorithm for undirected graphs as being // much more efficient (apparently based on spanning trees). Although not implemented, @@ -85,7 +85,7 @@ namespace boost // } /** - * The default cycle visitor providse an empty visit function for cycle + * The default cycle visitor provides an empty visit function for cycle * visitors. */ struct cycle_visitor @@ -168,7 +168,7 @@ namespace detail // conditions for allowing a traversal along this edge are: // 1. the index of v must be greater than that at which the - // the path is rooted (p.front()). + // path is rooted (p.front()). // 2. the vertex v cannot already be in the path // 3. the vertex v cannot be closed to the vertex u diff --git a/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp b/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp new file mode 100644 index 000000000..86d57ece0 --- /dev/null +++ b/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp @@ -0,0 +1,870 @@ +// Copyright (C) 2012, Michele Caini. +// 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) + +// Two Graphs Common Spanning Trees Algorithm +// Based on academic article of Mint, Read and Tarjan +// Efficient Algorithm for Common Spanning Tree Problem +// Electron. Lett., 28 April 1983, Volume 19, Issue 9, p.346-347 + + +#ifndef BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP +#define BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost +{ + + +namespace detail { + + + template + < + typename TreeMap, + typename PredMap, + typename DistMap, + typename LowMap, + typename Buffer + > + struct bridges_visitor: public default_dfs_visitor + { + bridges_visitor( + TreeMap tree, + PredMap pred, + DistMap dist, + LowMap low, + Buffer& buffer + ): mTree(tree), mPred(pred), mDist(dist), mLow(low), mBuffer(buffer) + { mNum = -1; } + + template + void initialize_vertex(const Vertex& u, const Graph& g) + { + put(mPred, u, u); + put(mDist, u, -1); + } + + template + void discover_vertex(const Vertex& u, const Graph& g) + { + put(mDist, u, ++mNum); + put(mLow, u, get(mDist, u)); + } + + template + void tree_edge(const Edge& e, const Graph& g) + { + put(mPred, target(e, g), source(e, g)); + put(mTree, target(e, g), e); + } + + template + void back_edge(const Edge& e, const Graph& g) + { + put(mLow, source(e, g), + (std::min)(get(mLow, source(e, g)), get(mDist, target(e, g)))); + } + + template + void finish_vertex(const Vertex& u, const Graph& g) + { + Vertex parent = get(mPred, u); + if(get(mLow, u) > get(mDist, parent)) + mBuffer.push(get(mTree, u)); + put(mLow, parent, + (std::min)(get(mLow, parent), get(mLow, u))); + } + + TreeMap mTree; + PredMap mPred; + DistMap mDist; + LowMap mLow; + Buffer& mBuffer; + int mNum; + }; + + + template + struct cycle_finder: public base_visitor< cycle_finder > + { + typedef on_back_edge event_filter; + cycle_finder(): mBuffer(0) { } + cycle_finder(Buffer* buffer) + : mBuffer(buffer) { } + template + void operator()(const Edge& e, const Graph& g) + { + if(mBuffer) + mBuffer->push(e); + } + Buffer* mBuffer; + }; + + + template + struct deleted_edge_status + { + deleted_edge_status() { } + deleted_edge_status(DeletedMap map): mMap(map) { } + template + bool operator()(const Edge& e) const + { return (!get(mMap, e)); } + DeletedMap mMap; + }; + + + template + struct inL_edge_status + { + inL_edge_status() { } + inL_edge_status(InLMap map): mMap(map) { } + template + bool operator()(const Edge& e) const + { return get(mMap, e); } + InLMap mMap; + }; + + + template < + typename Graph, + typename Func, + typename Seq, + typename Map + > + void rec_two_graphs_common_spanning_trees + ( + const Graph& iG, + bimap< + bimaps::set_of, + bimaps::set_of< typename graph_traits::edge_descriptor > + > iG_bimap, + Map aiG_inL, + Map diG, + const Graph& vG, + bimap< + bimaps::set_of, + bimaps::set_of< typename graph_traits::edge_descriptor > + > vG_bimap, + Map avG_inL, + Map dvG, + Func func, + Seq inL + ) + { + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::vertex_descriptor vertex_descriptor; + typedef typename GraphTraits::edge_descriptor edge_descriptor; + + typedef typename Seq::size_type seq_size_type; + + int edges = num_vertices(iG) - 1; +// +// [ Michele Caini ] +// +// Using the condition (edges != 0) leads to the accidental submission of +// sub-graphs ((V-1+1)-fake-tree, named here fat-tree). +// Remove this condition is a workaround for the problem of fat-trees. +// Please do not add that condition, even if it improves performance. +// +// Here is proposed the previous guard (that was wrong): +// for(seq_size_type i = 0; (i < inL.size()) && (edges != 0); ++i) +// + { + for(seq_size_type i = 0; i < inL.size(); ++i) + if(inL[i]) + --edges; + + if(edges < 0) + return; + } + + bool is_tree = (edges == 0); + if(is_tree) { + func(inL); + } else { + std::map vertex_color; + std::map edge_color; + + std::stack iG_buf, vG_buf; + bool found = false; + + seq_size_type m; + for(seq_size_type j = 0; j < inL.size() && !found; ++j) { + if(!inL[j] + && !get(diG, iG_bimap.left.at(j)) + && !get(dvG, vG_bimap.left.at(j))) + { + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(iG_buf.empty() && vG_buf.empty()) { + inL[j] = true; + found = true; + m = j; + } else { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + } + + if(found) { + + std::stack iG_buf_copy, vG_buf_copy; + for(seq_size_type j = 0; j < inL.size(); ++j) { + if(!inL[j] + && !get(diG, iG_bimap.left.at(j)) + && !get(dvG, vG_bimap.left.at(j))) + { + + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf)), + associative_property_map< std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf)), + associative_property_map< std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf.empty() || !vG_buf.empty()) { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(diG, iG_bimap.left.at(j), true); + put(dvG, vG_bimap.left.at(j), true); + iG_buf_copy.push(iG_bimap.left.at(j)); + vG_buf_copy.push(vG_bimap.left.at(j)); + } + + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + + // REC + detail::rec_two_graphs_common_spanning_trees + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + while(!iG_buf_copy.empty()) { + put(diG, iG_buf_copy.top(), false); + put(dvG, vG_bimap.left.at( + iG_bimap.right.at(iG_buf_copy.top())), false); + iG_buf_copy.pop(); + } + while(!vG_buf_copy.empty()) { + put(dvG, vG_buf_copy.top(), false); + put(diG, iG_bimap.left.at( + vG_bimap.right.at(vG_buf_copy.top())), false); + vG_buf_copy.pop(); + } + + inL[m] = false; + put(aiG_inL, iG_bimap.left.at(m), false); + put(avG_inL, vG_bimap.left.at(m), false); + + put(diG, iG_bimap.left.at(m), true); + put(dvG, vG_bimap.left.at(m), true); + + std::map tree_map; + std::map pred_map; + std::map dist_map, low_map; + + detail::bridges_visitor< + associative_property_map< + std::map + >, + associative_property_map< + std::map + >, + associative_property_map< std::map >, + associative_property_map< std::map >, + std::stack + > + iG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map< + std::map< vertex_descriptor, int> >(dist_map), + associative_property_map< + std::map< vertex_descriptor, int> >(low_map), + iG_buf + ), + vG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map< + std::map< vertex_descriptor, int> >(dist_map), + associative_property_map< + std::map< vertex_descriptor, int> >(low_map), + vG_buf + ); + + undirected_dfs(make_filtered_graph(iG, + detail::deleted_edge_status< associative_property_map< + std::map > >(diG)), + iG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs(make_filtered_graph(vG, + detail::deleted_edge_status< associative_property_map< + std::map > >(dvG)), + vG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + found = false; + std::stack iG_buf_tmp, vG_buf_tmp; + while(!iG_buf.empty() && !found) { + if(!inL[iG_bimap.right.at(iG_buf.top())]) { + put(aiG_inL, iG_buf.top(), true); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf_tmp.empty() || !vG_buf_tmp.empty()) { + found = true; + } else { + while(!iG_buf_tmp.empty()) iG_buf_tmp.pop(); + while(!vG_buf_tmp.empty()) vG_buf_tmp.pop(); + iG_buf_copy.push(iG_buf.top()); + } + + put(aiG_inL, iG_buf.top(), false); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), false); + } + iG_buf.pop(); + } + while(!vG_buf.empty() && !found) { + if(!inL[vG_bimap.right.at(vG_buf.top())]) { + put(avG_inL, vG_buf.top(), true); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf_tmp.empty() || !vG_buf_tmp.empty()) { + found = true; + } else { + while(!iG_buf_tmp.empty()) iG_buf_tmp.pop(); + while(!vG_buf_tmp.empty()) vG_buf_tmp.pop(); + vG_buf_copy.push(vG_buf.top()); + } + + put(avG_inL, vG_buf.top(), false); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), false); + } + vG_buf.pop(); + } + + if(!found) { + + while(!iG_buf_copy.empty()) { + inL[iG_bimap.right.at(iG_buf_copy.top())] = true; + put(aiG_inL, iG_buf_copy.top(), true); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf_copy.top())), true); + iG_buf.push(iG_buf_copy.top()); + iG_buf_copy.pop(); + } + while(!vG_buf_copy.empty()) { + inL[vG_bimap.right.at(vG_buf_copy.top())] = true; + put(avG_inL, vG_buf_copy.top(), true); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf_copy.top())), true); + vG_buf.push(vG_buf_copy.top()); + vG_buf_copy.pop(); + } + + // REC + detail::rec_two_graphs_common_spanning_trees< + Graph, Func, Seq, Map> + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + while(!iG_buf.empty()) { + inL[iG_bimap.right.at(iG_buf.top())] = false; + put(aiG_inL, iG_buf.top(), false); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), false); + iG_buf.pop(); + } + while(!vG_buf.empty()) { + inL[vG_bimap.right.at(vG_buf.top())] = false; + put(avG_inL, vG_buf.top(), false); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), false); + vG_buf.pop(); + } + + } + + put(diG, iG_bimap.left.at(m), false); + put(dvG, vG_bimap.left.at(m), false); + + } + } + } + +} // namespace detail + + + +template +struct tree_collector +{ + +public: + BOOST_CONCEPT_ASSERT((BackInsertionSequence)); + BOOST_CONCEPT_ASSERT((RandomAccessContainer)); + BOOST_CONCEPT_ASSERT((CopyConstructible)); + + typedef typename Coll::value_type coll_value_type; + typedef typename Seq::value_type seq_value_type; + + BOOST_STATIC_ASSERT((is_same::value)); + BOOST_STATIC_ASSERT((is_same::value)); + + tree_collector(Coll& seqs): mSeqs(seqs) { } + + inline void operator()(Seq seq) + { mSeqs.push_back(seq); } + +private: + Coll& mSeqs; + +}; + + + +template < + typename Graph, + typename Order, + typename Func, + typename Seq +> +BOOST_CONCEPT_REQUIRES( + ((RandomAccessContainer)) + ((IncidenceGraphConcept)) + ((UnaryFunction)) + ((Mutable_RandomAccessContainer)) + ((VertexAndEdgeListGraphConcept)), + (void) +) +two_graphs_common_spanning_trees + ( + const Graph& iG, + Order iG_map, + const Graph& vG, + Order vG_map, + Func func, + Seq inL + ) +{ + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::directed_category directed_category; + typedef typename GraphTraits::vertex_descriptor vertex_descriptor; + typedef typename GraphTraits::edge_descriptor edge_descriptor; + + typedef typename GraphTraits::edges_size_type edges_size_type; + typedef typename GraphTraits::edge_iterator edge_iterator; + + typedef typename Seq::const_iterator seq_const_iterator; + typedef typename Seq::difference_type seq_diff_type; + typedef typename Seq::value_type seq_value_type; + typedef typename Seq::size_type seq_size_type; + typedef typename Seq::iterator seq_iterator; + + typedef typename Order::const_iterator order_const_iterator; + typedef typename Order::difference_type order_diff_type; + typedef typename Order::value_type order_value_type; + typedef typename Order::size_type order_size_type; + typedef typename Order::iterator order_iterator; + + BOOST_STATIC_ASSERT((is_same::value)); + BOOST_CONCEPT_ASSERT((Convertible)); + + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((is_same::value)); + + BOOST_STATIC_ASSERT((is_same::value)); + + if(num_vertices(iG) != num_vertices(vG)) + return; + + if(inL.size() != num_edges(iG) + || inL.size() != num_edges(vG)) + return; + + if(iG_map.size() != num_edges(iG) + || vG_map.size() != num_edges(vG)) + return; + + typedef bimaps::bimap< + bimaps::set_of< int >, + bimaps::set_of< order_value_type > + > bimap_type; + typedef typename bimap_type::value_type bimap_value; + + bimap_type iG_bimap, vG_bimap; + for(order_size_type i = 0; i < iG_map.size(); ++i) + iG_bimap.insert(bimap_value(i, iG_map[i])); + for(order_size_type i = 0; i < vG_map.size(); ++i) + vG_bimap.insert(bimap_value(i, vG_map[i])); + + edge_iterator current, last; + boost::tuples::tie(current, last) = edges(iG); + for(; current != last; ++current) + if(iG_bimap.right.find(*current) == iG_bimap.right.end()) + return; + boost::tuples::tie(current, last) = edges(vG); + for(; current != last; ++current) + if(vG_bimap.right.find(*current) == vG_bimap.right.end()) + return; + + std::stack iG_buf, vG_buf; + + std::map tree_map; + std::map pred_map; + std::map dist_map, low_map; + + detail::bridges_visitor< + associative_property_map< + std::map + >, + associative_property_map< + std::map + >, + associative_property_map< std::map >, + associative_property_map< std::map >, + std::stack + > + iG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map >(dist_map), + associative_property_map >(low_map), + iG_buf + ), + vG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map >(dist_map), + associative_property_map >(low_map), + vG_buf + ); + + std::map vertex_color; + std::map edge_color; + + undirected_dfs(iG, iG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs(vG, vG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + while(!iG_buf.empty()) { + inL[iG_bimap.right.at(iG_buf.top())] = true; + iG_buf.pop(); + } + while(!vG_buf.empty()) { + inL[vG_bimap.right.at(vG_buf.top())] = true; + vG_buf.pop(); + } + + std::map iG_inL, vG_inL; + associative_property_map< std::map > + aiG_inL(iG_inL), avG_inL(vG_inL); + + for(seq_size_type i = 0; i < inL.size(); ++i) + { + if(inL[i]) { + put(aiG_inL, iG_bimap.left.at(i), true); + put(avG_inL, vG_bimap.left.at(i), true); + } else { + put(aiG_inL, iG_bimap.left.at(i), false); + put(avG_inL, vG_bimap.left.at(i), false); + } + } + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(iG_buf.empty() && vG_buf.empty()) { + + std::map iG_deleted, vG_deleted; + associative_property_map< std::map > diG(iG_deleted); + associative_property_map< std::map > dvG(vG_deleted); + + boost::tuples::tie(current, last) = edges(iG); + for(; current != last; ++current) + put(diG, *current, false); + boost::tuples::tie(current, last) = edges(vG); + for(; current != last; ++current) + put(dvG, *current, false); + + for(seq_size_type j = 0; j < inL.size(); ++j) { + if(!inL[j]) { + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf.empty() || !vG_buf.empty()) { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(diG, iG_bimap.left.at(j), true); + put(dvG, vG_bimap.left.at(j), true); + } + + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + + int cc = 0; + + std::map com_map; + cc += connected_components( + make_filtered_graph(iG, + detail::deleted_edge_status > >(diG)), + associative_property_map >(com_map) + ); + cc += connected_components( + make_filtered_graph(vG, + detail::deleted_edge_status > >(dvG)), + associative_property_map< std::map >(com_map) + ); + + if(cc != 2) + return; + + // REC + detail::rec_two_graphs_common_spanning_trees > > + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + } + +} + + +template < + typename Graph, + typename Func, + typename Seq +> +BOOST_CONCEPT_REQUIRES( + ((IncidenceGraphConcept)) + ((EdgeListGraphConcept)), + (void) +) +two_graphs_common_spanning_trees + ( + const Graph& iG, + const Graph& vG, + Func func, + Seq inL + ) +{ + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::edge_descriptor edge_descriptor; + typedef typename GraphTraits::edges_size_type edges_size_type; + typedef typename GraphTraits::edge_iterator edge_iterator; + + std::vector iGO, vGO; + edge_iterator curr, last; + + boost::tuples::tie(curr, last) = edges(iG); + for(; curr != last; ++curr) + iGO.push_back(*curr); + + boost::tuples::tie(curr, last) = edges(vG); + for(; curr != last; ++curr) + vGO.push_back(*curr); + + two_graphs_common_spanning_trees(iG, iGO, vG, vGO, func, inL); +} + + +} // namespace boost + + +#endif // BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP diff --git a/project/jni/boost/include/boost/graph/undirected_dfs.hpp b/project/jni/boost/include/boost/graph/undirected_dfs.hpp index df31d22b2..a3e1c038f 100644 --- a/project/jni/boost/include/boost/graph/undirected_dfs.hpp +++ b/project/jni/boost/include/boost/graph/undirected_dfs.hpp @@ -188,7 +188,7 @@ namespace boost { }; template <> - struct udfs_dispatch { + struct udfs_dispatch { template @@ -196,7 +196,7 @@ namespace boost { apply(const Graph& g, DFSVisitor vis, Vertex start_vertex, const bgl_named_params& params, EdgeColorMap edge_color, - detail::error_property_not_found) + param_not_found) { std::vector color_vec(num_vertices(g)); default_color_type c = white_color; // avoid warning about un-init @@ -219,8 +219,7 @@ namespace boost { undirected_dfs(const Graph& g, const bgl_named_params& params) { - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::udfs_dispatch::apply (g, choose_param(get_param(params, graph_visitor), diff --git a/project/jni/boost/include/boost/graph/undirected_graph.hpp b/project/jni/boost/include/boost/graph/undirected_graph.hpp index 3178b42af..5c000dc2a 100644 --- a/project/jni/boost/include/boost/graph/undirected_graph.hpp +++ b/project/jni/boost/include/boost/graph/undirected_graph.hpp @@ -7,14 +7,12 @@ #ifndef BOOST_GRAPH_UNDIRECTED_GRAPH_HPP #define BOOST_GRAPH_UNDIRECTED_GRAPH_HPP -#include #include #include - -// NOTE: The retag_property_list is used to "normalize" a proeprty such that -// any non-property conforming parameter is wrapped in a vertex_bundle -// property. For example (with bad syntax) retag> -> property, -// but retag -> property. +#include +#include +#include +#include namespace boost { @@ -38,25 +36,23 @@ template < class undirected_graph { public: - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProp graph_property_type; + typedef VertexProp vertex_property_type; + typedef EdgeProp edge_property_type; + typedef typename lookup_one_property::type graph_bundled; + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; - -private: +public: // Embed indices into the vertex type. - typedef property vertex_property; - typedef property edge_property; + typedef property internal_vertex_property; + typedef property internal_edge_property; public: typedef adjacency_list graph_type; private: @@ -159,7 +155,7 @@ public: { return make_index(boost::add_vertex(m_graph)); } vertex_descriptor add_vertex(vertex_property_type const& p) - { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + { return make_index(boost::add_vertex(internal_vertex_property(0u, p), m_graph)); } void clear_vertex(vertex_descriptor v) { std::pair @@ -196,7 +192,7 @@ public: std::pair add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) - { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + { return make_index(boost::add_edge(u, v, internal_edge_property(0u, p), m_graph)); } void remove_edge(vertex_descriptor u, vertex_descriptor v) { // find all edges, (u, v) @@ -530,36 +526,32 @@ remove_in_edge_if(typename UNDIRECTED_GRAPH::vertex_descriptor v, UNDIRECTED_GRAPH& g) { return remove_in_edge_if(v, pred, g.impl()); } -// Helper code for working with property maps -namespace detail { - struct undirected_graph_vertex_property_selector { - template - struct bind_ { - typedef typename UndirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; +template +struct property_map: property_map {}; - struct undirected_graph_edge_property_selector { - template - struct bind_ { - typedef typename UndirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; -} // namespace detail +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; -template <> -struct vertex_property_selector -{ typedef detail::undirected_graph_vertex_property_selector type; }; - -template <> -struct edge_property_selector -{ typedef detail::undirected_graph_edge_property_selector type; }; +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; // PropertyGraph concepts template @@ -572,6 +564,26 @@ inline typename property_map::const_type get(Property p, UNDIRECTED_GRAPH const& g) { return get(p, g.impl()); } +template +inline typename property_map::type +get(vertex_all_t, UNDIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::const_type +get(vertex_all_t, UNDIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::type +get(edge_all_t, UNDIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(edge_all, g.impl())); } + +template +inline typename property_map::const_type +get(edge_all_t, UNDIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(edge_all, g.impl())); } + template inline typename property_traits< typename property_map< @@ -581,10 +593,40 @@ inline typename property_traits< get(Property p, UNDIRECTED_GRAPH const& g, Key const& k) { return get(p, g.impl(), k); } +template +inline typename property_traits< + typename property_map< + typename UNDIRECTED_GRAPH::graph_type, vertex_all_t + >::const_type +>::value_type +get(vertex_all_t, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(vertex_all, g.impl(), k).m_base; } + +template +inline typename property_traits< + typename property_map< + typename UNDIRECTED_GRAPH::graph_type, edge_all_t + >::const_type +>::value_type +get(edge_all_t, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(edge_all, g.impl(), k).m_base; } + template inline void put(Property p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) { put(p, g.impl(), k, v); } +template +inline void put(vertex_all_t, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(vertex_all, g.impl(), k, + typename UNDIRECTED_GRAPH::internal_vertex_property(get(vertex_index, g.impl(), k), v)); +} + +template +inline void put(edge_all_t, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(edge_all, g.impl(), k, + typename UNDIRECTED_GRAPH::internal_vertex_property(get(edge_index, g.impl(), k), v)); +} + template inline typename graph_property::type& get_property(UNDIRECTED_GRAPH& g, Property p) @@ -599,36 +641,6 @@ template inline void set_property(UNDIRECTED_GRAPH& g, Property p, Value v) { return set_property(g.impl(), p, v); } -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -template -inline typename property_map::type -get(Type Bundle::* p, UNDIRECTED_GRAPH& g) { - typedef typename property_map< - UNDIRECTED_GRAPH, Type Bundle::* - >::type return_type; - return return_type(&g, p); -} - -template -inline typename property_map::const_type -get(Type Bundle::* p, UNDIRECTED_GRAPH const& g) { - typedef typename property_map< - UNDIRECTED_GRAPH, Type Bundle::* - >::const_type return_type; - return return_type(&g, p); -} - -template -inline Type -get(Type Bundle::* p, UNDIRECTED_GRAPH const& g, Key const& k) -{ return get(p, g.impl(), k); } - -template -inline void -put(Type Bundle::* p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) -{ put(p, g.impl(), k, v); } -#endif - // Indexed Vertex graph template diff --git a/project/jni/boost/include/boost/graph/vector_as_graph.hpp b/project/jni/boost/include/boost/graph/vector_as_graph.hpp index ee0df4bc9..7bc8ac380 100644 --- a/project/jni/boost/include/boost/graph/vector_as_graph.hpp +++ b/project/jni/boost/include/boost/graph/vector_as_graph.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -71,13 +72,14 @@ namespace boost { out_edge_iterator; typedef void in_edge_iterator; typedef void edge_iterator; - typedef typename integer_range::iterator vertex_iterator; + typedef counting_iterator vertex_iterator; typedef directed_tag directed_category; typedef allow_parallel_edge_tag edge_parallel_category; typedef vector_as_graph_traversal_tag traversal_category; typedef typename std::vector::size_type vertices_size_type; typedef void edges_size_type; typedef typename EdgeList::size_type degree_size_type; + static V null_vertex() {return V(-1);} }; template struct edge_property_type< std::vector > @@ -178,14 +180,11 @@ namespace boost { // source() and target() already provided for pairs in graph_traits.hpp template - std::pair - ::iterator, - typename boost::integer_range - ::iterator > + std::pair, + boost::counting_iterator > vertices(const std::vector& v) { - typedef typename boost::integer_range - ::iterator Iter; + typedef boost::counting_iterator Iter; return std::make_pair(Iter(0), Iter(v.size())); } diff --git a/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp b/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp new file mode 100755 index 000000000..89784dfe4 --- /dev/null +++ b/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp @@ -0,0 +1,1125 @@ +//======================================================================= +// Copyright (C) 2012 Flavio De Lorenzi (fdlorenzi@gmail.com) +// +// The algorithm implemented here is derived from original ideas by +// Pasquale Foggia and colaborators. For further information see +// e.g. Cordella et al. 2001, 2004. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef BOOST_VF2_SUB_GRAPH_ISO_HPP +#define BOOST_VF2_SUB_GRAPH_ISO_HPP + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include // for always_equivalent +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_GRAPH_ITERATION_MACROS_HPP +#define BOOST_ISO_INCLUDED_ITER_MACROS // local macro, see bottom of file +#include +#endif + +namespace boost { + + // Default print_callback + template + struct vf2_print_callback { + + vf2_print_callback(const Graph1& graph1, const Graph2& graph2) + : graph1_(graph1), graph2_(graph2) {} + + template + bool operator()(CorrespondenceMap1To2 f, CorrespondenceMap2To1) const { + + // Print (sub)graph isomorphism map + BGL_FORALL_VERTICES_T(v, graph1_, Graph1) + std::cout << '(' << get(vertex_index_t(), graph1_, v) << ", " + << get(vertex_index_t(), graph1_, get(f, v)) << ") "; + + std::cout << std::endl; + + return true; + } + + private: + const Graph1& graph1_; + const Graph2& graph2_; + }; + + namespace detail { + + // State associated with a single graph (graph_this) + template + class base_state { + + typedef typename graph_traits::vertex_descriptor vertex_this_type; + typedef typename graph_traits::vertex_descriptor vertex_other_type; + + typedef typename graph_traits::vertices_size_type size_type; + + const GraphThis& graph_this_; + const GraphOther& graph_other_; + + IndexMapThis index_map_this_; + IndexMapOther index_map_other_; + + std::vector core_vec_; + typedef iterator_property_map::iterator, + IndexMapThis, vertex_other_type, + vertex_other_type&> core_map_type; + core_map_type core_; + + std::vector in_vec_, out_vec_; + typedef iterator_property_map::iterator, + IndexMapThis, size_type, size_type&> in_out_map_type; + in_out_map_type in_, out_; + + size_type term_in_count_, term_out_count_, term_both_count_, core_count_; + + // Forbidden + base_state(const base_state&); + base_state& operator=(const base_state&); + + public: + + base_state(const GraphThis& graph_this, const GraphOther& graph_other, + IndexMapThis index_map_this, IndexMapOther index_map_other) + : graph_this_(graph_this), graph_other_(graph_other), + index_map_this_(index_map_this), index_map_other_(index_map_other), + term_in_count_(0), term_out_count_(0), term_both_count_(0), core_count_(0) { + + core_vec_.resize(num_vertices(graph_this_), graph_traits::null_vertex()); + core_ = make_iterator_property_map(core_vec_.begin(), index_map_this_); + + in_vec_.resize(num_vertices(graph_this_), 0); + in_ = make_iterator_property_map(in_vec_.begin(), index_map_this_); + + out_vec_.resize(num_vertices(graph_this_), 0); + out_ = make_iterator_property_map(out_vec_.begin(), index_map_this_); + } + + // Adds a vertex pair to the state of graph graph_this + void push(const vertex_this_type& v_this, const vertex_other_type& v_other) { + + ++core_count_; + + put(core_, v_this, v_other); + + if (!get(in_, v_this)) { + put(in_, v_this, core_count_); + ++term_in_count_; + if (get(out_, v_this)) + ++term_both_count_; + } + + if (!get(out_, v_this)) { + put(out_, v_this, core_count_); + ++term_out_count_; + if (get(in_, v_this)) + ++term_both_count_; + } + + BGL_FORALL_INEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = source(e, graph_this_); + if (!get(in_, w)) { + put(in_, w, core_count_); + ++term_in_count_; + if (get(out_, w)) + ++term_both_count_; + } + } + + BGL_FORALL_OUTEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = target(e, graph_this_); + if (!get(out_, w)) { + put(out_, w, core_count_); + ++term_out_count_; + if (get(in_, w)) + ++term_both_count_; + } + } + + } + + // Removes vertex pair from state of graph_this + void pop(const vertex_this_type& v_this, const vertex_other_type&) { + + if (!core_count_) return; + + if (get(in_, v_this) == core_count_) { + put(in_, v_this, 0); + --term_in_count_; + if (get(out_, v_this)) + --term_both_count_; + } + + BGL_FORALL_INEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = source(e, graph_this_); + if (get(in_, w) == core_count_) { + put(in_, w, 0); + --term_in_count_; + if (get(out_, w)) + --term_both_count_; + } + } + + if (get(out_, v_this) == core_count_) { + put(out_, v_this, 0); + --term_out_count_; + if (get(in_, v_this)) + --term_both_count_; + } + + BGL_FORALL_OUTEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = target(e, graph_this_); + if (get(out_, w) == core_count_) { + put(out_, w, 0); + --term_out_count_; + if (get(in_, w)) + --term_both_count_; + } + } + put(core_, v_this, graph_traits::null_vertex()); + + --core_count_; + + } + + // Returns true if the in-terminal set is not empty + bool term_in() const { + return core_count_ < term_in_count_ ; + } + + // Returns true if vertex belongs to the in-terminal set + bool term_in(const vertex_this_type& v) const { + return (get(in_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true if the out-terminal set is not empty + bool term_out() const { + return core_count_ < term_out_count_; + } + + // Returns true if vertex belongs to the out-terminal set + bool term_out(const vertex_this_type& v) const { + return (get(out_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true of both (in- and out-terminal) sets are not empty + bool term_both() const { + return core_count_ < term_both_count_; + } + + // Returns true if vertex belongs to both (in- and out-terminal) sets + bool term_both(const vertex_this_type& v) const { + return (get(in_, v) > 0) && (get(out_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true if vertex belongs to the core map, i.e. it is in the + // present mapping + bool in_core(const vertex_this_type& v) const { + return get(core_, v) != graph_traits::null_vertex(); + } + + // Returns the number of vertices in the mapping + size_type count() const { + return core_count_; + } + + // Returns the image (in graph_other) of vertex v (in graph_this) + vertex_other_type core(const vertex_this_type& v) const { + return get(core_, v); + } + + // Returns the mapping + core_map_type get_map() const { + return core_; + } + + // Returns the "time" (or depth) when vertex was added to the in-terminal set + size_type in_depth(const vertex_this_type& v) const { + return get(in_, v); + } + + // Returns the "time" (or depth) when vertex was added to the out-terminal set + size_type out_depth(const vertex_this_type& v) const { + return get(out_, v); + } + + // Returns the terminal set counts + boost::tuple + term_set() const { + return boost::make_tuple(term_in_count_, term_out_count_, + term_both_count_); + } + + }; + + + // Function object that checks whether a valid edge + // exists. For multi-graphs matched edges are excluded + template + struct equivalent_edge_exists { + typedef typename boost::graph_traits::edge_descriptor edge_type; + + BOOST_CONCEPT_ASSERT(( LessThanComparable )); + + template + bool operator()(typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + EdgePredicate is_valid_edge, const Graph& g) { + + BGL_FORALL_OUTEDGES_T(s, e, g, Graph) { + if ((target(e, g) == t) && is_valid_edge(e) && + (matched_edges_.find(e) == matched_edges_.end())) { + matched_edges_.insert(e); + return true; + } + } + + return false; + } + + private: + + std::set matched_edges_; + }; + + template + struct equivalent_edge_exists >::type> { + template + bool operator()(typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + EdgePredicate is_valid_edge, const Graph& g) { + + typename graph_traits::edge_descriptor e; + bool found; + boost::tie(e, found) = edge(s, t, g); + if (!found) + return false; + else if (is_valid_edge(e)) + return true; + + return false; + } + + }; + + + // Generates a predicate for edge e1 given a binary predicate and a + // fixed edge e2 + template + struct edge1_predicate { + + edge1_predicate(EdgeEquivalencePredicate edge_comp, + typename graph_traits::edge_descriptor e2) + : edge_comp_(edge_comp), e2_(e2) {} + + bool operator()(typename graph_traits::edge_descriptor e1) { + return edge_comp_(e1, e2_); + } + + EdgeEquivalencePredicate edge_comp_; + typename graph_traits::edge_descriptor e2_; + }; + + + // Generates a predicate for edge e2 given given a binary predicate and a + // fixed edge e1 + template + struct edge2_predicate { + + edge2_predicate(EdgeEquivalencePredicate edge_comp, + typename graph_traits::edge_descriptor e1) + : edge_comp_(edge_comp), e1_(e1) {} + + bool operator()(typename graph_traits::edge_descriptor e2) { + return edge_comp_(e1_, e2); + } + + EdgeEquivalencePredicate edge_comp_; + typename graph_traits::edge_descriptor e1_; + }; + + + enum problem_selector { subgraph_iso, isomorphism }; + + // The actual state associated with both graphs + template + class state { + + typedef typename graph_traits::vertex_descriptor vertex1_type; + typedef typename graph_traits::vertex_descriptor vertex2_type; + + typedef typename graph_traits::edge_descriptor edge1_type; + typedef typename graph_traits::edge_descriptor edge2_type; + + typedef typename graph_traits::vertices_size_type graph1_size_type; + typedef typename graph_traits::vertices_size_type graph2_size_type; + + const Graph1& graph1_; + const Graph2& graph2_; + + IndexMap1 index_map1_; + + EdgeEquivalencePredicate edge_comp_; + VertexEquivalencePredicate vertex_comp_; + + base_state state1_; + base_state state2_; + + // Two helper functions used in Feasibility and Valid functions to test + // terminal set counts when testing for: + // - graph sub-graph isomorphism, or + inline bool comp_term_sets(graph1_size_type a, + graph2_size_type b, + boost::mpl::int_) const { + return a <= b; + } + + // - graph isomorphism + inline bool comp_term_sets(graph1_size_type a, + graph2_size_type b, + boost::mpl::int_) const { + return a == b; + } + + // Forbidden + state(const state&); + state& operator=(const state&); + + public: + + state(const Graph1& graph1, const Graph2& graph2, + IndexMap1 index_map1, IndexMap2 index_map2, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) + : graph1_(graph1), graph2_(graph2), + index_map1_(index_map1), + edge_comp_(edge_comp), vertex_comp_(vertex_comp), + state1_(graph1, graph2, index_map1, index_map2), + state2_(graph2, graph1, index_map2, index_map1) {} + + // Add vertex pair to the state + void push(const vertex1_type& v, const vertex2_type& w) { + state1_.push(v, w); + state2_.push(w, v); + } + + // Remove vertex pair from state + void pop(const vertex1_type& v, const vertex2_type&) { + vertex2_type w = state1_.core(v); + state1_.pop(v, w); + state2_.pop(w, v); + } + + // Checks the feasibility of a new vertex pair + bool feasible(const vertex1_type& v_new, const vertex2_type& w_new) { + + if (!vertex_comp_(v_new, w_new)) return false; + + // graph1 + graph1_size_type term_in1_count = 0, term_out1_count = 0, rest1_count = 0; + + { + equivalent_edge_exists edge2_exists; + + BGL_FORALL_INEDGES_T(v_new, e1, graph1_, Graph1) { + vertex1_type v = source(e1, graph1_); + + if (state1_.in_core(v) || (v == v_new)) { + vertex2_type w = w_new; + if (v != v_new) + w = state1_.core(v); + if (!edge2_exists(w, w_new, + edge2_predicate(edge_comp_, e1), + graph2_)) + return false; + + } else { + if (0 < state1_.in_depth(v)) + ++term_in1_count; + if (0 < state1_.out_depth(v)) + ++term_out1_count; + if ((state1_.in_depth(v) == 0) && (state1_.out_depth(v) == 0)) + ++rest1_count; + } + } + } + + { + equivalent_edge_exists edge2_exists; + + BGL_FORALL_OUTEDGES_T(v_new, e1, graph1_, Graph1) { + vertex1_type v = target(e1, graph1_); + if (state1_.in_core(v) || (v == v_new)) { + vertex2_type w = w_new; + if (v != v_new) + w = state1_.core(v); + + if (!edge2_exists(w_new, w, + edge2_predicate(edge_comp_, e1), + graph2_)) + return false; + + } else { + if (0 < state1_.in_depth(v)) + ++term_in1_count; + if (0 < state1_.out_depth(v)) + ++term_out1_count; + if ((state1_.in_depth(v) == 0) && (state1_.out_depth(v) == 0)) + ++rest1_count; + } + } + } + + // graph2 + graph2_size_type term_out2_count = 0, term_in2_count = 0, rest2_count = 0; + + { + equivalent_edge_exists edge1_exists; + + BGL_FORALL_INEDGES_T(w_new, e2, graph2_, Graph2) { + vertex2_type w = source(e2, graph2_); + if (state2_.in_core(w) || (w == w_new)) { + vertex1_type v = v_new; + if (w != w_new) + v = state2_.core(w); + + if (!edge1_exists(v, v_new, + edge1_predicate(edge_comp_, e2), + graph1_)) + return false; + + } else { + if (0 < state2_.in_depth(w)) + ++term_in2_count; + if (0 < state2_.out_depth(w)) + ++term_out2_count; + if ((state2_.in_depth(w) == 0) && (state2_.out_depth(w) == 0)) + ++rest2_count; + } + } + } + + { + equivalent_edge_exists edge1_exists; + + BGL_FORALL_OUTEDGES_T(w_new, e2, graph2_, Graph2) { + vertex2_type w = target(e2, graph2_); + if (state2_.in_core(w) || (w == w_new)) { + vertex1_type v = v_new; + if (w != w_new) + v = state2_.core(w); + + if (!edge1_exists(v_new, v, + edge1_predicate(edge_comp_, e2), + graph1_)) + return false; + + } else { + if (0 < state2_.in_depth(w)) + ++term_in2_count; + if (0 < state2_.out_depth(w)) + ++term_out2_count; + if ((state2_.in_depth(w) == 0) && (state2_.out_depth(w) == 0)) + ++rest2_count; + } + } + } + + return comp_term_sets(term_in1_count, term_in2_count, + boost::mpl::int_()) && + comp_term_sets(term_out1_count, term_out2_count, + boost::mpl::int_()) && + comp_term_sets(rest1_count, rest2_count, + boost::mpl::int_()); + } + + // Returns true if vertex v in graph1 is a possible candidate to + // be added to the current state + bool possible_candidate1(const vertex1_type& v) const { + if (state1_.term_both() && state2_.term_both()) + return state1_.term_both(v); + else if (state1_.term_out() && state2_.term_out()) + return state1_.term_out(v); + else if (state1_.term_in() && state2_.term_in()) + return state1_.term_in(v); + else + return !state1_.in_core(v); + } + + // Returns true if vertex w in graph2 is a possible candidate to + // be added to the current state + bool possible_candidate2(const vertex2_type& w) const { + if (state1_.term_both() && state2_.term_both()) + return state2_.term_both(w); + else if (state1_.term_out() && state2_.term_out()) + return state2_.term_out(w); + else if (state1_.term_in() && state2_.term_in()) + return state2_.term_in(w); + else + return !state2_.in_core(w); + } + + // Returns true if a mapping was found + bool success() const { + return state1_.count() == num_vertices(graph1_); + } + + // Returns true if a state is valid + bool valid() const { + boost::tuple term1; + boost::tuple term2; + + term1 = state1_.term_set(); + term2 = state2_.term_set(); + + return comp_term_sets(boost::get<0>(term1), boost::get<0>(term2), + boost::mpl::int_()) && + comp_term_sets(boost::get<1>(term1), boost::get<1>(term2), + boost::mpl::int_()) && + comp_term_sets(boost::get<2>(term1), boost::get<2>(term2), + boost::mpl::int_()); + } + + // Calls the user_callback with a graph (sub)graph mapping + bool call_back(SubGraphIsoMapCallback user_callback) const { + return user_callback(state1_.get_map(), state2_.get_map()); + } + + }; + + + // Data structure to keep info used for back tracking during + // matching process + template + struct vf2_match_continuation { + typename VertexOrder1::const_iterator graph1_verts_iter; + typename graph_traits::vertex_iterator graph2_verts_iter; + }; + + // Non-recursive method that explores state space using a depth-first + // search strategy. At each depth possible pairs candidate are compute + // and tested for feasibility to extend the mapping. If a complete + // mapping is found, the mapping is output to user_callback in the form + // of a correspondence map (graph1 to graph2). Returning false from the + // user_callback will terminate the search. Function match will return + // true if the entire search space was explored. + template + bool match(const Graph1& graph1, const Graph2& graph2, + SubGraphIsoMapCallback user_callback, const VertexOrder1& vertex_order1, + state& s) { + + typename VertexOrder1::const_iterator graph1_verts_iter; + + typedef typename graph_traits::vertex_iterator vertex2_iterator_type; + vertex2_iterator_type graph2_verts_iter, graph2_verts_iter_end; + + typedef vf2_match_continuation match_continuation_type; + std::vector k; + + recur: + if (s.success()) { + if (!s.call_back(user_callback)) + return false; + + goto back_track; + } + + if (!s.valid()) + goto back_track; + + graph1_verts_iter = vertex_order1.begin(); + while (graph1_verts_iter != vertex_order1.end() && + !s.possible_candidate1(*graph1_verts_iter)) { + ++graph1_verts_iter; + } + + boost::tie(graph2_verts_iter, graph2_verts_iter_end) = vertices(graph2); + while (graph2_verts_iter != graph2_verts_iter_end) { + if (s.possible_candidate2(*graph2_verts_iter)) { + if (s.feasible(*graph1_verts_iter, *graph2_verts_iter)) { + match_continuation_type kk; + kk.graph1_verts_iter = graph1_verts_iter; + kk.graph2_verts_iter = graph2_verts_iter; + k.push_back(kk); + + s.push(*graph1_verts_iter, *graph2_verts_iter); + goto recur; + } + } + graph2_loop: ++graph2_verts_iter; + } + + back_track: + if (k.empty()) + return true; + + const match_continuation_type kk = k.back(); + graph1_verts_iter = kk.graph1_verts_iter; + graph2_verts_iter = kk.graph2_verts_iter; + k.pop_back(); + + s.pop(*graph1_verts_iter, *graph2_verts_iter); + + goto graph2_loop; + } + + + // Used to sort nodes by in/out degrees + template + struct vertex_in_out_degree_cmp { + typedef typename graph_traits::vertex_descriptor vertex_type; + + vertex_in_out_degree_cmp(const Graph& graph) + : graph_(graph) {} + + bool operator()(const vertex_type& v, const vertex_type& w) const { + // lexicographical comparison + return std::make_pair(in_degree(v, graph_), out_degree(v, graph_)) < + std::make_pair(in_degree(w, graph_), out_degree(w, graph_)); + } + + const Graph& graph_; + }; + + + // Used to sort nodes by multiplicity of in/out degrees + template + struct vertex_frequency_degree_cmp { + typedef typename graph_traits::vertex_descriptor vertex_type; + + vertex_frequency_degree_cmp(const Graph& graph, FrequencyMap freq) + : graph_(graph), freq_(freq) {} + + bool operator()(const vertex_type& v, const vertex_type& w) const { + // lexicographical comparison + return std::make_pair(freq_[v], in_degree(v, graph_)+out_degree(v, graph_)) < + std::make_pair(freq_[w], in_degree(w, graph_)+out_degree(w, graph_)); + } + + const Graph& graph_; + FrequencyMap freq_; + }; + + + // Sorts vertices of a graph by multiplicity of in/out degrees + template + void sort_vertices(const Graph& graph, IndexMap index_map, VertexOrder& order) { + typedef typename graph_traits::vertices_size_type size_type; + + boost::range::sort(order, vertex_in_out_degree_cmp(graph)); + + std::vector freq_vec(num_vertices(graph), 0); + typedef iterator_property_map::iterator, + IndexMap, size_type, size_type&> frequency_map_type; + + frequency_map_type freq = make_iterator_property_map(freq_vec.begin(), index_map); + + typedef typename VertexOrder::iterator order_iterator; + + for (order_iterator order_iter = order.begin(); order_iter != order.end(); ) { + size_type count = 0; + for (order_iterator count_iter = order_iter; + (count_iter != order.end()) && + (in_degree(*order_iter, graph) == in_degree(*count_iter, graph)) && + (out_degree(*order_iter, graph) == out_degree(*count_iter, graph)); + ++count_iter) + ++count; + + for (size_type i = 0; i < count; ++i) { + freq[*order_iter] = count; + ++order_iter; + } + } + + boost::range::sort(order, vertex_frequency_degree_cmp(graph, freq)); + + } + + } // namespace detail + + + // Returns vertex order (vertices sorted by multiplicity of in/out degrees) + template + std::vector::vertex_descriptor> + vertex_order_by_mult(const Graph& graph) { + + std::vector::vertex_descriptor> vertex_order; + std::copy(vertices(graph).first, vertices(graph).second, std::back_inserter(vertex_order)); + + detail::sort_vertices(graph, get(vertex_index, graph), vertex_order); + return vertex_order; + } + + + // Enumerates all graph sub-graph isomorphism mappings between graphs + // graph_small and graph_large. Continues until user_callback returns true or the + // search space has been fully explored. + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback, + IndexMapSmall index_map_small, IndexMapLarge index_map_large, + const VertexOrderSmall& vertex_order_small, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + // Graph requirements + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + typedef typename graph_traits::vertex_descriptor vertex_small_type; + typedef typename graph_traits::vertex_descriptor vertex_large_type; + + typedef typename graph_traits::vertices_size_type size_type_small; + typedef typename graph_traits::vertices_size_type size_type_large; + + // Property map requirements + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMapSmallValue; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMapLargeValue; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + // Edge & vertex requirements + typedef typename graph_traits::edge_descriptor edge_small_type; + typedef typename graph_traits::edge_descriptor edge_large_type; + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + // Vertex order requirements + BOOST_CONCEPT_ASSERT(( ContainerConcept )); + typedef typename VertexOrderSmall::value_type order_value_type; + BOOST_STATIC_ASSERT(( is_same::value )); + BOOST_ASSERT( num_vertices(graph_small) == vertex_order_small.size() ); + + if (num_vertices(graph_small) > num_vertices(graph_large)) + return false; + + typename graph_traits::edges_size_type num_edges_small = num_edges(graph_small); + typename graph_traits::edges_size_type num_edges_large = num_edges(graph_large); + + // Double the number of edges for undirected graphs: each edge counts as + // in-edge and out-edge + if (is_undirected(graph_small)) num_edges_small *= 2; + if (is_undirected(graph_large)) num_edges_large *= 2; + if (num_edges_small > num_edges_large) + return false; + + if ((num_vertices(graph_small) == 0) && (num_vertices(graph_large) == 0)) + return true; + + detail::state + s(graph_small, graph_large, index_map_small, index_map_large, edge_comp, vertex_comp); + + return detail::match(graph_small, graph_large, user_callback, vertex_order_small, s); + } + + + // All default interface for vf2_subgraph_iso + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback) { + + typedef typename graph_traits::vertex_descriptor vertex_small_type; + + return vf2_subgraph_iso(graph_small, graph_large, user_callback, + get(vertex_index, graph_small), get(vertex_index, graph_large), + vertex_order_by_mult(graph_small), + always_equivalent(), always_equivalent()); + } + + + // Named parameter interface of vf2_subgraph_iso + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback, + const VertexOrderSmall& vertex_order_small, + const bgl_named_params& params) { + + return vf2_subgraph_iso(graph_small, graph_large, user_callback, + choose_const_pmap(get_param(params, vertex_index1), + graph_small, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph_large, vertex_index), + vertex_order_small, + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()) + ); + + } + + + // Enumerates all isomorphism mappings between graphs graph1_ and graph2_. + // Continues until user_callback returns true or the search space has been + // fully explored. + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback, + IndexMap1 index_map1, IndexMap2 index_map2, + const VertexOrder1& vertex_order1, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + // Graph requirements + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + + typedef typename graph_traits::vertex_descriptor vertex1_type; + typedef typename graph_traits::vertex_descriptor vertex2_type; + + typedef typename graph_traits::vertices_size_type size_type1; + typedef typename graph_traits::vertices_size_type size_type2; + + // Property map requirements + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMap1Value; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMap2Value; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + // Edge & vertex requirements + typedef typename graph_traits::edge_descriptor edge1_type; + typedef typename graph_traits::edge_descriptor edge2_type; + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + // Vertex order requirements + BOOST_CONCEPT_ASSERT(( ContainerConcept )); + typedef typename VertexOrder1::value_type order_value_type; + BOOST_STATIC_ASSERT(( is_same::value )); + BOOST_ASSERT( num_vertices(graph1) == vertex_order1.size() ); + + if (num_vertices(graph1) != num_vertices(graph2)) + return false; + + typename graph_traits::edges_size_type num_edges1 = num_edges(graph1); + typename graph_traits::edges_size_type num_edges2 = num_edges(graph2); + + // Double the number of edges for undirected graphs: each edge counts as + // in-edge and out-edge + if (is_undirected(graph1)) num_edges1 *= 2; + if (is_undirected(graph2)) num_edges2 *= 2; + if (num_edges1 != num_edges2) + return false; + + if ((num_vertices(graph1) == 0) && (num_vertices(graph2) == 0)) + return true; + + detail::state + s(graph1, graph2, index_map1, index_map2, edge_comp, vertex_comp); + + return detail::match(graph1, graph2, user_callback, vertex_order1, s); + } + + + // All default interface for vf2_graph_iso + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback) { + + typedef typename graph_traits::vertex_descriptor vertex1_type; + + return vf2_graph_iso(graph1, graph2, user_callback, + get(vertex_index, graph1), get(vertex_index, graph2), + vertex_order_by_mult(graph1), + always_equivalent(), always_equivalent()); + } + + + // Named parameter interface of vf2_graph_iso + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback, + const VertexOrder1& vertex_order1, + const bgl_named_params& params) { + + return vf2_graph_iso(graph1, graph2, user_callback, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + vertex_order1, + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()) + ); + + } + + + // Verifies a graph (sub)graph isomorphism map + template + inline bool verify_vf2_subgraph_iso(const Graph1& graph1, const Graph2& graph2, + const CorresponenceMap1To2 f, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + detail::equivalent_edge_exists edge2_exists; + + BGL_FORALL_EDGES_T(e1, graph1, Graph1) { + typename graph_traits::vertex_descriptor s1, t1; + typename graph_traits::vertex_descriptor s2, t2; + + s1 = source(e1, graph1); t1 = target(e1, graph1); + s2 = get(f, s1); t2 = get(f, t1); + + if (!vertex_comp(s1, s2) || !vertex_comp(t1, t2)) + return false; + + typename graph_traits::edge_descriptor e2; + + if (!edge2_exists(s2, t2, + detail::edge2_predicate(edge_comp, e1), + graph2)) + return false; + + } + + return true; + } + + // Variant of verify_subgraph_iso with all default parameters + template + inline bool verify_vf2_subgraph_iso(const Graph1& graph1, const Graph2& graph2, + const CorresponenceMap1To2 f) { + return verify_vf2_subgraph_iso(graph1, graph2, f, + always_equivalent(), always_equivalent()); + } + + + +} // namespace boost + +#ifdef BOOST_ISO_INCLUDED_ITER_MACROS +#undef BOOST_ISO_INCLUDED_ITER_MACROS +#include +#endif + +#endif // BOOST_VF2_SUB_GRAPH_ISO_HPP diff --git a/project/jni/boost/include/boost/graph/visitors.hpp b/project/jni/boost/include/boost/graph/visitors.hpp index f986c96ce..d10e140c7 100644 --- a/project/jni/boost/include/boost/graph/visitors.hpp +++ b/project/jni/boost/include/boost/graph/visitors.hpp @@ -269,7 +269,7 @@ namespace boost { {} template - void operator() (VertexOrEdge v, const Graph& g) + void operator() (VertexOrEdge v, const Graph&) { put (property_map_, v, value_); } @@ -292,7 +292,7 @@ namespace boost { inline property_put put_property (PropertyMap property_map, typename property_traits ::value_type value, - EventTag tag) + EventTag) { return property_put (property_map, value); } diff --git a/project/jni/boost/include/boost/heap/binomial_heap.hpp b/project/jni/boost/include/boost/heap/binomial_heap.hpp index 742754f68..4ffe89dfd 100644 --- a/project/jni/boost/include/boost/heap/binomial_heap.hpp +++ b/project/jni/boost/include/boost/heap/binomial_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_BINOMIAL_HEAP_HPP #include +#include #include #include @@ -61,7 +62,11 @@ struct make_binomial_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + type(type const & rhs): + base_type(rhs), allocator_type(rhs) + {} + type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) @@ -145,6 +150,7 @@ private: typedef typename base_maker::compare_argument value_compare; typedef typename base_maker::allocator_type allocator_type; + typedef typename base_maker::node_type node; typedef typename allocator_type::pointer node_pointer; typedef typename allocator_type::const_pointer const_node_pointer; @@ -240,7 +246,7 @@ public: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) binomial_heap(binomial_heap && rhs): super_t(std::move(rhs)), top_element(rhs.top_element) @@ -348,7 +354,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -523,7 +529,7 @@ public: rhs.set_size(0); rhs.top_element = NULL; - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -569,7 +575,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(&*it); + node_type * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /// \copydoc boost::heap::priority_queue::value_comp diff --git a/project/jni/boost/include/boost/heap/d_ary_heap.hpp b/project/jni/boost/include/boost/heap/d_ary_heap.hpp index 6a9cc8f33..f84fdd783 100644 --- a/project/jni/boost/include/boost/heap/d_ary_heap.hpp +++ b/project/jni/boost/include/boost/heap/d_ary_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_D_ARY_HEAP_HPP #include +#include #include #include @@ -32,16 +33,11 @@ namespace boost { namespace heap { namespace detail { -template struct nop_index_updater { - void operator()(T &, std::size_t) const + template + static void run(T &, std::size_t) {} - - template - struct rebind { - typedef nop_index_updater other; - }; }; typedef parameter::parameters, @@ -69,7 +65,7 @@ class d_ary_heap: typedef std::vector container_type; typedef typename container_type::const_iterator container_iterator; - typedef typename IndexUpdater::template rebind::other index_updater; + typedef IndexUpdater index_updater; container_type q_; @@ -159,7 +155,7 @@ public: super_t(rhs), q_(rhs.q_) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES d_ary_heap(d_ary_heap && rhs): super_t(std::move(rhs)), q_(std::move(rhs.q_)) {} @@ -217,7 +213,7 @@ public: siftup(q_.size() - 1); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void emplace(Args&&... args) { @@ -279,7 +275,7 @@ private: void reset_index(size_type index, size_type new_index) { BOOST_HEAP_ASSERT(index < q_.size()); - index_updater()(q_[index], new_index); + index_updater::run(q_[index], new_index); } void siftdown(size_type index) @@ -355,7 +351,7 @@ private: typedef typename container_type::const_iterator container_iterator; const size_t first_index = first_child_index(index); - const size_type last_index = std::min(first_index + D - 1, size() - 1); + const size_type last_index = (std::min)(first_index + D - 1, size() - 1); return last_index; } @@ -423,8 +419,8 @@ struct select_dary_heap static const bool is_mutable = extract_mutable::value; typedef typename mpl::if_c< is_mutable, - priority_queue_mutable_wrapper > >, - d_ary_heap > + priority_queue_mutable_wrapper >, + d_ary_heap >::type type; }; @@ -528,7 +524,7 @@ public: super_t(rhs) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) d_ary_heap(d_ary_heap && rhs): super_t(std::move(rhs)) @@ -591,7 +587,7 @@ public: return super_t::push(v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /// \copydoc boost::heap::priority_queue::emplace template typename mpl::if_c::type emplace(Args&&... args) @@ -753,7 +749,7 @@ public: static handle_type s_handle_from_iterator(iterator const & it) { BOOST_STATIC_ASSERT(is_mutable); - return super_t::handle_type(it); + return super_t::s_handle_from_iterator(it); } /// \copydoc boost::heap::priority_queue::pop @@ -769,13 +765,25 @@ public: } /// \copydoc boost::heap::priority_queue::begin - iterator begin(void) const + const_iterator begin(void) const + { + return super_t::begin(); + } + + /// \copydoc boost::heap::priority_queue::begin + iterator begin(void) { return super_t::begin(); } /// \copydoc boost::heap::priority_queue::end - iterator end(void) const + iterator end(void) + { + return super_t::end(); + } + + /// \copydoc boost::heap::priority_queue::end + const_iterator end(void) const { return super_t::end(); } diff --git a/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp b/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp index 557f89229..ca465ebce 100644 --- a/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp +++ b/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp @@ -141,8 +141,8 @@ bool heap_equality(Heap1 const & lhs, Heap2 const & rhs) heap_equivalence_copy >::type equivalence_check; - equivalence_check check; - return check(lhs, rhs); + equivalence_check eq_check; + return eq_check(lhs, rhs); } @@ -230,8 +230,8 @@ bool heap_compare(Heap1 const & lhs, Heap2 const & rhs) heap_compare_copy >::type compare_check; - compare_check check; - return check(lhs, rhs); + compare_check check_object; + return check_object(lhs, rhs); } diff --git a/project/jni/boost/include/boost/heap/detail/heap_node.hpp b/project/jni/boost/include/boost/heap/detail/heap_node.hpp index 659ffc300..588891744 100644 --- a/project/jni/boost/include/boost/heap/detail/heap_node.hpp +++ b/project/jni/boost/include/boost/heap/detail/heap_node.hpp @@ -171,7 +171,7 @@ public: value(v) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template heap_node(Args&&... args): value(std::forward(args)...) @@ -230,7 +230,7 @@ struct parent_pointing_heap_node: super_t(v), parent(NULL) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template parent_pointing_heap_node(Args&&... args): super_t(std::forward(args)...), parent(NULL) @@ -310,7 +310,7 @@ struct marked_heap_node: super_t(v), mark(false) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template marked_heap_node(Args&&... args): super_t(std::forward(args)...), mark(false) diff --git a/project/jni/boost/include/boost/heap/detail/ilog2.hpp b/project/jni/boost/include/boost/heap/detail/ilog2.hpp index 9b5df05ef..c6b65c66c 100644 --- a/project/jni/boost/include/boost/heap/detail/ilog2.hpp +++ b/project/jni/boost/include/boost/heap/detail/ilog2.hpp @@ -61,4 +61,4 @@ IntType log2(IntType value) } /* namespace heap */ } /* namespace boost */ -#endif /* BOOST_HEAP_DETAIL_ILOG2_HPP */ \ No newline at end of file +#endif /* BOOST_HEAP_DETAIL_ILOG2_HPP */ diff --git a/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp b/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp index 37f6ddfeb..3218858ce 100644 --- a/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp +++ b/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp @@ -68,19 +68,13 @@ private: q_.set_stability_count(new_count); } - template struct index_updater { template - void operator()(It & it, size_type new_index) + static void run(It & it, size_type new_index) { q_type::get_value(it)->second = new_index; } - - template - struct rebind { - typedef index_updater other; - }; }; public: @@ -94,6 +88,10 @@ public: handle_type (void) {} + handle_type(handle_type const & rhs): + iterator(rhs.iterator) + {} + private: explicit handle_type(list_iterator const & it): iterator(it) @@ -120,7 +118,7 @@ private: typedef typename PriorityQueueType::template rebind >::other q_type; + allocator_type, index_updater >::other q_type; protected: q_type q_; @@ -132,7 +130,7 @@ protected: {} priority_queue_mutable_wrapper(priority_queue_mutable_wrapper const & rhs): - objects(rhs.objects) + q_(rhs.q_), objects(rhs.objects) { for (typename object_list::iterator it = objects.begin(); it != objects.end(); ++it) q_.push(it); @@ -140,6 +138,7 @@ protected: priority_queue_mutable_wrapper & operator=(priority_queue_mutable_wrapper const & rhs) { + q_ = rhs.q_; objects = rhs.objects; q_.clear(); for (typename object_list::iterator it = objects.begin(); it != objects.end(); ++it) @@ -147,7 +146,7 @@ protected: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES priority_queue_mutable_wrapper (priority_queue_mutable_wrapper && rhs): q_(std::move(rhs.q_)) { @@ -166,25 +165,27 @@ protected: public: - class iterator: - public boost::iterator_adaptor + class iterator_base: + public boost::iterator_adaptor, + iterator_type, value_type const, boost::bidirectional_traversal_tag> { - typedef boost::iterator_adaptor, + iterator_type, value_type const, boost::bidirectional_traversal_tag> super_t; friend class boost::iterator_core_access; friend class priority_queue_mutable_wrapper; - iterator(void): + iterator_base(void): super_t(0) {} - explicit iterator(const_list_iterator const & it): + template + explicit iterator_base(T const & it): super_t(it) {} @@ -192,9 +193,16 @@ public: { return super_t::base()->first; } + + iterator_type get_list_iterator() const + { + return super_t::base_reference(); + } }; - typedef iterator const_iterator; + typedef iterator_base iterator; + typedef iterator_base const_iterator; + typedef typename object_list::difference_type difference_type; class ordered_iterator: @@ -331,7 +339,7 @@ public: return handle_type(ret); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template handle_type emplace(Args&&... args) { @@ -374,7 +382,7 @@ public: { list_iterator it = handle.iterator; value_type const & current_value = it->first; - value_compare const & cmp = q_; + value_compare const & cmp = q_.value_comp(); if (cmp(v, current_value)) decrease(handle, v); else @@ -464,12 +472,22 @@ public: objects.erase(it); } - iterator begin(void) const + const_iterator begin(void) const + { + return const_iterator(objects.begin()); + } + + const_iterator end(void) const + { + return const_iterator(objects.end()); + } + + iterator begin(void) { return iterator(objects.begin()); } - iterator end(void) const + iterator end(void) { return iterator(objects.end()); } @@ -489,7 +507,7 @@ public: static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(it); + return handle_type(it.get_list_iterator()); } value_compare const & value_comp(void) const diff --git a/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp b/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp index e2f166f85..e2cbf1f39 100644 --- a/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp +++ b/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp @@ -64,8 +64,8 @@ class ordered_adaptor_iterator: bool operator()(size_t lhs, size_t rhs) { - assert(lhs <= Dispatcher::max_index(container)); - assert(rhs <= Dispatcher::max_index(container)); + BOOST_ASSERT(lhs <= Dispatcher::max_index(container)); + BOOST_ASSERT(rhs <= Dispatcher::max_index(container)); return ValueCompare::operator()(Dispatcher::get_internal_value(container, lhs), Dispatcher::get_internal_value(container, rhs)); } @@ -76,7 +76,7 @@ class ordered_adaptor_iterator: public: ordered_adaptor_iterator(void): - container(NULL), current_index(std::numeric_limits::max()), + container(NULL), current_index((std::numeric_limits::max)()), unvisited_nodes(compare_by_heap_value(NULL, ValueCompare())) {} diff --git a/project/jni/boost/include/boost/heap/detail/stable_heap.hpp b/project/jni/boost/include/boost/heap/detail/stable_heap.hpp index e9f3f2cd8..aaaa9de2e 100644 --- a/project/jni/boost/include/boost/heap/detail/stable_heap.hpp +++ b/project/jni/boost/include/boost/heap/detail/stable_heap.hpp @@ -24,7 +24,6 @@ namespace boost { namespace heap { namespace detail { - template struct size_holder { @@ -35,7 +34,7 @@ struct size_holder size_(0) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES size_holder(size_holder && rhs): size_(rhs.size_) { @@ -93,7 +92,7 @@ struct size_holder size_holder(void) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES size_holder(size_holder && rhs) {} @@ -133,6 +132,8 @@ struct size_holder {} }; +// note: MSVC does not implement lookup correctly, we therefore have to place the Cmp object as member inside the +// struct. of course, this prevents EBO and significantly reduces the readability of this code template struct heap_base: +#ifndef BOOST_MSVC Cmp, +#endif size_holder { typedef StabilityCounterType stability_counter_type; @@ -151,31 +154,47 @@ struct heap_base: typedef Cmp internal_compare; static const bool is_stable = stable; +#ifdef BOOST_MSVC + Cmp cmp_; +#endif + heap_base (Cmp const & cmp = Cmp()): +#ifndef BOOST_MSVC Cmp(cmp) +#else + cmp_(cmp) +#endif {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES heap_base(heap_base && rhs): +#ifndef BOOST_MSVC Cmp(std::move(static_cast(rhs))), +#else + cmp_(std::move(rhs.cmp_)), +#endif size_holder_type(std::move(static_cast(rhs))) {} heap_base(heap_base const & rhs): +#ifndef BOOST_MSVC Cmp(static_cast(rhs)), +#else + cmp_(rhs.value_comp()), +#endif size_holder_type(static_cast(rhs)) {} heap_base & operator=(heap_base && rhs) { - Cmp::operator=(std::move(static_cast(rhs))); + value_comp_ref().operator=(std::move(rhs.value_comp_ref())); size_holder_type::operator=(std::move(static_cast(rhs))); return *this; } heap_base & operator=(heap_base const & rhs) { - Cmp::operator=(static_cast(rhs)); + value_comp_ref().operator=(rhs.value_comp()); size_holder_type::operator=(static_cast(rhs)); return *this; } @@ -183,7 +202,7 @@ struct heap_base: bool operator()(internal_type const & lhs, internal_type const & rhs) const { - return Cmp::operator()(lhs, rhs); + return value_comp().operator()(lhs, rhs); } internal_type make_node(T const & val) @@ -191,7 +210,7 @@ struct heap_base: return val; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES T && make_node(T && val) { return std::forward(val); @@ -210,17 +229,21 @@ struct heap_base: Cmp const & value_comp(void) const { +#ifndef BOOST_MSVC return *this; +#else + return cmp_; +#endif } Cmp const & get_internal_cmp(void) const { - return *this; + return value_comp(); } void swap(heap_base & rhs) { - std::swap(static_cast(*this), static_cast(rhs)); + std::swap(value_comp_ref(), rhs.value_comp_ref()); size_holder::swap(rhs); } @@ -234,15 +257,28 @@ struct heap_base: template friend struct heap_merge_emulate; + +private: + Cmp & value_comp_ref(void) + { +#ifndef BOOST_MSVC + return *this; +#else + return cmp_; +#endif + } }; + template struct heap_base: +#ifndef BOOST_MSVC Cmp, +#endif size_holder { typedef StabilityCounterType stability_counter_type; @@ -251,21 +287,43 @@ struct heap_base: typedef size_holder size_holder_type; typedef Cmp value_compare; +#ifdef BOOST_MSVC + Cmp cmp_; +#endif + heap_base (Cmp const & cmp = Cmp()): - Cmp(cmp), counter_(0) +#ifndef BOOST_MSVC + Cmp(cmp), +#else + cmp_(cmp), +#endif + counter_(0) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES heap_base(heap_base && rhs): +#ifndef BOOST_MSVC Cmp(std::move(static_cast(rhs))), +#else + cmp_(std::move(rhs.cmp_)), +#endif size_holder_type(std::move(static_cast(rhs))), counter_(rhs.counter_) { rhs.counter_ = 0; } + heap_base(heap_base const & rhs): +#ifndef BOOST_MSVC + Cmp(static_cast(rhs)), +#else + cmp_(rhs.value_comp()), +#endif + size_holder_type(static_cast(rhs)), counter_(rhs.counter_) + {} + heap_base & operator=(heap_base && rhs) { - Cmp::operator=(std::move(static_cast(rhs))); + value_comp_ref().operator=(std::move(rhs.value_comp_ref())); size_holder_type::operator=(std::move(static_cast(rhs))); counter_ = rhs.counter_; @@ -275,40 +333,38 @@ struct heap_base: heap_base & operator=(heap_base const & rhs) { - Cmp::operator=(static_cast(rhs)); + value_comp_ref().operator=(rhs.value_comp()); size_holder_type::operator=(static_cast(rhs)); counter_ = rhs.counter_; return *this; } - #endif bool operator()(internal_type const & lhs, internal_type const & rhs) const { - internal_compare cmp(get_internal_cmp()); - return cmp(lhs, rhs); + return get_internal_cmp()(lhs, rhs); } bool operator()(T const & lhs, T const & rhs) const { - return Cmp::operator()(lhs, rhs); + return value_comp()(lhs, rhs); } internal_type make_node(T const & val) { stability_counter_type count = ++counter_; - if (counter_ == std::numeric_limits::max()) + if (counter_ == (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::runtime_error("boost::heap counter overflow")); return std::make_pair(val, count); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template internal_type make_node(Args&&... args) { stability_counter_type count = ++counter_; - if (counter_ == std::numeric_limits::max()) + if (counter_ == (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::runtime_error("boost::heap counter overflow")); return std::make_pair(std::forward(args)..., count); } @@ -326,7 +382,11 @@ struct heap_base: Cmp const & value_comp(void) const { +#ifndef BOOST_MSVC return *this; +#else + return cmp_; +#endif } struct internal_compare: @@ -350,12 +410,16 @@ struct heap_base: internal_compare get_internal_cmp(void) const { - return internal_compare(*this); + return internal_compare(value_comp()); } void swap(heap_base & rhs) { +#ifndef BOOST_MSVC std::swap(static_cast(*this), static_cast(rhs)); +#else + std::swap(cmp_, rhs.cmp_); +#endif std::swap(counter_, rhs.counter_); size_holder::swap(rhs); } @@ -374,6 +438,15 @@ struct heap_base: friend struct heap_merge_emulate; private: + Cmp & value_comp_ref(void) + { +#ifndef BOOST_MSVC + return *this; +#else + return cmp_; +#endif + } + stability_counter_type counter_; }; diff --git a/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp b/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp index 7a184310d..83c8d3fb4 100644 --- a/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp +++ b/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp @@ -254,6 +254,11 @@ public: return !operator!=(rhs); } + const Node * get_node() const + { + return adaptor_type::base_reference(); + } + private: void increment(void) { @@ -373,6 +378,11 @@ public: { return static_cast(&*it); } + + const Node * get_node() const + { + return get_node(adaptor_type::base_reference()); + } }; diff --git a/project/jni/boost/include/boost/heap/fibonacci_heap.hpp b/project/jni/boost/include/boost/heap/fibonacci_heap.hpp index 907d44230..eb6883408 100644 --- a/project/jni/boost/include/boost/heap/fibonacci_heap.hpp +++ b/project/jni/boost/include/boost/heap/fibonacci_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_FIBONACCI_HEAP_HPP #include +#include #include #include @@ -62,12 +63,17 @@ struct make_fibonacci_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) {} + type(type & rhs): + base_type(static_cast(rhs)), + allocator_type(static_cast(rhs)) + {} + type & operator=(type && rhs) { base_type::operator=(std::move(static_cast(rhs))); @@ -223,7 +229,7 @@ public: size_holder::set_size(rhs.size()); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) fibonacci_heap(fibonacci_heap && rhs): super_t(std::move(rhs)), top_element(rhs.top_element) @@ -232,6 +238,13 @@ public: rhs.top_element = NULL; } + fibonacci_heap(fibonacci_heap & rhs): + super_t(rhs), top_element(rhs.top_element) + { + roots.splice(roots.begin(), rhs.roots); + rhs.top_element = NULL; + } + /// \copydoc boost::heap::priority_queue::operator=(priority_queue &&) fibonacci_heap & operator=(fibonacci_heap && rhs) { @@ -346,7 +359,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -384,16 +397,7 @@ public: node_pointer element = top_element; roots.erase(node_list_type::s_iterator_to(*element)); - add_children_to_root(element); - - element->~node(); - allocator_type::deallocate(element, 1); - - size_holder::decrement(); - if (!empty()) - consolidate(); - else - top_element = NULL; + finish_erase_or_pop(element); } /** @@ -413,7 +417,7 @@ public: /** \copydoc boost::heap::fibonacci_heap::update(handle_type, const_reference) * * \b Rationale: The lazy update function is a modification of the traditional update, that just invalidates - * the iterator the the object referred to by the handle. + * the iterator to the object referred to by the handle. * */ void update_lazy(handle_type handle, const_reference v) { @@ -444,7 +448,7 @@ public: /** \copydoc boost::heap::fibonacci_heap::update (handle_type handle) * * \b Rationale: The lazy update function is a modification of the traditional update, that just invalidates - * the iterator the the object referred to by the handle. + * the iterator to the object referred to by the handle. * */ void update_lazy (handle_type handle) { @@ -529,21 +533,15 @@ public: * */ void erase(handle_type const & handle) { - node_pointer n = handle.node_; - node_pointer parent = n->get_parent(); + node_pointer element = handle.node_; + node_pointer parent = element->get_parent(); if (parent) - parent->children.erase(node_list_type::s_iterator_to(*n)); + parent->children.erase(node_list_type::s_iterator_to(*element)); else - roots.erase(node_list_type::s_iterator_to(*n)); + roots.erase(node_list_type::s_iterator_to(*element)); - add_children_to_root(n); - consolidate(); - - n->~node(); - allocator_type::deallocate(n, 1); - - size_holder::decrement(); + finish_erase_or_pop(element); } /// \copydoc boost::heap::priority_queue::begin @@ -597,7 +595,7 @@ public: rhs.set_size(0); - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -605,7 +603,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return super_t::s_handle_from_iterator(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /// \copydoc boost::heap::priority_queue::value_comp @@ -701,6 +700,9 @@ private: void consolidate(void) { + if (roots.empty()) + return; + static const size_type max_log2 = sizeof(size_type) * 8; boost::array aux; aux.assign(NULL); @@ -740,6 +742,20 @@ private: while (it != roots.end()); } + void finish_erase_or_pop(node_pointer erased_node) + { + add_children_to_root(erased_node); + + erased_node->~node(); + allocator_type::deallocate(erased_node, 1); + + size_holder::decrement(); + if (!empty()) + consolidate(); + else + top_element = NULL; + } + mutable node_pointer top_element; node_list_type roots; #endif diff --git a/project/jni/boost/include/boost/heap/heap_merge.hpp b/project/jni/boost/include/boost/heap/heap_merge.hpp index 192d0f9d3..eabae3196 100644 --- a/project/jni/boost/include/boost/heap/heap_merge.hpp +++ b/project/jni/boost/include/boost/heap/heap_merge.hpp @@ -56,8 +56,8 @@ struct heap_merge_emulate rhs.pop(); } - lhs.set_stability_count(std::max(lhs.get_stability_count(), - rhs.get_stability_count())); + lhs.set_stability_count((std::max)(lhs.get_stability_count(), + rhs.get_stability_count())); rhs.set_stability_count(0); } diff --git a/project/jni/boost/include/boost/heap/pairing_heap.hpp b/project/jni/boost/include/boost/heap/pairing_heap.hpp index 577fdc534..f7ea7ba8d 100644 --- a/project/jni/boost/include/boost/heap/pairing_heap.hpp +++ b/project/jni/boost/include/boost/heap/pairing_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_PAIRING_HEAP_HPP #include +#include #include #include @@ -62,7 +63,11 @@ struct make_pairing_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + type(type const & rhs): + base_type(rhs), allocator_type(rhs) + {} + type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) @@ -95,7 +100,7 @@ struct make_pairing_heap_base * the complexity analysis is yet unsolved. For details, consult: * * Pettie, Seth (2005), "Towards a final analysis of pairing heaps", - * Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174–183 + * Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174-183 * * The template parameter T is the type to be managed by the container. * The user can specify additional options and if no options are provided default options are used. @@ -236,7 +241,7 @@ public: size_holder::set_size(rhs.get_size()); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) pairing_heap(pairing_heap && rhs): super_t(std::move(rhs)), root(rhs.root) @@ -352,7 +357,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -549,7 +554,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return super_t::s_handle_from_iterator(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /** @@ -573,7 +579,7 @@ public: rhs.set_size(0); rhs.root = NULL; - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -650,7 +656,7 @@ private: node_pointer merge_node_list(node_child_list & children) { - assert(!children.empty()); + BOOST_HEAP_ASSERT(!children.empty()); node_pointer merged = merge_first_pair(children); if (children.empty()) return merged; @@ -668,7 +674,7 @@ private: node_pointer merge_first_pair(node_child_list & children) { - assert(!children.empty()); + BOOST_HEAP_ASSERT(!children.empty()); node_pointer first_child = static_cast(&children.front()); children.pop_front(); if (children.empty()) diff --git a/project/jni/boost/include/boost/heap/priority_queue.hpp b/project/jni/boost/include/boost/heap/priority_queue.hpp index 05d79fd87..7f2fa13fb 100644 --- a/project/jni/boost/include/boost/heap/priority_queue.hpp +++ b/project/jni/boost/include/boost/heap/priority_queue.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -122,13 +123,13 @@ public: super_t(rhs), q_(rhs.q_) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /** * \b Effects: C++11-style move constructor. * * \b Complexity: Constant. * - * \b Note: Only available, if BOOST_HAS_RVALUE_REFS is defined + * \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined * */ priority_queue(priority_queue && rhs): super_t(std::move(rhs)), q_(std::move(rhs.q_)) @@ -139,7 +140,7 @@ public: * * \b Complexity: Constant. * - * \b Note: Only available, if BOOST_HAS_RVALUE_REFS is defined + * \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined * */ priority_queue & operator=(priority_queue && rhs) { @@ -241,7 +242,7 @@ public: std::push_heap(q_.begin(), q_.end(), static_cast(*this)); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. * diff --git a/project/jni/boost/include/boost/heap/skew_heap.hpp b/project/jni/boost/include/boost/heap/skew_heap.hpp index de89a63a8..17c3d1d95 100644 --- a/project/jni/boost/include/boost/heap/skew_heap.hpp +++ b/project/jni/boost/include/boost/heap/skew_heap.hpp @@ -84,7 +84,7 @@ struct skew_heap_node: children.assign(0); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES skew_heap_node(value_type && v): value(v) { @@ -199,12 +199,17 @@ struct make_skew_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) {} + type(type const & rhs): + base_type(rhs), + allocator_type(rhs) + {} + type & operator=(type && rhs) { base_type::operator=(std::move(static_cast(rhs))); @@ -383,7 +388,7 @@ public: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) skew_heap(skew_heap && rhs): super_t(std::move(rhs)), root(rhs.root) @@ -418,7 +423,7 @@ public: return push_helper::push(this, v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. * @@ -559,7 +564,7 @@ public: rhs.root = NULL; sanity_check(); - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -616,7 +621,8 @@ public: /// \copydoc boost::heap::d_ary_heap::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /** @@ -756,7 +762,7 @@ private: self->push_internal(v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static void emplace(skew_heap * self, Args&&... args) { @@ -772,7 +778,7 @@ private: return handle_type(self->push_internal(v)); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static handle_type emplace(skew_heap * self, Args&&... args) { @@ -792,7 +798,7 @@ private: return n; } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template node_pointer emplace_internal(Args&&... args) { diff --git a/project/jni/boost/include/boost/icl/concept/element_associator.hpp b/project/jni/boost/include/boost/icl/concept/element_associator.hpp index a9371848d..ce421e018 100644 --- a/project/jni/boost/include/boost/icl/concept/element_associator.hpp +++ b/project/jni/boost/include/boost/icl/concept/element_associator.hpp @@ -188,7 +188,7 @@ operator + (const typename Type::value_type& operand, Type object) } template -inline typename enable_if, Type>::type +inline typename enable_if, Type>::type& operator += (Type& object, const Type& operand) { if(&object == &operand) diff --git a/project/jni/boost/include/boost/icl/concept/element_map.hpp b/project/jni/boost/include/boost/icl/concept/element_map.hpp index d54df0218..b2d78abbe 100644 --- a/project/jni/boost/include/boost/icl/concept/element_map.hpp +++ b/project/jni/boost/include/boost/icl/concept/element_map.hpp @@ -11,6 +11,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/icl/concept/interval_associator.hpp b/project/jni/boost/include/boost/icl/concept/interval_associator.hpp index 75d8622af..14d522eb3 100644 --- a/project/jni/boost/include/boost/icl/concept/interval_associator.hpp +++ b/project/jni/boost/include/boost/icl/concept/interval_associator.hpp @@ -325,7 +325,7 @@ operator += (Type& object, const OperandT& operand) } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (T, c P&) T:{S}|{M} P:{e i S}|{b p M} //------------------------------------------------------------------------------ @@ -340,13 +340,13 @@ operator + (Type object, const OperandT& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -357,9 +357,9 @@ operator + (Type&& object, const OperandT& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'} //------------------------------------------------------------------------------ @@ -374,13 +374,13 @@ operator + (const OperandT& operand, Type object) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -391,9 +391,9 @@ operator + (const OperandT& operand, Type&& object) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -408,13 +408,13 @@ operator + (Type object, const Type& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -439,7 +439,7 @@ operator + (Type&& object, Type&& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- Addition |=, | @@ -477,7 +477,7 @@ operator |= (Type& object, const OperandT& operand) return object += operand; } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{e i S}|{b p M} //------------------------------------------------------------------------------ @@ -492,13 +492,13 @@ operator | (Type object, const OperandT& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -509,9 +509,9 @@ operator | (Type&& object, const OperandT& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -526,13 +526,13 @@ operator | (const OperandT& operand, Type object) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -543,9 +543,9 @@ operator | (const OperandT& operand, Type&& object) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -559,13 +559,13 @@ operator | (Type object, const Type& operand) { return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -590,7 +590,7 @@ operator | (Type&& object, Type&& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //============================================================================== @@ -605,7 +605,7 @@ insert(Type& object, const OperandT& operand) { typename Type::iterator prior_ = object.end(); ICL_const_FORALL(typename OperandT, elem_, operand) - insert(object, *elem_); + insert(object, prior_, *elem_); return object; } @@ -707,7 +707,7 @@ operator -= (Type& object, const IntervalSetT& operand) return erase(object, operand); } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op - (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'} //------------------------------------------------------------------------------ @@ -718,13 +718,13 @@ operator - (Type object, const OperandT& operand) return object -= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator - (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp -= operand); } @@ -735,7 +735,7 @@ operator - (Type&& object, const OperandT& operand) return boost::move(object -= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //============================================================================== //= Intersection @@ -776,7 +776,7 @@ operator &= (Type& object, const OperandT& operand) return object; } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S typename enable_if, Type>::type operator & (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -804,9 +804,9 @@ operator & (Type&& object, const OperandT& operand) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (c P&, T) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S typename enable_if, Type>::type operator & (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -834,9 +834,9 @@ operator & (const OperandT& operand, Type&& object) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (T, c T&) T:{S M} //------------------------------------------------------------------------------ @@ -847,13 +847,13 @@ operator & (Type object, const Type& operand) return object &= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator & (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -878,7 +878,7 @@ operator & (Type&& object, Type&& operand) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- intersects @@ -1011,7 +1011,7 @@ operator ^= (Type& object, const OperandT& operand) return icl::flip(object, operand); } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (T, c P&) T:{S}|{M} P:{e i S'}|{b p M'} S typename enable_if, Type>::type operator ^ (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1039,9 +1039,9 @@ operator ^ (Type&& object, const OperandT& operand) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'} S typename enable_if, Type>::type operator ^ (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1069,9 +1069,9 @@ operator ^ (const OperandT& operand, Type&& object) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (T, c T&) T:{S M} //------------------------------------------------------------------------------ @@ -1082,13 +1082,13 @@ operator ^ (typename Type::overloadable_type object, const Type& operand) return object ^= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator ^ (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1113,7 +1113,7 @@ operator ^ (Type&& object, Type&& operand) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Element Iteration diff --git a/project/jni/boost/include/boost/icl/detail/set_algo.hpp b/project/jni/boost/include/boost/icl/detail/set_algo.hpp index 7f74cd46e..7b0e7c598 100644 --- a/project/jni/boost/include/boost/icl/detail/set_algo.hpp +++ b/project/jni/boost/include/boost/icl/detail/set_algo.hpp @@ -11,10 +11,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #define BOOST_ICL_SET_ALGO_HPP_JOFA_990225 #include - #include -#include - #include #include #include diff --git a/project/jni/boost/include/boost/icl/functors.hpp b/project/jni/boost/include/boost/icl/functors.hpp index 1b4758fc5..2401b2b80 100644 --- a/project/jni/boost/include/boost/icl/functors.hpp +++ b/project/jni/boost/include/boost/icl/functors.hpp @@ -22,14 +22,14 @@ namespace boost{namespace icl template struct identity_based_inplace_combine : public std::binary_function { - static Type identity_element() { return boost::icl::identity_element::value(); } + inline static Type identity_element() { return boost::icl::identity_element::value(); } }; // ------------------------------------------------------------------------ template struct unit_element_based_inplace_combine : public std::binary_function { - static Type identity_element() { return boost::icl::unit_element::value(); } + inline static Type identity_element() { return boost::icl::unit_element::value(); } }; // ------------------------------------------------------------------------ @@ -49,11 +49,13 @@ namespace boost{namespace icl : public identity_based_inplace_combine { typedef inplace_erasure type; + typedef identity_based_inplace_combine base_type; void operator()(Type& object, const Type& operand)const { if(object == operand) - object = Type(); + //identity_element(); //JODO Old gcc-3.4.4 does not compile this + object = base_type::identity_element(); //<-- but this. } }; @@ -112,8 +114,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object &= ~operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -140,8 +140,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object ^= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; // ------------------------------------------------------------------------ @@ -165,8 +163,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object ^= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -180,8 +176,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { insert(object,operand); } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -195,8 +189,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { erase(object,operand); } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -204,14 +196,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ template struct inplace_star - : public identity_based_inplace_combine + : public identity_based_inplace_combine //JODO unit_element_ { typedef inplace_star type; void operator()(Type& object, const Type& operand)const { object *= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -219,14 +209,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ template struct inplace_slash - : public identity_based_inplace_combine + : public identity_based_inplace_combine //JODO unit_element_ { typedef inplace_slash type; void operator()(Type& object, const Type& operand)const { object /= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -243,8 +231,6 @@ namespace boost{namespace icl if(object < operand) object = operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -261,8 +247,6 @@ namespace boost{namespace icl if(object > operand) object = operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -340,6 +324,19 @@ namespace boost{namespace icl struct inverse > { typedef icl::inplace_max type; }; + template + struct inverse > + { typedef icl::inplace_erasure type; }; + + // If a Functor + template + struct inverse + { + typedef typename + remove_reference::type argument_type; + typedef icl::inplace_erasure type; + }; + //-------------------------------------------------------------------------- // Inverse inter_section functor diff --git a/project/jni/boost/include/boost/icl/gregorian.hpp b/project/jni/boost/include/boost/icl/gregorian.hpp index 883299c61..a10161709 100644 --- a/project/jni/boost/include/boost/icl/gregorian.hpp +++ b/project/jni/boost/include/boost/icl/gregorian.hpp @@ -77,12 +77,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ - boost::gregorian::date operator ++(boost::gregorian::date& x) + inline boost::gregorian::date operator ++(boost::gregorian::date& x) { return x += boost::gregorian::date::duration_type::unit(); } - boost::gregorian::date operator --(boost::gregorian::date& x) + inline boost::gregorian::date operator --(boost::gregorian::date& x) { return x -= boost::gregorian::date::duration_type::unit(); } @@ -107,12 +107,12 @@ namespace boost{namespace icl typedef boost::gregorian::date_duration type; }; - boost::gregorian::date_duration operator ++(boost::gregorian::date_duration& x) + inline boost::gregorian::date_duration operator ++(boost::gregorian::date_duration& x) { return x += boost::gregorian::date::duration_type::unit(); } - boost::gregorian::date_duration operator --(boost::gregorian::date_duration& x) + inline boost::gregorian::date_duration operator --(boost::gregorian::date_duration& x) { return x -= boost::gregorian::date::duration_type::unit(); } diff --git a/project/jni/boost/include/boost/icl/impl_config.hpp b/project/jni/boost/include/boost/icl/impl_config.hpp index 1f244d239..d21d132d4 100644 --- a/project/jni/boost/include/boost/icl/impl_config.hpp +++ b/project/jni/boost/include/boost/icl/impl_config.hpp @@ -9,6 +9,8 @@ Copyright (c) 2009-2011: Joachim Faulhaber #ifndef BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 #define BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 +#include + /*-----------------------------------------------------------------------------+ | You can choose an implementation for the basic set and map classes. | | Select at most ONE of the following defines to change the default | @@ -39,6 +41,19 @@ Copyright (c) 2009-2011: Joachim Faulhaber # define ICL_IMPL_SPACE std #endif +/*-----------------------------------------------------------------------------+ +| MEMO 2012-12-30: Due to problems with new c++11 compilers and their | +| implementation of rvalue references, ICL's move implementation will be | +| disabled for some new compilers for version 1.53. | ++-----------------------------------------------------------------------------*/ +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#elif defined(__clang__) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#elif (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#endif + #include #endif // BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 diff --git a/project/jni/boost/include/boost/icl/interval_base_map.hpp b/project/jni/boost/include/boost/icl/interval_base_map.hpp index 9f265a67c..7ecbb4d4e 100644 --- a/project/jni/boost/include/boost/icl/interval_base_map.hpp +++ b/project/jni/boost/include/boost/icl/interval_base_map.hpp @@ -222,7 +222,7 @@ public: return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -244,7 +244,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES /** swap the content of containers */ void swap(interval_base_map& object) { _map.swap(object._map); } diff --git a/project/jni/boost/include/boost/icl/interval_base_set.hpp b/project/jni/boost/include/boost/icl/interval_base_set.hpp index b5bd4d5cb..722db64d1 100644 --- a/project/jni/boost/include/boost/icl/interval_base_set.hpp +++ b/project/jni/boost/include/boost/icl/interval_base_set.hpp @@ -175,7 +175,7 @@ public: return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -195,7 +195,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES /** swap the content of containers */ void swap(interval_base_set& operand) { _set.swap(operand._set); } diff --git a/project/jni/boost/include/boost/icl/interval_map.hpp b/project/jni/boost/include/boost/icl/interval_map.hpp index f743b3d53..8b47044d8 100644 --- a/project/jni/boost/include/boost/icl/interval_map.hpp +++ b/project/jni/boost/include/boost/icl/interval_map.hpp @@ -86,7 +86,7 @@ public: Traits,Compare,Combine,Section,Interval,Alloc>& src) { this->assign(src); } - explicit interval_map(domain_mapping_type& base_pair): base_type() + explicit interval_map(const domain_mapping_type& base_pair): base_type() { this->add(base_pair); } explicit interval_map(const value_type& value_pair): base_type() @@ -94,6 +94,13 @@ public: /// Assignment operator + interval_map& operator = (const interval_map& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template interval_map& operator = (const interval_base_mapadd(prior_, *it_); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -131,7 +138,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/interval_set.hpp b/project/jni/boost/include/boost/icl/interval_set.hpp index 890e29efa..7dce8a480 100644 --- a/project/jni/boost/include/boost/icl/interval_set.hpp +++ b/project/jni/boost/include/boost/icl/interval_set.hpp @@ -116,6 +116,13 @@ public: } /// Assignment operator + interval_set& operator = (const interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template interval_set& operator = (const interval_base_set& src) @@ -137,7 +144,7 @@ public: prior_ = this->add(prior_, *it_); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -154,7 +161,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/map.hpp b/project/jni/boost/include/boost/icl/map.hpp index 7092906a7..0081dcfff 100644 --- a/project/jni/boost/include/boost/icl/map.hpp +++ b/project/jni/boost/include/boost/icl/map.hpp @@ -34,9 +34,9 @@ Copyright (c) 2007-2011: Joachim Faulhaber #include #include #include -#include #include +#include namespace boost{namespace icl { @@ -192,13 +192,13 @@ public: insert(key_value_pair); } - map& operator = (map& src) + map& operator = (const map& src) { base_type::operator=(src); return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -218,7 +218,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES void swap(map& src) { base_type::swap(src); } diff --git a/project/jni/boost/include/boost/icl/ptime.hpp b/project/jni/boost/include/boost/icl/ptime.hpp index 455963f19..42c2235ec 100644 --- a/project/jni/boost/include/boost/icl/ptime.hpp +++ b/project/jni/boost/include/boost/icl/ptime.hpp @@ -76,12 +76,12 @@ namespace boost{namespace icl }; // ------------------------------------------------------------------------ - boost::posix_time::ptime operator ++(boost::posix_time::ptime& x) + inline boost::posix_time::ptime operator ++(boost::posix_time::ptime& x) { return x += boost::posix_time::ptime::time_duration_type::unit(); } - boost::posix_time::ptime operator --(boost::posix_time::ptime& x) + inline boost::posix_time::ptime operator --(boost::posix_time::ptime& x) { return x -= boost::posix_time::ptime::time_duration_type::unit(); } @@ -106,12 +106,12 @@ namespace boost{namespace icl typedef boost::posix_time::time_duration type; }; - boost::posix_time::time_duration operator ++(boost::posix_time::time_duration& x) + inline boost::posix_time::time_duration operator ++(boost::posix_time::time_duration& x) { return x += boost::posix_time::ptime::time_duration_type::unit(); } - boost::posix_time::time_duration operator --(boost::posix_time::time_duration& x) + inline boost::posix_time::time_duration operator --(boost::posix_time::time_duration& x) { return x -= boost::posix_time::ptime::time_duration_type::unit(); } diff --git a/project/jni/boost/include/boost/icl/separate_interval_set.hpp b/project/jni/boost/include/boost/icl/separate_interval_set.hpp index 2292bd75b..4d06a2941 100644 --- a/project/jni/boost/include/boost/icl/separate_interval_set.hpp +++ b/project/jni/boost/include/boost/icl/separate_interval_set.hpp @@ -107,6 +107,13 @@ public: explicit separate_interval_set(const interval_type& itv): base_type() { this->add(itv); } /// Assignment operator + separate_interval_set& operator = (const separate_interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template separate_interval_set& operator = (const interval_base_set& src) @@ -123,7 +130,7 @@ public: this->_set.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -140,7 +147,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/set.hpp b/project/jni/boost/include/boost/icl/set.hpp index 90e655f0d..db44b5e80 100644 --- a/project/jni/boost/include/boost/icl/set.hpp +++ b/project/jni/boost/include/boost/icl/set.hpp @@ -18,10 +18,8 @@ Copyright (c) 2007-2011: Joachim Faulhaber # include #endif -#include - - -}} // namespace icl boost +#include +#include #endif // BOOST_ICL_SET_HPP_JOFA_070519 diff --git a/project/jni/boost/include/boost/icl/split_interval_map.hpp b/project/jni/boost/include/boost/icl/split_interval_map.hpp index 762ab5cc1..487b0d22b 100644 --- a/project/jni/boost/include/boost/icl/split_interval_map.hpp +++ b/project/jni/boost/include/boost/icl/split_interval_map.hpp @@ -72,13 +72,20 @@ public: /// Copy constructor split_interval_map(const split_interval_map& src): base_type(src) {} - explicit split_interval_map(domain_mapping_type& base_pair): base_type() + explicit split_interval_map(const domain_mapping_type& base_pair): base_type() { this->add(base_pair); } explicit split_interval_map(const value_type& value_pair): base_type() { this->add(value_pair); } - /// Copy assignment operator + /// Assignment operator + split_interval_map& operator = (const split_interval_map& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template split_interval_map& operator = (const interval_base_map_map.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -112,7 +119,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/split_interval_set.hpp b/project/jni/boost/include/boost/icl/split_interval_set.hpp index 452a521fa..5b6235f65 100644 --- a/project/jni/boost/include/boost/icl/split_interval_set.hpp +++ b/project/jni/boost/include/boost/icl/split_interval_set.hpp @@ -105,6 +105,13 @@ public: explicit split_interval_set(const domain_type& itv): base_type() { this->add(itv); } /// Assignment operator + split_interval_set& operator = (const split_interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template split_interval_set& operator = (const interval_base_set& src) @@ -118,7 +125,7 @@ public: this->_set.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -135,7 +142,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: diff --git a/project/jni/boost/include/boost/integer.hpp b/project/jni/boost/include/boost/integer.hpp index fc0b3983b..35a1e1098 100644 --- a/project/jni/boost/include/boost/integer.hpp +++ b/project/jni/boost/include/boost/integer.hpp @@ -20,6 +20,7 @@ #include // for boost::::boost::integer_traits #include // for ::std::numeric_limits #include // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T +#include // // We simply cannot include this header on gcc without getting copious warnings of the kind: @@ -51,6 +52,7 @@ namespace boost // convert category to type template< int Category > struct int_least_helper {}; // default is empty + template< int Category > struct uint_least_helper {}; // default is empty // specializatons: 1=long, 2=int, 3=short, 4=signed char, // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char @@ -65,14 +67,14 @@ namespace boost template<> struct int_least_helper<4> { typedef short least; }; template<> struct int_least_helper<5> { typedef signed char least; }; #ifdef BOOST_HAS_LONG_LONG - template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; }; + template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; #elif defined(BOOST_HAS_MS_INT64) - template<> struct int_least_helper<6> { typedef unsigned __int64 least; }; + template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; #endif - template<> struct int_least_helper<7> { typedef unsigned long least; }; - template<> struct int_least_helper<8> { typedef unsigned int least; }; - template<> struct int_least_helper<9> { typedef unsigned short least; }; - template<> struct int_least_helper<10> { typedef unsigned char least; }; + template<> struct uint_least_helper<2> { typedef unsigned long least; }; + template<> struct uint_least_helper<3> { typedef unsigned int least; }; + template<> struct uint_least_helper<4> { typedef unsigned short least; }; + template<> struct uint_least_helper<5> { typedef unsigned char least; }; template struct exact_signed_base_helper{}; @@ -111,10 +113,12 @@ namespace boost template< int Bits > // bits (including sign) required struct int_t : public detail::exact_signed_base_helper { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), + "No suitable signed integer type with the requested number of bits is available."); typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -130,6 +134,8 @@ namespace boost template< int Bits > // bits required struct uint_t : public detail::exact_unsigned_base_helper { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), + "No suitable unsigned integer type with the requested number of bits is available."); #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) // It's really not clear why this workaround should be needed... shrug I guess! JM BOOST_STATIC_CONSTANT(int, s = @@ -140,11 +146,10 @@ namespace boost (Bits <= ::std::numeric_limits::digits)); typedef typename detail::int_least_helper< ::boost::uint_t::s>::least least; #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -217,7 +222,7 @@ namespace boost // It's really not clear why this workaround should be needed... shrug I guess! JM #if defined(BOOST_NO_INTEGRAL_INT64_T) BOOST_STATIC_CONSTANT(unsigned, which = - 6 + + 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + @@ -225,18 +230,17 @@ namespace boost typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; #else // BOOST_NO_INTEGRAL_INT64_T BOOST_STATIC_CONSTANT(unsigned, which = - 5 + + 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max)); - typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; + typedef typename detail::uint_least_helper< ::boost::uint_value_t::which>::least least; #endif // BOOST_NO_INTEGRAL_INT64_T #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits::const_max) + #else diff --git a/project/jni/boost/include/boost/integer_traits.hpp b/project/jni/boost/include/boost/integer_traits.hpp index c6d761a71..ddd560952 100644 --- a/project/jni/boost/include/boost/integer_traits.hpp +++ b/project/jni/boost/include/boost/integer_traits.hpp @@ -5,7 +5,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * $Id: integer_traits.hpp 76784 2012-01-29 21:58:13Z eric_niebler $ + * $Id: integer_traits.hpp 81851 2012-12-11 14:42:26Z marshall $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ diff --git a/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp index 846df5d41..8a2d61ecc 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -35,7 +35,7 @@ #include //!\file -//!Describes adaptive_pool pooled shared memory STL compatible allocator +//!Describes adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -101,11 +101,11 @@ class adaptive_pool_base typedef boost::container::container_detail::transform_multiallocation_chain multiallocation_chain; - //!Obtains adaptive_pool_base from + //!Obtains adaptive_pool_base from //!adaptive_pool_base template struct rebind - { + { typedef adaptive_pool_base other; }; @@ -122,15 +122,15 @@ class adaptive_pool_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - adaptive_pool_base(segment_manager *segment_mngr) + adaptive_pool_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool::type>(segment_mngr)) { } - //!Copy constructor from other adaptive_pool_base. Increments the reference + //!Copy constructor from other adaptive_pool_base. Increments the reference //!count of the associated node pool. Never throws - adaptive_pool_base(const adaptive_pool_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + adaptive_pool_base(const adaptive_pool_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Assignment from other adaptive_pool_base @@ -151,7 +151,7 @@ class adaptive_pool_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~adaptive_pool_base() + ~adaptive_pool_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -178,14 +178,14 @@ class adaptive_pool_base //!Equality test for same type //!of adaptive_pool_base template inline -bool operator==(const adaptive_pool_base &alloc1, +bool operator==(const adaptive_pool_base &alloc1, const adaptive_pool_base &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of adaptive_pool_base template inline -bool operator!=(const adaptive_pool_base &alloc1, +bool operator!=(const adaptive_pool_base &alloc1, const adaptive_pool_base &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -211,11 +211,11 @@ class adaptive_pool_v1 template struct rebind - { + { typedef adaptive_pool_v1 other; }; - adaptive_pool_v1(SegmentManager *segment_mngr) + adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -230,13 +230,13 @@ class adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances -//!of adaptive_pool with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of adaptive_pool with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks //!that the adaptive node pool will hold. The rest of the totally free blocks will be @@ -271,11 +271,11 @@ class adaptive_pool template struct rebind - { + { typedef adaptive_pool other; }; - adaptive_pool(SegmentManager *segment_mngr) + adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -299,11 +299,11 @@ class adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains adaptive_pool from + //!Obtains adaptive_pool from //!adaptive_pool template struct rebind - { + { typedef adaptive_pool other; }; @@ -314,7 +314,7 @@ class adaptive_pool adaptive_pool& operator= (const adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other adaptive_pool //adaptive_pool& operator=(const adaptive_pool&); @@ -324,7 +324,7 @@ class adaptive_pool //!Can throw boost::interprocess::bad_alloc adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other adaptive_pool. Increments the reference + //!Copy constructor from other adaptive_pool. Increments the reference //!count of the associated node pool. Never throws adaptive_pool(const adaptive_pool &other); @@ -351,7 +351,7 @@ class adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class adaptive_pool //!Never throws const_pointer address(const_reference value) const; /* - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -400,12 +400,12 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -413,7 +413,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -426,7 +426,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -439,7 +439,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain it); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -448,13 +448,13 @@ class adaptive_pool //!Equality test for same type //!of adaptive_pool template inline -bool operator==(const adaptive_pool &alloc1, +bool operator==(const adaptive_pool &alloc1, const adaptive_pool &alloc2); //!Inequality test for same type //!of adaptive_pool template inline -bool operator!=(const adaptive_pool &alloc1, +bool operator!=(const adaptive_pool &alloc1, const adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp index aa4b22dcc..497cbd447 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -45,12 +45,12 @@ namespace boost { namespace interprocess { -//!An STL compatible allocator that uses a segment manager as +//!An STL compatible allocator that uses a segment manager as //!memory source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... template -class allocator +class allocator { public: //Segment manager @@ -115,7 +115,7 @@ class allocator //!objects of type T2 template struct rebind - { + { typedef allocator other; }; @@ -126,27 +126,28 @@ class allocator //!Constructor from the segment manager. //!Never throws - allocator(segment_manager *segment_mngr) + allocator(segment_manager *segment_mngr) : mp_mngr(segment_mngr) { } //!Constructor from other allocator. //!Never throws - allocator(const allocator &other) + allocator(const allocator &other) : mp_mngr(other.get_segment_manager()){ } //!Constructor from related allocator. //!Never throws template - allocator(const allocator &other) + allocator(const allocator &other) : mp_mngr(other.get_segment_manager()){} - //!Allocates memory for an array of count elements. + //!Allocates memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_ptr hint = 0) { (void)hint; - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); + } return pointer(static_cast(mp_mngr->allocate(count*sizeof(T)))); } @@ -169,13 +170,13 @@ class allocator //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -189,19 +190,20 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many - (size_type elem_size, size_type num_elements) + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) { - return multiallocation_chain(mp_mngr->allocate_many(sizeof(T)*elem_size, num_elements)); + if(size_overflows(elem_size)){ + throw bad_alloc(); + } + mp_mngr->allocate_many(elem_size*sizeof(T), num_elements, chain); } //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many - (const size_type *elem_sizes, size_type n_elements) + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { - multiallocation_chain(mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T))); + mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), chain); } //!Allocates many elements of size elem_size in a contiguous block @@ -210,10 +212,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain) - { - return mp_mngr->deallocate_many(chain.extract_multiallocation_chain()); - } + void deallocate_many(multiallocation_chain &chain) + { mp_mngr->deallocate_many(chain); } //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -227,9 +227,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual - (size_type num_elements) - { return this->allocate_many(1, num_elements); } + void allocate_individual(size_type num_elements, multiallocation_chain &chain) + { this->allocate_many(1, num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -243,8 +242,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) - { return this->deallocate_many(boost::move(chain)); } + void deallocate_individual(multiallocation_chain &chain) + { this->deallocate_many(chain); } //!Returns address of mutable object. //!Never throws @@ -273,14 +272,14 @@ class allocator //!Equality test for same type //!of allocator template inline -bool operator==(const allocator &alloc1, +bool operator==(const allocator &alloc1, const allocator &alloc2) { return alloc1.get_segment_manager() == alloc2.get_segment_manager(); } //!Inequality test for same type //!of allocator template inline -bool operator!=(const allocator &alloc1, +bool operator!=(const allocator &alloc1, const allocator &alloc2) { return alloc1.get_segment_manager() != alloc2.get_segment_manager(); } diff --git a/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp index bec1050de..2a2d7b8a4 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -28,7 +28,7 @@ #include //!\file -//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator +//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -69,7 +69,7 @@ class cached_adaptive_pool_v1 template struct rebind - { + { typedef cached_adaptive_pool_v1 other; }; @@ -77,7 +77,7 @@ class cached_adaptive_pool_v1 typedef typename base_t::size_type size_type; cached_adaptive_pool_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -93,12 +93,12 @@ class cached_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances of +//!This node allocator shares a segregated storage between all instances of //!cached_adaptive_pool with equal sizeof(T) placed in the same //!memory segment. But also caches some nodes privately to //!avoid some synchronization overhead. @@ -149,13 +149,13 @@ class cached_adaptive_pool template struct rebind - { + { typedef cached_adaptive_pool other; }; cached_adaptive_pool(SegmentManager *segment_mngr, - std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -179,11 +179,11 @@ class cached_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains cached_adaptive_pool from + //!Obtains cached_adaptive_pool from //!cached_adaptive_pool template struct rebind - { + { typedef cached_adaptive_pool other; }; @@ -194,7 +194,7 @@ class cached_adaptive_pool cached_adaptive_pool& operator= (const cached_adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other cached_adaptive_pool cached_adaptive_pool& operator=(const cached_adaptive_pool&); @@ -204,7 +204,7 @@ class cached_adaptive_pool //!Can throw boost::interprocess::bad_alloc cached_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other cached_adaptive_pool. Increments the reference + //!Copy constructor from other cached_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws cached_adaptive_pool(const cached_adaptive_pool &other); @@ -231,7 +231,7 @@ class cached_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -255,7 +255,7 @@ class cached_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -270,7 +270,7 @@ class cached_adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -280,12 +280,12 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -293,7 +293,7 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -319,7 +319,7 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); //!Sets the new max cached nodes value. This can provoke deallocations //!if "newmax" is less than current cached nodes. Never throws void set_max_cached_nodes(size_type newmax); @@ -335,13 +335,13 @@ class cached_adaptive_pool //!Equality test for same type //!of cached_adaptive_pool template inline -bool operator==(const cached_adaptive_pool &alloc1, +bool operator==(const cached_adaptive_pool &alloc1, const cached_adaptive_pool &alloc2); //!Inequality test for same type //!of cached_adaptive_pool template inline -bool operator!=(const cached_adaptive_pool &alloc1, +bool operator!=(const cached_adaptive_pool &alloc1, const cached_adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp index 03398156d..ed1bee2f1 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -28,7 +28,7 @@ #include //!\file -//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator +//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -64,7 +64,7 @@ class cached_node_allocator_v1 template struct rebind - { + { typedef cached_node_allocator_v1 other; }; @@ -72,7 +72,7 @@ class cached_node_allocator_v1 typedef typename base_t::size_type size_type; cached_node_allocator_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -122,12 +122,12 @@ class cached_node_allocator template struct rebind - { + { typedef cached_node_allocator other; }; cached_node_allocator(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -151,11 +151,11 @@ class cached_node_allocator typedef typename SegmentManager::size_type size_type; typedef typename SegmentManager::difference_type difference_type; - //!Obtains cached_node_allocator from + //!Obtains cached_node_allocator from //!cached_node_allocator template struct rebind - { + { typedef cached_node_allocator other; }; @@ -166,7 +166,7 @@ class cached_node_allocator cached_node_allocator& operator= (const cached_node_allocator&); - //!Not assignable from + //!Not assignable from //!other cached_node_allocator cached_node_allocator& operator=(const cached_node_allocator&); @@ -176,7 +176,7 @@ class cached_node_allocator //!Can throw boost::interprocess::bad_alloc cached_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other cached_node_allocator. Increments the reference + //!Copy constructor from other cached_node_allocator. Increments the reference //!count of the associated node pool. Never throws cached_node_allocator(const cached_node_allocator &other); @@ -203,7 +203,7 @@ class cached_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -227,7 +227,7 @@ class cached_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Default construct an object. + //!Default construct an object. //!Throws if T's default constructor throws void construct(const pointer &ptr, const_reference v); @@ -242,7 +242,7 @@ class cached_node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -252,12 +252,12 @@ class cached_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -265,7 +265,7 @@ class cached_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -307,13 +307,13 @@ class cached_node_allocator //!Equality test for same type //!of cached_node_allocator template inline -bool operator==(const cached_node_allocator &alloc1, +bool operator==(const cached_node_allocator &alloc1, const cached_node_allocator &alloc2); //!Inequality test for same type //!of cached_node_allocator template inline -bool operator!=(const cached_node_allocator &alloc1, +bool operator!=(const cached_node_allocator &alloc1, const cached_node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp index 4ccc92066..a3afa8ee4 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -45,10 +45,16 @@ template< class SegmentManager > class private_adaptive_node_pool : public boost::container::container_detail::private_adaptive_node_pool_impl - + < typename SegmentManager::segment_manager_base_type + , ::boost::container::adaptive_pool_flag::size_ordered | + ::boost::container::adaptive_pool_flag::address_ordered + > { typedef boost::container::container_detail::private_adaptive_node_pool_impl - base_t; + < typename SegmentManager::segment_manager_base_type + , ::boost::container::adaptive_pool_flag::size_ordered | + ::boost::container::adaptive_pool_flag::address_ordered + > base_t; //Non-copyable private_adaptive_node_pool(); private_adaptive_node_pool(const private_adaptive_node_pool &); @@ -74,7 +80,7 @@ class private_adaptive_node_pool }; //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager @@ -83,7 +89,7 @@ template< class SegmentManager , std::size_t MaxFreeBlocks , unsigned char OverheadPercent > -class shared_adaptive_node_pool +class shared_adaptive_node_pool : public ipcdetail::shared_pool_impl < private_adaptive_node_pool diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp index ea660b1a9..f2b54a8ab 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // @@ -73,7 +73,7 @@ namespace ipcdetail { template struct get_or_create_node_pool_func { - + //!This connects or constructs the unique instance of node_pool_t //!Can throw boost::interprocess::bad_alloc void operator()() @@ -90,7 +90,7 @@ struct get_or_create_node_pool_func //!object parameters get_or_create_node_pool_func(typename NodePool::segment_manager *mngr) : mp_segment_manager(mngr){} - + NodePool *mp_node_pool; typename NodePool::segment_manager *mp_segment_manager; }; @@ -103,13 +103,13 @@ inline NodePool *get_or_create_node_pool(typename NodePool::segment_manager *mgn return func.mp_node_pool; } -//!Object function that decrements the reference count. If the count -//!reaches to zero destroys the node allocator from memory. +//!Object function that decrements the reference count. If the count +//!reaches to zero destroys the node allocator from memory. //!Never throws template struct destroy_if_last_link_func { - //!Decrements reference count and destroys the object if there is no + //!Decrements reference count and destroys the object if there is no //!more attached allocators. Never throws void operator()() { @@ -117,19 +117,19 @@ struct destroy_if_last_link_func if(mp_node_pool->dec_ref_count() != 0) return; //Last link, let's destroy the segment_manager - mp_node_pool->get_segment_manager()->template destroy(boost::interprocess::unique_instance); - } + mp_node_pool->get_segment_manager()->template destroy(boost::interprocess::unique_instance); + } //!Constructor. Initializes function //!object parameters - destroy_if_last_link_func(NodePool *pool) + destroy_if_last_link_func(NodePool *pool) : mp_node_pool(pool) {} NodePool *mp_node_pool; }; -//!Destruction function, initializes and executes destruction function +//!Destruction function, initializes and executes destruction function //!object. Never throws template inline void destroy_node_pool_if_last_link(NodePool *pool) @@ -173,7 +173,7 @@ class cache_impl ~cache_impl() { this->deallocate_all_cached_nodes(); - ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); + ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); } NodePool *get_node_pool() const @@ -189,34 +189,29 @@ class cache_impl { //If don't have any cached node, we have to get a new list of free nodes from the pool if(m_cached_nodes.empty()){ - m_cached_nodes = mp_node_pool->allocate_nodes(m_max_cached_nodes/2); + mp_node_pool->allocate_nodes(m_max_cached_nodes/2, m_cached_nodes); } - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front()); - m_cached_nodes.pop_front(); + void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); return ret; } - multiallocation_chain cached_allocation(size_type n) + void cached_allocation(size_type n, multiallocation_chain &chain) { - multiallocation_chain chain; size_type count = n, allocated(0); BOOST_TRY{ //If don't have any cached node, we have to get a new list of free nodes from the pool while(!m_cached_nodes.empty() && count--){ - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front()); - m_cached_nodes.pop_front(); + void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); chain.push_back(ret); ++allocated; } if(allocated != n){ - multiallocation_chain chain2(mp_node_pool->allocate_nodes(n - allocated)); - chain.splice_after(chain.last(), chain2, chain2.before_begin(), chain2.last(), n - allocated); + mp_node_pool->allocate_nodes(n - allocated, chain); } - return boost::move(chain); } BOOST_CATCH(...){ - this->cached_deallocation(boost::move(chain)); + this->cached_deallocation(chain); BOOST_RETHROW } BOOST_CATCH_END @@ -227,7 +222,7 @@ class cache_impl //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -235,14 +230,14 @@ class cache_impl m_cached_nodes.push_front(ptr); } - void cached_deallocation(multiallocation_chain chain) + void cached_deallocation(multiallocation_chain &chain) { m_cached_nodes.splice_after(m_cached_nodes.before_begin(), chain); //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -262,7 +257,7 @@ class cache_impl void deallocate_all_cached_nodes() { if(m_cached_nodes.empty()) return; - mp_node_pool->deallocate_nodes(boost::move(m_cached_nodes)); + mp_node_pool->deallocate_nodes(m_cached_nodes); } private: @@ -279,7 +274,7 @@ class cache_impl void priv_deallocate_n_nodes(size_type n) { //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. size_type count(n); @@ -290,16 +285,16 @@ class cache_impl multiallocation_chain chain; chain.splice_after(chain.before_begin(), m_cached_nodes, m_cached_nodes.before_begin(), it, n); //Deallocate all new linked list at once - mp_node_pool->deallocate_nodes(boost::move(chain)); + mp_node_pool->deallocate_nodes(chain); } public: void swap(cache_impl &other) { - ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); - m_cached_nodes.swap(other.m_cached_nodes); - ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); - } + ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); + m_cached_nodes.swap(other.m_cached_nodes); + ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); + } }; template @@ -335,13 +330,13 @@ class array_allocation_impl //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -355,17 +350,20 @@ class array_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements) + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) { - return this->derived()->get_segment_manager()->allocate_many(sizeof(T)*elem_size, num_elements); + if(size_overflows(elem_size)){ + throw bad_alloc(); + } + this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain); } //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements) + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { - return this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T)); + this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain); } //!Allocates many elements of size elem_size in a contiguous block @@ -374,8 +372,8 @@ class array_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain) - { return this->derived()->get_segment_manager()->deallocate_many(boost::move(chain)); } + void deallocate_many(multiallocation_chain &chain) + { this->derived()->get_segment_manager()->deallocate_many(chain); } //!Returns the number of elements that could be //!allocated. Never throws @@ -450,21 +448,24 @@ class node_pool_allocation_impl }; public: - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { (void)hint; typedef typename node_pool<0>::type node_pool_t; node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); - else if(Version == 1 && count == 1) + } + else if(Version == 1 && count == 1){ return pointer(static_cast (pool->allocate_node())); - else + } + else{ return pointer(static_cast - (pool->get_segment_manager()->allocate(sizeof(T)*count))); + (pool->get_segment_manager()->allocate(count*sizeof(T)))); + } } //!Deallocate allocated memory. Never throws @@ -495,11 +496,11 @@ class node_pool_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements) + void allocate_individual(size_type num_elements, multiallocation_chain &chain) { typedef typename node_pool<0>::type node_pool_t; node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - return multiallocation_chain(pool->allocate_nodes(num_elements)); + pool->allocate_nodes(num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). @@ -518,10 +519,10 @@ class node_pool_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) + void deallocate_individual(multiallocation_chain &chain) { node_pool<0>::get(this->derived()->get_node_pool())->deallocate_nodes - (chain.extract_multiallocation_chain()); + (chain); } //!Deallocates all free blocks of the pool @@ -599,20 +600,21 @@ class cached_allocator_impl size_type get_max_cached_nodes() const { return m_cache.get_max_cached_nodes(); } - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { (void)hint; void * ret; - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); + } else if(Version == 1 && count == 1){ ret = m_cache.cached_allocation(); } else{ - ret = this->get_segment_manager()->allocate(sizeof(T)*count); - } + ret = this->get_segment_manager()->allocate(count*sizeof(T)); + } return pointer(static_cast(ret)); } @@ -640,8 +642,8 @@ class cached_allocator_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements) - { return multiallocation_chain(this->m_cache.cached_allocation(num_elements)); } + void allocate_individual(size_type num_elements, multiallocation_chain &chain) + { this->m_cache.cached_allocation(num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -655,12 +657,8 @@ class cached_allocator_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) - { - typename node_pool_t::multiallocation_chain mem - (chain.extract_multiallocation_chain()); - m_cache.cached_deallocation(boost::move(mem)); - } + void deallocate_individual(multiallocation_chain &chain) + { m_cache.cached_deallocation(chain); } //!Deallocates all free blocks of the pool void deallocate_free_blocks() @@ -686,20 +684,20 @@ class cached_allocator_impl //!Equality test for same type of //!cached_allocator_impl template inline -bool operator==(const cached_allocator_impl &alloc1, +bool operator==(const cached_allocator_impl &alloc1, const cached_allocator_impl &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type of //!cached_allocator_impl template inline -bool operator!=(const cached_allocator_impl &alloc1, +bool operator!=(const cached_allocator_impl &alloc1, const cached_allocator_impl &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template @@ -736,7 +734,7 @@ class shared_pool_impl //----------------------- return private_node_allocator_t::allocate_node(); } - + //!Deallocates an array pointed by ptr. Never throws void deallocate_node(void *ptr) { @@ -745,25 +743,15 @@ class shared_pool_impl //----------------------- private_node_allocator_t::deallocate_node(ptr); } -/* - //!Allocates a singly linked list of n nodes ending in null pointer. - //!can throw boost::interprocess::bad_alloc - void allocate_nodes(multiallocation_chain &nodes, size_type n) - { - //----------------------- - boost::interprocess::scoped_lock guard(m_header); - //----------------------- - return private_node_allocator_t::allocate_nodes(nodes, n); - } -*/ - //!Allocates n nodes. + + //!Allocates n nodes. //!Can throw boost::interprocess::bad_alloc - multiallocation_chain allocate_nodes(const size_type n) + void allocate_nodes(const size_type n, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return private_node_allocator_t::allocate_nodes(n); + private_node_allocator_t::allocate_nodes(n, chain); } //!Deallocates a linked list of nodes ending in null pointer. Never throws @@ -776,12 +764,12 @@ class shared_pool_impl } //!Deallocates the nodes pointed by the multiallocation iterator. Never throws - void deallocate_nodes(multiallocation_chain chain) + void deallocate_nodes(multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - private_node_allocator_t::deallocate_nodes(boost::move(chain)); + private_node_allocator_t::deallocate_nodes(chain); } //!Deallocates all the free blocks of memory. Never throws diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp index 7327ff92d..e67d3217b 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -37,7 +37,7 @@ namespace ipcdetail { //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock > @@ -73,18 +73,18 @@ class private_node_pool //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager , std::size_t NodeSize , std::size_t NodesPerBlock > -class shared_node_pool +class shared_node_pool : public ipcdetail::shared_pool_impl < private_node_pool diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp index da7e4668e..e9fec385e 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-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) // diff --git a/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp index f1c3259d7..3b2ec2901 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -34,7 +34,7 @@ #include //!\file -//!Describes node_allocator pooled shared memory STL compatible allocator +//!Describes node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -98,11 +98,11 @@ class node_allocator_base typedef boost::container::container_detail::transform_multiallocation_chain multiallocation_chain; - //!Obtains node_allocator_base from + //!Obtains node_allocator_base from //!node_allocator_base template struct rebind - { + { typedef node_allocator_base other; }; @@ -121,15 +121,15 @@ class node_allocator_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - node_allocator_base(segment_manager *segment_mngr) + node_allocator_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool::type>(segment_mngr)) { } - //!Copy constructor from other node_allocator_base. Increments the reference + //!Copy constructor from other node_allocator_base. Increments the reference //!count of the associated node pool. Never throws - node_allocator_base(const node_allocator_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + node_allocator_base(const node_allocator_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Copy constructor from related node_allocator_base. If not present, constructs @@ -150,7 +150,7 @@ class node_allocator_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~node_allocator_base() + ~node_allocator_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -177,14 +177,14 @@ class node_allocator_base //!Equality test for same type //!of node_allocator_base template inline -bool operator==(const node_allocator_base &alloc1, +bool operator==(const node_allocator_base &alloc1, const node_allocator_base &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of node_allocator_base template inline -bool operator!=(const node_allocator_base &alloc1, +bool operator!=(const node_allocator_base &alloc1, const node_allocator_base &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -206,11 +206,11 @@ class node_allocator_v1 template struct rebind - { + { typedef node_allocator_v1 other; }; - node_allocator_v1(SegmentManager *segment_mngr) + node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -225,12 +225,12 @@ class node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This node allocator shares a segregated storage between all instances -//!of node_allocator with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of node_allocator with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes template < class T @@ -256,11 +256,11 @@ class node_allocator template struct rebind - { + { typedef node_allocator other; }; - node_allocator(SegmentManager *segment_mngr) + node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -284,11 +284,11 @@ class node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains node_allocator from + //!Obtains node_allocator from //!node_allocator template struct rebind - { + { typedef node_allocator other; }; @@ -299,7 +299,7 @@ class node_allocator node_allocator& operator= (const node_allocator&); - //!Not assignable from + //!Not assignable from //!other node_allocator //node_allocator& operator=(const node_allocator&); @@ -309,7 +309,7 @@ class node_allocator //!Can throw boost::interprocess::bad_alloc node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other node_allocator. Increments the reference + //!Copy constructor from other node_allocator. Increments the reference //!count of the associated node pool. Never throws node_allocator(const node_allocator &other); @@ -336,7 +336,7 @@ class node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -360,7 +360,7 @@ class node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -375,7 +375,7 @@ class node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -385,12 +385,12 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -398,7 +398,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -411,7 +411,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -424,7 +424,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -433,13 +433,13 @@ class node_allocator //!Equality test for same type //!of node_allocator template inline -bool operator==(const node_allocator &alloc1, +bool operator==(const node_allocator &alloc1, const node_allocator &alloc2); //!Inequality test for same type //!of node_allocator template inline -bool operator!=(const node_allocator &alloc1, +bool operator!=(const node_allocator &alloc1, const node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp index 301fb92da..fd7ad7c7d 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -33,7 +33,7 @@ #include //!\file -//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator +//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -102,7 +102,7 @@ class private_adaptive_pool_base //!Obtains node_allocator from other node_allocator template struct rebind - { + { typedef private_adaptive_pool_base other; }; @@ -154,7 +154,7 @@ class private_adaptive_pool_base {} //!Destructor, frees all used memory. Never throws - ~private_adaptive_pool_base() + ~private_adaptive_pool_base() {} //!Returns the segment manager. Never throws @@ -178,13 +178,13 @@ class private_adaptive_pool_base //!Equality test for same type of private_adaptive_pool_base template inline -bool operator==(const private_adaptive_pool_base &alloc1, +bool operator==(const private_adaptive_pool_base &alloc1, const private_adaptive_pool_base &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_adaptive_pool_base template inline -bool operator!=(const private_adaptive_pool_base &alloc1, +bool operator!=(const private_adaptive_pool_base &alloc1, const private_adaptive_pool_base &alloc2) { return &alloc1 != &alloc2; } @@ -210,11 +210,11 @@ class private_adaptive_pool_v1 template struct rebind - { + { typedef private_adaptive_pool_v1 other; }; - private_adaptive_pool_v1(SegmentManager *segment_mngr) + private_adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -229,7 +229,7 @@ class private_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... @@ -269,12 +269,12 @@ class private_adaptive_pool template struct rebind - { + { typedef private_adaptive_pool other; }; - private_adaptive_pool(SegmentManager *segment_mngr) + private_adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -298,11 +298,11 @@ class private_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains private_adaptive_pool from + //!Obtains private_adaptive_pool from //!private_adaptive_pool template struct rebind - { + { typedef private_adaptive_pool other; }; @@ -314,7 +314,7 @@ class private_adaptive_pool private_adaptive_pool& operator= (const private_adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other private_adaptive_pool private_adaptive_pool& operator=(const private_adaptive_pool&); @@ -324,7 +324,7 @@ class private_adaptive_pool //!Can throw boost::interprocess::bad_alloc private_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other private_adaptive_pool. Increments the reference + //!Copy constructor from other private_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws private_adaptive_pool(const private_adaptive_pool &other); @@ -351,7 +351,7 @@ class private_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class private_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class private_adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -400,12 +400,12 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -413,7 +413,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -426,7 +426,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -439,7 +439,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -448,13 +448,13 @@ class private_adaptive_pool //!Equality test for same type //!of private_adaptive_pool template inline -bool operator==(const private_adaptive_pool &alloc1, +bool operator==(const private_adaptive_pool &alloc1, const private_adaptive_pool &alloc2); //!Inequality test for same type //!of private_adaptive_pool template inline -bool operator!=(const private_adaptive_pool &alloc1, +bool operator!=(const private_adaptive_pool &alloc1, const private_adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp index f202e316f..93a4750b8 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -33,7 +33,7 @@ #include //!\file -//!Describes private_node_allocator_base pooled shared memory STL compatible allocator +//!Describes private_node_allocator_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -97,7 +97,7 @@ class private_node_allocator_base //!Obtains node_allocator from other node_allocator template struct rebind - { + { typedef private_node_allocator_base other; }; @@ -146,7 +146,7 @@ class private_node_allocator_base {} //!Destructor, frees all used memory. Never throws - ~private_node_allocator_base() + ~private_node_allocator_base() {} //!Returns the segment manager. Never throws @@ -170,13 +170,13 @@ class private_node_allocator_base //!Equality test for same type of private_node_allocator_base template inline -bool operator==(const private_node_allocator_base &alloc1, +bool operator==(const private_node_allocator_base &alloc1, const private_node_allocator_base &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_node_allocator_base template inline -bool operator!=(const private_node_allocator_base &alloc1, +bool operator!=(const private_node_allocator_base &alloc1, const private_node_allocator_base &alloc2) { return &alloc1 != &alloc2; } @@ -198,11 +198,11 @@ class private_node_allocator_v1 template struct rebind - { + { typedef private_node_allocator_v1 other; }; - private_node_allocator_v1(SegmentManager *segment_mngr) + private_node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -217,11 +217,11 @@ class private_node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated +//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated //!at once when the allocator needs runs out of nodes template < class T , class SegmentManager @@ -246,12 +246,12 @@ class private_node_allocator template struct rebind - { + { typedef private_node_allocator other; }; - private_node_allocator(SegmentManager *segment_mngr) + private_node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -275,11 +275,11 @@ class private_node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manage::difference_type difference_type; - //!Obtains private_node_allocator from + //!Obtains private_node_allocator from //!private_node_allocator template struct rebind - { + { typedef private_node_allocator other; }; @@ -291,7 +291,7 @@ class private_node_allocator private_node_allocator& operator= (const private_node_allocator&); - //!Not assignable from + //!Not assignable from //!other private_node_allocator private_node_allocator& operator=(const private_node_allocator&); @@ -301,7 +301,7 @@ class private_node_allocator //!Can throw boost::interprocess::bad_alloc private_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other private_node_allocator. Increments the reference + //!Copy constructor from other private_node_allocator. Increments the reference //!count of the associated node pool. Never throws private_node_allocator(const private_node_allocator &other); @@ -328,7 +328,7 @@ class private_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -352,7 +352,7 @@ class private_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -367,7 +367,7 @@ class private_node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -377,12 +377,12 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -390,7 +390,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -403,7 +403,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -416,7 +416,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -425,13 +425,13 @@ class private_node_allocator //!Equality test for same type //!of private_node_allocator template inline -bool operator==(const private_node_allocator &alloc1, +bool operator==(const private_node_allocator &alloc1, const private_node_allocator &alloc2); //!Inequality test for same type //!of private_node_allocator template inline -bool operator!=(const private_node_allocator &alloc1, +bool operator!=(const private_node_allocator &alloc1, const private_node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp index 7184306a6..2eb219a83 100644 --- a/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -20,7 +20,7 @@ #include #if (!defined(BOOST_INTERPROCESS_WINDOWS)) -# include //open, O_CREAT, O_*... +# include //open, O_CREAT, O_*... # include //mmap # include //mode_t, S_IRWXG, S_IRWXO, S_IRWXU, #else @@ -43,12 +43,10 @@ namespace ipcdetail{ { public: static mapped_region - create_posix_mapped_region(void *address, offset_t offset, std::size_t size) + create_posix_mapped_region(void *address, std::size_t size) { mapped_region region; region.m_base = address; - region.m_offset = offset; - region.m_extra_offset = 0; region.m_size = size; return region; } @@ -92,16 +90,16 @@ anonymous_shared_memory(std::size_t size, void *address = 0) , 0); if(address == MAP_FAILED){ - if(fd != -1) + if(fd != -1) close(fd); error_info err = system_error_code(); throw interprocess_exception(err); } - if(fd != -1) + if(fd != -1) close(fd); - return ipcdetail::raw_mapped_region_creator::create_posix_mapped_region(address, 0, size); + return ipcdetail::raw_mapped_region_creator::create_posix_mapped_region(address, size); } #else { diff --git a/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp b/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp index 660b6cbdb..eea431b0d 100644 --- a/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp b/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp index 7852bbc85..28cd0f126 100644 --- a/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009. Distributed under the Boost +// (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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/deque.hpp b/project/jni/boost/include/boost/interprocess/containers/deque.hpp index 30ca43203..66122e247 100644 --- a/project/jni/boost/include/boost/interprocess/containers/deque.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/deque.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp b/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp index f18a006c7..38b04ac9a 100644 --- a/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp b/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp index 1b2bf9b4d..45b42fd1e 100644 --- a/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/list.hpp b/project/jni/boost/include/boost/interprocess/containers/list.hpp index a75b9759b..50f0ff0d0 100644 --- a/project/jni/boost/include/boost/interprocess/containers/list.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/list.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/map.hpp b/project/jni/boost/include/boost/interprocess/containers/map.hpp index 2e45ec063..ca00b2049 100644 --- a/project/jni/boost/include/boost/interprocess/containers/map.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/map.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/pair.hpp b/project/jni/boost/include/boost/interprocess/containers/pair.hpp index 8ba6d047a..65526ab93 100644 --- a/project/jni/boost/include/boost/interprocess/containers/pair.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/pair.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/set.hpp b/project/jni/boost/include/boost/interprocess/containers/set.hpp index db06afea6..697920453 100644 --- a/project/jni/boost/include/boost/interprocess/containers/set.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/set.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/slist.hpp b/project/jni/boost/include/boost/interprocess/containers/slist.hpp index f93379cb7..b511d060f 100644 --- a/project/jni/boost/include/boost/interprocess/containers/slist.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/slist.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp b/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp index ae09e6b52..4a59b81ed 100644 --- a/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/string.hpp b/project/jni/boost/include/boost/interprocess/containers/string.hpp index a11bb904b..e7af2fa36 100644 --- a/project/jni/boost/include/boost/interprocess/containers/string.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/string.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/vector.hpp b/project/jni/boost/include/boost/interprocess/containers/vector.hpp index 3a6b41151..3f10e0153 100644 --- a/project/jni/boost/include/boost/interprocess/containers/vector.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/vector.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/containers/version_type.hpp b/project/jni/boost/include/boost/interprocess/containers/version_type.hpp index 247f800f4..4516e8c9b 100644 --- a/project/jni/boost/include/boost/interprocess/containers/version_type.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/version_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/interprocess/creation_tags.hpp b/project/jni/boost/include/boost/interprocess/creation_tags.hpp index 374829ac2..459eb4df4 100644 --- a/project/jni/boost/include/boost/interprocess/creation_tags.hpp +++ b/project/jni/boost/include/boost/interprocess/creation_tags.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/detail/atomic.hpp b/project/jni/boost/include/boost/interprocess/detail/atomic.hpp index f7551f3dd..08481a430 100644 --- a/project/jni/boost/include/boost/interprocess/detail/atomic.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/atomic.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2011 +// (C) Copyright Ion Gaztanaga 2006-2012 // (C) Copyright Markus Schoepflin 2007 // (C) Copyright Bryce Lelbach 2010 // @@ -117,23 +117,6 @@ inline boost::uint32_t atomic_cas32 : "cc"); return prev; -/* - asm volatile( "lock\n\t" - "cmpxchg %3,%1" - : "=a" (prev), "=m" (*(mem)) - : "0" (prev), "r" (with) - : "memory", "cc"); -*/ -/* - boost::uint32_t prev; - - asm volatile ("lock; cmpxchgl %1, %2" - : "=a" (prev) - : "r" (with), "m" (*(mem)), "0"(cmp)); - asm volatile("" : : : "memory"); - - return prev; -*/ } //! Atomically add 'val' to an boost::uint32_t @@ -158,14 +141,6 @@ inline boost::uint32_t atomic_add32 ); return r; -/* - asm volatile( "lock\n\t; xaddl %0,%1" - : "=r"(val), "=m"(*mem) - : "0"(val), "m"(*mem)); - asm volatile("" : : : "memory"); - - return val; -*/ } //! Atomically increment an apr_uint32_t by 1 @@ -208,17 +183,14 @@ inline boost::uint32_t atomic_add32(volatile boost::uint32_t *mem, boost::uint32 { boost::uint32_t prev, temp; - asm volatile ("0:\n\t" // retry local label - "lwarx %0,0,%2\n\t" // load prev and reserve - "add %1,%0,%3\n\t" // temp = prev + val - "stwcx. %1,0,%2\n\t" // conditionally store - "bne- 0b" // start over if we lost - // the reservation - //XXX find a cleaner way to define the temp - //it's not an output - : "=&r" (prev), "=&r" (temp) // output, temp - : "b" (mem), "r" (val) // inputs - : "memory", "cc"); // clobbered + asm volatile ("1:\n\t" + "lwarx %0,0,%2\n\t" + "add %1,%0,%3\n\t" + "stwcx. %1,0,%2\n\t" + "bne- 1b" + : "=&r" (prev), "=&r" (temp) + : "b" (mem), "r" (val) + : "cc", "memory"); return prev; } @@ -233,19 +205,16 @@ inline boost::uint32_t atomic_cas32 { boost::uint32_t prev; - asm volatile ("0:\n\t" // retry local label - "lwarx %0,0,%1\n\t" // load prev and reserve - "cmpw %0,%3\n\t" // does it match cmp? - "bne- 1f\n\t" // ...no, bail out - "stwcx. %2,0,%1\n\t" // ...yes, conditionally - // store with - "bne- 0b\n\t" // start over if we lost - // the reservation - "1:" // exit local label - - : "=&r"(prev) // output - : "b" (mem), "r" (with), "r"(cmp) // inputs - : "memory", "cc"); // clobbered + asm volatile ("1:\n\t" + "lwarx %0,0,%1\n\t" + "cmpw %0,%3\n\t" + "bne- 2f\n\t" + "stwcx. %2,0,%1\n\t" + "bne- 1b\n\t" + "2:" + : "=&r"(prev) + : "b" (mem), "r"(cmp), "r" (with) + : "cc", "memory"); return prev; } @@ -275,56 +244,6 @@ inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) } //namespace interprocess{ } //namespace boost{ -#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ return __sync_fetch_and_add(const_cast(mem), val); } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return __sync_val_compare_and_swap(const_cast(mem), cmp, with); } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - #elif (defined(sun) || defined(__sun)) #include @@ -471,97 +390,147 @@ inline boost::uint32_t atomic_cas32( } //namespace interprocess{ } //namespace boost{ -#elif defined(__IBMCPP__) && (__IBMCPP__ >= 800) && defined(_AIX) +#elif defined(__IBMCPP__) && (__IBMCPP__ >= 800) && defined(_AIX) -#include +#include -namespace boost { -namespace interprocess { -namespace ipcdetail{ +namespace boost { +namespace interprocess { +namespace ipcdetail{ -//first define boost::uint32_t versions of __lwarx and __stwcx to avoid poluting -//all the functions with casts +//first define boost::uint32_t versions of __lwarx and __stwcx to avoid poluting +//all the functions with casts -//! From XLC documenation : -//! This function can be used with a subsequent stwcxu call to implement a -//! read-modify-write on a specified memory location. The two functions work -//! together to ensure that if the store is successfully performed, no other -//! processor or mechanism can modify the target doubleword between the time -//! lwarxu function is executed and the time the stwcxu functio ncompletes. -//! "mem" : pointer to the object -//! Returns the value at pointed to by mem -inline boost::uint32_t lwarxu(volatile boost::uint32_t *mem) -{ - return static_cast(__lwarx(reinterpret_cast(mem))); -} +//! From XLC documenation : +//! This function can be used with a subsequent stwcxu call to implement a +//! read-modify-write on a specified memory location. The two functions work +//! together to ensure that if the store is successfully performed, no other +//! processor or mechanism can modify the target doubleword between the time +//! lwarxu function is executed and the time the stwcxu functio ncompletes. +//! "mem" : pointer to the object +//! Returns the value at pointed to by mem +inline boost::uint32_t lwarxu(volatile boost::uint32_t *mem) +{ + return static_cast(__lwarx(reinterpret_cast(mem))); +} -//! "mem" : pointer to the object -//! "val" : the value to store -//! Returns true if the update of mem is successful and false if it is -//!unsuccessful -inline bool stwcxu(volatile boost::uint32_t* mem, boost::uint32_t val) -{ - return (__stwcx(reinterpret_cast(mem), static_cast(val)) != 0); -} +//! "mem" : pointer to the object +//! "val" : the value to store +//! Returns true if the update of mem is successful and false if it is +//!unsuccessful +inline bool stwcxu(volatile boost::uint32_t* mem, boost::uint32_t val) +{ + return (__stwcx(reinterpret_cast(mem), static_cast(val)) != 0); +} -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ - boost::uint32_t oldValue; - do - { - oldValue = lwarxu(mem); - }while (!stwcxu(mem, oldValue+val)); - return oldValue; -} +//! "mem": pointer to the object +//! "val": amount to add +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_add32 + (volatile boost::uint32_t *mem, boost::uint32_t val) +{ + boost::uint32_t oldValue; + do + { + oldValue = lwarxu(mem); + }while (!stwcxu(mem, oldValue+val)); + return oldValue; +} -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } +//! Atomically increment an apr_uint32_t by 1 +//! "mem": pointer to the object +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, 1); } -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } +//! Atomically decrement an boost::uint32_t by 1 +//! "mem": pointer to the atomic value +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, (boost::uint32_t)-1); } -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } +//! Atomically read an boost::uint32_t from memory +inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) +{ return *mem; } -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - boost::uint32_t oldValue; - boost::uint32_t valueToStore; - do - { - oldValue = lwarxu(mem); - } while (!stwcxu(mem, (oldValue == with) ? cmp : oldValue)); +//! Compare an boost::uint32_t's value with "cmp". +//! If they are the same swap the value with "with" +//! "mem": pointer to the value +//! "with" what to swap it with +//! "cmp": the value to compare it to +//! Returns the old value of *mem +inline boost::uint32_t atomic_cas32 + (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) +{ + boost::uint32_t oldValue; + boost::uint32_t valueToStore; + do + { + oldValue = lwarxu(mem); + } while (!stwcxu(mem, (oldValue == with) ? cmp : oldValue)); - return oldValue; -} + return oldValue; +} -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } +//! Atomically set an boost::uint32_t in memory +//! "mem": pointer to the object +//! "param": val value that the object will assume +inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) +{ *mem = val; } -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) + +namespace boost { +namespace interprocess { +namespace ipcdetail{ + +//! Atomically add 'val' to an boost::uint32_t +//! "mem": pointer to the object +//! "val": amount to add +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_add32 + (volatile boost::uint32_t *mem, boost::uint32_t val) +{ return __sync_fetch_and_add(const_cast(mem), val); } + +//! Atomically increment an apr_uint32_t by 1 +//! "mem": pointer to the object +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, 1); } + +//! Atomically decrement an boost::uint32_t by 1 +//! "mem": pointer to the atomic value +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, (boost::uint32_t)-1); } + +//! Atomically read an boost::uint32_t from memory +inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) +{ return *mem; } + +//! Compare an boost::uint32_t's value with "cmp". +//! If they are the same swap the value with "with" +//! "mem": pointer to the value +//! "with" what to swap it with +//! "cmp": the value to compare it to +//! Returns the old value of *mem +inline boost::uint32_t atomic_cas32 + (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) +{ return __sync_val_compare_and_swap(const_cast(mem), cmp, with); } + +//! Atomically set an boost::uint32_t in memory +//! "mem": pointer to the object +//! "param": val value that the object will assume +inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) +{ *mem = val; } + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ #else @@ -583,9 +552,9 @@ inline bool atomic_add_unless32 return c != unless_this; } -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp b/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp index bd91d1b6b..37dabd1f8 100644 --- a/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp b/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp index 559331ab3..9224f7dd6 100644 --- a/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -44,4 +44,5 @@ // with /GR-; unpredictable behavior may result #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4250) // inherits 'x' via dominance #endif diff --git a/project/jni/boost/include/boost/interprocess/detail/config_end.hpp b/project/jni/boost/include/boost/interprocess/detail/config_end.hpp index 422458e85..f871ce754 100644 --- a/project/jni/boost/include/boost/interprocess/detail/config_end.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/config_end.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp b/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp new file mode 100644 index 000000000..fb578ef01 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp @@ -0,0 +1,18 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED +#define BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED +#include +#endif + +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wshadow" +#endif diff --git a/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp b/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp new file mode 100644 index 000000000..214558f58 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp @@ -0,0 +1,12 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) +# pragma GCC diagnostic pop +#endif diff --git a/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp b/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp new file mode 100644 index 000000000..2b96e2b6d --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp @@ -0,0 +1,298 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP +#define BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +#include +#include +#include + +#else //defined(BOOST_INTERPROCESS_WINDOWS) + +#include +#include +#include + +#endif //defined(BOOST_INTERPROCESS_WINDOWS) + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +struct locking_file_serial_id +{ + int fd; + unsigned long dwVolumeSerialNumber; + unsigned long nFileIndexHigh; + unsigned long nFileIndexLow; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno == EDEADLK){ + ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + return 0 == _locking(fd, _LK_NBLCK , 1); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + file_handle_t handle = create_or_open_file(name, read_write, p); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; + } + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + struct _stat s; + if(0 == _stat(name, &s)){ + return fd; + } + else{ + _close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + file_handle_t handle = open_existing_file(name, read_write); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; + } + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ _close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct _stat s; + return EBADF != _fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + if(_isatty(fd)) + return false; + struct _stat s; + if(0 != _fstat(fd, &s)) + return false; + return 0 != (s.st_mode & _S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct _stat s; + if(0 != _fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + id.fd = fd; + id.dwVolumeSerialNumber = info.dwVolumeSerialNumber; + id.nFileIndexHigh = info.nFileIndexHigh; + id.nFileIndexLow = info.nFileIndexLow; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + + return id.dwVolumeSerialNumber == info.dwVolumeSerialNumber && + id.nFileIndexHigh == info.nFileIndexHigh && + id.nFileIndexLow == info.nFileIndexLow; +} + +#else //UNIX + +struct locking_file_serial_id +{ + int fd; + dev_t st_dev; + ino_t st_ino; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno != EINTR){ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + ret = fcntl (fd, F_SETLKW, &lock); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + return 0 == fcntl (fd, F_SETLK, &lock); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + int fd = create_or_open_file(name, read_write, p); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + struct stat s; + if(0 == stat(name, &s)){ + return fd; + } + else{ + close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + int fd = open_existing_file(name, read_write); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct stat s; + return EBADF != fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + return 0 != (s.st_mode & S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + id.fd = fd; + id.st_dev = s.st_dev; + id.st_ino = s.st_ino; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + struct stat info; + if(0 != fstat(fd, &info)) + return false; + + return id.st_dev == info.st_dev && + id.st_ino == info.st_ino; +} + +#endif + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp b/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp index 7b53f36ac..e139df26a 100644 --- a/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -44,13 +44,13 @@ class file_wrapper file_wrapper(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); } - //!Tries to open a file with name "name", with the access mode "mode". + //!Tries to open a file with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. file_wrapper(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); } - //!Moves the ownership of "moved"'s file to *this. - //!After the call, "moved" does not represent any file. + //!Moves the ownership of "moved"'s file to *this. + //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper(BOOST_RV_REF(file_wrapper) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) @@ -60,10 +60,10 @@ class file_wrapper //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved) - { + { file_wrapper tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to file_wrappers. @@ -73,7 +73,7 @@ class file_wrapper //!Erases a file from the system. //!Returns false on error. Never throws static bool remove(const char *name); - + //!Sets the size of the file void truncate(offset_t length); @@ -108,11 +108,11 @@ class file_wrapper std::string m_filename; }; -inline file_wrapper::file_wrapper() +inline file_wrapper::file_wrapper() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline file_wrapper::~file_wrapper() +inline file_wrapper::~file_wrapper() { this->priv_close(); } inline const char *file_wrapper::get_name() const @@ -122,10 +122,10 @@ inline bool file_wrapper::get_size(offset_t &size) const { return get_file_size((file_handle_t)m_handle, size); } inline void file_wrapper::swap(file_wrapper &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t file_wrapper::get_mapping_handle() const @@ -135,7 +135,7 @@ inline mode_t file_wrapper::get_mode() const { return m_mode; } inline bool file_wrapper::priv_open_or_create - (ipcdetail::create_enum_t type, + (ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm = permissions()) diff --git a/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp b/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp index 0e69452a4..7c0966c10 100644 --- a/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -25,7 +25,7 @@ //!Describes an abstract interface for placement construction and destruction. namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { struct in_place_interface diff --git a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp index 4bffbe9d4..9f41ba63f 100644 --- a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (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) // @@ -18,1163 +18,27 @@ #include #include -#if defined(BOOST_INTERPROCESS_WINDOWS) -#include -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if defined(BOOST_INTERPROCESS_WINDOWS) -#include -#include - -#include -#else -#include -#include -#include +#ifdef BOOST_INTERPROCESS_WINDOWS + #include #endif +#include namespace boost{ namespace interprocess{ namespace ipcdetail{ -struct intermodule_singleton_mutex_family -{ - typedef boost::interprocess::ipcdetail::spin_mutex mutex_type; - typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type; -}; - -struct intermodule_types -{ - //We must use offset_ptr since a loaded DLL can map the singleton holder shared memory - //at a different address than other DLLs/main executables - typedef rbtree_best_fit > mem_algo; - template - struct open_or_create - { - typedef managed_open_or_create_impl - type; - }; -}; - -template -class basic_managed_global_memory - : public basic_managed_memory_impl - < char - , intermodule_types::mem_algo - , iset_index - , intermodule_types::open_or_create::type::ManagedOpenOrCreateUserOffset - > - , private intermodule_types::open_or_create::type -{ - /// @cond - typedef typename intermodule_types::template open_or_create::type base2_t; - - typedef basic_managed_memory_impl - < char - , intermodule_types::mem_algo - , iset_index - , base2_t::ManagedOpenOrCreateUserOffset - > base_t; - - typedef create_open_func create_open_func_t; - - basic_managed_global_memory *get_this_pointer() - { return this; } - - public: - typedef typename base_t::size_type size_type; - - private: - typedef typename base_t::char_ptr_holder_t char_ptr_holder_t; - BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory) - /// @endcond - - public: //functions -/* - basic_managed_global_memory() - {} - - basic_managed_global_memory(create_only_t create_only, const char *name, - size_type size, const void *addr = 0, const permissions& perm = permissions()) - : base_t() - , base2_t(create_only, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), DoCreate), perm) - {} -*/ - basic_managed_global_memory (open_or_create_t open_or_create, - const char *name, size_type size, - const void *addr = 0, const permissions& perm = permissions()) - : base_t() - , base2_t(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), - DoOpenOrCreate), perm) - {} - - basic_managed_global_memory (open_only_t open_only, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - -/* - basic_managed_global_memory (open_copy_on_write_t, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - - //!Connects to a created shared memory and its segment manager. - //!in read-only mode. - //!This can throw. - basic_managed_global_memory (open_read_only_t, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - - //!Moves the ownership of "moved"'s managed memory to *this. - //!Does not throw - basic_managed_global_memory(BOOST_RV_REF(basic_managed_global_memory) moved) - { - basic_managed_global_memory tmp; - this->swap(moved); - tmp.swap(moved); - } - - //!Moves the ownership of "moved"'s managed memory to *this. - //!Does not throw - basic_managed_global_memory &operator=(BOOST_RV_REF(basic_managed_global_memory) moved) - { - basic_managed_global_memory tmp(boost::move(moved)); - this->swap(tmp); - return *this; - }*/ -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) -typedef basic_managed_global_memory windows_managed_global_memory; -#endif - -typedef basic_managed_global_memory managed_global_memory; - -namespace file_locking_helpers { - -inline void get_pid_creation_time_str(std::string &s) -{ - std::stringstream stream; - stream << get_current_process_id() << '_'; - stream.precision(6); - stream << std::fixed << get_current_process_creation_time(); - s = stream.str(); -} - -inline void create_tmp_subdir_and_get_pid_based_filepath(const char *subdir_name, const char *file_prefix, OS_process_id_t pid, std::string &s, bool creation_time = false) -{ - //Let's create a lock file for each process gmem that will mark if - //the process is alive or not - create_tmp_and_clean_old(s); - s += "/"; - s += subdir_name; - if(!open_or_create_directory(s.c_str())){ - throw interprocess_exception(error_info(system_error_code())); - } - s += "/"; - s += file_prefix; - if(creation_time){ - std::string sstamp; - get_pid_creation_time_str(sstamp); - s += sstamp; - } - else{ - pid_str_t pid_str; - get_pid_str(pid_str, pid); - s += pid_str; - } -} - -inline bool check_if_filename_complies_with_pid - (const char *filename, const char *prefix, OS_process_id_t pid, std::string &file_suffix, bool creation_time = false) -{ - //Check if filename complies with lock file name pattern - std::string fname(filename); - std::string fprefix(prefix); - if(fname.size() <= fprefix.size()){ - return false; - } - fname.resize(fprefix.size()); - if(fname != fprefix){ - return false; - } - - //If not our lock file, delete it if we can lock it - fname = filename; - fname.erase(0, fprefix.size()); - pid_str_t pid_str; - get_pid_str(pid_str, pid); - file_suffix = pid_str; - if(creation_time){ - std::size_t p = fname.find('_'); - if (p == std::string::npos){ - return false; - } - std::string save_suffix(fname); - fname.erase(p); - fname.swap(file_suffix); - bool ret = (file_suffix == fname); - file_suffix.swap(save_suffix); - return ret; - } - else{ - fname.swap(file_suffix); - return (file_suffix == fname); - } -} - -} //file_locking_helpers - -namespace intermodule_singleton_helpers { - -const int GMemMarkToBeRemoved = -1; -const int GMemNotPresent = -2; - -inline const char *get_lock_file_subdir_name() -{ return "gmem"; } - -inline const char *get_lock_file_base_name() -{ return "lck"; } - -inline void create_and_get_singleton_lock_file_path(std::string &s) -{ - file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath - (get_lock_file_subdir_name(), get_lock_file_base_name(), get_current_process_id(), s, true); -} - -inline const char *get_shm_base_name() -{ return "bip.gmem.shm."; } - -inline void get_shm_name(std::string &shm_name) -{ - file_locking_helpers::get_pid_creation_time_str(shm_name); - shm_name.insert(0, get_shm_base_name()); -} - -inline std::size_t get_shm_size() -{ return 65536; } - -template -struct managed_sh_dependant -{ - static void apply_gmem_erase_logic(const char *filepath, const char *filename); - - static bool remove_old_gmem() - { - std::string refcstrRootDirectory; - tmp_folder(refcstrRootDirectory); - refcstrRootDirectory += "/"; - refcstrRootDirectory += get_lock_file_subdir_name(); - return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); - } -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct managed_sh_dependant -{ - static void apply_gmem_erase_logic(const char *, const char *){} - - static bool remove_old_gmem() - { return true; } -}; - - -struct locking_file_serial_id -{ - int fd; - unsigned long dwVolumeSerialNumber; - unsigned long nFileIndexHigh; - unsigned long nFileIndexLow; - //This reference count counts the number of modules attached - //to the shared memory and lock file. This serves to unlink - //the locking file and shared memory when all modules are - //done with the global memory (shared memory) - volatile boost::uint32_t modules_attached_to_gmem_count; -}; - -inline bool lock_locking_file(int fd) -{ - int ret = 0; - while(ret != 0 && errno == EDEADLK){ - ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); - } - return 0 == ret; -} - -inline bool try_lock_locking_file(int fd) -{ - return 0 == _locking(fd, _LK_NBLCK , 1); -} - -inline int open_or_create_and_lock_file(const char *name) -{ - permissions p; - p.set_unrestricted(); - while(1){ - file_handle_t handle = create_or_open_file(name, read_write, p); - int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); - if(fd < 0){ - close_file(handle); - return fd; - } - if(!try_lock_locking_file(fd)){ - _close(fd); - return -1; - } - struct _stat s; - if(0 == _stat(name, &s)){ - return fd; - } - else{ - _close(fd); - } - } -} - -inline int try_open_and_lock_file(const char *name) -{ - file_handle_t handle = open_existing_file(name, read_write); - int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); - if(fd < 0){ - close_file(handle); - return fd; - } - if(!try_lock_locking_file(fd)){ - _close(fd); - return -1; - } - return fd; -} - -inline void close_lock_file(int fd) -{ _close(fd); } - -inline bool is_valid_fd(int fd) -{ - struct _stat s; - return EBADF != _fstat(fd, &s); -} - -inline bool is_normal_file(int fd) -{ - if(_isatty(fd)) - return false; - struct _stat s; - if(0 != _fstat(fd, &s)) - return false; - return 0 != (s.st_mode & _S_IFREG); -} - -inline std::size_t get_size(int fd) -{ - struct _stat s; - if(0 != _fstat(fd, &s)) - return 0u; - return (std::size_t)s.st_size; -} - -inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) -{ - winapi::interprocess_by_handle_file_information info; - if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) - return false; - id.fd = fd; - id.dwVolumeSerialNumber = info.dwVolumeSerialNumber; - id.nFileIndexHigh = info.nFileIndexHigh; - id.nFileIndexLow = info.nFileIndexLow; - id.modules_attached_to_gmem_count = 1; //Initialize attached count - return true; -} - -inline bool compare_file_serial(int fd, const locking_file_serial_id &id) -{ - winapi::interprocess_by_handle_file_information info; - if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) - return false; - - return id.dwVolumeSerialNumber == info.dwVolumeSerialNumber && - id.nFileIndexHigh == info.nFileIndexHigh && - id.nFileIndexLow == info.nFileIndexLow; -} - -#else //UNIX - -struct locking_file_serial_id -{ - int fd; - dev_t st_dev; - ino_t st_ino; - //This reference count counts the number of modules attached - //to the shared memory and lock file. This serves to unlink - //the locking file and shared memory when all modules are - //done with the global memory (shared memory) - volatile boost::uint32_t modules_attached_to_gmem_count; -}; - -inline bool lock_locking_file(int fd) -{ - int ret = 0; - while(ret != 0 && errno != EINTR){ - struct flock lock; - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - ret = fcntl (fd, F_SETLKW, &lock); - } - return 0 == ret; -} - -inline bool try_lock_locking_file(int fd) -{ - struct flock lock; - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - return 0 == fcntl (fd, F_SETLK, &lock); -} - -inline int open_or_create_and_lock_file(const char *name) -{ - permissions p; - p.set_unrestricted(); - while(1){ - int fd = create_or_open_file(name, read_write, p); - if(fd < 0){ - return fd; - } - if(!try_lock_locking_file(fd)){ - close(fd); - return -1; - } - struct stat s; - if(0 == stat(name, &s)){ - return fd; - } - else{ - close(fd); - } - } -} - -inline int try_open_and_lock_file(const char *name) -{ - int fd = open_existing_file(name, read_write); - if(fd < 0){ - return fd; - } - if(!try_lock_locking_file(fd)){ - close(fd); - return -1; - } - return fd; -} - -inline void close_lock_file(int fd) -{ close(fd); } - -inline bool is_valid_fd(int fd) -{ - struct stat s; - return EBADF != fstat(fd, &s); -} - -inline bool is_normal_file(int fd) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return false; - return 0 != (s.st_mode & S_IFREG); -} - -inline std::size_t get_size(int fd) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return 0u; - return (std::size_t)s.st_size; -} - -inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return false; - id.fd = fd; - id.st_dev = s.st_dev; - id.st_ino = s.st_ino; - id.modules_attached_to_gmem_count = 1; //Initialize attached count - return true; -} - -inline bool compare_file_serial(int fd, const locking_file_serial_id &id) -{ - struct stat info; - if(0 != fstat(fd, &info)) - return false; - - return id.st_dev == info.st_dev && - id.st_ino == info.st_ino; -} - -#endif - -template -struct gmem_erase_func -{ - gmem_erase_func(const char *shm_name, const char *singleton_lock_file_path, ManagedShMem & shm) - :shm_name_(shm_name), singleton_lock_file_path_(singleton_lock_file_path), shm_(shm) - {} - - void operator()() - { - locking_file_serial_id *pserial_id = shm_.template find("lock_file_fd").first; - if(pserial_id){ - pserial_id->fd = GMemMarkToBeRemoved; - } - delete_file(singleton_lock_file_path_); - shared_memory_object::remove(shm_name_); - } - - const char * const shm_name_; - const char * const singleton_lock_file_path_; - ManagedShMem & shm_; -}; - -//This function applies shared memory erasure logic based on the passed lock file. -template -void managed_sh_dependant:: - apply_gmem_erase_logic(const char *filepath, const char *filename) -{ - int fd = GMemMarkToBeRemoved; - try{ - std::string str; - //If the filename is current process lock file, then avoid it - if(file_locking_helpers::check_if_filename_complies_with_pid - (filename, get_lock_file_base_name(), get_current_process_id(), str, true)){ - return; - } - //Open and lock the other process' lock file - fd = try_open_and_lock_file(filepath); - if(fd < 0){ - return; - } - //If done, then the process is dead so take global shared memory name - //(the name is based on the lock file name) and try to apply erasure logic - str.insert(0, get_shm_base_name()); - try{ - ManagedShMem shm(open_only, str.c_str()); - gmem_erase_func func(str.c_str(), filepath, shm); - shm.try_atomic_func(func); - } - catch(interprocess_exception &e){ - //If shared memory is not found erase the lock file - if(e.get_error_code() == not_found_error){ - delete_file(filepath); - } - } - } - catch(...){ - - } - if(fd >= 0){ - close_lock_file(fd); - } -} - -} //namespace intermodule_singleton_helpers { - - - -namespace intermodule_singleton_helpers { - -//The lock file logic creates uses a unique instance to a file -template -struct lock_file_logic -{ - lock_file_logic(ManagedShMem &shm) - : mshm(shm) - { shm.atomic_func(*this); } - - void operator()(void) - { - retry_with_new_shm = false; - - //First find the file locking descriptor id - locking_file_serial_id *pserial_id = - mshm.template find("lock_file_fd").first; - - int fd; - //If not found schedule a creation - if(!pserial_id){ - fd = GMemNotPresent; - } - //Else get it - else{ - fd = pserial_id->fd; - } - //If we need to create a new one, do it - if(fd == GMemNotPresent){ - std::string lck_str; - //Create a unique current pid based lock file path - create_and_get_singleton_lock_file_path(lck_str); - //Open or create and lock file - int fd = intermodule_singleton_helpers::open_or_create_and_lock_file(lck_str.c_str()); - //If failed, write a bad file descriptor to notify other modules that - //something was wrong and unlink shared memory. Mark the function object - //to tell caller to retry with another shared memory - if(fd < 0){ - this->register_lock_file(GMemMarkToBeRemoved); - std::string s; - get_shm_name(s); - shared_memory_object::remove(s.c_str()); - retry_with_new_shm = true; - } - //If successful, register the file descriptor - else{ - this->register_lock_file(fd); - } - } - //If the fd was invalid (maybe a previous try failed) notify caller that - //should retry creation logic, since this shm might have been already - //unlinked since the shm was removed - else if (fd == GMemMarkToBeRemoved){ - retry_with_new_shm = true; - } - //If the stored fd is not valid (a open fd, a normal file with the - //expected size, or does not have the same file id number, - //then it's an old shm from an old process with the same pid. - //If that's the case, mark it as invalid - else if(!is_valid_fd(fd) || - !is_normal_file(fd) || - 0 != get_size(fd) || - !compare_file_serial(fd, *pserial_id)){ - pserial_id->fd = GMemMarkToBeRemoved; - std::string s; - get_shm_name(s); - shared_memory_object::remove(s.c_str()); - retry_with_new_shm = true; - } - else{ - //If the lock file is ok, increment reference count of - //attached modules to shared memory - atomic_inc32(&pserial_id->modules_attached_to_gmem_count); - } - } - - private: - locking_file_serial_id * register_lock_file(int fd) - { - locking_file_serial_id *pinfo = mshm.template construct("lock_file_fd")(); - fill_file_serial_id(fd, *pinfo); - return pinfo; - } - - public: - ManagedShMem &mshm; - bool retry_with_new_shm; -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct lock_file_logic -{ - lock_file_logic(windows_managed_global_memory &) - : retry_with_new_shm(false) - {} - - void operator()(void){} - const bool retry_with_new_shm; -}; - -#endif - -} //namespace intermodule_singleton_helpers { - -//This class contains common code for all singleton types, so that we instantiate this -//code just once per module. This class also holds a reference counted shared memory -//to be used by all instances - -template -class intermodule_singleton_common -{ - public: - typedef void*(singleton_constructor_t)(ManagedShMem &); - typedef void (singleton_destructor_t)(void *, ManagedShMem &); - - static const ::boost::uint32_t Uninitialized = 0u; - static const ::boost::uint32_t Initializing = 1u; - static const ::boost::uint32_t Initialized = 2u; - static const ::boost::uint32_t Broken = 3u; - - static void finalize_singleton_logic(void *ptr, singleton_destructor_t destructor) - { - if(ptr) - destructor(ptr, get_shm()); - //If this is the last singleton of this module - //apply shm destruction. - //Note: singletons are destroyed when the module is unloaded - //so no threads should be executing or holding references - //to this module - if(1 == atomic_dec32(&this_module_singleton_count)){ - destroy_shm(); - } - } - - static void initialize_singleton_logic - (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t ini_func); - - private: - static ManagedShMem &get_shm() - { - return *static_cast(static_cast(&mem_holder.shm_mem)); - } - - static void initialize_shm(); - static void destroy_shm(); - //Static data, zero-initalized without any dependencies - //this_module_singleton_count is the number of singletons used by this module - static volatile boost::uint32_t this_module_singleton_count; - //this_module_shm_initialized is the state of this module's shm class object - static volatile boost::uint32_t this_module_shm_initialized; - static struct mem_holder_t - { - ::boost::detail::max_align aligner; - char shm_mem [sizeof(ManagedShMem)]; - } mem_holder; -}; - -template -volatile boost::uint32_t intermodule_singleton_common::this_module_singleton_count; - -template -volatile boost::uint32_t intermodule_singleton_common::this_module_shm_initialized; - -template -typename intermodule_singleton_common::mem_holder_t - intermodule_singleton_common::mem_holder; - -template -void intermodule_singleton_common::initialize_shm() -{ - //Obtain unique shm name and size - std::string s; - while(1){ - //Try to pass shm state to initializing - ::boost::uint32_t tmp = atomic_cas32(&this_module_shm_initialized, Initializing, Uninitialized); - if(tmp >= Initialized){ - break; - } - //If some other thread is doing the work wait - else if(tmp == Initializing){ - thread_yield(); - } - else{ //(tmp == Uninitialized) - //If not initialized try it again? - try{ - //Remove old shared memory from the system - intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); - // - if(s.empty()){ - intermodule_singleton_helpers::get_shm_name(s); - } - const char *ShmName = s.c_str(); - const std::size_t ShmSize = intermodule_singleton_helpers::get_shm_size();; - - //in-place construction of the shared memory class - ::new (&get_shm())ManagedShMem(open_or_create, ShmName, ShmSize); - //Use shared memory internal lock to initialize the lock file - //that will mark this gmem as "in use". - intermodule_singleton_helpers::lock_file_logic f(get_shm()); - //If function failed (maybe a competing process has erased the shared - //memory between creation and file locking), retry with a new instance. - if(f.retry_with_new_shm){ - get_shm().~ManagedShMem(); - atomic_write32(&this_module_shm_initialized, Uninitialized); - } - else{ - //Locking succeeded, so this shared memory module-instance is ready - atomic_write32(&this_module_shm_initialized, Initialized); - break; - } - } - catch(...){ - // - throw; - } - } - } -} - -template -struct unlink_shmlogic -{ - unlink_shmlogic(ManagedShMem &mshm) - : mshm_(mshm) - { mshm.atomic_func(*this); } - void operator()() - { - intermodule_singleton_helpers::locking_file_serial_id *pserial_id = - mshm_.template find - ("lock_file_fd").first; - BOOST_ASSERT(0 != pserial_id); - if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){ - int fd = pserial_id->fd; - if(fd > 0){ - pserial_id->fd = intermodule_singleton_helpers::GMemMarkToBeRemoved; - std::string s; - intermodule_singleton_helpers::create_and_get_singleton_lock_file_path(s); - delete_file(s.c_str()); - intermodule_singleton_helpers::close_lock_file(fd); - intermodule_singleton_helpers::get_shm_name(s); - shared_memory_object::remove(s.c_str()); - } - } - } - ManagedShMem &mshm_; -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct unlink_shmlogic -{ - unlink_shmlogic(windows_managed_global_memory &) - {} - void operator()(){} -}; - -#endif - - -template -void intermodule_singleton_common::destroy_shm() -{ - if(!atomic_read32(&this_module_singleton_count)){ - //This module is being unloaded, so destroy - //the shared memory object of this module - //and unlink the shared memory if it's the last - unlink_shmlogic f(get_shm()); - (get_shm()).~ManagedShMem(); - atomic_write32(&this_module_shm_initialized, Uninitialized); - //Do some cleanup for other processes old gmem instances - intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); - } -} - -//Initialize this_module_singleton_ptr, creates the shared memory if needed and also creates an unique -//opaque type in shared memory through a singleton_constructor_t function call, -//initializing the passed pointer to that unique instance. -// -//We have two concurrency types here. a)the shared memory/singleton creation must -//be safe between threads of this process but in different modules/dlls. b) -//the pointer to the singleton is per-module, so we have to protect this -//initization between threads of the same module. -// -//All static variables declared here are shared between inside a module -//so atomic operations will synchronize only threads of the same module. -template -void intermodule_singleton_common::initialize_singleton_logic - (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t constructor) -{ - //If current module is not initialized enter to lock free logic - if(atomic_read32(&this_module_singleton_initialized) != Initialized){ - //Now a single thread of the module will succeed in this CAS. - //trying to pass from Uninitialized to Initializing - ::boost::uint32_t previous_module_singleton_initialized = atomic_cas32 - (&this_module_singleton_initialized, Initializing, Uninitialized); - //If the thread succeeded the CAS (winner) it will compete with other - //winner threads from other modules to create the shared memory - if(previous_module_singleton_initialized == Uninitialized){ - try{ - //Now initialize shm, this function solves concurrency issues - //between threads of several modules - initialize_shm(); - //Increment the module reference count that reflects how many - //singletons this module holds, so that we can safely destroy - //module shared memory object when no singleton is left - atomic_inc32(&this_module_singleton_count); - //Now try to create the singleton in shared memory. - //This function solves concurrency issues - //between threads of several modules - void *tmp = constructor(get_shm()); - //Insert a barrier before assigning the pointer to - //make sure this assignment comes after the initialization - atomic_write32(&this_module_singleton_initialized, Initializing); - //Assign the singleton address to the module-local pointer - ptr = tmp; - //Memory barrier inserted, all previous operations should complete - //before this one. Now marked as initialized - atomic_inc32(&this_module_singleton_initialized); - } - catch(...){ - //Mark singleton failed to initialize - atomic_write32(&this_module_singleton_initialized, Broken); - throw; - } - } - //If previous state was initializing, this means that another winner thread is - //trying to initialize the singleton. Just wait until completes its work. - else if(previous_module_singleton_initialized == Initializing){ - while(1){ - previous_module_singleton_initialized = atomic_read32(&this_module_singleton_initialized); - if(previous_module_singleton_initialized >= Initialized){ - //Already initialized, or exception thrown by initializer thread - break; - } - else if(previous_module_singleton_initialized == Initializing){ - thread_yield(); - } - else{ - //This can't be happening! - BOOST_ASSERT(0); - } - } - } - else if(previous_module_singleton_initialized == Initialized){ - //Nothing to do here, the singleton is ready - } - //If previous state was greater than initialized, then memory is broken - //trying to initialize the singleton. - else{//(previous_module_singleton_initialized > Initialized) - throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed"); - } - } - BOOST_ASSERT(ptr != 0); -} - //Now this class is a singleton, initializing the singleton in //the first get() function call if LazyInit is false. If true //then the singleton will be initialized when loading the module. -template -class intermodule_singleton_impl -{ - public: - static C& get() //Let's make inlining easy - { - if(!this_module_singleton_ptr){ - if(lifetime.dummy_function()) //This forces lifetime instantiation, for reference counted destruction - intermodule_singleton_common::initialize_singleton_logic - (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); - } - return *static_cast(this_module_singleton_ptr); - } - - private: - - struct ref_count_ptr - { - ref_count_ptr(C *p, boost::uint32_t count) - : ptr(p), singleton_ref_count(count) - {} - C *ptr; - //This reference count serves to count the number of attached - //modules to this singleton - volatile boost::uint32_t singleton_ref_count; - }; - - //These statics will be zero-initialized without any constructor call dependency - //this_module_singleton_ptr will be a module-local pointer to the singleton - static void* this_module_singleton_ptr; - //this_module_singleton_count will be used to synchronize threads of the same module - //for access to a singleton instance, and to flag the state of the - //singleton. - static volatile boost::uint32_t this_module_singleton_initialized; - - //This class destructor will trigger singleton destruction - struct lifetime_type_lazy - { - bool dummy_function() - { return m_dummy == 0; } - - ~lifetime_type_lazy() - { - intermodule_singleton_common::finalize_singleton_logic - (this_module_singleton_ptr, singleton_destructor); - } - //Dummy volatile so that the compiler can't resolve its value at compile-time - //and can't avoid lifetime_type instantiation if dummy_function() is called. - static volatile int m_dummy; - }; - - struct lifetime_type_static - : public lifetime_type_lazy - { - lifetime_type_static() - { - intermodule_singleton_common::initialize_singleton_logic - (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); - } - }; - - typedef typename if_c - ::type lifetime_type; - - static lifetime_type lifetime; - - //A functor to be executed inside shared memory lock that just - //searches for the singleton in shm and if not present creates a new one. - //If singleton constructor throws, the exception is propagated - struct init_atomic_func - { - init_atomic_func(ManagedShMem &m) - : mshm(m) - {} - - void operator()() - { - ref_count_ptr *rcount = mshm.template find(unique_instance).first; - if(!rcount){ - C *p = new C(); - try{ - rcount = mshm.template construct(unique_instance)(p, 0u); - } - catch(...){ - delete p; - throw; - } - } - atomic_inc32(&rcount->singleton_ref_count); - ret_ptr = rcount->ptr; - } - ManagedShMem &mshm; - void *ret_ptr; - }; - - //A functor to be executed inside shared memory lock that just - //deletes the singleton in shm if the attached count reaches to zero - struct fini_atomic_func - { - fini_atomic_func(ManagedShMem &m) - : mshm(m) - {} - - void operator()() - { - ref_count_ptr *rcount = mshm.template find(unique_instance).first; - //The object must exist - BOOST_ASSERT(rcount); - //Check if last reference - if(atomic_dec32(&rcount->singleton_ref_count) == 1){ - //If last, destroy the object - BOOST_ASSERT(rcount->ptr != 0); - delete rcount->ptr; - //Now destroy shm entry - bool destroyed = mshm.template destroy(unique_instance); - (void)destroyed; BOOST_ASSERT(destroyed == true); - } - } - ManagedShMem &mshm; - void *ret_ptr; - }; - - //A wrapper to execute init_atomic_func - static void *singleton_constructor(ManagedShMem &mshm) - { - init_atomic_func f(mshm); - mshm.atomic_func(f); - return f.ret_ptr; - } - - //A wrapper to execute fini_atomic_func - static void singleton_destructor(void *p, ManagedShMem &mshm) - { (void)p; - fini_atomic_func f(mshm); - mshm.atomic_func(f); - } -}; - -template -volatile int intermodule_singleton_impl::lifetime_type_lazy::m_dummy = 0; - -//These will be zero-initialized by the loader -template -void *intermodule_singleton_impl::this_module_singleton_ptr = 0; - -template -volatile boost::uint32_t intermodule_singleton_impl::this_module_singleton_initialized = 0; - -template -typename intermodule_singleton_impl::lifetime_type - intermodule_singleton_impl::lifetime; - -template -class portable_intermodule_singleton - : public intermodule_singleton_impl -{}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template -class windows_intermodule_singleton - : public intermodule_singleton_impl - < C - , LazyInit - , windows_managed_global_memory - > -{}; - -#endif - -//Now this class is a singleton, initializing the singleton in -//the first get() function call if LazyInit is false. If true -//then the singleton will be initialized when loading the module. -template +template class intermodule_singleton #ifdef BOOST_INTERPROCESS_WINDOWS - : public windows_intermodule_singleton + : public windows_intermodule_singleton #else - : public portable_intermodule_singleton + : public portable_intermodule_singleton #endif {}; - } //namespace ipcdetail{ } //namespace interprocess{ } //namespace boost{ diff --git a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp new file mode 100644 index 000000000..d03c56652 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp @@ -0,0 +1,496 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP +#define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +namespace intermodule_singleton_helpers { + +inline void get_pid_creation_time_str(std::string &s) +{ + std::stringstream stream; + stream << get_current_process_id() << '_'; + stream.precision(6); + stream << std::fixed << get_current_process_creation_time(); + s = stream.str(); +} + +inline const char *get_map_base_name() +{ return "bip.gmem.map."; } + +inline void get_map_name(std::string &map_name) +{ + get_pid_creation_time_str(map_name); + map_name.insert(0, get_map_base_name()); +} + +inline std::size_t get_map_size() +{ return 65536; } + +template +struct thread_safe_global_map_dependant; + +} //namespace intermodule_singleton_helpers { + +//This class contains common code for all singleton types, so that we instantiate this +//code just once per module. This class also holds a thread soafe global map +//to be used by all instances protected with a reference count +template +class intermodule_singleton_common +{ + public: + typedef void*(singleton_constructor_t)(ThreadSafeGlobalMap &); + typedef void (singleton_destructor_t)(void *, ThreadSafeGlobalMap &); + + static const ::boost::uint32_t Uninitialized = 0u; + static const ::boost::uint32_t Initializing = 1u; + static const ::boost::uint32_t Initialized = 2u; + static const ::boost::uint32_t Broken = 3u; + static const ::boost::uint32_t Destroyed = 4u; + + //Initialize this_module_singleton_ptr, creates the global map if needed and also creates an unique + //opaque type in global map through a singleton_constructor_t function call, + //initializing the passed pointer to that unique instance. + // + //We have two concurrency types here. a)the global map/singleton creation must + //be safe between threads of this process but in different modules/dlls. b) + //the pointer to the singleton is per-module, so we have to protect this + //initization between threads of the same module. + // + //All static variables declared here are shared between inside a module + //so atomic operations will synchronize only threads of the same module. + static void initialize_singleton_logic + (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t constructor, bool phoenix) + { + //If current module is not initialized enter to lock free logic + if(atomic_read32(&this_module_singleton_initialized) != Initialized){ + //Now a single thread of the module will succeed in this CAS. + //trying to pass from Uninitialized to Initializing + ::boost::uint32_t previous_module_singleton_initialized = atomic_cas32 + (&this_module_singleton_initialized, Initializing, Uninitialized); + //If the thread succeeded the CAS (winner) it will compete with other + //winner threads from other modules to create the global map + if(previous_module_singleton_initialized == Destroyed){ + //Trying to resurrect a dead Phoenix singleton. Just try to + //mark it as uninitialized and start again + if(phoenix){ + atomic_cas32(&this_module_singleton_initialized, Uninitialized, Destroyed); + previous_module_singleton_initialized = atomic_cas32 + (&this_module_singleton_initialized, Initializing, Uninitialized); + } + //Trying to resurrect a non-Phoenix dead singleton is an error + else{ + throw interprocess_exception("Boost.Interprocess: Dead reference on non-Phoenix singleton of type"); + } + } + if(previous_module_singleton_initialized == Uninitialized){ + try{ + //Now initialize the global map, this function must solve concurrency + //issues between threads of several modules + initialize_global_map_handle(); + //Now try to create the singleton in global map. + //This function solves concurrency issues + //between threads of several modules + void *tmp = constructor(get_map()); + //Increment the module reference count that reflects how many + //singletons this module holds, so that we can safely destroy + //module global map object when no singleton is left + atomic_inc32(&this_module_singleton_count); + //Insert a barrier before assigning the pointer to + //make sure this assignment comes after the initialization + atomic_write32(&this_module_singleton_initialized, Initializing); + //Assign the singleton address to the module-local pointer + ptr = tmp; + //Memory barrier inserted, all previous operations should complete + //before this one. Now marked as initialized + atomic_write32(&this_module_singleton_initialized, Initialized); + } + catch(...){ + //Mark singleton failed to initialize + atomic_write32(&this_module_singleton_initialized, Broken); + throw; + } + } + //If previous state was initializing, this means that another winner thread is + //trying to initialize the singleton. Just wait until completes its work. + else if(previous_module_singleton_initialized == Initializing){ + while(1){ + previous_module_singleton_initialized = atomic_read32(&this_module_singleton_initialized); + if(previous_module_singleton_initialized >= Initialized){ + //Already initialized, or exception thrown by initializer thread + break; + } + else if(previous_module_singleton_initialized == Initializing){ + thread_yield(); + } + else{ + //This can't be happening! + BOOST_ASSERT(0); + } + } + } + else if(previous_module_singleton_initialized == Initialized){ + //Nothing to do here, the singleton is ready + } + //If previous state was greater than initialized, then memory is broken + //trying to initialize the singleton. + else{//(previous_module_singleton_initialized > Initialized) + throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed"); + } + } + BOOST_ASSERT(ptr != 0); + } + + static void finalize_singleton_logic(void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_destructor_t destructor) + { + //Protect destruction against lazy singletons not initialized in this execution + if(ptr){ + //Note: this destructor might provoke a Phoenix singleton + //resurrection. This means that this_module_singleton_count + //might change after this call. + destructor(ptr, get_map()); + ptr = 0; + + //Memory barrier to make sure pointer is nulled. + //Mark this singleton as destroyed. + atomic_write32(&this_module_singleton_initialized, Destroyed); + + //If this is the last singleton of this module + //apply map destruction. + //Note: singletons are destroyed when the module is unloaded + //so no threads should be executing or holding references + //to this module + if(1 == atomic_dec32(&this_module_singleton_count)){ + destroy_global_map_handle(); + } + } + } + + private: + static ThreadSafeGlobalMap &get_map() + { + return *static_cast(static_cast(&mem_holder.map_mem[0])); + } + + static void initialize_global_map_handle() + { + //Obtain unique map name and size + while(1){ + //Try to pass map state to initializing + ::boost::uint32_t tmp = atomic_cas32(&this_module_map_initialized, Initializing, Uninitialized); + if(tmp == Initialized || tmp == Broken){ + break; + } + else if(tmp == Destroyed){ + tmp = atomic_cas32(&this_module_map_initialized, Uninitialized, Destroyed); + continue; + } + //If some other thread is doing the work wait + else if(tmp == Initializing){ + thread_yield(); + } + else{ //(tmp == Uninitialized) + //If not initialized try it again? + try{ + //Remove old global map from the system + intermodule_singleton_helpers::thread_safe_global_map_dependant::remove_old_gmem(); + //in-place construction of the global map class + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::construct_map(static_cast(&get_map())); + //Use global map's internal lock to initialize the lock file + //that will mark this gmem as "in use". + typename intermodule_singleton_helpers::thread_safe_global_map_dependant:: + lock_file_logic f(get_map()); + //If function failed (maybe a competing process has erased the shared + //memory between creation and file locking), retry with a new instance. + if(f.retry()){ + get_map().~ThreadSafeGlobalMap(); + atomic_write32(&this_module_map_initialized, Destroyed); + } + else{ + //Locking succeeded, so this global map module-instance is ready + atomic_write32(&this_module_map_initialized, Initialized); + break; + } + } + catch(...){ + // + throw; + } + } + } + } + + static void destroy_global_map_handle() + { + if(!atomic_read32(&this_module_singleton_count)){ + //This module is being unloaded, so destroy + //the global map object of this module + //and unlink the global map if it's the last + typename intermodule_singleton_helpers::thread_safe_global_map_dependant:: + unlink_map_logic f(get_map()); + (get_map()).~ThreadSafeGlobalMap(); + atomic_write32(&this_module_map_initialized, Destroyed); + //Do some cleanup for other processes old gmem instances + intermodule_singleton_helpers::thread_safe_global_map_dependant::remove_old_gmem(); + } + } + + //Static data, zero-initalized without any dependencies + //this_module_singleton_count is the number of singletons used by this module + static volatile boost::uint32_t this_module_singleton_count; + + //this_module_map_initialized is the state of this module's map class object. + //Values: Uninitialized, Initializing, Initialized, Broken + static volatile boost::uint32_t this_module_map_initialized; + + //Raw memory to construct the global map manager + static struct mem_holder_t + { + ::boost::detail::max_align aligner; + char map_mem [sizeof(ThreadSafeGlobalMap)]; + } mem_holder; +}; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_singleton_count; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_map_initialized; + +template +typename intermodule_singleton_common::mem_holder_t + intermodule_singleton_common::mem_holder; + +//A reference count to be stored in global map holding the number +//of singletons (one per module) attached to the instance pointed by +//the internal ptr. +struct ref_count_ptr +{ + ref_count_ptr(void *p, boost::uint32_t count) + : ptr(p), singleton_ref_count(count) + {} + void *ptr; + //This reference count serves to count the number of attached + //modules to this singleton + volatile boost::uint32_t singleton_ref_count; +}; + + +//Now this class is a singleton, initializing the singleton in +//the first get() function call if LazyInit is false. If true +//then the singleton will be initialized when loading the module. +template +class intermodule_singleton_impl +{ + public: + + static C& get() //Let's make inlining easy + { + if(!this_module_singleton_ptr){ + if(lifetime.dummy_function()){ //This forces lifetime instantiation, for reference counted destruction + atentry_work(); + } + } + return *static_cast(this_module_singleton_ptr); + } + + private: + + static void atentry_work() + { + intermodule_singleton_common::initialize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor, Phoenix); + } + + static void atexit_work() + { + intermodule_singleton_common::finalize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_destructor); + } + + //These statics will be zero-initialized without any constructor call dependency + //this_module_singleton_ptr will be a module-local pointer to the singleton + static void* this_module_singleton_ptr; + + //this_module_singleton_count will be used to synchronize threads of the same module + //for access to a singleton instance, and to flag the state of the + //singleton. + static volatile boost::uint32_t this_module_singleton_initialized; + + //This class destructor will trigger singleton destruction + struct lifetime_type_lazy + { + bool dummy_function() + { return m_dummy == 0; } + + ~lifetime_type_lazy() + { + if(!Phoenix){ + atexit_work(); + } + } + + //Dummy volatile so that the compiler can't resolve its value at compile-time + //and can't avoid lifetime_type instantiation if dummy_function() is called. + static volatile int m_dummy; + }; + + struct lifetime_type_static + : public lifetime_type_lazy + { + lifetime_type_static() + { atentry_work(); } + }; + + typedef typename if_c + ::type lifetime_type; + + static lifetime_type lifetime; + + //A functor to be executed inside global map lock that just + //searches for the singleton in map and if not present creates a new one. + //If singleton constructor throws, the exception is propagated + struct init_atomic_func + { + init_atomic_func(ThreadSafeGlobalMap &m) + : m_map(m) + {} + + void operator()() + { + ref_count_ptr *rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::find(m_map, typeid(C).name()); + if(!rcount){ + C *p = new C; + try{ + ref_count_ptr val(p, 0u); + rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::insert(m_map, typeid(C).name(), val); + } + catch(...){ + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::erase(m_map, typeid(C).name()); + delete p; + throw; + } + } + if(Phoenix){ + std::atexit(&atexit_work); + } + atomic_inc32(&rcount->singleton_ref_count); + ret_ptr = rcount->ptr; + } + void *data() const + { return ret_ptr; } + + private: + ThreadSafeGlobalMap &m_map; + void *ret_ptr; + }; + + //A functor to be executed inside global map lock that just + //deletes the singleton in map if the attached count reaches to zero + struct fini_atomic_func + { + fini_atomic_func(ThreadSafeGlobalMap &m) + : m_map(m) + {} + + void operator()() + { + ref_count_ptr *rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::find(m_map, typeid(C).name()); + //The object must exist + BOOST_ASSERT(rcount); + BOOST_ASSERT(rcount->singleton_ref_count > 0); + //Check if last reference + if(atomic_dec32(&rcount->singleton_ref_count) == 1){ + //If last, destroy the object + BOOST_ASSERT(rcount->ptr != 0); + C *pc = static_cast(rcount->ptr); + //Now destroy map entry + bool destroyed = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::erase(m_map, typeid(C).name()); + (void)destroyed; BOOST_ASSERT(destroyed == true); + delete pc; + } + } + void *data() const + { return ret_ptr; } + + private: + ThreadSafeGlobalMap &m_map; + void *ret_ptr; + }; + + //A wrapper to execute init_atomic_func + static void *singleton_constructor(ThreadSafeGlobalMap &map) + { + init_atomic_func f(map); + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::atomic_func(map, f); + return f.data(); + } + + //A wrapper to execute fini_atomic_func + static void singleton_destructor(void *p, ThreadSafeGlobalMap &map) + { (void)p; + fini_atomic_func f(map); + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::atomic_func(map, f); + } +}; + +template +volatile int intermodule_singleton_impl::lifetime_type_lazy::m_dummy = 0; + +//These will be zero-initialized by the loader +template +void *intermodule_singleton_impl::this_module_singleton_ptr = 0; + +template +volatile boost::uint32_t intermodule_singleton_impl::this_module_singleton_initialized = 0; + +template +typename intermodule_singleton_impl::lifetime_type + intermodule_singleton_impl::lifetime; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp b/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp index 258177674..2fcc07bcc 100644 --- a/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-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) // diff --git a/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp b/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp index 92970923d..ca2ff4acf 100644 --- a/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -68,8 +68,8 @@ struct intersegment_base static const std::size_t begin_bits = max_segment_size_bits - align_bits; static const std::size_t pow_size_bits_helper = static_log2::value; - static const std::size_t pow_size_bits = - (max_segment_size_bits == (std::size_t(1) << pow_size_bits_helper)) ? + static const std::size_t pow_size_bits = + (max_segment_size_bits == (std::size_t(1) << pow_size_bits_helper)) ? pow_size_bits_helper : pow_size_bits_helper + 1; static const std::size_t frc_size_bits = size_t_bits - ctrl_bits - begin_bits - pow_size_bits; @@ -177,7 +177,7 @@ struct intersegment_base void set_mode(std::size_t mode) { - BOOST_ASSERT(mode < is_max_mode); + BOOST_ASSERT(mode < is_max_mode); members.direct.ctrl = mode; } @@ -185,7 +185,7 @@ struct intersegment_base //!null pointer bool is_null() const { - return (this->get_mode() < is_relative) && + return (this->get_mode() < is_relative) && !members.direct.dummy && !members.direct.addr; } @@ -309,13 +309,13 @@ struct flat_map_intersegment void *ptr_base; void *this_base; get_segment_info_and_offset(this, this_info, this_offset, this_base); - + if(!this_info.group){ this->set_mode(is_in_stack); this->members.direct.addr = const_cast(ptr); } else{ - get_segment_info_and_offset(ptr, ptr_info, ptr_offset, ptr_base); + get_segment_info_and_offset(ptr, ptr_info, ptr_offset, ptr_base); if(ptr_info.group != this_info.group){ this->set_mode(is_pointee_outside); @@ -340,7 +340,7 @@ struct flat_map_intersegment } } - //!Sets the object internals to represent the address pointed + //!Sets the object internals to represent the address pointed //!by another flat_map_intersegment void set_from_other(const self_t &other) { @@ -383,7 +383,7 @@ struct flat_map_intersegment }; vector m_segments; multi_segment_services &m_ms_services; - + public: segment_group_t(multi_segment_services &ms_services) : m_ms_services(ms_services) @@ -434,7 +434,7 @@ struct flat_map_intersegment typedef set segment_groups_t; typedef boost::interprocess::flat_map - > ptr_to_segment_info_t; @@ -443,9 +443,9 @@ struct flat_map_intersegment //!Mutex to preserve integrity in multi-threaded //!enviroments typedef Mutex mutex_type; - //!Maps base addresses and segment information + //!Maps base addresses and segment information //!(size and segment group and id)* - + ptr_to_segment_info_t m_ptr_to_segment_info; ~mappings_t() @@ -476,7 +476,7 @@ struct flat_map_intersegment return; } //Find the first base address greater than ptr - typename ptr_to_segment_info_t::iterator it + typename ptr_to_segment_info_t::iterator it = s_map.m_ptr_to_segment_info.upper_bound(ptr); if(it == s_map.m_ptr_to_segment_info.begin()){ segment = segment_info_t(); @@ -486,7 +486,7 @@ struct flat_map_intersegment --it; char * segment_base = const_cast(reinterpret_cast(it->first)); std::size_t segment_size = it->second.size; - + if(segment_base <= reinterpret_cast(ptr) && (segment_base + segment_size) >= reinterpret_cast(ptr)){ segment = it->second; @@ -552,7 +552,7 @@ struct flat_map_intersegment s_groups.insert(segment_group_t(*services)); BOOST_ASSERT(ret.second); return &*ret.first; - } + } } static bool delete_group(segment_group_id id) @@ -574,23 +574,23 @@ struct flat_map_intersegment } } return success; - } + } } }; //!Static map-segment_info associated with //!flat_map_intersegment<> template -typename flat_map_intersegment::mappings_t +typename flat_map_intersegment::mappings_t flat_map_intersegment::s_map; //!Static segment group container associated with //!flat_map_intersegment<> template -typename flat_map_intersegment::segment_groups_t +typename flat_map_intersegment::segment_groups_t flat_map_intersegment::s_groups; -//!A smart pointer that can point to a pointee that resides in another memory +//!A smart pointer that can point to a pointee that resides in another memory //!memory mapped or shared memory segment. template class intersegment_ptr : public flat_map_intersegment @@ -623,13 +623,13 @@ class intersegment_ptr : public flat_map_intersegment //!Constructor from other intersegment_ptr //!Never throws - intersegment_ptr(const intersegment_ptr& ptr) + intersegment_ptr(const intersegment_ptr& ptr) { base_t::set_from_other(ptr); } - //!Constructor from other intersegment_ptr. If pointers of pointee types are + //!Constructor from other intersegment_ptr. If pointers of pointee types are //!convertible, intersegment_ptrs will be convertibles. Never throws. template - intersegment_ptr(const intersegment_ptr &ptr) + intersegment_ptr(const intersegment_ptr &ptr) { pointer p(ptr.get()); (void)p; base_t::set_from_other(ptr); } //!Emulates static_cast operator. @@ -663,17 +663,17 @@ class intersegment_ptr : public flat_map_intersegment //!Pointer-like -> operator. It can return 0 pointer. //!Never throws. - pointer operator->() const + pointer operator->() const { return self_t::get(); } - //!Dereferencing operator, if it is a null intersegment_ptr behavior + //!Dereferencing operator, if it is a null intersegment_ptr behavior //!is undefined. Never throws. - reference operator* () const + reference operator* () const { return *(self_t::get()); } //!Indexing operator. //!Never throws. - reference operator[](std::ptrdiff_t idx) const + reference operator[](std::ptrdiff_t idx) const { return self_t::get()[idx]; } //!Assignment from pointer (saves extra conversion). @@ -686,19 +686,19 @@ class intersegment_ptr : public flat_map_intersegment intersegment_ptr& operator= (const intersegment_ptr &ptr) { base_t::set_from_other(ptr); return *this; } - //!Assignment from related intersegment_ptr. If pointers of pointee types + //!Assignment from related intersegment_ptr. If pointers of pointee types //!are assignable, intersegment_ptrs will be assignable. Never throws. template intersegment_ptr& operator= (const intersegment_ptr & ptr) - { - pointer p(ptr.get()); (void)p; - base_t::set_from_other(ptr); return *this; + { + pointer p(ptr.get()); (void)p; + base_t::set_from_other(ptr); return *this; } - + //!intersegment_ptr + std::ptrdiff_t. //!Never throws. - intersegment_ptr operator+ (std::ptrdiff_t idx) const - { + intersegment_ptr operator+ (std::ptrdiff_t idx) const + { intersegment_ptr result (*this); result.inc_offset(idx*sizeof(T)); return result; @@ -706,8 +706,8 @@ class intersegment_ptr : public flat_map_intersegment //!intersegment_ptr - std::ptrdiff_t. //!Never throws. - intersegment_ptr operator- (std::ptrdiff_t idx) const - { + intersegment_ptr operator- (std::ptrdiff_t idx) const + { intersegment_ptr result (*this); result.dec_offset(idx*sizeof(T)); return result; @@ -727,7 +727,7 @@ class intersegment_ptr : public flat_map_intersegment //!Never throws. intersegment_ptr& operator++ (void) { base_t::inc_offset(sizeof(T)); return *this; } - + //!intersegment_ptr++. //!Never throws. intersegment_ptr operator++ (int) @@ -745,10 +745,10 @@ class intersegment_ptr : public flat_map_intersegment //!Safe bool conversion operator. //!Never throws. - operator unspecified_bool_type() const + operator unspecified_bool_type() const { return base_t::is_null()? 0 : &self_t::unspecified_bool_type_func; } - //!Not operator. Not needed in theory, but improves portability. + //!Not operator. Not needed in theory, but improves portability. //!Never throws. bool operator! () const { return base_t::is_null(); } @@ -784,12 +784,12 @@ class intersegment_ptr : public flat_map_intersegment template inline bool operator ==(const intersegment_ptr &left, const intersegment_ptr &right) -{ +{ //Make sure both pointers can be compared bool e = typename intersegment_ptr::pointer(0) == typename intersegment_ptr::pointer(0); (void)e; - return left._equal(right); + return left._equal(right); } //!Returns true if *this is less than other. @@ -798,74 +798,74 @@ bool operator ==(const intersegment_ptr &left, template inline bool operator <(const intersegment_ptr &left, const intersegment_ptr &right) -{ +{ //Make sure both pointers can be compared bool e = typename intersegment_ptr::pointer(0) < typename intersegment_ptr::pointer(0); (void)e; - return left._less(right); + return left._less(right); } template inline -bool operator!= (const intersegment_ptr &pt1, +bool operator!= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 ==pt2); } //!intersegment_ptr <= intersegment_ptr. //!Never throws. template inline -bool operator<= (const intersegment_ptr &pt1, +bool operator<= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 > pt2); } //!intersegment_ptr > intersegment_ptr. //!Never throws. template inline -bool operator> (const intersegment_ptr &pt1, +bool operator> (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return (pt2 < pt1); } //!intersegment_ptr >= intersegment_ptr. //!Never throws. template inline -bool operator>= (const intersegment_ptr &pt1, +bool operator>= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 < pt2); } //!operator<< template inline -std::basic_ostream & operator<< +std::basic_ostream & operator<< (std::basic_ostream & os, const intersegment_ptr & p) { return os << p.get(); } //!operator>> template inline -std::basic_istream & operator>> +std::basic_istream & operator>> (std::basic_istream & os, intersegment_ptr & p) { U * tmp; return os >> tmp; p = tmp; } -//!std::ptrdiff_t + intersegment_ptr. +//!std::ptrdiff_t + intersegment_ptr. //!The result is another pointer of the same segment template inline intersegment_ptr operator+ (std::ptrdiff_t diff, const intersegment_ptr& right) { return right + diff; } -//!intersegment_ptr - intersegment_ptr. +//!intersegment_ptr - intersegment_ptr. //!This only works with two intersegment_ptr-s that point to the //!same segment template inline -std::ptrdiff_t operator- (const intersegment_ptr &pt, +std::ptrdiff_t operator- (const intersegment_ptr &pt, const intersegment_ptr &pt2) { return pt._diff(pt2)/sizeof(T); } //! swap specialization template inline -void swap (boost::interprocess::intersegment_ptr &pt, +void swap (boost::interprocess::intersegment_ptr &pt, boost::interprocess::intersegment_ptr &pt2) { pt.swap(pt2); } -//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. +//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) @@ -873,19 +873,19 @@ T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) //!Simulation of static_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr static_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::static_cast_tag()); } //!Simulation of const_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr const_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr dynamic_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::dynamic_cast_tag()); } @@ -895,7 +895,7 @@ template inline boost::interprocess::intersegment_ptr reinterpret_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); } -//!Trait class to detect if an smart pointer has +//!Trait class to detect if an smart pointer has //!multi-segment addressing capabilities. template struct is_multisegment_ptr @@ -907,7 +907,7 @@ struct is_multisegment_ptr } //namespace interprocess { #if defined(_MSC_VER) && (_MSC_VER < 1400) -//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. +//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) @@ -918,14 +918,14 @@ T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) //!for optimizations template struct has_trivial_constructor - < boost::interprocess::intersegment_ptr > + < boost::interprocess::intersegment_ptr > : public true_type{}; //!has_trivial_destructor<> == true_type specialization //!for optimizations template struct has_trivial_destructor - < boost::interprocess::intersegment_ptr > + < boost::interprocess::intersegment_ptr > : public true_type{}; } //namespace boost { @@ -950,7 +950,7 @@ struct has_trivial_destructor // std::size_t offset; //RELATIVE_SIZE_BITS = SIZE_T_BITS - -// MAX_SEGMENT_BITS - +// MAX_SEGMENT_BITS - // CTRL_BITS 10 10 //MAX_SEGMENT_SIZE = SIZE_T_BITS - ALIGN_BITS 20 52 diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp new file mode 100644 index 000000000..548e17d9e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp @@ -0,0 +1,115 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP +#define BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +struct intermodule_singleton_mutex_family +{ + typedef boost::interprocess::ipcdetail::spin_mutex mutex_type; + typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type; +}; + +struct intermodule_types +{ + //We must use offset_ptr since a loaded DLL can map the singleton holder shared memory + //at a different address than other DLLs or the main executable + typedef rbtree_best_fit > mem_algo; + template + struct open_or_create + { + typedef managed_open_or_create_impl + type; + }; +}; + +//we must implement our own managed shared memory to avoid circular dependencies +template +class basic_managed_global_memory + : public basic_managed_memory_impl + < char + , intermodule_types::mem_algo + , iset_index + , intermodule_types::open_or_create::type::ManagedOpenOrCreateUserOffset + > + , private intermodule_types::open_or_create::type +{ + /// @cond + typedef typename intermodule_types::template open_or_create::type base2_t; + + typedef basic_managed_memory_impl + < char + , intermodule_types::mem_algo + , iset_index + , base2_t::ManagedOpenOrCreateUserOffset + > base_t; + + typedef create_open_func create_open_func_t; + + basic_managed_global_memory *get_this_pointer() + { return this; } + + public: + typedef typename base_t::size_type size_type; + + private: + typedef typename base_t::char_ptr_holder_t char_ptr_holder_t; + BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory) + /// @endcond + + public: //functions + + basic_managed_global_memory (open_or_create_t open_or_create, + const char *name, size_type size, + const void *addr = 0, const permissions& perm = permissions()) + : base_t() + , base2_t(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), + DoOpenOrCreate), perm) + {} + + basic_managed_global_memory (open_only_t open_only, const char* name, + const void *addr = 0) + : base_t() + , base2_t(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), + DoOpen)) + {} +}; + + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp index 31c380443..2f97935d4 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -34,7 +34,7 @@ #include //!\file -//!Describes a named shared memory allocation user class. +//!Describes a named shared memory allocation user class. //! namespace boost { @@ -45,7 +45,7 @@ template class create_open_func; template< - class CharType, + class CharType, class MemoryAlgorithm, template class IndexType > @@ -54,14 +54,14 @@ struct segment_manager_type typedef segment_manager type; }; -//!This class is designed to be a base class to classes that manage -//!creation of objects in a fixed size memory buffer. Apart -//!from allocating raw memory, the user can construct named objects. To +//!This class is designed to be a base class to classes that manage +//!creation of objects in a fixed size memory buffer. Apart +//!from allocating raw memory, the user can construct named objects. To //!achieve this, this class uses the reserved space provided by the allocation //!algorithm to place a named_allocator_algo, who takes care of name mappings. //!The class can be customized with the char type used for object names //!and the memory allocation algorithm to be used.*/ -template < class CharType +template < class CharType , class MemoryAlgorithm , template class IndexType , std::size_t Offset = 0 @@ -92,7 +92,7 @@ class basic_managed_memory_impl /// @cond - typedef typename + typedef typename segment_manager::char_ptr_holder_t char_ptr_holder_t; //Experimental. Don't use. @@ -153,7 +153,7 @@ class basic_managed_memory_impl } //!Constructor. Allocates basic resources. Never throws. - basic_managed_memory_impl() + basic_managed_memory_impl() : mp_header(0){} //!Destructor. Calls close. Never throws. @@ -169,19 +169,19 @@ class basic_managed_memory_impl if(size < segment_manager::get_min_size()) return false; - //This function should not throw. The index construction can + //This function should not throw. The index construction can //throw if constructor allocates memory. So we must catch it. BOOST_TRY{ - //Let's construct the allocator in memory + //Let's construct the allocator in memory mp_header = new(addr) segment_manager(size); } BOOST_CATCH(...){ return false; } BOOST_CATCH_END - return true; + return true; } - + //!Connects to a segment manager in the reserved buffer. Never throws. bool open_impl (void *addr, size_type) { @@ -192,7 +192,7 @@ class basic_managed_memory_impl //!Frees resources. Never throws. bool close_impl() - { + { bool ret = mp_header != 0; mp_header = 0; return ret; @@ -249,40 +249,40 @@ class basic_managed_memory_impl void zero_free_memory() { mp_header->zero_free_memory(); } - //!Transforms an absolute address into an offset from base address. + //!Transforms an absolute address into an offset from base address. //!The address must belong to the memory segment. Never throws. handle_t get_handle_from_address (const void *ptr) const { - return (handle_t)(reinterpret_cast(ptr) - - reinterpret_cast(this->get_address())); + return (handle_t)(reinterpret_cast(ptr) - + reinterpret_cast(this->get_address())); } //!Returns true if the address belongs to the managed memory segment bool belongs_to_segment (const void *ptr) const - { - return ptr >= this->get_address() && + { + return ptr >= this->get_address() && ptr < (reinterpret_cast(this->get_address()) + this->get_size()); } - //!Transforms previously obtained offset into an absolute address in the + //!Transforms previously obtained offset into an absolute address in the //!process space of the current process. Never throws.*/ void * get_address_from_handle (handle_t offset) const { return reinterpret_cast(this->get_address()) + offset; } //!Searches for nbytes of free memory in the segment, marks the - //!memory as used and return the pointer to the memory. If no + //!memory as used and return the pointer to the memory. If no //!memory is available throws a boost::interprocess::bad_alloc exception void* allocate (size_type nbytes) { return mp_header->allocate(nbytes); } - //!Searches for nbytes of free memory in the segment, marks the - //!memory as used and return the pointer to the memory. If no memory + //!Searches for nbytes of free memory in the segment, marks the + //!memory as used and return the pointer to the memory. If no memory //!is available returns 0. Never throws. void* allocate (size_type nbytes, std::nothrow_t nothrow) { return mp_header->allocate(nbytes, nothrow); } //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment" - //!must be power of two. If no memory + //!must be power of two. If no memory //!is available returns 0. Never throws. void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t nothrow) { return mp_header->allocate_aligned(nbytes, alignment, nothrow); } @@ -292,13 +292,13 @@ class basic_managed_memory_impl allocation_command (boost::interprocess::allocation_type command, size_type limit_size, size_type preferred_size,size_type &received_size, T *reuse_ptr = 0) - { + { return mp_header->allocation_command (command, limit_size, preferred_size, received_size, reuse_ptr); } //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment" - //!must be power of two. If no + //!must be power of two. If no //!memory is available throws a boost::interprocess::bad_alloc exception void * allocate_aligned(size_type nbytes, size_type alignment) { return mp_header->allocate_aligned(nbytes, alignment); } @@ -307,25 +307,31 @@ class basic_managed_memory_impl //Experimental. Don't use. - //!Allocates n_elements of elem_size bytes. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) - { return mp_header->allocate_many(elem_bytes, num_elements); } + //!Allocates n_elements of elem_bytes bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { mp_header->allocate_many(elem_bytes, n_elements, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements) - { return mp_header->allocate_many(elem_sizes, n_elements); } + //!Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { mp_header->allocate_many(element_lengths, n_elements, sizeof_element, chain); } - //!Allocates n_elements of elem_size bytes. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements, std::nothrow_t nothrow) - { return mp_header->allocate_many(elem_bytes, num_elements, nothrow); } + //!Allocates n_elements of elem_bytes bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { mp_header->allocate_many(std::nothrow_t(), elem_bytes, n_elements, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, std::nothrow_t nothrow) - { return mp_header->allocate_many(elem_sizes, n_elements, nothrow); } + //!Allocates n_elements, each one of + //!element_lengths[i]*sizeof_element bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { mp_header->allocate_many(std::nothrow_t(), elem_sizes, n_elements, sizeof_element, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - void deallocate_many(multiallocation_chain chain) - { return mp_header->deallocate_many(boost::move(chain)); } + //!Deallocates all elements contained in chain. + //!Never throws. + void deallocate_many(multiallocation_chain &chain) + { mp_header->deallocate_many(chain); } /// @endcond @@ -342,18 +348,18 @@ class basic_managed_memory_impl //!Creates a named object or array in memory //! - //!Allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -363,18 +369,18 @@ class basic_managed_memory_impl //!Finds or creates a named object or array in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -384,18 +390,18 @@ class basic_managed_memory_impl //!Creates a named object or array in memory //! - //!Allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! //!-> If the name was previously used, returns 0. //! - //!-> Returns 0 if there is no available memory + //!-> Returns 0 if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -405,18 +411,18 @@ class basic_managed_memory_impl //!Finds or creates a named object or array in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! - //!-> Returns 0 if there is no available memory + //!-> Returns 0 if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -424,54 +430,54 @@ class basic_managed_memory_impl find_or_construct(char_ptr_holder_t name, std::nothrow_t nothrow) { return mp_header->template find_or_construct(name, nothrow); } - //!Creates a named array from iterators in memory + //!Creates a named array from iterators in memory //! - //!Allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory. template typename segment_manager::template construct_iter_proxy::type construct_it(char_ptr_holder_t name) { return mp_header->template construct_it(name); } - //!Finds or creates a named array from iterators in memory + //!Finds or creates a named array from iterators in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory. template typename segment_manager::template construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name) { return mp_header->template find_or_construct_it(name); } - //!Creates a named array from iterators in memory + //!Creates a named array from iterators in memory //! - //!Allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. @@ -482,19 +488,19 @@ class basic_managed_memory_impl //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory.*/ template typename segment_manager::template construct_iter_proxy::type construct_it(char_ptr_holder_t name, std::nothrow_t nothrow) { return mp_header->template construct_it(name, nothrow); } - //!Finds or creates a named array from iterators in memory + //!Finds or creates a named array from iterators in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. @@ -505,7 +511,7 @@ class basic_managed_memory_impl //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory.*/ template typename segment_manager::template construct_iter_proxy::type @@ -537,11 +543,11 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object or array, the Standard + //!When deleting a dynamically object or array, the Standard //!does not guarantee that dynamically allocated memory, will be released. - //!Also, when deleting arrays, the Standard doesn't require calling - //!destructors for the rest of the objects if for one of them the destructor - //!terminated with an exception. + //!Also, when deleting arrays, the Standard doesn't require calling + //!destructors for the rest of the objects if for one of them the destructor + //!terminated with an exception. //! //!Destroying an object: //! @@ -550,13 +556,13 @@ class basic_managed_memory_impl //! //!Destroying an array: //! - //!When destroying an array, if a destructor throws, the rest of + //!When destroying an array, if a destructor throws, the rest of //!destructors are called. If any of these throws, the exceptions are //!ignored. The name association will be erased, memory will be freed and //!the first exception will be thrown. This guarantees the unlocking of //!mutexes and other resources. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended. template bool destroy(const CharType *name) @@ -568,7 +574,7 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object, the Standard does not + //!When deleting a dynamically object, the Standard does not //!guarantee that dynamically allocated memory will be released. //! //!Destroying an object: @@ -576,7 +582,7 @@ class basic_managed_memory_impl //!If the destructor throws, the memory will be freed and that exception //!will be thrown. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended for memory. template bool destroy(const unique_instance_t *const ) @@ -588,7 +594,7 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object, the Standard does not + //!When deleting a dynamically object, the Standard does not //!guarantee that dynamically allocated memory will be released. //! //!Destroying an object: @@ -596,7 +602,7 @@ class basic_managed_memory_impl //!If the destructor throws, the memory will be freed and that exception //!will be thrown. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended for memory. template void destroy_ptr(const T *ptr) @@ -620,13 +626,13 @@ class basic_managed_memory_impl static size_type get_instance_length(const T *ptr) { return segment_manager::get_instance_length(ptr); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" named objects in the memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_named_objects(size_type num) { mp_header->reserve_named_objects(num); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" unique objects in the memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_unique_objects(size_type num) @@ -652,7 +658,7 @@ class basic_managed_memory_impl const_named_iterator named_begin() const { return mp_header->named_begin(); } - //!Returns a constant iterator to the end of the index + //!Returns a constant iterator to the end of the index //!storing the named allocations. NOT thread-safe. Never throws. const_named_iterator named_end() const { return mp_header->named_end(); } @@ -662,7 +668,7 @@ class basic_managed_memory_impl const_unique_iterator unique_begin() const { return mp_header->unique_begin(); } - //!Returns a constant iterator to the end of the index + //!Returns a constant iterator to the end of the index //!storing the unique allocations. NOT thread-safe. Never throws. const_unique_iterator unique_end() const { return mp_header->unique_end(); } @@ -719,20 +725,40 @@ class basic_managed_memory_impl template class create_open_func { + typedef typename BasicManagedMemoryImpl::size_type size_type; + public: + create_open_func(BasicManagedMemoryImpl * const frontend, create_enum_t type) : m_frontend(frontend), m_type(type){} - bool operator()(void *addr, typename BasicManagedMemoryImpl::size_type size, bool created) const - { - if(((m_type == DoOpen) && created) || - ((m_type == DoCreate) && !created)) + bool operator()(void *addr, std::size_t size, bool created) const + { + if( ((m_type == DoOpen) && created) || + ((m_type == DoCreate) && !created) || + //Check for overflow + size_type(-1) < size ){ return false; + } + else if(created){ + return m_frontend->create_impl(addr, static_cast(size)); + } + else{ + return m_frontend->open_impl (addr, static_cast(size)); + } + } - if(created) - return m_frontend->create_impl(addr, size); - else - return m_frontend->open_impl (addr, size); + std::size_t get_min_size() const + { + const size_type sz = m_frontend->get_segment_manager()->get_min_size(); + if(sz > std::size_t(-1)){ + //The minimum size is not representable by std::size_t + BOOST_ASSERT(false); + return std::size_t(-1); + } + else{ + return static_cast(sz); + } } private: diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp index 579d1ad6f..b1b272514 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -36,7 +36,7 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include //!\file @@ -51,28 +51,28 @@ namespace interprocess { //-Use GetSecurityInfo? //-Change everything to use only a shared memory object expanded via truncate()? -//!A basic shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +//!A basic shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl template < - class CharType, - class MemoryAlgorithm, + class CharType, + class MemoryAlgorithm, template class IndexType > -class basic_managed_multi_shared_memory +class basic_managed_multi_shared_memory : public ipcdetail::basic_managed_memory_impl { typedef basic_managed_multi_shared_memory self_t; - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; - + typedef typename MemoryAlgorithm::void_pointer void_pointer; typedef typename ipcdetail:: - managed_open_or_create_impl managed_impl; + managed_open_or_create_impl managed_impl; typedef typename void_pointer::segment_group_id segment_group_id; typedef typename base_t::size_type size_type; @@ -91,7 +91,7 @@ class basic_managed_multi_shared_memory // { // public: // segment_creator(shared_memory &shmem, -// const char *mem_name, +// const char *mem_name, // const void *addr) // : m_shmem(shmem), m_mem_name(mem_name), m_addr(addr){} // @@ -99,8 +99,8 @@ class basic_managed_multi_shared_memory // { // if(!m_shmem.create(m_mem_name, size, m_addr)) // return 0; -// return m_shmem.get_address(); -// } +// return m_shmem.get_address(); +// } // private: // shared_memory &m_shmem; // const char *m_mem_name; @@ -113,7 +113,7 @@ class basic_managed_multi_shared_memory public: typedef std::pair result_type; typedef basic_managed_multi_shared_memory frontend_t; - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; typedef typename void_pointer::segment_group_id segment_group_id; group_services(frontend_t *const frontend) @@ -127,14 +127,14 @@ class basic_managed_multi_shared_memory alloc_size += 1; //If requested size is less than minimum, update that - alloc_size = (m_min_segment_size > alloc_size) ? + alloc_size = (m_min_segment_size > alloc_size) ? m_min_segment_size : alloc_size; if(mp_frontend->priv_new_segment(create_open_func::DoCreate, alloc_size, 0, permissions())){ typename shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin(); return result_type(m_impl.get_real_address(), m_impl.get_real_size()-1); }*/ - return result_type(static_cast(0), 0); + return result_type(static_cast(0), 0); } virtual bool update_segments () @@ -166,7 +166,7 @@ class basic_managed_multi_shared_memory struct create_open_func { enum type_t { DoCreate, DoOpen, DoOpenOrCreate }; - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; create_open_func(self_t * const frontend, @@ -174,8 +174,8 @@ class basic_managed_multi_shared_memory : mp_frontend(frontend), m_type(type), m_segment_number(segment_number){} bool operator()(void *addr, size_type size, bool created) const - { - if(((m_type == DoOpen) && created) || + { + if(((m_type == DoOpen) && created) || ((m_type == DoCreate) && !created)) return false; segment_group_id group = mp_frontend->m_group_services.get_group(); @@ -191,7 +191,7 @@ class basic_managed_multi_shared_memory //Check if this is the master segment if(!m_segment_number){ //Create or open the Interprocess machinery - if((impl_done = created ? + if((impl_done = created ? mp_frontend->create_impl(addr, size) : mp_frontend->open_impl(addr, size))){ return true; } @@ -211,22 +211,36 @@ class basic_managed_multi_shared_memory } return false; } + + std::size_t get_min_size() const + { + const size_type sz = mp_frontend->get_segment_manager()->get_min_size(); + if(sz > std::size_t(-1)){ + //The minimum size is not representable by std::size_t + BOOST_ASSERT(false); + return std::size_t(-1); + } + else{ + return static_cast(sz); + } + } + self_t * const mp_frontend; type_t m_type; - size_type m_segment_number; + size_type m_segment_number; }; //!Functor to execute atomically when closing a shared memory segment. struct close_func { - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; close_func(self_t * const frontend) : mp_frontend(frontend){} void operator()(const mapped_region ®ion, bool last) const - { + { if(last) mp_frontend->destroy_impl(); else mp_frontend->close_impl(); } @@ -251,7 +265,7 @@ class basic_managed_multi_shared_memory const permissions &perm = permissions()) : m_group_services(get_this_pointer()) { - priv_open_or_create(create_open_func::DoCreate,name, size, perm); + priv_open_or_create(create_open_func::DoCreate,name, size, perm); } basic_managed_multi_shared_memory(open_or_create_t, @@ -273,7 +287,7 @@ class basic_managed_multi_shared_memory { this->priv_close(); } private: - bool priv_open_or_create(typename create_open_func::type_t type, + bool priv_open_or_create(typename create_open_func::type_t type, const char *name, size_type size, const permissions &perm) @@ -301,7 +315,7 @@ class basic_managed_multi_shared_memory if(group){ void_pointer::delete_group(group); } - return false; + return false; } bool priv_new_segment(typename create_open_func::type_t type, @@ -312,7 +326,7 @@ class basic_managed_multi_shared_memory BOOST_TRY{ //Get the number of groups of this multi_segment group size_type segment_id = m_shmem_list.size(); - //Format the name of the shared memory: append segment number. + //Format the name of the shared memory: append segment number. boost::interprocess::basic_ovectorstream formatter; //Pre-reserve string size size_type str_size = m_root_name.length()+10; @@ -368,7 +382,7 @@ class basic_managed_multi_shared_memory //!Frees resources. Never throws. void priv_close() - { + { if(!m_shmem_list.empty()){ bool ret; //Obtain group identifier @@ -385,7 +399,7 @@ class basic_managed_multi_shared_memory m_shmem_list.clear(); } } - + private: shmem_list_t m_shmem_list; group_services m_group_services; diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp index 4d6997f33..f8154d061 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -48,12 +48,12 @@ class xsi_key; template<> struct managed_open_or_create_impl_device_id_t -{ +{ typedef xsi_key type; }; #endif //BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS - + /// @endcond namespace ipcdetail { @@ -79,12 +79,12 @@ class managed_open_or_create_impl_device_holder const DeviceAbstraction &get_device() const { return dev; } - + private: DeviceAbstraction dev; }; -template +template class managed_open_or_create_impl : public managed_open_or_create_impl_device_holder { @@ -94,16 +94,16 @@ class managed_open_or_create_impl typedef typename managed_open_or_create_impl_device_id_t::type device_id_t; typedef managed_open_or_create_impl_device_holder DevHolder; enum - { - UninitializedSegment, - InitializingSegment, + { + UninitializedSegment, + InitializingSegment, InitializedSegment, CorruptedSegment }; public: static const std::size_t - ManagedOpenOrCreateUserOffset = + ManagedOpenOrCreateUserOffset = ct_rounded_size < sizeof(boost::uint32_t) , MemAlignment ? (MemAlignment) : @@ -113,7 +113,7 @@ class managed_open_or_create_impl managed_open_or_create_impl() {} - managed_open_or_create_impl(create_only_t, + managed_open_or_create_impl(create_only_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -130,7 +130,7 @@ class managed_open_or_create_impl , null_mapped_region_function()); } - managed_open_or_create_impl(open_only_t, + managed_open_or_create_impl(open_only_t, const device_id_t & id, mode_t mode, const void *addr) @@ -146,7 +146,7 @@ class managed_open_or_create_impl } - managed_open_or_create_impl(open_or_create_t, + managed_open_or_create_impl(open_or_create_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -164,7 +164,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(create_only_t, + managed_open_or_create_impl(create_only_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -183,7 +183,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(open_only_t, + managed_open_or_create_impl(open_only_t, const device_id_t & id, mode_t mode, const void *addr, @@ -200,7 +200,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(open_or_create_t, + managed_open_or_create_impl(open_or_create_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -222,10 +222,10 @@ class managed_open_or_create_impl { this->swap(moved); } managed_open_or_create_impl &operator=(BOOST_RV_REF(managed_open_or_create_impl) moved) - { + { managed_open_or_create_impl tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } ~managed_open_or_create_impl() @@ -298,10 +298,10 @@ class managed_open_or_create_impl tmp.swap(dev); } - template inline + template inline void priv_open_or_create - (create_enum_t type, - const device_id_t & id, + (create_enum_t type, + const device_id_t & id, std::size_t size, mode_t mode, const void *addr, const permissions &perm, @@ -315,8 +315,13 @@ class managed_open_or_create_impl bool cow = false; DeviceAbstraction dev; - if(type != DoOpen && size < ManagedOpenOrCreateUserOffset){ - throw interprocess_exception(error_info(size_error)); + if(type != DoOpen){ + //Check if the requested size is enough to build the managed metadata + const std::size_t func_min_size = construct_func.get_min_size(); + if( (std::size_t(-1) - ManagedOpenOrCreateUserOffset) < func_min_size || + size < (func_min_size + ManagedOpenOrCreateUserOffset) ){ + throw interprocess_exception(error_info(size_error)); + } } //Check size can be represented by offset_t (used by truncate) if(type != DoOpen && !check_offset_t_size(size, file_like_t())){ @@ -366,8 +371,8 @@ class managed_open_or_create_impl created = false; completed = true; } - catch(interprocess_exception &ex){ - if(ex.get_error_code() != not_found_error){ + catch(interprocess_exception &e){ + if(e.get_error_code() != not_found_error){ throw; } } @@ -396,7 +401,8 @@ class managed_open_or_create_impl if(previous == UninitializedSegment){ try{ - construct_func(static_cast(region.get_address()) + ManagedOpenOrCreateUserOffset, size - ManagedOpenOrCreateUserOffset, true); + construct_func( static_cast(region.get_address()) + ManagedOpenOrCreateUserOffset + , size - ManagedOpenOrCreateUserOffset, true); //All ok, just move resources to the external mapped region m_mapped_region.swap(region); } @@ -460,6 +466,11 @@ class managed_open_or_create_impl } } + friend void swap(managed_open_or_create_impl &left, managed_open_or_create_impl &right) + { + left.swap(right); + } + private: friend class interprocess_tester; void dont_close_on_destruction() @@ -468,11 +479,6 @@ class managed_open_or_create_impl mapped_region m_mapped_region; }; -template -inline void swap(managed_open_or_create_impl &x - ,managed_open_or_create_impl &y) -{ x.swap(y); } - } //namespace ipcdetail { } //namespace interprocess { diff --git a/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp index 08274160d..20922b39c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp @@ -1,10 +1,10 @@ ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Stephen Cleary 2000. -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // 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) // // See http://www.boost.org/libs/interprocess for documentation. @@ -93,7 +93,7 @@ inline std::size_t floor_log2 (std::size_t x) std::size_t n = x; std::size_t log2 = 0; - + for(std::size_t shift = Bits >> 1; shift; shift >>= 1){ std::size_t tmp = n >> shift; if (tmp) diff --git a/project/jni/boost/include/boost/interprocess/detail/min_max.hpp b/project/jni/boost/include/boost/interprocess/detail/min_max.hpp index 75aa00f87..63ce7efd9 100644 --- a/project/jni/boost/include/boost/interprocess/detail/min_max.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/min_max.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -21,7 +21,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { template const T &max_value(const T &a, const T &b) @@ -31,7 +31,7 @@ template const T &min_value(const T &a, const T &b) { return a < b ? a : b; } -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/move.hpp b/project/jni/boost/include/boost/interprocess/detail/move.hpp index 1ec43b211..87684f621 100644 --- a/project/jni/boost/include/boost/interprocess/detail/move.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/move.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2010-2011. +// (C) Copyright Ion Gaztanaga 2010-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) diff --git a/project/jni/boost/include/boost/interprocess/detail/mpl.hpp b/project/jni/boost/include/boost/interprocess/detail/mpl.hpp index c5b6f90ef..4c5e1f1b9 100644 --- a/project/jni/boost/include/boost/interprocess/detail/mpl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/mpl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -105,24 +105,24 @@ struct if_ template -struct select1st -// : public std::unary_function +struct select1st +// : public std::unary_function { template - const typename Pair::first_type& operator()(const OtherPair& x) const + const typename Pair::first_type& operator()(const OtherPair& x) const { return x.first; } - const typename Pair::first_type& operator()(const typename Pair::first_type& x) const + const typename Pair::first_type& operator()(const typename Pair::first_type& x) const { return x; } }; // identity is an extension: it is not part of the standard. template -struct identity -// : public std::unary_function +struct identity +// : public std::unary_function { typedef T type; - const T& operator()(const T& x) const + const T& operator()(const T& x) const { return x; } }; @@ -144,8 +144,8 @@ struct ls_zeros<1> static const std::size_t value = 0; }; -} //namespace ipcdetail { -} //namespace interprocess { +} //namespace ipcdetail { +} //namespace interprocess { } //namespace boost { #endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp b/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp index 4b6cafc74..f625a9bc3 100644 --- a/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -20,7 +20,7 @@ /*!\file - Describes a named shared memory allocation user class. + Describes a named shared memory allocation user class. */ namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp b/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp index 604d7881e..14a9aa0a7 100644 --- a/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -24,7 +24,7 @@ #include #ifndef BOOST_INTERPROCESS_PERFECT_FORWARDING -#include +#include #else #include #include @@ -34,7 +34,7 @@ //!Describes a proxy class that implements named allocation syntax. namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING @@ -83,7 +83,7 @@ struct CtorNArg : public placement_destroy { this->expansion_helper(++get(args_)...); } - + template void expansion_helper(ExpansionArgs &&...) {} @@ -93,11 +93,11 @@ struct CtorNArg : public placement_destroy {} tuple args_; -}; +}; //!Describes a proxy class that implements named //!allocation syntax. -template +template < class SegmentManager //segment manager to construct the object , class T //type of object to build , bool is_iterator //passing parameters are normal object or iterators? @@ -119,10 +119,10 @@ class named_proxy template T *operator()(Args &&...args) const - { + { CtorNArg &&ctor_obj = CtorNArg (boost::forward(args)...); - return mp_mngr->template + return mp_mngr->template generic_construct(mp_name, m_num, m_find, m_dothrow, ctor_obj); } @@ -199,7 +199,7 @@ struct Ctor0Arg : public placement_destroy // private: // void construct(void *mem, true_) // { new((void*)mem)T(*m_p1, *m_p2); } -// +// // void construct(void *mem, false_) // { new((void*)mem)T(m_p1, m_p2); } // @@ -270,7 +270,7 @@ struct Ctor0Arg : public placement_destroy //!Describes a proxy class that implements named //!allocation syntax. -template +template < class SegmentManager //segment manager to construct the object , class T //type of object to build , bool is_iterator //passing parameters are normal object or iterators? @@ -293,9 +293,9 @@ class named_proxy //!makes a named allocation and calls the //!default constructor T *operator()() const - { + { Ctor0Arg ctor_obj; - return mp_mngr->template + return mp_mngr->template generic_construct(mp_name, m_num, m_find, m_dothrow, ctor_obj); } //! @@ -322,7 +322,7 @@ class named_proxy //////////////////////////////////////////////////////////////////////// // // template - // T *operator()(P1 &p1, P2 &p2) const + // T *operator()(P1 &p1, P2 &p2) const // { // typedef Ctor2Arg // diff --git a/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp index b680c5713..840079dc1 100644 --- a/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -32,7 +32,7 @@ # include # include # if 0 -# include +# include # endif # else # error Unknown platform @@ -58,7 +58,7 @@ typedef enum { read_only = winapi::generic_read , read_write = winapi::generic_read | winapi::generic_write , copy_on_write , read_private - , invalid_mode = 0xffff + , invalid_mode = 0xffff } mode_t; typedef enum { file_begin = winapi::file_begin @@ -96,28 +96,28 @@ inline const char *get_temporary_path() inline file_handle_t create_new_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file ( name, (unsigned int)mode, winapi::create_new, attr - , (winapi::interprocess_security_attributes*)perm.get_permissions()); + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t create_or_open_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file ( name, (unsigned int)mode, winapi::open_always, attr - , (winapi::interprocess_security_attributes*)perm.get_permissions()); + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t open_existing_file (const char *name, mode_t mode, bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file - (name, (unsigned int)mode, winapi::open_existing, attr, 0); + (name, (unsigned int)mode, winapi::open_existing, attr, 0); } inline bool delete_file(const char *name) @@ -140,7 +140,7 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size) if(offset_t(size) > filesize){ if(!winapi::set_file_pointer_ex(hnd, filesize, 0, winapi::file_begin)){ return false; - } + } //We will write zeros in the end of the file //since set_end_of_file does not guarantee this for(std::size_t remaining = size - filesize, write_size = 0 @@ -177,7 +177,7 @@ inline bool get_file_pointer(file_handle_t hnd, offset_t &off) { return winapi::set_file_pointer_ex(hnd, 0, &off, winapi::file_current); } inline bool write_file(file_handle_t hnd, const void *data, std::size_t numdata) -{ +{ unsigned long written; return 0 != winapi::write_file(hnd, data, (unsigned long)numdata, &written, 0); } @@ -189,9 +189,9 @@ inline bool close_file(file_handle_t hnd) { return 0 != winapi::close_handle(hnd); } inline bool acquire_file_lock(file_handle_t hnd) -{ +{ static winapi::interprocess_overlapped overlapped; - const unsigned long len = 0xffffffff; + const unsigned long len = ((unsigned long)-1); // winapi::interprocess_overlapped overlapped; // std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::lock_file_ex @@ -199,44 +199,44 @@ inline bool acquire_file_lock(file_handle_t hnd) } inline bool try_acquire_file_lock(file_handle_t hnd, bool &acquired) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); if(!winapi::lock_file_ex - (hnd, winapi::lockfile_exclusive_lock | winapi::lockfile_fail_immediately, + (hnd, winapi::lockfile_exclusive_lock | winapi::lockfile_fail_immediately, 0, len, len, &overlapped)){ - return winapi::get_last_error() == winapi::error_lock_violation ? + return winapi::get_last_error() == winapi::error_lock_violation ? acquired = false, true : false; - + } return (acquired = true); } inline bool release_file_lock(file_handle_t hnd) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::unlock_file_ex(hnd, 0, len, len, &overlapped); } inline bool acquire_file_lock_sharable(file_handle_t hnd) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::lock_file_ex(hnd, 0, 0, len, len, &overlapped); } inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); if(!winapi::lock_file_ex (hnd, winapi::lockfile_fail_immediately, 0, len, len, &overlapped)){ - return winapi::get_last_error() == winapi::error_lock_violation ? + return winapi::get_last_error() == winapi::error_lock_violation ? acquired = false, true : false; } return (acquired = true); @@ -367,7 +367,7 @@ typedef enum { read_only = O_RDONLY , read_write = O_RDWR , copy_on_write , read_private - , invalid_mode = 0xffff + , invalid_mode = 0xffff } mode_t; typedef enum { file_begin = SEEK_SET @@ -406,7 +406,7 @@ inline const char *get_temporary_path() inline file_handle_t create_new_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ (void)temporary; int ret = ::open(name, ((int)mode) | O_EXCL | O_CREAT, perm.get_permissions()); if(ret >= 0){ @@ -439,7 +439,7 @@ inline file_handle_t create_or_open_file inline file_handle_t open_existing_file (const char *name, mode_t mode, bool temporary = false) -{ +{ (void)temporary; return ::open(name, (int)mode); } @@ -459,7 +459,7 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size) } inline bool get_file_size(file_handle_t hnd, offset_t &size) -{ +{ struct stat data; bool ret = 0 == ::fstat(hnd, &data); if(ret){ @@ -472,7 +472,7 @@ inline bool set_file_pointer(file_handle_t hnd, offset_t off, file_pos_t pos) { return ((off_t)(-1)) != ::lseek(hnd, off, (int)pos); } inline bool get_file_pointer(file_handle_t hnd, offset_t &off) -{ +{ off = ::lseek(hnd, 0, SEEK_CUR); return off != ((off_t)-1); } @@ -522,7 +522,7 @@ inline bool release_file_lock(file_handle_t hnd) } inline bool acquire_file_lock_sharable(file_handle_t hnd) -{ +{ struct ::flock lock; lock.l_type = F_RDLCK; lock.l_whence = SEEK_SET; @@ -532,7 +532,7 @@ inline bool acquire_file_lock_sharable(file_handle_t hnd) } inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) -{ +{ struct flock lock; lock.l_type = F_RDLCK; lock.l_whence = SEEK_SET; @@ -540,7 +540,7 @@ inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) lock.l_len = 0; int ret = ::fcntl(hnd, F_SETLK, &lock); if(ret == -1){ - return (errno == EAGAIN || errno == EACCES) ? + return (errno == EAGAIN || errno == EACCES) ? acquired = false, true : false; } return (acquired = true); @@ -601,7 +601,7 @@ inline bool delete_subdirectories_recursive || (de->d_name[1] == '.' && de->d_name[2] == '\0' )) ){ continue; } - if(dont_delete_this && std::strcmp(dont_delete_this, de->d_name) == 0){ + if(dont_delete_this && std::strcmp(dont_delete_this, de->d_name) == 0){ continue; } fn = refcstrRootDirectory; diff --git a/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp index e49e82c8e..f881a1f46 100644 --- a/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -104,7 +104,7 @@ typedef pthread_t OS_thread_id_t; typedef pid_t OS_process_id_t; struct OS_systemwide_thread_id_t -{ +{ OS_systemwide_thread_id_t() : pid(), tid() {} @@ -153,7 +153,7 @@ inline OS_thread_id_t get_current_thread_id() { return ::pthread_self(); } inline OS_thread_id_t get_invalid_thread_id() -{ +{ static pthread_t invalid_id; return invalid_id; } diff --git a/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp b/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp index 7c45be085..aa8da550c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -61,11 +61,11 @@ template struct pointer_type { typedef typename pointer_type_imp::pointer_type::type>::type type; + typename remove_reference::type>::type type; }; } //namespace ipcdetail { -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp new file mode 100644 index 000000000..2d0190687 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp @@ -0,0 +1,356 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP +#define BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +typedef basic_managed_global_memory managed_global_memory; + +namespace intermodule_singleton_helpers { + +static void create_tmp_subdir_and_get_pid_based_filepath + (const char *subdir_name, const char *file_prefix, OS_process_id_t pid, std::string &s, bool creation_time = false) +{ + //Let's create a lock file for each process gmem that will mark if + //the process is alive or not + create_tmp_and_clean_old(s); + s += "/"; + s += subdir_name; + if(!open_or_create_directory(s.c_str())){ + throw interprocess_exception(error_info(system_error_code())); + } + s += "/"; + s += file_prefix; + if(creation_time){ + std::string sstamp; + get_pid_creation_time_str(sstamp); + s += sstamp; + } + else{ + pid_str_t pid_str; + get_pid_str(pid_str, pid); + s += pid_str; + } +} + +static bool check_if_filename_complies_with_pid + (const char *filename, const char *prefix, OS_process_id_t pid, std::string &file_suffix, bool creation_time = false) +{ + //Check if filename complies with lock file name pattern + std::string fname(filename); + std::string fprefix(prefix); + if(fname.size() <= fprefix.size()){ + return false; + } + fname.resize(fprefix.size()); + if(fname != fprefix){ + return false; + } + + //If not our lock file, delete it if we can lock it + fname = filename; + fname.erase(0, fprefix.size()); + pid_str_t pid_str; + get_pid_str(pid_str, pid); + file_suffix = pid_str; + if(creation_time){ + std::size_t p = fname.find('_'); + if (p == std::string::npos){ + return false; + } + std::string save_suffix(fname); + fname.erase(p); + fname.swap(file_suffix); + bool ret = (file_suffix == fname); + file_suffix.swap(save_suffix); + return ret; + } + else{ + fname.swap(file_suffix); + return (file_suffix == fname); + } +} + +template<> +struct thread_safe_global_map_dependant +{ + private: + static const int GMemMarkToBeRemoved = -1; + static const int GMemNotPresent = -2; + + static const char *get_lock_file_subdir_name() + { return "gmem"; } + + static const char *get_lock_file_base_name() + { return "lck"; } + + static void create_and_get_singleton_lock_file_path(std::string &s) + { + create_tmp_subdir_and_get_pid_based_filepath + (get_lock_file_subdir_name(), get_lock_file_base_name(), get_current_process_id(), s, true); + } + + struct gmem_erase_func + { + gmem_erase_func(const char *shm_name, const char *singleton_lock_file_path, managed_global_memory & shm) + :shm_name_(shm_name), singleton_lock_file_path_(singleton_lock_file_path), shm_(shm) + {} + + void operator()() + { + locking_file_serial_id *pserial_id = shm_.find("lock_file_fd").first; + if(pserial_id){ + pserial_id->fd = GMemMarkToBeRemoved; + } + delete_file(singleton_lock_file_path_); + shared_memory_object::remove(shm_name_); + } + + const char * const shm_name_; + const char * const singleton_lock_file_path_; + managed_global_memory & shm_; + }; + + //This function applies shared memory erasure logic based on the passed lock file. + static void apply_gmem_erase_logic(const char *filepath, const char *filename) + { + int fd = GMemMarkToBeRemoved; + try{ + std::string str; + //If the filename is current process lock file, then avoid it + if(check_if_filename_complies_with_pid + (filename, get_lock_file_base_name(), get_current_process_id(), str, true)){ + return; + } + //Open and lock the other process' lock file + fd = try_open_and_lock_file(filepath); + if(fd < 0){ + return; + } + //If done, then the process is dead so take global shared memory name + //(the name is based on the lock file name) and try to apply erasure logic + str.insert(0, get_map_base_name()); + try{ + managed_global_memory shm(open_only, str.c_str()); + gmem_erase_func func(str.c_str(), filepath, shm); + shm.try_atomic_func(func); + } + catch(interprocess_exception &e){ + //If shared memory is not found erase the lock file + if(e.get_error_code() == not_found_error){ + delete_file(filepath); + } + } + } + catch(...){ + + } + if(fd >= 0){ + close_lock_file(fd); + } + } + + public: + + static bool remove_old_gmem() + { + std::string refcstrRootDirectory; + tmp_folder(refcstrRootDirectory); + refcstrRootDirectory += "/"; + refcstrRootDirectory += get_lock_file_subdir_name(); + return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); + } + + struct lock_file_logic + { + lock_file_logic(managed_global_memory &shm) + : mshm(shm) + { shm.atomic_func(*this); } + + void operator()(void) + { + retry_with_new_map = false; + + //First find the file locking descriptor id + locking_file_serial_id *pserial_id = + mshm.find("lock_file_fd").first; + + int fd; + //If not found schedule a creation + if(!pserial_id){ + fd = GMemNotPresent; + } + //Else get it + else{ + fd = pserial_id->fd; + } + //If we need to create a new one, do it + if(fd == GMemNotPresent){ + std::string lck_str; + //Create a unique current pid based lock file path + create_and_get_singleton_lock_file_path(lck_str); + //Open or create and lock file + int fd_lockfile = open_or_create_and_lock_file(lck_str.c_str()); + //If failed, write a bad file descriptor to notify other modules that + //something was wrong and unlink shared memory. Mark the function object + //to tell caller to retry with another shared memory + if(fd_lockfile < 0){ + this->register_lock_file(GMemMarkToBeRemoved); + std::string s; + get_map_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_map = true; + } + //If successful, register the file descriptor + else{ + this->register_lock_file(fd_lockfile); + } + } + //If the fd was invalid (maybe a previous try failed) notify caller that + //should retry creation logic, since this shm might have been already + //unlinked since the shm was removed + else if (fd == GMemMarkToBeRemoved){ + retry_with_new_map = true; + } + //If the stored fd is not valid (a open fd, a normal file with the + //expected size, or does not have the same file id number, + //then it's an old shm from an old process with the same pid. + //If that's the case, mark it as invalid + else if(!is_valid_fd(fd) || + !is_normal_file(fd) || + 0 != get_size(fd) || + !compare_file_serial(fd, *pserial_id)){ + pserial_id->fd = GMemMarkToBeRemoved; + std::string s; + get_map_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_map = true; + } + else{ + //If the lock file is ok, increment reference count of + //attached modules to shared memory + atomic_inc32(&pserial_id->modules_attached_to_gmem_count); + } + } + + bool retry() const { return retry_with_new_map; } + + private: + locking_file_serial_id * register_lock_file(int fd) + { + locking_file_serial_id *pinfo = mshm.construct("lock_file_fd")(); + fill_file_serial_id(fd, *pinfo); + return pinfo; + } + + managed_global_memory &mshm; + bool retry_with_new_map; + }; + + static void construct_map(void *addr) + { + std::string s; + intermodule_singleton_helpers::get_map_name(s); + const char *MapName = s.c_str(); + const std::size_t MapSize = intermodule_singleton_helpers::get_map_size();; + ::new (addr)managed_global_memory(open_or_create, MapName, MapSize); + } + + struct unlink_map_logic + { + unlink_map_logic(managed_global_memory &mshm) + : mshm_(mshm) + { mshm.atomic_func(*this); } + + void operator()() + { + locking_file_serial_id *pserial_id = + mshm_.find + ("lock_file_fd").first; + BOOST_ASSERT(0 != pserial_id); + if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){ + int fd = pserial_id->fd; + if(fd > 0){ + pserial_id->fd = GMemMarkToBeRemoved; + std::string s; + create_and_get_singleton_lock_file_path(s); + delete_file(s.c_str()); + close_lock_file(fd); + intermodule_singleton_helpers::get_map_name(s); + shared_memory_object::remove(s.c_str()); + } + } + } + + private: + managed_global_memory &mshm_; + }; + + static ref_count_ptr *find(managed_global_memory &map, const char *name) + { + return map.find(name).first; + } + + static ref_count_ptr *insert(managed_global_memory &map, const char *name, const ref_count_ptr &ref) + { + return map.construct(name)(ref); + } + + static bool erase(managed_global_memory &map, const char *name) + { + return map.destroy(name); + } + + template + static void atomic_func(managed_global_memory &map, F &f) + { + map.atomic_func(f); + } +}; + +} //namespace intermodule_singleton_helpers { + +template +class portable_intermodule_singleton + : public intermodule_singleton_impl +{}; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp b/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp index c1276f0f2..fa167f576 100644 --- a/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -15,7 +15,7 @@ #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define BOOST_INTERPROCESS_WIN32_LEAN_AND_MEAN #endif //#ifndef WIN32_LEAN_AND_MEAN #endif //#ifdef _WIN32 diff --git a/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp b/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp index 4af268645..0eb419d62 100644 --- a/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // @@ -21,7 +21,7 @@ #error "This file is not needed when perfect forwarding is available" #endif -#include +#include #include #include #include @@ -35,7 +35,7 @@ //This cast is ugly but it is necessary until "perfect forwarding" //is achieved in C++0x. Meanwhile, if we want to be able to //bind rvalues with non-const references, we have to be ugly -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ //! @@ -45,7 +45,7 @@ //! #endif -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PP_PARAM(U, u) \ U && u \ //! @@ -55,78 +55,144 @@ //! #endif -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ + //! -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ -//! - -#else - -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \ -//! +#else //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ + //! #endif -#else -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ -//! -#endif +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ - BOOST_PP_CAT(++m_p, n) \ -//! + #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) -#ifndef BOOST_NO_RVALUE_REFERENCES + namespace boost { + namespace interprocess { + namespace ipcdetail { + template + struct ref_holder; -#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + template + struct ref_holder + { + ref_holder(T &t) + : t_(t) + {} + T &t_; + T & get() { return t_; } + T & get_lvalue() { return t_; } + }; -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ -//! + template + struct ref_holder + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + const T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + const T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(T &&t) + : t_(t) + {} + T &t_; + T && get() { return ::boost::move(t_); } + T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(T &&t) + : t(t) + {} + T &t; + T && get() { return ::boost::move(t_); } + T & get_lvalue() { return t_; } + }; + + } //namespace ipcdetail { + } //namespace interprocess { + } //namespace boost { + + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ + ::boost::interprocess::ipcdetail::ref_holder BOOST_PP_CAT(m_p, n); \ + //! + + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n).get_lvalue() \ + //! + + #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data)\ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ + //! + + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n) \ + //! + + #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #else + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ + //! -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ -//! + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n) \ + //! -#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) - - -#else -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ -//! #endif #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \ ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ //! -#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) -#include + #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ + //! -#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ -::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \ -//! + #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ + BOOST_PP_CAT(*m_p, n).get_lvalue() \ + //! #else -#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ -::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ -//! + #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ + ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ + //! -#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ + BOOST_PP_CAT(*m_p, n) \ + //! -#define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ -BOOST_PP_CAT(*m_p, n) \ -//! + +#endif //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #include diff --git a/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp b/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp index 4a4709e3a..63d9915b5 100644 --- a/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -15,7 +15,7 @@ #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define BOOST_INTERPROCESS_WIN32_LEAN_AND_MEAN #endif //#ifndef WIN32_LEAN_AND_MEAN #endif //#ifdef _WIN32 diff --git a/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp b/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp index b2097d0ad..cac659549 100644 --- a/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2010-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2010-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) // @@ -68,7 +68,7 @@ inline void robust_lock_path(std::string &s) inline void create_and_get_robust_lock_file_path(std::string &s, OS_process_id_t pid) { - file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath + intermodule_singleton_helpers::create_tmp_subdir_and_get_pid_based_filepath (robust_lock_subdir_path(), robust_lock_prefix(), pid, s); } @@ -132,7 +132,7 @@ class robust_mutex_lock_file throw interprocess_exception(other_error, "Robust emulation robust_mutex_lock_file constructor failed: create_file filed with unexpected error"); } } - } + } ~robust_mutex_lock_file() { @@ -154,7 +154,7 @@ class robust_mutex_lock_file { std::string pid_str; //If the lock file is not our own lock file, then try to do the cleanup - if(!file_locking_helpers::check_if_filename_complies_with_pid + if(!intermodule_singleton_helpers::check_if_filename_complies_with_pid (filename, robust_lock_prefix(), get_current_process_id(), pid_str)){ remove_if_can_lock_file(filepath); } @@ -197,8 +197,8 @@ class robust_spin_mutex bool lock_own_unique_file(); bool robust_check(); bool check_if_owner_dead_and_take_ownership_atomically(); - bool is_owner_dead(boost::uint32_t owner); - void owner_to_filename(boost::uint32_t owner, std::string &s); + bool is_owner_dead(boost::uint32_t own); + void owner_to_filename(boost::uint32_t own, std::string &s); //The real mutex Mutex mtx; //The pid of the owner @@ -309,9 +309,9 @@ inline bool robust_spin_mutex::timed_lock } template -inline void robust_spin_mutex::owner_to_filename(boost::uint32_t owner, std::string &s) +inline void robust_spin_mutex::owner_to_filename(boost::uint32_t own, std::string &s) { - robust_emulation_helpers::create_and_get_robust_lock_file_path(s, owner); + robust_emulation_helpers::create_and_get_robust_lock_file_path(s, own); } template @@ -324,7 +324,7 @@ inline bool robust_spin_mutex::robust_check() return false; } atomic_write32(&this->state, fixing_state); - return true; + return true; } template @@ -349,16 +349,16 @@ inline bool robust_spin_mutex::check_if_owner_dead_and_take_ownership_ato } template -inline bool robust_spin_mutex::is_owner_dead(boost::uint32_t owner) +inline bool robust_spin_mutex::is_owner_dead(boost::uint32_t own) { //If owner is an invalid id, then it's clear it's dead - if(owner == (boost::uint32_t)get_invalid_process_id()){ + if(own == (boost::uint32_t)get_invalid_process_id()){ return true; } //Obtain the lock filename of the owner field std::string file; - this->owner_to_filename(owner, file); + this->owner_to_filename(own, file); //Now the logic is to open and lock it file_handle_t fhnd = open_existing_file(file.c_str(), read_write); @@ -424,7 +424,7 @@ template inline bool robust_spin_mutex::lock_own_unique_file() { //This function forces instantiation of the singleton - robust_emulation_helpers::robust_mutex_lock_file* dummy = + robust_emulation_helpers::robust_mutex_lock_file* dummy = &ipcdetail::intermodule_singleton ::get(); return dummy != 0; diff --git a/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp b/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp index ea820b388..83e5a05eb 100644 --- a/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -81,21 +81,18 @@ struct block_header unsigned char m_value_alignment; unsigned char m_alloc_type_sizeof_char; - block_header(size_type value_bytes - ,size_type value_alignment - ,unsigned char alloc_type - ,std::size_t sizeof_char + block_header(size_type val_bytes + ,size_type val_alignment + ,unsigned char al_type + ,std::size_t szof_char ,std::size_t num_char ) - : m_value_bytes(value_bytes) + : m_value_bytes(val_bytes) , m_num_char((unsigned short)num_char) - , m_value_alignment((unsigned char)value_alignment) - , m_alloc_type_sizeof_char - ( (alloc_type << 5u) | - ((unsigned char)sizeof_char & 0x1F) ) + , m_value_alignment((unsigned char)val_alignment) + , m_alloc_type_sizeof_char( (al_type << 5u) | ((unsigned char)szof_char & 0x1F) ) {}; - template block_header &operator= (const T& ) { return *this; } @@ -130,7 +127,7 @@ struct block_header template CharType *name() const - { + { return const_cast(reinterpret_cast (reinterpret_cast(this) + name_offset())); } @@ -139,7 +136,7 @@ struct block_header { return m_num_char; } size_type name_offset() const - { + { return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char())); } @@ -157,7 +154,7 @@ struct block_header bool less_comp(const block_header &b) const { return m_num_char < b.m_num_char || - (m_num_char < b.m_num_char && + (m_num_char < b.m_num_char && std::char_traits::compare (name(), b.name(), m_num_char) < 0); } @@ -175,10 +172,10 @@ struct block_header { return block_header_from_value(value, sizeof(T), ::boost::alignment_of::value); } static block_header *block_header_from_value(const void *value, std::size_t sz, std::size_t algn) - { - block_header * hdr = + { + block_header * hdr = const_cast - (reinterpret_cast(reinterpret_cast(value) - + (reinterpret_cast(reinterpret_cast(value) - get_rounded_size(sizeof(block_header), algn))); (void)sz; //Some sanity checks @@ -189,9 +186,9 @@ struct block_header template static block_header *from_first_header(Header *header) - { - block_header * hdr = - reinterpret_cast*>(reinterpret_cast(header) + + { + block_header * hdr = + reinterpret_cast*>(reinterpret_cast(header) + get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of >::value))); //Some sanity checks return hdr; @@ -199,9 +196,9 @@ struct block_header template static Header *to_first_header(block_header *bheader) - { - Header * hdr = - reinterpret_cast(reinterpret_cast(bheader) - + { + Header * hdr = + reinterpret_cast(reinterpret_cast(bheader) - get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of >::value))); //Some sanity checks return hdr; @@ -311,15 +308,15 @@ template class char_ptr_holder { public: - char_ptr_holder(const CharType *name) + char_ptr_holder(const CharType *name) : m_name(name) {} - char_ptr_holder(const anonymous_instance_t *) + char_ptr_holder(const anonymous_instance_t *) : m_name(static_cast(0)) {} - char_ptr_holder(const unique_instance_t *) + char_ptr_holder(const unique_instance_t *) : m_name(reinterpret_cast(-1)) {} @@ -330,7 +327,7 @@ class char_ptr_holder const CharType *m_name; }; -//!The key of the the named allocation information index. Stores an offset pointer +//!The key of the the named allocation information index. Stores an offset pointer //!to a null terminated string and the length of the string to speed up sorting template struct index_key @@ -350,15 +347,16 @@ struct index_key public: //!Constructor of the key - index_key (const char_type *name, size_type length) - : mp_str(name), m_len(length) {} + index_key (const char_type *nm, size_type length) + : mp_str(nm), m_len(length) + {} //!Less than function for index ordering bool operator < (const index_key & right) const { - return (m_len < right.m_len) || - (m_len == right.m_len && - std::char_traits::compare + return (m_len < right.m_len) || + (m_len == right.m_len && + std::char_traits::compare (to_raw_pointer(mp_str) ,to_raw_pointer(right.mp_str), m_len) < 0); } @@ -366,14 +364,14 @@ struct index_key //!Equal to function for index ordering bool operator == (const index_key & right) const { - return m_len == right.m_len && - std::char_traits::compare + return m_len == right.m_len && + std::char_traits::compare (to_raw_pointer(mp_str), to_raw_pointer(right.mp_str), m_len) == 0; } - void name(const CharT *name) - { mp_str = name; } + void name(const CharT *nm) + { mp_str = nm; } void name_length(size_type len) { m_len = len; } @@ -478,14 +476,14 @@ struct segment_manager_iterator_transform , segment_manager_iterator_value_adaptor > { typedef segment_manager_iterator_value_adaptor result_type; - + result_type operator()(const typename Iterator::value_type &arg) const { return result_type(arg); } }; } //namespace ipcdetail { -//These pointers are the ones the user will use to +//These pointers are the ones the user will use to //indicate previous allocation types static const ipcdetail::anonymous_instance_t * anonymous_instance = 0; static const ipcdetail::unique_instance_t * unique_instance = 0; diff --git a/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp b/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp index 38aafb2be..e4e867e3f 100644 --- a/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-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) // @@ -18,80 +18,87 @@ #include #include -#if defined(BOOST_INTERPROCESS_WINDOWS) - //#define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME - //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - //#include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) - //#include - //#if defined(CTL_KERN) && defined (KERN_BOOTTIME) - //#define BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME - //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - //#endif +#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) && defined(BOOST_INTERPROCESS_WINDOWS) + #include #endif namespace boost { namespace interprocess { namespace ipcdetail { -#if defined (BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) -inline void get_bootstamp(std::string &s, bool add = false) -{ - std::string bootstamp; - winapi::get_last_bootup_time(bootstamp); - if(add){ - s += bootstamp; - } - else{ - s.swap(bootstamp); - } -} -#elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME) -inline void get_bootstamp(std::string &s, bool add = false) -{ - // FreeBSD specific: sysctl "kern.boottime" - int request[2] = { CTL_KERN, KERN_BOOTTIME }; - struct ::timeval result; - std::size_t result_len = sizeof result; +#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + #if defined(BOOST_INTERPROCESS_WINDOWS) + //This type will initialize the stamp + struct windows_bootstamp + { + windows_bootstamp() + { + winapi::get_last_bootup_time(stamp); + } + //Use std::string. Even if this will be constructed in shared memory, all + //modules/dlls are from this process so internal raw pointers to heap are always valid + std::string stamp; + }; - if (::sysctl (request, 2, &result, &result_len, NULL, 0) < 0) - return; - - char bootstamp_str[256]; - - const char Characters [] = - { '0', '1', '2', '3', '4', '5', '6', '7' - , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - std::size_t char_counter = 0; - //32 bit values to allow 32 and 64 bit process IPC - boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) }; - for(std::size_t field = 0; field != 2; ++field){ - for(std::size_t i = 0; i != sizeof(fields[0]); ++i){ - const char *ptr = (const char *)&fields[field]; - bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4]; - bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)]; + inline void get_bootstamp(std::string &s, bool add = false) + { + const windows_bootstamp &bootstamp = windows_intermodule_singleton::get(); + if(add){ + s += bootstamp.stamp; + } + else{ + s = bootstamp.stamp; + } } - } - bootstamp_str[char_counter] = 0; - if(add){ - s += bootstamp_str; - } - else{ - s = bootstamp_str; - } -} -#endif + #elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME) + inline void get_bootstamp(std::string &s, bool add = false) + { + // FreeBSD specific: sysctl "kern.boottime" + int request[2] = { CTL_KERN, KERN_BOOTTIME }; + struct ::timeval result; + std::size_t result_len = sizeof result; + + if (::sysctl (request, 2, &result, &result_len, NULL, 0) < 0) + return; + + char bootstamp_str[256]; + + const char Characters [] = + { '0', '1', '2', '3', '4', '5', '6', '7' + , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + + std::size_t char_counter = 0; + //32 bit values to allow 32 and 64 bit process IPC + boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) }; + for(std::size_t field = 0; field != 2; ++field){ + for(std::size_t i = 0; i != sizeof(fields[0]); ++i){ + const char *ptr = (const char *)&fields[field]; + bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4]; + bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)]; + } + } + bootstamp_str[char_counter] = 0; + if(add){ + s += bootstamp_str; + } + else{ + s = bootstamp_str; + } + } + #else + #error "BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME defined with no known implementation" + #endif +#endif //#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) inline void get_tmp_base_dir(std::string &tmp_name) { #if defined (BOOST_INTERPROCESS_WINDOWS) - winapi::get_shared_documents_folder(tmp_name); - if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){ - tmp_name = get_temporary_path(); - } + winapi::get_shared_documents_folder(tmp_name); + if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){ + tmp_name = get_temporary_path(); + } #else - tmp_name = get_temporary_path(); + tmp_name = get_temporary_path(); #endif if(tmp_name.empty()){ error_info err = system_error_code(); @@ -104,9 +111,9 @@ inline void get_tmp_base_dir(std::string &tmp_name) inline void tmp_folder(std::string &tmp_name) { get_tmp_base_dir(tmp_name); - #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - tmp_name += "/"; - get_bootstamp(tmp_name, true); + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + tmp_name += "/"; + get_bootstamp(tmp_name, true); #endif } @@ -131,22 +138,22 @@ inline void create_tmp_and_clean_old(std::string &tmp_name) } } - #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - tmp_folder(tmp_name); + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + tmp_folder(tmp_name); - //If fails, check that it's because already exists - if(!create_directory(tmp_name.c_str())){ - error_info info(system_error_code()); - if(info.get_error_code() != already_exists_error){ - throw interprocess_exception(info); + //If fails, check that it's because already exists + if(!create_directory(tmp_name.c_str())){ + error_info info(system_error_code()); + if(info.get_error_code() != already_exists_error){ + throw interprocess_exception(info); + } } - } - //Now erase all old directories created in the previous boot sessions - std::string subdir = tmp_name; - subdir.erase(0, root_tmp_name.size()+1); - delete_subdirectories(root_tmp_name, subdir.c_str()); + //Now erase all old directories created in the previous boot sessions + std::string subdir = tmp_name; + subdir.erase(0, root_tmp_name.size()+1); + delete_subdirectories(root_tmp_name, subdir.c_str()); #else - tmp_name = root_tmp_name; + tmp_name = root_tmp_name; #endif } diff --git a/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp b/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp index ef646fbef..56bd0e56c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -27,7 +27,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { template struct operator_arrow_proxy @@ -77,7 +77,7 @@ class transform_iterator {} //Constructors - transform_iterator& operator++() + transform_iterator& operator++() { increment(); return *this; } transform_iterator operator++(int) @@ -87,7 +87,7 @@ class transform_iterator return result; } - transform_iterator& operator--() + transform_iterator& operator--() { decrement(); return *this; } transform_iterator operator--(int) @@ -186,7 +186,7 @@ make_transform_iterator(Iterator it, UnaryFunc fun) return transform_iterator(it, fun); } -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp b/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp index 2cfa0be29..ade623f1e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // (C) Copyright John Maddock 2000. -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { struct nat{}; @@ -117,6 +117,12 @@ struct remove_volatile typedef T type; }; +template +struct remove_const_volatile +{ + typedef typename remove_const::type>::type type; +}; + template struct is_same { @@ -136,8 +142,15 @@ struct is_same static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); }; +template +struct is_cv_same +{ + static const bool value = is_same< typename remove_const_volatile::type + , typename remove_const_volatile::type >::value; +}; + } // namespace ipcdetail -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/utilities.hpp b/project/jni/boost/include/boost/interprocess/detail/utilities.hpp index 625a9159d..3b486ddcf 100644 --- a/project/jni/boost/include/boost/interprocess/detail/utilities.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/utilities.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -31,11 +31,13 @@ #include #include #include +#include #include #include +#include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -86,7 +88,10 @@ inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple) template struct ct_rounded_size { - static const std::size_t value = ((OrigSize-1)/RoundTo+1)*RoundTo; + BOOST_STATIC_ASSERT((RoundTo != 0)); + static const std::size_t intermediate_value = (OrigSize-1)/RoundTo+1; + BOOST_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo); + static const std::size_t value = intermediate_value*RoundTo; }; // Gennaro Prota wrote this. Thanks! @@ -133,14 +138,67 @@ addressof(T& v) &const_cast(reinterpret_cast(v))); } +template +struct sqrt_size_type_max +{ + static const SizeType value = (SizeType(1) << (sizeof(SizeType)*(CHAR_BIT/2)))-1; +}; + +template +inline bool multiplication_overflows(SizeType a, SizeType b) +{ + const SizeType sqrt_size_max = sqrt_size_type_max::value; + return //Fast runtime check + ( (a | b) > sqrt_size_max && + //Slow division check + b && a > SizeType(-1)/b + ); +} + +template +inline bool size_overflows(SizeType count) +{ + //Compile time-check + BOOST_STATIC_ASSERT(SztSizeOfType <= SizeType(-1)); + //Runtime check + return multiplication_overflows(SizeType(SztSizeOfType), count); +} + +template +class pointer_size_t_caster +{ + public: + explicit pointer_size_t_caster(std::size_t sz) + : m_ptr(reinterpret_cast(sz)) + {} + + explicit pointer_size_t_caster(RawPointer p) + : m_ptr(p) + {} + + std::size_t size() const + { return reinterpret_cast(m_ptr); } + + RawPointer pointer() const + { return m_ptr; } + + private: + RawPointer m_ptr; +}; + + +template +inline bool sum_overflows(SizeType a, SizeType b) +{ return SizeType(-1) - a < b; } + //Anti-exception node eraser template class value_eraser { public: - value_eraser(Cont & cont, typename Cont::iterator it) + value_eraser(Cont & cont, typename Cont::iterator it) : m_cont(cont), m_index_it(it), m_erase(true){} - ~value_eraser() + ~value_eraser() { if(m_erase) m_cont.erase(m_index_it); } void release() { m_erase = false; } @@ -151,7 +209,7 @@ class value_eraser bool m_erase; }; -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp b/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp index 1e6c4216e..5f2a94a31 100644 --- a/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // @@ -21,7 +21,7 @@ #include //std::size_t namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -136,7 +136,7 @@ struct index_tuple{}; template > struct build_number_seq; -template +template struct build_number_seq > : build_number_seq > {}; diff --git a/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp b/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp index b420c3d67..078eef10e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -21,7 +21,7 @@ #include #include -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined (_MSC_VER) && (_MSC_VER >= 1200) # pragma once # pragma comment( lib, "advapi32.lib" ) # pragma comment( lib, "oleaut32.lib" ) @@ -46,9 +46,11 @@ namespace winapi { //Some used constants static const unsigned long infinite_time = 0xFFFFFFFF; static const unsigned long error_already_exists = 183L; +static const unsigned long error_invalid_handle = 6L; static const unsigned long error_sharing_violation = 32L; static const unsigned long error_file_not_found = 2u; static const unsigned long error_no_more_files = 18u; +static const unsigned long error_not_locked = 158L; //Retries in CreateFile, see http://support.microsoft.com/kb/316609 static const unsigned int error_sharing_violation_tries = 3u; static const unsigned int error_sharing_violation_sleep_ms = 250u; @@ -60,6 +62,7 @@ static const unsigned long mutex_all_access = (0x000F0000L)|(0x00100000L)|0x static const unsigned long page_readonly = 0x02; static const unsigned long page_readwrite = 0x04; static const unsigned long page_writecopy = 0x08; +static const unsigned long page_noaccess = 0x01; static const unsigned long standard_rights_required = 0x000F0000L; static const unsigned long section_query = 0x0001; @@ -137,7 +140,14 @@ static const unsigned long lang_neutral = (unsigned long)0x00; static const unsigned long sublang_default = (unsigned long)0x01; static const unsigned long invalid_file_size = (unsigned long)0xFFFFFFFF; static const unsigned long invalid_file_attributes = ((unsigned long)-1); -static void * const invalid_handle_value = (void*)(long)(-1); +static void * const invalid_handle_value = ((void*)(long)(-1)); + +static const unsigned long file_type_char = 0x0002L; +static const unsigned long file_type_disk = 0x0001L; +static const unsigned long file_type_pipe = 0x0003L; +static const unsigned long file_type_remote = 0x8000L; +static const unsigned long file_type_unknown = 0x0000L; + static const unsigned long create_new = 1; static const unsigned long create_always = 2; static const unsigned long open_existing = 3; @@ -159,7 +169,6 @@ static const long BootAndSystemstampLength = 16; static const long BootstampLength = 8; static const unsigned long MaxPath = 260; - //Keys static void * const hkey_local_machine = (void*)(unsigned long*)(long)(0x80000002); static unsigned long key_query_value = 0x0001; @@ -179,6 +188,27 @@ const signed long WBEM_INFINITE_BIPC = 0xffffffffL; const signed long RPC_E_TOO_LATE_BIPC = 0x80010119L; const signed long S_OK_BIPC = 0L; const signed long S_FALSE_BIPC = 1; +const signed long RPC_E_CHANGED_MODE_BIPC = 0x80010106L; +const unsigned long COINIT_APARTMENTTHREADED_BIPC = 0x2; +const unsigned long COINIT_MULTITHREADED_BIPC = 0x0; +const unsigned long COINIT_DISABLE_OLE1DDE_BIPC = 0x4; +const unsigned long COINIT_SPEED_OVER_MEMORY_BIPC = 0x4; + +//If the user needs to change default COM initialization model, +//it can define BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL to one of these: +// +// COINIT_APARTMENTTHREADED_BIPC +// COINIT_MULTITHREADED_BIPC +// COINIT_DISABLE_OLE1DDE_BIPC +// COINIT_SPEED_OVER_MEMORY_BIPC +#if !defined(BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL) + #define BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL COINIT_APARTMENTTHREADED_BIPC +#elif (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_APARTMENTTHREADED_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_MULTITHREADED_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_DISABLE_OLE1DDE_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_SPEED_OVER_MEMORY_BIPC) + #error "Wrong value for BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL macro" +#endif } //namespace winapi { } //namespace interprocess { @@ -211,161 +241,159 @@ struct wchar_variant } value; }; - struct IUnknown_BIPC - { - public: - virtual long __stdcall QueryInterface( - /* [in] */ const GUID_BIPC &riid, - /* [iid_is][out] */ void **ppvObject) = 0; - - virtual unsigned long __stdcall AddRef( void) = 0; - - virtual unsigned long __stdcall Release( void) = 0; - }; +struct IUnknown_BIPC +{ + public: + virtual long __stdcall QueryInterface( + const GUID_BIPC &riid, // [in] + void **ppvObject) = 0; // [iid_is][out] + + virtual unsigned long __stdcall AddRef (void) = 0; + virtual unsigned long __stdcall Release(void) = 0; +}; struct IWbemClassObject_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall GetQualifierSet( + virtual long __stdcall GetQualifierSet( /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall Get( + + virtual long __stdcall Get( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [unique][in][out] */ wchar_variant *pVal, /* [unique][in][out] */ long *pType, /* [unique][in][out] */ long *plFlavor) = 0; - - virtual long __stdcall Put( + + virtual long __stdcall Put( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pVal, /* [in] */ long Type) = 0; - - virtual long __stdcall Delete( + + virtual long __stdcall Delete( /* [string][in] */ const wchar_t * wszName) = 0; - - virtual long __stdcall GetNames( + + virtual long __stdcall GetNames( /* [string][in] */ const wchar_t * wszQualifierName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pQualifierVal, /* [out] */ void * *pNames) = 0; - - virtual long __stdcall BeginEnumeration( + + virtual long __stdcall BeginEnumeration( /* [in] */ long lEnumFlags) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lFlags, /* [unique][in][out] */ wchar_t * *strName, /* [unique][in][out] */ wchar_variant *pVal, /* [unique][in][out] */ long *pType, /* [unique][in][out] */ long *plFlavor) = 0; - + virtual long __stdcall EndEnumeration( void) = 0; - - virtual long __stdcall GetPropertyQualifierSet( + + virtual long __stdcall GetPropertyQualifierSet( /* [string][in] */ const wchar_t * wszProperty, /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall Clone( + + virtual long __stdcall Clone( /* [out] */ IWbemClassObject_BIPC **ppCopy) = 0; - - virtual long __stdcall GetObjectText( + + virtual long __stdcall GetObjectText( /* [in] */ long lFlags, /* [out] */ wchar_t * *pstrObjectText) = 0; - - virtual long __stdcall SpawnDerivedClass( + + virtual long __stdcall SpawnDerivedClass( /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppNewClass) = 0; - - virtual long __stdcall SpawnInstance( + + virtual long __stdcall SpawnInstance( /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppNewInstance) = 0; - - virtual long __stdcall CompareTo( + + virtual long __stdcall CompareTo( /* [in] */ long lFlags, /* [in] */ IWbemClassObject_BIPC *pCompareTo) = 0; - - virtual long __stdcall GetPropertyOrigin( + + virtual long __stdcall GetPropertyOrigin( /* [string][in] */ const wchar_t * wszName, /* [out] */ wchar_t * *pstrClassName) = 0; - - virtual long __stdcall InheritsFrom( + + virtual long __stdcall InheritsFrom( /* [in] */ const wchar_t * strAncestor) = 0; - - virtual long __stdcall GetMethod( + + virtual long __stdcall GetMethod( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppInSignature, /* [out] */ IWbemClassObject_BIPC **ppOutSignature) = 0; - - virtual long __stdcall PutMethod( + + virtual long __stdcall PutMethod( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ IWbemClassObject_BIPC *pInSignature, /* [in] */ IWbemClassObject_BIPC *pOutSignature) = 0; - - virtual long __stdcall DeleteMethod( + + virtual long __stdcall DeleteMethod( /* [string][in] */ const wchar_t * wszName) = 0; - - virtual long __stdcall BeginMethodEnumeration( + + virtual long __stdcall BeginMethodEnumeration( /* [in] */ long lEnumFlags) = 0; - - virtual long __stdcall NextMethod( + + virtual long __stdcall NextMethod( /* [in] */ long lFlags, /* [unique][in][out] */ wchar_t * *pstrName, /* [unique][in][out] */ IWbemClassObject_BIPC **ppInSignature, /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutSignature) = 0; - + virtual long __stdcall EndMethodEnumeration( void) = 0; - - virtual long __stdcall GetMethodQualifierSet( + + virtual long __stdcall GetMethodQualifierSet( /* [string][in] */ const wchar_t * wszMethod, /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall GetMethodOrigin( + + virtual long __stdcall GetMethodOrigin( /* [string][in] */ const wchar_t * wszMethodName, /* [out] */ wchar_t * *pstrClassName) = 0; - -}; +}; struct IWbemContext_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall Clone( + virtual long __stdcall Clone( /* [out] */ IWbemContext_BIPC **ppNewCopy) = 0; - - virtual long __stdcall GetNames( + + virtual long __stdcall GetNames( /* [in] */ long lFlags, /* [out] */ void * *pNames) = 0; - - virtual long __stdcall BeginEnumeration( + + virtual long __stdcall BeginEnumeration( /* [in] */ long lFlags) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lFlags, /* [out] */ wchar_t * *pstrName, /* [out] */ wchar_variant *pValue) = 0; - + virtual long __stdcall EndEnumeration( void) = 0; - - virtual long __stdcall SetValue( + + virtual long __stdcall SetValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pValue) = 0; - - virtual long __stdcall GetValue( + + virtual long __stdcall GetValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [out] */ wchar_variant *pValue) = 0; - - virtual long __stdcall DeleteValue( + + virtual long __stdcall DeleteValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags) = 0; - + virtual long __stdcall DeleteAll( void) = 0; - + }; @@ -373,157 +401,157 @@ struct IEnumWbemClassObject_BIPC : public IUnknown_BIPC { public: virtual long __stdcall Reset( void) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lTimeout, /* [in] */ unsigned long uCount, /* [length_is][size_is][out] */ IWbemClassObject_BIPC **apObjects, /* [out] */ unsigned long *puReturned) = 0; - - virtual long __stdcall NextAsync( + + virtual long __stdcall NextAsync( /* [in] */ unsigned long uCount, /* [in] */ void *pSink) = 0; - - virtual long __stdcall Clone( + + virtual long __stdcall Clone( /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall Skip( + + virtual long __stdcall Skip( /* [in] */ long lTimeout, /* [in] */ unsigned long nCount) = 0; - + }; struct IWbemServices_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall OpenNamespace( + virtual long __stdcall OpenNamespace( /* [in] */ const wchar_t * strNamespace, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppWorkingNamespace, /* [unique][in][out] */ void **ppResult) = 0; - - virtual long __stdcall CancelAsyncCall( + + virtual long __stdcall CancelAsyncCall( /* [in] */ void *pSink) = 0; - - virtual long __stdcall QueryObjectSink( + + virtual long __stdcall QueryObjectSink( /* [in] */ long lFlags, /* [out] */ void **ppResponseHandler) = 0; - - virtual long __stdcall GetObject( + + virtual long __stdcall GetObject( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppObject, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall GetObjectAsync( + + virtual long __stdcall GetObjectAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall PutClass( + + virtual long __stdcall PutClass( /* [in] */ IWbemClassObject_BIPC *pObject, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall PutClassAsync( + + virtual long __stdcall PutClassAsync( /* [in] */ IWbemClassObject_BIPC *pObject, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall DeleteClass( + + virtual long __stdcall DeleteClass( /* [in] */ const wchar_t * strClass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall DeleteClassAsync( + + virtual long __stdcall DeleteClassAsync( /* [in] */ const wchar_t * strClass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall CreateClassEnum( + + virtual long __stdcall CreateClassEnum( /* [in] */ const wchar_t * strSuperclass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall CreateClassEnumAsync( + + virtual long __stdcall CreateClassEnumAsync( /* [in] */ const wchar_t * strSuperclass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall PutInstance( + + virtual long __stdcall PutInstance( /* [in] */ void *pInst, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall PutInstanceAsync( + + virtual long __stdcall PutInstanceAsync( /* [in] */ void *pInst, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall DeleteInstance( + + virtual long __stdcall DeleteInstance( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall DeleteInstanceAsync( + + virtual long __stdcall DeleteInstanceAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall CreateInstanceEnum( + + virtual long __stdcall CreateInstanceEnum( /* [in] */ const wchar_t * strFilter, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall CreateInstanceEnumAsync( + + virtual long __stdcall CreateInstanceEnumAsync( /* [in] */ const wchar_t * strFilter, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecQuery( + + virtual long __stdcall ExecQuery( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [out] */ IEnumWbemClassObject_BIPC **ppEnum) = 0; - virtual long __stdcall ExecQueryAsync( + virtual long __stdcall ExecQueryAsync( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecNotificationQuery( + + virtual long __stdcall ExecNotificationQuery( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall ExecNotificationQueryAsync( + + virtual long __stdcall ExecNotificationQueryAsync( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecMethod( + + virtual long __stdcall ExecMethod( /* [in] */ const wchar_t * strObjectPath, /* [in] */ const wchar_t * strMethodName, /* [in] */ long lFlags, @@ -531,21 +559,21 @@ public: /* [in] */ IWbemClassObject_BIPC *pInParams, /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutParams, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall ExecMethodAsync( + + virtual long __stdcall ExecMethodAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ const wchar_t * strMethodName, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ IWbemClassObject_BIPC *pInParams, /* [in] */ void *pResponseHandler) = 0; - + }; struct IWbemLocator_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall ConnectServer( + virtual long __stdcall ConnectServer( /* [in] */ const wchar_t * strNetworkResource, /* [in] */ const wchar_t * strUser, /* [in] */ const wchar_t * strPassword, @@ -554,12 +582,10 @@ public: /* [in] */ const wchar_t * strAuthority, /* [in] */ void *pCtx, /* [out] */ IWbemServices_BIPC **ppNamespace) = 0; - + }; - - -struct interprocess_overlapped +struct interprocess_overlapped { unsigned long *internal; unsigned long *internal_high; @@ -574,9 +600,22 @@ struct interprocess_overlapped void *h_event; }; +struct interprocess_semaphore_basic_information +{ + unsigned int count; // current semaphore count + unsigned int limit; // max semaphore count +}; + +struct interprocess_section_basic_information +{ + void * base_address; + unsigned long section_attributes; + __int64 section_size; +}; + struct interprocess_filetime -{ - unsigned long dwLowDateTime; +{ + unsigned long dwLowDateTime; unsigned long dwHighDateTime; }; @@ -622,7 +661,7 @@ struct system_info { struct interprocess_memory_basic_information { - void * BaseAddress; + void * BaseAddress; void * AllocationBase; unsigned long AllocationProtect; unsigned long RegionSize; @@ -631,14 +670,14 @@ struct interprocess_memory_basic_information unsigned long Type; }; -typedef struct _interprocess_acl +struct interprocess_acl { unsigned char AclRevision; unsigned char Sbz1; unsigned short AclSize; unsigned short AceCount; unsigned short Sbz2; -} interprocess_acl; +}; typedef struct _interprocess_security_descriptor { @@ -695,6 +734,10 @@ enum file_information_class_t { file_maximum_information }; +enum semaphore_information_class { + semaphore_basic_information = 0 +}; + struct file_name_information_t { unsigned long FileNameLength; wchar_t FileName[1]; @@ -779,6 +822,12 @@ enum object_information_class object_data_information }; +enum section_information_class +{ + section_basic_information, + section_image_information +}; + struct object_name_information_t { unicode_string_t Name; @@ -803,6 +852,7 @@ extern "C" __declspec(dllimport) int __stdcall DuplicateHandle , void *hTargetProcessHandle, void **lpTargetHandle , unsigned long dwDesiredAccess, int bInheritHandle , unsigned long dwOptions); +extern "C" __declspec(dllimport) long __stdcall GetFileType(void *hFile); extern "C" __declspec(dllimport) void *__stdcall FindFirstFileA(const char *lpFileName, win32_find_data_t *lpFindFileData); extern "C" __declspec(dllimport) int __stdcall FindNextFileA(void *hFindFile, win32_find_data_t *lpFindFileData); extern "C" __declspec(dllimport) int __stdcall FindClose(void *hFindFile); @@ -824,11 +874,13 @@ extern "C" __declspec(dllimport) int __stdcall DeleteFileA (const char *); extern "C" __declspec(dllimport) int __stdcall MoveFileExA (const char *, const char *, unsigned long); extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::size_t); +extern "C" __declspec(dllimport) int __stdcall VirtualUnlock (void *, std::size_t); +extern "C" __declspec(dllimport) int __stdcall VirtualProtect (void *, std::size_t, unsigned long, unsigned long *); extern "C" __declspec(dllimport) int __stdcall FlushFileBuffers (void *); extern "C" __declspec(dllimport) int __stdcall GetFileSizeEx (void *, __int64 *size); extern "C" __declspec(dllimport) unsigned long __stdcall FormatMessageA - (unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId, - unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize, + (unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId, + unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize, std::va_list *Arguments); extern "C" __declspec(dllimport) void *__stdcall LocalFree (void *); extern "C" __declspec(dllimport) unsigned long __stdcall GetFileAttributesA(const char *); @@ -844,6 +896,7 @@ extern "C" __declspec(dllimport) int __stdcall UnlockFile(void *hnd, unsigned lo extern "C" __declspec(dllimport) int __stdcall LockFileEx(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall UnlockFileEx(void *hnd, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall WriteFile(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped); +extern "C" __declspec(dllimport) int __stdcall ReadFile(void *hnd, void *buffer, unsigned long bytes_to_read, unsigned long *bytes_read, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall InitializeSecurityDescriptor(interprocess_security_descriptor *pSecurityDescriptor, unsigned long dwRevision); extern "C" __declspec(dllimport) int __stdcall SetSecurityDescriptorDacl(interprocess_security_descriptor *pSecurityDescriptor, int bDaclPresent, interprocess_acl *pDacl, int bDaclDefaulted); extern "C" __declspec(dllimport) void *__stdcall LoadLibraryA(const char *); @@ -858,17 +911,17 @@ extern "C" __declspec(dllimport) long __stdcall RegCloseKey(void *); extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(__int64 *lpPerformanceCount); //COM API -extern "C" __declspec(dllimport) long __stdcall CoInitialize(void *pvReserved); +extern "C" __declspec(dllimport) long __stdcall CoInitializeEx(void *pvReserved, unsigned long dwCoInit); extern "C" __declspec(dllimport) long __stdcall CoInitializeSecurity( - void* pSecDesc, - long cAuthSvc, - void *asAuthSvc, - void *pReserved1, - unsigned long dwAuthnLevel, - unsigned long dwImpLevel, - void *pAuthList, - unsigned long dwCapabilities, - void *pReserved3 ); + void* pSecDesc, + long cAuthSvc, + void * asAuthSvc, + void *pReserved1, + unsigned long dwAuthnLevel, + unsigned long dwImpLevel, + void *pAuthList, + unsigned long dwCapabilities, + void *pReserved3 ); extern "C" __declspec(dllimport) long __stdcall CoSetProxyBlanket( IUnknown_BIPC *pProxy, @@ -889,10 +942,12 @@ extern "C" __declspec(dllimport) void __stdcall CoUninitialize(void); //API function typedefs //Pointer to functions -typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); -typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass ); -typedef long (__stdcall * NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *); -typedef long (__stdcall * NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *); +typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); +typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass ); +typedef long (__stdcall *NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *); +typedef long (__stdcall *NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *); +typedef long (__stdcall *NtQuerySemaphore_t)(void*, unsigned int info_class, interprocess_semaphore_basic_information *pinfo, unsigned int info_size, unsigned int *ret_len); +typedef long (__stdcall *NtQuerySection_t)(void*, section_information_class, interprocess_section_basic_information *pinfo, unsigned long info_size, unsigned long *ret_len); typedef long (__stdcall *NtQueryInformationFile_t)(void *,io_status_block_t *,void *, long, int); typedef long (__stdcall *NtOpenFile_t)(void*,unsigned long ,object_attributes_t*,io_status_block_t*,unsigned long,unsigned long); typedef long (__stdcall *NtClose_t) (void*); @@ -977,6 +1032,12 @@ inline bool duplicate_current_process_handle , lpTargetHandle, 0, 0 , duplicate_same_access); } + +inline unsigned long get_file_type(void *hFile) +{ + return GetFileType(hFile); +} + /* inline void get_system_time_as_file_time(interprocess_filetime *filetime) { GetSystemTimeAsFileTime(filetime); } @@ -1000,13 +1061,16 @@ inline int unmap_view_of_file(void *address) inline void *open_or_create_semaphore(const char *name, long initial_count, long maximum_count, interprocess_security_attributes *attr) { return CreateSemaphoreA(attr, initial_count, maximum_count, name); } +inline void *open_semaphore(const char *name) +{ return OpenSemaphoreA(semaphore_all_access, 0, name); } + inline int release_semaphore(void *handle, long release_count, long *prev_count) { return ReleaseSemaphore(handle, release_count, prev_count); } class interprocess_all_access_security { interprocess_security_attributes sa; - interprocess_security_descriptor sd; + interprocess_security_descriptor sd; bool initialized; public: @@ -1027,16 +1091,21 @@ class interprocess_all_access_security { return &sa; } }; -inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name, interprocess_security_attributes *psec) +inline void * create_file_mapping (void * handle, unsigned long access, unsigned __int64 file_offset, const char * name, interprocess_security_attributes *psec) { - return CreateFileMappingA (handle, psec, access, high_size, low_size, name); + const unsigned long high_size(file_offset >> 32), low_size((boost::uint32_t)file_offset); + return CreateFileMappingA (handle, psec, access, high_size, low_size, name); } inline void * open_file_mapping (unsigned long access, const char *name) { return OpenFileMappingA (access, 0, name); } -inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned long highoffset, unsigned long lowoffset, std::size_t numbytes, void *base_addr) -{ return MapViewOfFileEx(handle, file_access, highoffset, lowoffset, numbytes, base_addr); } +inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned __int64 offset, std::size_t numbytes, void *base_addr) +{ + const unsigned long offset_low = (unsigned long)(offset & ((unsigned __int64)0xFFFFFFFF)); + const unsigned long offset_high = offset >> 32; + return MapViewOfFileEx(handle, file_access, offset_high, offset_low, numbytes, base_addr); +} inline void *create_file(const char *name, unsigned long access, unsigned long creation_flags, unsigned long attributes, interprocess_security_attributes *psec) { @@ -1051,7 +1120,7 @@ inline void *create_file(const char *name, unsigned long access, unsigned long c if (error_sharing_violation != get_last_error()){ return handle; } - Sleep(error_sharing_violation_sleep_ms); + sleep(error_sharing_violation_sleep_ms); } return invalid_handle_value; } @@ -1068,6 +1137,12 @@ inline void get_system_info(system_info *info) inline bool flush_view_of_file(void *base_addr, std::size_t numbytes) { return 0 != FlushViewOfFile(base_addr, numbytes); } +inline bool virtual_unlock(void *base_addr, std::size_t numbytes) +{ return 0 != VirtualUnlock(base_addr, numbytes); } + +inline bool virtual_protect(void *base_addr, std::size_t numbytes, unsigned long flNewProtect, unsigned long &lpflOldProtect) +{ return 0 != VirtualProtect(base_addr, numbytes, flNewProtect, &lpflOldProtect); } + inline bool flush_file_buffers(void *handle) { return 0 != FlushFileBuffers(handle); } @@ -1075,9 +1150,9 @@ inline bool get_file_size(void *handle, __int64 &size) { return 0 != GetFileSizeEx(handle, &size); } inline bool create_directory(const char *name) -{ +{ interprocess_all_access_security sec; - return 0 != CreateDirectoryA(name, sec.get_attributes()); + return 0 != CreateDirectoryA(name, sec.get_attributes()); } inline bool remove_directory(const char *lpPathName) @@ -1101,6 +1176,9 @@ inline bool unlock_file_ex(void *hnd, unsigned long reserved, unsigned long size inline bool write_file(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped) { return 0 != WriteFile(hnd, buffer, bytes_to_write, bytes_written, overlapped); } +inline bool read_file(void *hnd, void *buffer, unsigned long bytes_to_read, unsigned long *bytes_read, interprocess_overlapped* overlapped) +{ return 0 != ReadFile(hnd, buffer, bytes_to_read, bytes_read, overlapped); } + inline bool get_file_information_by_handle(void *hnd, interprocess_by_handle_file_information *info) { return 0 != GetFileInformationByHandle(hnd, info); } @@ -1176,7 +1254,7 @@ inline void rtl_init_empty_unicode_string(unicode_string_t *ucStr, wchar_t *buf, template struct function_address_holder { - enum { NtSetInformationFile, NtQuerySystemInformation, NtQueryObject, NumFunction }; + enum { NtSetInformationFile, NtQuerySystemInformation, NtQueryObject, NtQuerySemaphore, NtQuerySection, NumFunction }; enum { NtDll_dll, NumModule }; private: @@ -1213,7 +1291,7 @@ struct function_address_holder static void *get_address_from_dll(const unsigned int id) { assert(id < (unsigned int)NumFunction); - const char *function[] = { "NtSetInformationFile", "NtQuerySystemInformation", "NtQueryObject" }; + const char *function[] = { "NtSetInformationFile", "NtQuerySystemInformation", "NtQueryObject", "NtQuerySemaphore", "NtQuerySection" }; bool compile_check[sizeof(function)/sizeof(function[0]) == NumFunction]; (void)compile_check; return get_proc_address(get_module(NtDll_dll), function[id]); @@ -1264,7 +1342,7 @@ struct library_unloader //pszFilename must have room for at least MaxPath+1 characters inline bool get_file_name_from_handle_function - (void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &out_length) + (void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &out_length) { if(length <= MaxPath){ return false; @@ -1285,17 +1363,17 @@ inline bool get_file_name_from_handle_function bool bSuccess = false; // Create a file mapping object. - void * hFileMap = create_file_mapping(hFile, page_readonly, 0, 1, 0, 0); + void * hFileMap = create_file_mapping(hFile, page_readonly, 1, 0, 0); if(hFileMap){ // Create a file mapping to get the file name. - void* pMem = map_view_of_file_ex(hFileMap, file_map_read, 0, 0, 1, 0); + void* pMem = map_view_of_file_ex(hFileMap, file_map_read, 0, 1, 0); if (pMem){ //out_length = pfGMFN(get_current_process(), pMem, pszFilename, MaxPath); out_length = get_mapped_file_name(get_current_process(), pMem, pszFilename, MaxPath); if(out_length){ bSuccess = true; - } + } unmap_view_of_file(pMem); } close_handle(hFileMap); @@ -1307,7 +1385,6 @@ inline bool get_file_name_from_handle_function inline bool get_system_time_of_day_information(system_timeofday_information &info) { NtQuerySystemInformation_t pNtQuerySystemInformation = (NtQuerySystemInformation_t) - //get_proc_address(get_module_handle("ntdll.dll"), "NtQuerySystemInformation"); dll_func::get(dll_func::NtQuerySystemInformation); unsigned long res; long status = pNtQuerySystemInformation(system_time_of_day_information, &info, sizeof(info), &res); @@ -1384,9 +1461,12 @@ inline bool get_boot_and_system_time_wstr(wchar_t *bootsystemstamp, std::size_t class handle_closer { void *handle_; + handle_closer(const handle_closer &); + handle_closer& operator=(const handle_closer &); public: - handle_closer(void *handle) : handle_(handle){} - ~handle_closer(){ close_handle(handle_); } + explicit handle_closer(void *handle) : handle_(handle){} + ~handle_closer() + { close_handle(handle_); } }; union ntquery_mem_t @@ -1401,81 +1481,92 @@ union ntquery_mem_t inline bool unlink_file(const char *filename) { - if(!delete_file(filename)){ - try{ - NtSetInformationFile_t pNtSetInformationFile = - //(NtSetInformationFile_t)get_proc_address(get_module_handle("ntdll.dll"), "NtSetInformationFile"); - (NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile); - if(!pNtSetInformationFile){ - return false; - } + //Don't try to optimize doing a DeleteFile first + //as there are interactions with permissions and + //in-use files. + // + //if(!delete_file(filename)){ + // (...) + // - NtQueryObject_t pNtQueryObject = - //(NtQueryObject_t)get_proc_address(get_module_handle("ntdll.dll"), "NtQueryObject"); - (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject); - - //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths - void *fh = create_file(filename, generic_read | delete_access, open_existing, - file_flag_backup_semantics | file_flag_delete_on_close, 0); - if(fh == invalid_handle_value){ - return false; - } - - handle_closer h_closer(fh); - - std::auto_ptr pmem(new ntquery_mem_t); - file_rename_information_t *pfri = &pmem->ren.info; - const std::size_t RenMaxNumChars = - ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t); - - //Obtain file name - unsigned long size; - if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){ - return false; - } - - //Copy filename to the rename member - std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length); - std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t); - - //Second step: obtain the complete native-nt filename - //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){ - //return 0; - //} - - //Add trailing mark - if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){ - return false; - } - - //Search '\\' character to replace it - for(std::size_t i = filename_string_length; i != 0; --filename_string_length){ - if(pmem->ren.info.FileName[--i] == L'\\') - break; - } - - //Add random number - std::size_t s = RenMaxNumChars - filename_string_length; - if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){ - return false; - } - filename_string_length += s; - - //Fill rename information (FileNameLength is in bytes) - pfri->FileNameLength = static_cast(sizeof(wchar_t)*(filename_string_length)); - pfri->Replace = 1; - pfri->RootDir = 0; - - //Final step: change the name of the in-use file: - io_status_block_t io; - if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){ - return false; - } - return true; - } - catch(...){ + //This functions tries to emulate UNIX unlink semantics in windows. + // + //- Open the file and mark the handle as delete-on-close + //- Rename the file to an arbitrary name based on a random number + //- Close the handle. If there are no file users, it will be deleted. + // Otherwise it will be used by already connected handles but the + // file name can't be used to open this file again + try{ + NtSetInformationFile_t pNtSetInformationFile = + (NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile); + if(!pNtSetInformationFile){ return false; } + + NtQueryObject_t pNtQueryObject = + (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject); + + //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths + void *fh = create_file(filename, generic_read | delete_access, open_existing, + file_flag_backup_semantics | file_flag_delete_on_close, 0); + if(fh == invalid_handle_value){ + return false; + } + + handle_closer h_closer(fh); + + std::auto_ptr pmem(new ntquery_mem_t); + file_rename_information_t *pfri = &pmem->ren.info; + const std::size_t RenMaxNumChars = + ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t); + + //Obtain file name + unsigned long size; + if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){ + return false; + } + + //Copy filename to the rename member + std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length); + std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t); + + //Second step: obtain the complete native-nt filename + //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){ + //return 0; + //} + + //Add trailing mark + if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){ + return false; + } + + //Search '\\' character to replace it + for(std::size_t i = filename_string_length; i != 0; --filename_string_length){ + if(pmem->ren.info.FileName[--i] == L'\\') + break; + } + + //Add random number + std::size_t s = RenMaxNumChars - filename_string_length; + if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){ + return false; + } + filename_string_length += s; + + //Fill rename information (FileNameLength is in bytes) + pfri->FileNameLength = static_cast(sizeof(wchar_t)*(filename_string_length)); + pfri->Replace = 1; + pfri->RootDir = 0; + + //Final step: change the name of the in-use file: + io_status_block_t io; + if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){ + return false; + } + return true; + } + catch(...){ + return false; } return true; } @@ -1493,116 +1584,77 @@ struct reg_closer inline void get_shared_documents_folder(std::string &s) { s.clear(); - //void *hAdvapi = load_library("Advapi32.dll"); - //if (hAdvapi){ - //library_unloader unloader(hAdvapi); - // Pointer to function RegOpenKeyA - //RegOpenKeyEx_t pRegOpenKey = - //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA"); - //if (pRegOpenKey){ - // Pointer to function RegCloseKey - //RegCloseKey_t pRegCloseKey = - //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey"); - //if (pRegCloseKey){ - // Pointer to function RegQueryValueA - //RegQueryValueEx_t pRegQueryValue = - //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA"); - //if (pRegQueryValue){ - //Open the key - void *key; - //if ((*pRegOpenKey)( hkey_local_machine - //, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - //, 0 - //, key_query_value - //, &key) == 0){ - //reg_closer key_closer(pRegCloseKey, key); - if (reg_open_key_ex( hkey_local_machine - , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); + void *key; + if (reg_open_key_ex( hkey_local_machine + , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" + , 0 + , key_query_value + , &key) == 0){ + reg_closer key_closer(key); - //Obtain the value - unsigned long size; - unsigned long type; - const char *const reg_value = "Common AppData"; - //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); - long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); - if(!err){ - //Size includes terminating NULL - s.resize(size); - //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err) - s.erase(s.end()-1); - (void)err; - } - } - //} - //} - //} - //} + //Obtain the value + unsigned long size; + unsigned long type; + const char *const reg_value = "Common AppData"; + //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); + long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); + if(!err){ + //Size includes terminating NULL + s.resize(size); + //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + if(!err) + s.erase(s.end()-1); + (void)err; + } + } } - inline void get_registry_value(const char *folder, const char *value_key, std::vector &s) { s.clear(); - //void *hAdvapi = load_library("Advapi32.dll"); - //if (hAdvapi){ - //library_unloader unloader(hAdvapi); - // Pointer to function RegOpenKeyA - //RegOpenKeyEx_t pRegOpenKey = - //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA"); - //if (pRegOpenKey){ - // Pointer to function RegCloseKey - //RegCloseKey_t pRegCloseKey = - //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey"); - //if (pRegCloseKey){ - // Pointer to function RegQueryValueA - //RegQueryValueEx_t pRegQueryValue = - //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA"); - //if (pRegQueryValue){ - //Open the key - void *key; - //if ((*pRegOpenKey)( hkey_local_machine - //, folder - //, 0 - //, key_query_value - //, &key) == 0){ - //reg_closer key_closer(pRegCloseKey, key); - if (reg_open_key_ex( hkey_local_machine - , folder - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); + void *key; + if (reg_open_key_ex( hkey_local_machine + , folder + , 0 + , key_query_value + , &key) == 0){ + reg_closer key_closer(key); - //Obtain the value - unsigned long size; - unsigned long type; - const char *const reg_value = value_key; - //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); - long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); - if(!err){ - //Size includes terminating NULL - s.resize(size); - //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err) - s.erase(s.end()-1); - (void)err; - } - } - //} - //} - //} - //} + //Obtain the value + unsigned long size; + unsigned long type; + const char *const reg_value = value_key; + //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); + long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); + if(!err){ + //Size includes terminating NULL + s.resize(size); + //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + if(!err) + s.erase(s.end()-1); + (void)err; + } + } } struct co_uninitializer -{ ~co_uninitializer() { CoUninitialize(); } }; +{ + co_uninitializer(bool b_uninitialize) + : m_b_uninitialize(b_uninitialize) + {} + + ~co_uninitializer() + { + if(m_b_uninitialize){ + CoUninitialize(); + } + } + + private: + const bool m_b_uninitialize; +}; template struct com_releaser @@ -1615,29 +1667,32 @@ struct com_releaser inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_class, const wchar_t *wmi_class_var) { //See example http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx - long co_init_ret = CoInitialize(0); - if(co_init_ret != S_OK_BIPC && co_init_ret != S_FALSE_BIPC) + // + //See BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL definition if you need to change the + //default value of this macro in your application + long co_init_ret = CoInitializeEx(0, BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL); + if(co_init_ret != S_OK_BIPC && co_init_ret != S_FALSE_BIPC && co_init_ret != RPC_E_CHANGED_MODE_BIPC) return false; - co_uninitializer co_initialize_end; + co_uninitializer co_initialize_end(co_init_ret != RPC_E_CHANGED_MODE_BIPC); (void)co_initialize_end; bool bRet = false; long sec_init_ret = CoInitializeSecurity - ( 0 //pVoid - ,-1 //cAuthSvc - , 0 //asAuthSvc - , 0 //pReserved1 - , RPC_C_AUTHN_LEVEL_PKT_BIPC //dwAuthnLevel - , RPC_C_IMP_LEVEL_IMPERSONATE_BIPC //dwImpLevel - , 0 //pAuthList - , EOAC_NONE_BIPC //dwCapabilities - , 0 //pReserved3 + ( 0 //pVoid + ,-1 //cAuthSvc + , 0 //asAuthSvc + , 0 //pReserved1 + , RPC_C_AUTHN_LEVEL_PKT_BIPC //dwAuthnLevel + , RPC_C_IMP_LEVEL_IMPERSONATE_BIPC //dwImpLevel + , 0 //pAuthList + , EOAC_NONE_BIPC //dwCapabilities + , 0 //pReserved3 ); if( 0 == sec_init_ret || RPC_E_TOO_LATE_BIPC == sec_init_ret) { IWbemLocator_BIPC * pIWbemLocator = 0; const wchar_t * bstrNamespace = L"root\\cimv2"; - + if( 0 != CoCreateInstance( CLSID_WbemAdministrativeLocator, 0, @@ -1645,7 +1700,7 @@ inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_ IID_IUnknown, (void **)&pIWbemLocator)){ return false; } - + com_releaser IWbemLocator_releaser(pIWbemLocator); IWbemServices_BIPC *pWbemServices = 0; @@ -1677,7 +1732,7 @@ inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_ ){ return false; } - + com_releaser IWbemServices_releaser(pWbemServices); strValue.clear(); @@ -1757,9 +1812,40 @@ inline bool is_directory(const char *path) (attrib & file_attribute_directory)); } -} //namespace winapi +inline bool get_file_mapping_size(void *file_mapping_hnd, __int64 &size) +{ + NtQuerySection_t pNtQuerySection = + (NtQuerySection_t)dll_func::get(dll_func::NtQuerySection); + //Obtain file name + interprocess_section_basic_information info; + unsigned long ntstatus = + pNtQuerySection(file_mapping_hnd, section_basic_information, &info, sizeof(info), 0); + if(ntstatus){ + return false; + } + size = info.section_size; + return true; +} + +inline bool get_semaphore_info(void *handle, long &count, long &limit) +{ + winapi::interprocess_semaphore_basic_information info; + winapi::NtQuerySemaphore_t pNtQuerySemaphore = + (winapi::NtQuerySemaphore_t)dll_func::get(winapi::dll_func::NtQuerySemaphore); + unsigned int ret_len; + long status = pNtQuerySemaphore(handle, winapi::semaphore_basic_information, &info, sizeof(info), &ret_len); + if(status){ + return false; + } + count = info.count; + limit = info.limit; + return true; +} + + +} //namespace winapi } //namespace interprocess -} //namespace boost +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp new file mode 100644 index 000000000..194e566aa --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp @@ -0,0 +1,306 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP +#define BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#if !defined(BOOST_INTERPROCESS_WINDOWS) + #error "This header can't be included from non-windows operating systems" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +namespace intermodule_singleton_helpers { + +//This global map will be implemented using 3 sync primitives: +// +//1) A named mutex that will implement global mutual exclusion between +// threads from different modules/dlls +// +//2) A semaphore that will act as a global counter for modules attached to the global map +// so that the global map can be destroyed when the last module is detached. +// +//3) A semaphore that will be hacked to hold the address of a heap-allocated map in the +// max and current semaphore count. +class windows_semaphore_based_map +{ + typedef std::map map_type; + + public: + windows_semaphore_based_map() + { + map_type *m = new map_type; + boost::uint32_t initial_count = 0; + boost::uint32_t max_count = 0; + + //Windows user address space sizes: + //32 bit windows: [32 bit processes] 2GB or 3GB (31/32 bits) + //64 bit windows: [32 bit processes] 2GB or 4GB (31/32 bits) + // [64 bit processes] 2GB or 8TB (31/43 bits) + // + //Windows semaphores use 'long' parameters (32 bits in LLP64 data model) and + //those values can't be negative, so we have 31 bits to store something + //in max_count and initial count parameters. + //Also, max count must be bigger than 0 and bigger or equal than initial count. + if(sizeof(void*) == sizeof(boost::uint32_t)){ + //This means that for 32 bit processes, a semaphore count (31 usable bits) is + //enough to store 4 byte aligned memory (4GB -> 32 bits - 2 bits = 30 bits). + //The max count will hold the pointer value and current semaphore count + //will be zero. + // + //Relying in UB with a cast through union, but all known windows compilers + //accept this (C11 also accepts this). + union caster_union + { + void *addr; + boost::uint32_t addr_uint32; + } caster; + caster.addr = m; + //memory is at least 4 byte aligned in windows + BOOST_ASSERT((caster.addr_uint32 & boost::uint32_t(3)) == 0); + max_count = caster.addr_uint32 >> 2; + } + else if(sizeof(void*) == sizeof(boost::uint64_t)){ + //Relying in UB with a cast through union, but all known windows compilers + //accept this (C11 accepts this). + union caster_union + { + void *addr; + boost::uint64_t addr_uint64; + } caster; + caster.addr = m; + //We'll encode the address using 30 bits in each 32 bit high and low parts. + //High part will be the sem max count, low part will be the sem initial count. + //(restrictions: max count > 0, initial count >= 0 and max count >= initial count): + // + // - Low part will be shifted two times (4 byte alignment) so that top + // two bits are cleared (the top one for sign, the next one to + // assure low part value is always less than the high part value. + // - The top bit of the high part will be cleared and the next bit will be 1 + // (so high part is always bigger than low part due to the quasi-top bit). + // + // This means that the addresses we can store must be 4 byte aligned + // and less than 1 ExbiBytes ( 2^60 bytes, ~1 ExaByte). User-level address space in Windows 64 + // is much less than this (8TB, 2^43 bytes): "1 EByte (or it was 640K?) ought to be enough for anybody" ;-). + caster.addr = m; + BOOST_ASSERT((caster.addr_uint64 & boost::uint64_t(3)) == 0); + max_count = boost::uint32_t(caster.addr_uint64 >> 32); + initial_count = boost::uint32_t(caster.addr_uint64); + initial_count = initial_count/4; + //Make sure top two bits are zero + BOOST_ASSERT((max_count & boost::uint32_t(0xC0000000)) == 0); + //Set quasi-top bit + max_count |= boost::uint32_t(0x40000000); + } + bool created = false; + const permissions & perm = permissions(); + std::string pid_creation_time, name; + get_pid_creation_time_str(pid_creation_time); + name = "bipc_gmap_sem_lock_"; + name += pid_creation_time; + bool success = m_mtx_lock.open_or_create(name.c_str(), perm); + name = "bipc_gmap_sem_count_"; + name += pid_creation_time; + scoped_lock lck(m_mtx_lock); + { + success = success && m_sem_count.open_or_create + ( name.c_str(), static_cast(0), winapi_semaphore_wrapper::MaxCount, perm, created); + name = "bipc_gmap_sem_map_"; + name += pid_creation_time; + success = success && m_sem_map.open_or_create + (name.c_str(), initial_count, max_count, perm, created); + if(!success){ + //winapi_xxx wrappers do the cleanup... + throw int(0); + } + if(!created){ + delete m; + } + else{ + BOOST_ASSERT(&get_map_unlocked() == m); + } + m_sem_count.post(); + } + } + + map_type &get_map_unlocked() + { + if(sizeof(void*) == sizeof(boost::uint32_t)){ + union caster_union + { + void *addr; + boost::uint32_t addr_uint32; + } caster; + caster.addr = 0; + caster.addr_uint32 = m_sem_map.limit(); + caster.addr_uint32 = caster.addr_uint32 << 2; + return *static_cast(caster.addr); + } + else{ + union caster_union + { + void *addr; + boost::uint64_t addr_uint64; + } caster; + boost::uint32_t max_count(m_sem_map.limit()), initial_count(m_sem_map.value()); + //Clear quasi-top bit + max_count &= boost::uint32_t(0xBFFFFFFF); + caster.addr_uint64 = max_count; + caster.addr_uint64 = caster.addr_uint64 << 32; + caster.addr_uint64 |= boost::uint64_t(initial_count) << 2; + return *static_cast(caster.addr); + } + } + + ref_count_ptr *find(const char *name) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + map_type::iterator it = map.find(std::string(name)); + if(it != map.end()){ + return &it->second; + } + else{ + return 0; + } + } + + ref_count_ptr * insert(const char *name, const ref_count_ptr &ref) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + map_type::iterator it = map.insert(map_type::value_type(std::string(name), ref)).first; + return &it->second; + } + + bool erase(const char *name) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + return map.erase(std::string(name)) != 0; + } + + template + void atomic_func(F &f) + { + scoped_lock lck(m_mtx_lock); + f(); + } + + ~windows_semaphore_based_map() + { + scoped_lock lck(m_mtx_lock); + m_sem_count.wait(); + if(0 == m_sem_count.value()){ + delete &this->get_map_unlocked(); + } + //First close sems to protect this with the external mutex + m_sem_map.close(); + m_sem_count.close(); + //Once scoped_lock unlocks the mutex, the destructor will close the handle... + } + + private: + winapi_mutex_wrapper m_mtx_lock; + winapi_semaphore_wrapper m_sem_map; + winapi_semaphore_wrapper m_sem_count; +}; + +template<> +struct thread_safe_global_map_dependant +{ + static void apply_gmem_erase_logic(const char *, const char *){} + + static bool remove_old_gmem() + { return true; } + + struct lock_file_logic + { + lock_file_logic(windows_semaphore_based_map &) + : retry_with_new_map(false) + {} + + void operator()(void){} + bool retry() const { return retry_with_new_map; } + private: + const bool retry_with_new_map; + }; + + static void construct_map(void *addr) + { + ::new (addr)windows_semaphore_based_map; + } + + struct unlink_map_logic + { + unlink_map_logic(windows_semaphore_based_map &) + {} + void operator()(){} + }; + + static ref_count_ptr *find(windows_semaphore_based_map &map, const char *name) + { + return map.find(name); + } + + static ref_count_ptr * insert(windows_semaphore_based_map &map, const char *name, const ref_count_ptr &ref) + { + return map.insert(name, ref); + } + + static bool erase(windows_semaphore_based_map &map, const char *name) + { + return map.erase(name); + } + + template + static void atomic_func(windows_semaphore_based_map &map, F &f) + { + map.atomic_func(f); + } +}; + +} //namespace intermodule_singleton_helpers { + +template +class windows_intermodule_singleton + : public intermodule_singleton_impl + < C + , LazyInit + , Phoenix + , intermodule_singleton_helpers::windows_semaphore_based_map + > +{}; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/workaround.hpp b/project/jni/boost/include/boost/interprocess/detail/workaround.hpp index 160873875..44269fb2e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/workaround.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/workaround.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -13,43 +13,34 @@ #include -#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) - -#define BOOST_INTERPROCESS_WINDOWS - -/* -#if !defined(_MSC_EXTENSIONS) -#error "Turn on Microsoft language extensions (_MSC_EXTENSIONS) to be able to call Windows API functions" -#endif -*/ - -#endif - -#if !defined(BOOST_INTERPROCESS_WINDOWS) - +#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + #define BOOST_INTERPROCESS_WINDOWS + #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION + #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME +#else #include - #if ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0) - //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it. - //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work. - # if !defined(__CYGWIN__) && !defined(__APPLE__) - # define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED - # endif + #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0) + //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it. + //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seem to work. + #if !defined(__CYGWIN__) && !defined(__APPLE__) + #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED + #endif #endif - - #if ((_POSIX_BARRIERS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_BARRIERS - # endif - #if ((_POSIX_SEMAPHORES - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES - # if defined(__CYGWIN__) - #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK - # endif + #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_BARRIERS + #endif + + #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES + #if defined(__CYGWIN__) + #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK + #endif //Some platforms have a limited (name length) named semaphore support #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__) - # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES - #endif + #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES + #endif #if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\ ((defined _V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\ @@ -60,87 +51,119 @@ ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\ ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64)) #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T - #else #endif //Check for XSI shared memory objects. They are available in nearly all UNIX platforms #if !defined(__QNXNTO__) && !defined(ANDROID) - # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS #endif - #if ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS #else - //VMS and MACOS don't define it but the have shm_open/close interface - # if defined(__vms) - # if __CRTL_VER >= 70200000 - # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS - # endif - //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX - # elif defined (__APPLE__) -// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS -// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW - # endif + //VMS and MACOS don't define it but they have shm_open/close interface + #if defined(__vms) + #if __CRTL_VER >= 70200000 + #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + #endif + //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX + #elif defined (__APPLE__) + //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW + #endif #endif //Now check if we have only XSI shared memory #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\ !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) - //# define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY + //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY #endif - #if ((_POSIX_TIMEOUTS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_TIMEOUTS - #endif - + #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_TIMEOUTS + #endif #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS //Some systems have filesystem-based resources, so the //portable "/shmname" format does not work due to permission issues //For those systems we need to form a path to a temporary directory: // hp-ux tru64 vms freebsd - #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) - #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) + #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + //Some systems have "jailed" environments where shm usage is restricted at runtime + //and temporary file file based shm is possible in those executions. #elif defined(__FreeBSD__) - #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY #endif #endif #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES #if defined(__osf__) || defined(__vms) - #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES + #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES #endif #endif - #if ((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500) - #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES + #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \ + (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)) + #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES #endif -#endif + #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) + #define BOOST_INTERPROCESS_BSD_DERIVATIVE + #include + #if defined(CTL_KERN) && defined (KERN_BOOTTIME) + //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME + #endif + #endif +#endif //!defined(BOOST_INTERPROCESS_WINDOWS) -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ - && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) -#define BOOST_INTERPROCESS_PERFECT_FORWARDING +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #define BOOST_INTERPROCESS_PERFECT_FORWARDING #endif //Now declare some Boost.Interprocess features depending on the implementation - #if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK) - -#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES - -#endif - -#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK) - -#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES -#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES - + #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES + #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES #endif // Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set #ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS -#define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000 + #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000 +#endif + +//Other switches +//BOOST_INTERPROCESS_MSG_QUEUE_USES_CIRC_INDEX +//message queue uses a circular queue as index instead of an array (better performance) +//Boost version < 1.52 uses an array, so undef this if you want to communicate +//with processes compiled with those versions. +#define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX + +//Inline attributes +#if defined(_MSC_VER) + #define BOOST_INTERPROCESS_ALWAYS_INLINE __forceinline +#elif defined (__GNUC__) + #define BOOST_INTERPROCESS_ALWAYS_INLINE __attribute__((__always_inline__)) +#else + #define BOOST_INTERPROCESS_ALWAYS_INLINE inline +#endif + +#if defined(_MSC_VER) + #define BOOST_INTERPROCESS_NEVER_INLINE __declspec(noinline) +#elif defined (__GNUC__) + #define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__)) +#endif + +#if defined(BOOST_NO_CXX11_NOEXCEPT) + #if defined(BOOST_MSVC) + #define BOOST_INTERPROCESS_NOEXCEPT throw() + #else + #define BOOST_INTERPROCESS_NOEXCEPT + #endif + #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) +#else + #define BOOST_INTERPROCESS_NOEXCEPT noexcept + #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x) #endif #include diff --git a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp index d2e2bf2ce..b2a27501d 100644 --- a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (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) // @@ -46,7 +46,7 @@ class xsi_shared_memory_device { /// @cond BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper) - /// @endcond + /// @endcond public: @@ -74,10 +74,10 @@ class xsi_shared_memory_device { this->swap(moved); } xsi_shared_memory_device &operator=(BOOST_RV_REF(xsi_shared_memory_device) moved) - { + { xsi_shared_memory_device tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memory_device. Does not throw @@ -168,7 +168,7 @@ inline xsi_shared_memory_device::xsi_shared_memory_device() : m_shm(), m_mode(invalid_mode), m_name() {} -inline xsi_shared_memory_device::~xsi_shared_memory_device() +inline xsi_shared_memory_device::~xsi_shared_memory_device() {} inline const char *xsi_shared_memory_device::get_name() const @@ -178,7 +178,7 @@ inline void xsi_shared_memory_device::swap(xsi_shared_memory_device &other) { m_shm.swap(other.m_shm); std::swap(m_mode, other.m_mode); - m_name.swap(other.m_name); + m_name.swap(other.m_name); } inline mapping_handle_t xsi_shared_memory_device::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp index d74d9664a..51af830fb 100644 --- a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (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) // @@ -40,7 +40,7 @@ class xsi_shared_memory_file_wrapper { /// @cond BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper) - /// @endcond + /// @endcond public: xsi_shared_memory_file_wrapper() : xsi_shared_memory() {} @@ -61,10 +61,10 @@ class xsi_shared_memory_file_wrapper { this->swap(moved); } xsi_shared_memory_file_wrapper &operator=(BOOST_RV_REF(xsi_shared_memory_file_wrapper) moved) - { + { xsi_shared_memory_file_wrapper tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memory_file_wrapper. Does not throw diff --git a/project/jni/boost/include/boost/interprocess/errors.hpp b/project/jni/boost/include/boost/interprocess/errors.hpp index e36b8e4e6..345ca311f 100644 --- a/project/jni/boost/include/boost/interprocess/errors.hpp +++ b/project/jni/boost/include/boost/interprocess/errors.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -11,7 +11,7 @@ ////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 Beman Dawes -// Copyright (C) 2001 Dietmar Kuehl +// Copyright (C) 2001 Dietmar Kuehl // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy // at http://www.boost.org/LICENSE_1_0.txt) @@ -64,16 +64,16 @@ inline int system_error_code() // artifact of POSIX and WINDOWS error reporting inline void fill_system_message(int sys_err_code, std::string &str) { void *lpMsgBuf; - winapi::format_message( - winapi::format_message_allocate_buffer | - winapi::format_message_from_system | + winapi::format_message( + winapi::format_message_allocate_buffer | + winapi::format_message_from_system | winapi::format_message_ignore_inserts, 0, sys_err_code, winapi::make_lang_id(winapi::lang_neutral, winapi::sublang_default), // Default language reinterpret_cast(&lpMsgBuf), 0, - 0 + 0 ); str += static_cast(lpMsgBuf); winapi::local_free( lpMsgBuf ); // free the buffer @@ -123,7 +123,7 @@ typedef int native_error_t; struct ec_xlate { native_error_t sys_ec; - error_code_t ec; + error_code_t ec; }; static const ec_xlate ec_table[] = @@ -183,9 +183,9 @@ static const ec_xlate ec_table[] = }; inline error_code_t lookup_error(native_error_t err) -{ +{ const ec_xlate *cur = &ec_table[0], - *end = cur + sizeof(ec_table)/sizeof(ec_xlate); + *end = cur + sizeof(ec_table)/sizeof(ec_xlate); for (;cur != end; ++cur ){ if ( err == cur->sys_ec ) return cur->ec; } diff --git a/project/jni/boost/include/boost/interprocess/exceptions.hpp b/project/jni/boost/include/boost/interprocess/exceptions.hpp index a4f196f0b..b9ab45bec 100644 --- a/project/jni/boost/include/boost/interprocess/exceptions.hpp +++ b/project/jni/boost/include/boost/interprocess/exceptions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/file_mapping.hpp b/project/jni/boost/include/boost/interprocess/file_mapping.hpp index 3bad98fca..58428604c 100644 --- a/project/jni/boost/include/boost/interprocess/file_mapping.hpp +++ b/project/jni/boost/include/boost/interprocess/file_mapping.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -41,27 +41,27 @@ class file_mapping //!Does not throw file_mapping(); - //!Opens a file mapping of file "filename", starting in offset - //!"file_offset", and the mapping's size will be "size". The mapping + //!Opens a file mapping of file "filename", starting in offset + //!"file_offset", and the mapping's size will be "size". The mapping //!can be opened for read-only "read_only" or read-write "read_write" //!modes. Throws interprocess_exception on error. file_mapping(const char *filename, mode_t mode); - //!Moves the ownership of "moved"'s file mapping object to *this. - //!After the call, "moved" does not represent any file mapping object. + //!Moves the ownership of "moved"'s file mapping object to *this. + //!After the call, "moved" does not represent any file mapping object. //!Does not throw file_mapping(BOOST_RV_REF(file_mapping) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s file mapping to *this. - //!After the call, "moved" does not represent any file mapping. + //!After the call, "moved" does not represent any file mapping. //!Does not throw file_mapping &operator=(BOOST_RV_REF(file_mapping) moved) { file_mapping tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to file_mappings. @@ -100,21 +100,21 @@ class file_mapping /// @endcond }; -inline file_mapping::file_mapping() +inline file_mapping::file_mapping() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline file_mapping::~file_mapping() +inline file_mapping::~file_mapping() { this->priv_close(); } inline const char *file_mapping::get_name() const { return m_filename.c_str(); } inline void file_mapping::swap(file_mapping &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t file_mapping::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp index bac387e26..52bf88ac7 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp index 966239290..b1abededf 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -34,17 +34,17 @@ namespace interprocess { template struct iset_index_aux { - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; - typedef typename + typedef typename segment_manager_base::void_pointer void_pointer; typedef typename bi::make_set_base_hook < bi::void_pointer , bi::optimize_size >::type derivation_hook; - typedef typename MapConfig::template + typedef typename MapConfig::template intrusive_value_type::type value_type; typedef std::less value_compare; typedef typename bi::make_set @@ -82,20 +82,20 @@ class iset_index struct intrusive_key_value_less { bool operator()(const intrusive_compare_key_type &i, const value_type &b) const - { + { std::size_t blen = b.name_length(); - return (i.m_len < blen) || - (i.m_len == blen && - std::char_traits::compare + return (i.m_len < blen) || + (i.m_len == blen && + std::char_traits::compare (i.mp_str, b.name(), i.m_len) < 0); } bool operator()(const value_type &b, const intrusive_compare_key_type &i) const - { + { std::size_t blen = b.name_length(); - return (blen < i.m_len) || + return (blen < i.m_len) || (blen == i.m_len && - std::char_traits::compare + std::char_traits::compare (b.name(), i.mp_str, i.m_len) < 0); } }; @@ -143,7 +143,7 @@ struct is_intrusive_index /// @endcond } //namespace interprocess { -} //namespace boost +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp index ef1ae79d3..a23c8461d 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -35,17 +35,17 @@ namespace boost { namespace interprocess { template struct iunordered_set_index_aux { - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; - typedef typename + typedef typename segment_manager_base::void_pointer void_pointer; typedef typename bi::make_unordered_set_base_hook < bi::void_pointer >::type derivation_hook; - typedef typename MapConfig::template + typedef typename MapConfig::template intrusive_value_type::type value_type; typedef typename MapConfig:: @@ -58,23 +58,23 @@ struct iunordered_set_index_aux struct equal_function { bool operator()(const intrusive_compare_key_type &i, const value_type &b) const - { + { return (i.m_len == b.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (i.mp_str, b.name(), i.m_len) == 0); } bool operator()(const value_type &b, const intrusive_compare_key_type &i) const - { + { return (i.m_len == b.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (i.mp_str, b.name(), i.m_len) == 0); } bool operator()(const value_type &b1, const value_type &b2) const - { + { return (b1.name_length() == b2.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (b1.name(), b2.name(), b1.name_length()) == 0); } }; @@ -119,7 +119,7 @@ struct iunordered_set_index_aux /// @endcond //!Index type based in boost::intrusive::set. -//!Just derives from boost::intrusive::set +//!Just derives from boost::intrusive::set //!and defines the interface needed by managed memory segments template class iunordered_set_index @@ -135,9 +135,9 @@ class iunordered_set_index typedef typename index_aux::equal_function equal_function; typedef typename index_aux::hash_function hash_function; typedef typename MapConfig::char_type char_type; - typedef typename + typedef typename iunordered_set_index_aux::allocator_type allocator_type; - typedef typename + typedef typename iunordered_set_index_aux::allocator_holder allocator_holder; /// @endcond @@ -190,7 +190,7 @@ class iunordered_set_index bucket_ptr shunk_p = alloc.allocation_command (boost::interprocess::shrink_in_place | boost::interprocess::nothrow_allocation, received_size, received_size, received_size, buckets).first; - BOOST_ASSERT(buckets == shunk_p); + BOOST_ASSERT(buckets == shunk_p); (void)shunk_p; bucket_ptr buckets_init = buckets + received_size; for(size_type i = 0; i < (old_size - received_size); ++i){ @@ -290,7 +290,7 @@ class iunordered_set_index size_type cur_size = this->size(); size_type cur_count = this->bucket_count(); bucket_ptr old_p = this->bucket_pointer(); - + if(!this->size() && old_p != bucket_ptr(&this->init_bucket)){ this->rehash(bucket_traits(bucket_ptr(&this->init_bucket), 1)); destroy_buckets(this->alloc, old_p, cur_count); @@ -337,7 +337,7 @@ class iunordered_set_index //Strong guarantee: if something goes wrong //we should remove the insertion. // - //We can use the iterator because the hash function + //We can use the iterator because the hash function //can't throw and this means that "reserve" will //throw only because of the memory allocation: //the iterator has not been invalidated. diff --git a/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp index ffea73e8d..409e4c97a 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -48,7 +48,7 @@ struct map_index_aux } //namespace ipcdetail { -//!Index type based in boost::interprocess::map. Just derives from boost::interprocess::map +//!Index type based in boost::interprocess::map. Just derives from boost::interprocess::map //!and defines the interface needed by managed memory segments template class map_index diff --git a/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp index 81c88be79..1e1d670d7 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -16,7 +16,7 @@ #include //!\file -//!Describes a null index adaptor, so that if we don't want to construct +//!Describes a null index adaptor, so that if we don't want to construct //!named objects, we can use this null index type to save resources. namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp index a14fa1d4a..2fce665d4 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -69,7 +69,7 @@ class unordered_map_index /// @cond typedef unordered_map_index_aux index_aux; typedef typename index_aux::index_t base_type; - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp b/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp index 2b3e3eba0..42f170a65 100644 --- a/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp +++ b/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -214,7 +214,7 @@ template class IndexType> class basic_managed_shared_memory; -typedef basic_managed_shared_memory +typedef basic_managed_shared_memory ,iset_index> @@ -238,7 +238,7 @@ template class IndexType> class basic_managed_windows_shared_memory; -typedef basic_managed_windows_shared_memory +typedef basic_managed_windows_shared_memory ,iset_index> @@ -259,7 +259,7 @@ template class IndexType> class basic_managed_xsi_shared_memory; -typedef basic_managed_xsi_shared_memory +typedef basic_managed_xsi_shared_memory ,iset_index> diff --git a/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp b/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp index d3846afb7..90ca0af81 100644 --- a/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp +++ b/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -42,6 +42,12 @@ namespace boost{ namespace interprocess{ +namespace ipcdetail +{ + template + class msg_queue_initialization_func_t; +} + //!A class that allows sending messages //!between processes. template @@ -66,24 +72,24 @@ class message_queue_t //!the maximum number of messages will be "max_num_msg" and the maximum message size //!will be "max_msg_size". Throws on error and if the queue was previously created. message_queue_t(create_only_t create_only, - const char *name, - size_type max_num_msg, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm = permissions()); - //!Opens or creates a process shared message queue with name "name". - //!If the queue is created, the maximum number of messages will be "max_num_msg" - //!and the maximum message size will be "max_msg_size". If queue was previously + //!Opens or creates a process shared message queue with name "name". + //!If the queue is created, the maximum number of messages will be "max_num_msg" + //!and the maximum message size will be "max_msg_size". If queue was previously //!created the queue will be opened and "max_num_msg" and "max_msg_size" parameters //!are ignored. Throws on error. message_queue_t(open_or_create_t open_or_create, - const char *name, - size_type max_num_msg, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm = permissions()); - //!Opens a previously created process shared message queue with name "name". - //!If the queue was not previously created or there are no free resources, + //!Opens a previously created process shared message queue with name "name". + //!If the queue was not previously created or there are no free resources, //!throws an error. message_queue_t(open_only_t open_only, const char *name); @@ -95,65 +101,65 @@ class message_queue_t //!this resource. The resource can still be opened again calling //!the open constructor overload. To erase the message queue from the system //!use remove(). - ~message_queue_t(); + ~message_queue_t(); - //!Sends a message stored in buffer "buffer" with size "buffer_size" in the + //!Sends a message stored in buffer "buffer" with size "buffer_size" in the //!message queue with priority "priority". If the message queue is full - //!the sender is blocked. Throws interprocess_error on error.*/ - void send (const void *buffer, size_type buffer_size, + //!the sender is blocked. Throws interprocess_error on error. + void send (const void *buffer, size_type buffer_size, unsigned int priority); - //!Sends a message stored in buffer "buffer" with size "buffer_size" through the + //!Sends a message stored in buffer "buffer" with size "buffer_size" through the //!message queue with priority "priority". If the message queue is full //!the sender is not blocked and returns false, otherwise returns true. //!Throws interprocess_error on error. - bool try_send (const void *buffer, size_type buffer_size, + bool try_send (const void *buffer, size_type buffer_size, unsigned int priority); - //!Sends a message stored in buffer "buffer" with size "buffer_size" in the + //!Sends a message stored in buffer "buffer" with size "buffer_size" in the //!message queue with priority "priority". If the message queue is full //!the sender retries until time "abs_time" is reached. Returns true if //!the message has been successfully sent. Returns false if timeout is reached. //!Throws interprocess_error on error. - bool timed_send (const void *buffer, size_type buffer_size, + bool timed_send (const void *buffer, size_type buffer_size, unsigned int priority, const boost::posix_time::ptime& abs_time); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver is blocked. Throws interprocess_error on error. - void receive (void *buffer, size_type buffer_size, + void receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver is not blocked and returns false, otherwise returns true. //!Throws interprocess_error on error. - bool try_receive (void *buffer, size_type buffer_size, + bool try_receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver retries until time "abs_time" is reached. Returns true if //!the message has been successfully sent. Returns false if timeout is reached. //!Throws interprocess_error on error. - bool timed_receive (void *buffer, size_type buffer_size, + bool timed_receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority, const boost::posix_time::ptime &abs_time); //!Returns the maximum number of messages allowed by the queue. The message - //!queue must be opened or created previously. Otherwise, returns 0. + //!queue must be opened or created previously. Otherwise, returns 0. //!Never throws size_type get_max_msg() const; //!Returns the maximum size of message allowed by the queue. The message - //!queue must be opened or created previously. Otherwise, returns 0. + //!queue must be opened or created previously. Otherwise, returns 0. //!Never throws size_type get_max_msg_size() const; - //!Returns the number of messages currently stored. + //!Returns the number of messages currently stored. //!Never throws size_type get_num_msg(); @@ -161,23 +167,26 @@ class message_queue_t //!Returns false on error. Never throws static bool remove(const char *name); - /// @cond + /// @cond private: typedef boost::posix_time::ptime ptime; + + friend class ipcdetail::msg_queue_initialization_func_t; + bool do_receive(block_t block, - void *buffer, size_type buffer_size, + void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const ptime &abs_time); bool do_send(block_t block, - const void *buffer, size_type buffer_size, + const void *buffer, size_type buffer_size, unsigned int priority, const ptime &abs_time); //!Returns the needed memory size for the shared message queue. //!Never throws static size_type get_mem_size(size_type max_msg_size, size_type max_num_msg); - - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; /// @endcond }; @@ -187,7 +196,7 @@ namespace ipcdetail { //!This header is the prefix of each message in the queue template -class msg_hdr_t +class msg_hdr_t { typedef VoidPointer void_pointer; typedef typename boost::intrusive:: @@ -212,36 +221,55 @@ class priority_functor rebind_pointer >::type msg_hdr_ptr_t; public: - bool operator()(const msg_hdr_ptr_t &msg1, + bool operator()(const msg_hdr_ptr_t &msg1, const msg_hdr_ptr_t &msg2) const { return msg1->priority < msg2->priority; } }; -//!This header is placed in the beginning of the shared memory and contains -//!the data to control the queue. This class initializes the shared memory +//!This header is placed in the beginning of the shared memory and contains +//!the data to control the queue. This class initializes the shared memory //!in the following way: in ascending memory address with proper alignment //!fillings: //! -//!-> mq_hdr_t: +//!-> mq_hdr_t: //! Main control block that controls the rest of the elements //! //!-> offset_ptr index [max_num_msg] -//! An array of pointers with size "max_num_msg" called index. Each pointer -//! points to a preallocated message. The elements of this array are +//! An array of pointers with size "max_num_msg" called index. Each pointer +//! points to a preallocated message. Elements of this array are //! reordered in runtime in the following way: //! -//! When the current number of messages is "cur_num_msg", the first +//! IF BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX is defined: +//! +//! When the current number of messages is "cur_num_msg", the array +//! is treated like a circular buffer. Starting from position "cur_first_msg" +//! "cur_num_msg" in a circular way, pointers point to inserted messages and the rest +//! point to free messages. Those "cur_num_msg" pointers are +//! ordered by the priority of the pointed message and by insertion order +//! if two messages have the same priority. So the next message to be +//! used in a "receive" is pointed by index [(cur_first_msg + cur_num_msg-1)%max_num_msg] +//! and the first free message ready to be used in a "send" operation is +//! [cur_first_msg] if circular buffer is extended from front, +//! [(cur_first_msg + cur_num_msg)%max_num_msg] otherwise. +//! +//! This transforms the index in a circular buffer with an embedded free +//! message queue. +//! +//! ELSE (BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX is NOT defined): +//! +//! When the current number of messages is "cur_num_msg", the first //! "cur_num_msg" pointers point to inserted messages and the rest //! point to free messages. The first "cur_num_msg" pointers are -//! ordered by the priority of the pointed message and by insertion order -//! if two messages have the same priority. So the next message to be +//! ordered by the priority of the pointed message and by insertion order +//! if two messages have the same priority. So the next message to be //! used in a "receive" is pointed by index [cur_num_msg-1] and the first free //! message ready to be used in a "send" operation is index [cur_num_msg]. -//! This transforms index in a fixed size priority queue with an embedded free +//! +//! This transforms the index in a fixed size priority queue with an embedded free //! message queue. //! //!-> struct message_t -//! { +//! { //! msg_hdr_t header; //! char[max_msg_size] data; //! } messages [max_num_msg]; @@ -252,7 +280,7 @@ class priority_functor template class mq_hdr_t : public ipcdetail::priority_functor -{ +{ typedef VoidPointer void_pointer; typedef msg_hdr_t msg_header; typedef typename boost::intrusive:: @@ -264,22 +292,22 @@ class mq_hdr_t typedef typename boost::intrusive:: pointer_traits::template rebind_pointer::type msg_hdr_ptr_ptr_t; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; public: - //!Constructor. This object must be constructed in the beginning of the + //!Constructor. This object must be constructed in the beginning of the //!shared memory of the size returned by the function "get_mem_size". //!This constructor initializes the needed resources and creates - //!the internal structures like the priority index. This can throw.*/ + //!the internal structures like the priority index. This can throw. mq_hdr_t(size_type max_num_msg, size_type max_msg_size) - : m_max_num_msg(max_num_msg), + : m_max_num_msg(max_num_msg), m_max_msg_size(max_msg_size), m_cur_num_msg(0) + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) + ,m_cur_first_msg(0u) + #endif { this->initialize_memory(); } - //!Returns the inserted message with top priority - msg_header * top_msg() - { return mp_index[m_cur_num_msg-1].get(); } - //!Returns true if the message queue is full bool is_full() const { return m_cur_num_msg == m_max_num_msg; } @@ -292,51 +320,223 @@ class mq_hdr_t void free_top_msg() { --m_cur_num_msg; } - //!Returns the first free msg of the free message queue - msg_header * free_msg() - { return mp_index[m_cur_num_msg].get(); } + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) - //!Inserts the first free message in the priority queue - void queue_free_msg() - { - //Get free msg - msg_hdr_ptr_t free = mp_index[m_cur_num_msg]; - //Get priority queue's range - msg_hdr_ptr_t *it = &mp_index[0], *it_end = &mp_index[m_cur_num_msg]; - //Check where the free message should be placed - it = std::lower_bound(it, it_end, free, static_cast&>(*this)); - //Make room in that position - std::copy_backward(it, it_end, it_end+1); - //Insert the free message in the correct position - *it = free; - ++m_cur_num_msg; + typedef msg_hdr_ptr_t *iterator; + + size_type end_pos() const + { + const size_type space_until_bufend = m_max_num_msg - m_cur_first_msg; + return space_until_bufend > m_cur_num_msg + ? m_cur_first_msg + m_cur_num_msg : m_cur_num_msg - space_until_bufend; } - //!Returns the number of bytes needed to construct a message queue with - //!"max_num_size" maximum number of messages and "max_msg_size" maximum + //!Returns the inserted message with top priority + msg_header &top_msg() + { + size_type pos = this->end_pos(); + return *mp_index[pos ? --pos : m_max_num_msg - 1]; + } + + //!Returns the inserted message with bottom priority + msg_header &bottom_msg() + { return *mp_index[m_cur_first_msg]; } + + iterator inserted_ptr_begin() const + { return &mp_index[m_cur_first_msg]; } + + iterator inserted_ptr_end() const + { return &mp_index[this->end_pos()]; } + + iterator lower_bound(const msg_hdr_ptr_t & value, priority_functor func) + { + iterator begin(this->inserted_ptr_begin()), end(this->inserted_ptr_end()); + if(end < begin){ + iterator idx_end = &mp_index[m_max_num_msg]; + iterator ret = std::lower_bound(begin, idx_end, value, func); + if(idx_end == ret){ + iterator idx_beg = &mp_index[0]; + ret = std::lower_bound(idx_beg, end, value, func); + //sanity check, these cases should not call lower_bound (optimized out) + assert(ret != end); + assert(ret != begin); + return ret; + } + else{ + return ret; + } + } + else{ + return std::lower_bound(begin, end, value, func); + } + } + + msg_header & insert_at(iterator where) + { + iterator it_inserted_ptr_end = this->inserted_ptr_end(); + iterator it_inserted_ptr_beg = this->inserted_ptr_begin(); + if(where == it_inserted_ptr_end){ + ++m_cur_num_msg; + return **it_inserted_ptr_end; + } + else if(where == it_inserted_ptr_beg){ + //unsigned integer guarantees underflow + m_cur_first_msg = m_cur_first_msg ? m_cur_first_msg : m_max_num_msg; + --m_cur_first_msg; + ++m_cur_num_msg; + return *mp_index[m_cur_first_msg]; + } + else{ + size_type pos = where - &mp_index[0]; + size_type circ_pos = pos >= m_cur_first_msg ? pos - m_cur_first_msg : pos + (m_max_num_msg - m_cur_first_msg); + //Check if it's more efficient to move back or move front + if(circ_pos < m_cur_num_msg/2){ + //The queue can't be full so m_cur_num_msg == 0 or m_cur_num_msg <= pos + //indicates two step insertion + if(!pos){ + pos = m_max_num_msg; + where = &mp_index[m_max_num_msg-1]; + } + else{ + --where; + } + const bool unique_segment = m_cur_first_msg && m_cur_first_msg <= pos; + const size_type first_segment_beg = unique_segment ? m_cur_first_msg : 1u; + const size_type first_segment_end = pos; + const size_type second_segment_beg = unique_segment || !m_cur_first_msg ? m_max_num_msg : m_cur_first_msg; + const size_type second_segment_end = m_max_num_msg; + const msg_hdr_ptr_t backup = *(&mp_index[0] + (unique_segment ? first_segment_beg : second_segment_beg) - 1); + + //First segment + if(!unique_segment){ + std::copy( &mp_index[0] + second_segment_beg + , &mp_index[0] + second_segment_end + , &mp_index[0] + second_segment_beg - 1); + mp_index[m_max_num_msg-1] = mp_index[0]; + } + std::copy( &mp_index[0] + first_segment_beg + , &mp_index[0] + first_segment_end + , &mp_index[0] + first_segment_beg - 1); + *where = backup; + m_cur_first_msg = m_cur_first_msg ? m_cur_first_msg : m_max_num_msg; + --m_cur_first_msg; + ++m_cur_num_msg; + return **where; + } + else{ + //The queue can't be full so end_pos < m_cur_first_msg + //indicates two step insertion + const size_type pos_end = this->end_pos(); + const bool unique_segment = pos < pos_end; + const size_type first_segment_beg = pos; + const size_type first_segment_end = unique_segment ? pos_end : m_max_num_msg-1; + const size_type second_segment_beg = 0u; + const size_type second_segment_end = unique_segment ? 0u : pos_end; + const msg_hdr_ptr_t backup = *it_inserted_ptr_end; + + //First segment + if(!unique_segment){ + std::copy_backward( &mp_index[0] + second_segment_beg + , &mp_index[0] + second_segment_end + , &mp_index[0] + second_segment_end + 1); + mp_index[0] = mp_index[m_max_num_msg-1]; + } + std::copy_backward( &mp_index[0] + first_segment_beg + , &mp_index[0] + first_segment_end + , &mp_index[0] + first_segment_end + 1); + *where = backup; + ++m_cur_num_msg; + return **where; + } + } + } + + #else + + typedef msg_hdr_ptr_t *iterator; + + //!Returns the inserted message with top priority + msg_header &top_msg() + { return *mp_index[m_cur_num_msg-1]; } + + //!Returns the inserted message with bottom priority + msg_header &bottom_msg() + { return *mp_index[0]; } + + iterator inserted_ptr_begin() const + { return &mp_index[0]; } + + iterator inserted_ptr_end() const + { return &mp_index[m_cur_num_msg]; } + + iterator lower_bound(const msg_hdr_ptr_t & value, priority_functor func) + { return std::lower_bound(this->inserted_ptr_begin(), this->inserted_ptr_end(), value, func); } + + msg_header & insert_at(iterator pos) + { + const msg_hdr_ptr_t backup = *inserted_ptr_end(); + std::copy_backward(pos, inserted_ptr_end(), inserted_ptr_end()+1); + *pos = backup; + ++m_cur_num_msg; + return **pos; + } + + #endif + + //!Inserts the first free message in the priority queue + msg_header & queue_free_msg(unsigned int priority) + { + //Get priority queue's range + iterator it (inserted_ptr_begin()), it_end(inserted_ptr_end()); + //Optimize for non-priority usage + if(m_cur_num_msg && priority > this->bottom_msg().priority){ + //Check for higher priority than all stored messages + if(priority > this->top_msg().priority){ + it = it_end; + } + else{ + //Since we don't now which free message we will pick + //build a dummy header for searches + msg_header dummy_hdr; + dummy_hdr.priority = priority; + + //Get free msg + msg_hdr_ptr_t dummy_ptr(&dummy_hdr); + + //Check where the free message should be placed + it = this->lower_bound(dummy_ptr, static_cast&>(*this)); + } + + } + //Insert the free message in the correct position + return this->insert_at(it); + } + + //!Returns the number of bytes needed to construct a message queue with + //!"max_num_size" maximum number of messages and "max_msg_size" maximum //!message size. Never throws. static size_type get_mem_size (size_type max_msg_size, size_type max_num_msg) { - const size_type + const size_type msg_hdr_align = ::boost::alignment_of::value, index_align = ::boost::alignment_of::value, r_hdr_size = ipcdetail::ct_rounded_size::value, - r_index_size = ipcdetail::get_rounded_size(sizeof(msg_hdr_ptr_t)*max_num_msg, msg_hdr_align), + r_index_size = ipcdetail::get_rounded_size(max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align), r_max_msg_size = ipcdetail::get_rounded_size(max_msg_size, msg_hdr_align) + sizeof(msg_header); - return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) + - ipcdetail::managed_open_or_create_impl::ManagedOpenOrCreateUserOffset; + return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) + + open_create_impl_t::ManagedOpenOrCreateUserOffset; } //!Initializes the memory structures to preallocate messages and constructs the //!message index. Never throws. void initialize_memory() { - const size_type + const size_type msg_hdr_align = ::boost::alignment_of::value, index_align = ::boost::alignment_of::value, r_hdr_size = ipcdetail::ct_rounded_size::value, - r_index_size = ipcdetail::get_rounded_size(sizeof(msg_hdr_ptr_t)*m_max_num_msg, msg_hdr_align), + r_index_size = ipcdetail::get_rounded_size(m_max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align), r_max_msg_size = ipcdetail::get_rounded_size(m_max_msg_size, msg_hdr_align) + sizeof(msg_header); //Pointer to the index @@ -345,7 +545,7 @@ class mq_hdr_t //Pointer to the first message header msg_header *msg_hdr = reinterpret_cast - (reinterpret_cast(this)+r_hdr_size+r_index_size); + (reinterpret_cast(this)+r_hdr_size+r_index_size); //Initialize the pointer to the index mp_index = index; @@ -373,13 +573,17 @@ class mq_hdr_t interprocess_condition m_cond_recv; //Condition block senders when the queue is full interprocess_condition m_cond_send; + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) + //Current start offset in the circular index + size_type m_cur_first_msg; + #endif }; -//!This is the atomic functor to be executed when creating or opening +//!This is the atomic functor to be executed when creating or opening //!shared memory. Never throws template -class initialization_func_t +class msg_queue_initialization_func_t { public: typedef typename boost::intrusive:: @@ -388,7 +592,7 @@ class initialization_func_t typedef typename boost::intrusive::pointer_traits::difference_type difference_type; typedef typename boost::make_unsigned::type size_type; - initialization_func_t(size_type maxmsg = 0, + msg_queue_initialization_func_t(size_type maxmsg = 0, size_type maxmsgsize = 0) : m_maxmsg (maxmsg), m_maxmsgsize(maxmsgsize) {} @@ -403,12 +607,19 @@ class initialization_func_t new (mptr) mq_hdr_t(m_maxmsg, m_maxmsgsize); } BOOST_CATCH(...){ - return false; + return false; } BOOST_CATCH_END } return true; } + + std::size_t get_min_size() const + { + return mq_hdr_t::get_mem_size(m_maxmsgsize, m_maxmsg) + - message_queue_t::open_create_impl_t::ManagedOpenOrCreateUserOffset; + } + const size_type m_maxmsg; const size_type m_maxmsgsize; }; @@ -425,49 +636,48 @@ inline typename message_queue_t::size_type message_queue_t::get_mem_size(max_msg_size, max_num_msg); } template -inline message_queue_t::message_queue_t(create_only_t create_only, - const char *name, - size_type max_num_msg, +inline message_queue_t::message_queue_t(create_only_t, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm) //Create shared memory and execute functor atomically - : m_shmem(create_only, - name, - get_mem_size(max_msg_size, max_num_msg), - read_write, - static_cast(0), - //Prepare initialization functor - ipcdetail::initialization_func_t (max_num_msg, max_msg_size), - perm) -{} - -template -inline message_queue_t::message_queue_t(open_or_create_t open_or_create, - const char *name, - size_type max_num_msg, - size_type max_msg_size, - const permissions &perm) - //Create shared memory and execute functor atomically - : m_shmem(open_or_create, - name, + : m_shmem(create_only, + name, get_mem_size(max_msg_size, max_num_msg), read_write, static_cast(0), //Prepare initialization functor - ipcdetail::initialization_func_t (max_num_msg, max_msg_size), + ipcdetail::msg_queue_initialization_func_t (max_num_msg, max_msg_size), perm) {} template -inline message_queue_t::message_queue_t(open_only_t open_only, - const char *name) +inline message_queue_t::message_queue_t(open_or_create_t, + const char *name, + size_type max_num_msg, + size_type max_msg_size, + const permissions &perm) + //Create shared memory and execute functor atomically + : m_shmem(open_or_create, + name, + get_mem_size(max_msg_size, max_num_msg), + read_write, + static_cast(0), + //Prepare initialization functor + ipcdetail::msg_queue_initialization_func_t (max_num_msg, max_msg_size), + perm) +{} + +template +inline message_queue_t::message_queue_t(open_only_t, const char *name) //Create shared memory and execute functor atomically - : m_shmem(open_only, + : m_shmem(open_only, name, read_write, static_cast(0), //Prepare initialization functor - ipcdetail::initialization_func_t ()) + ipcdetail::msg_queue_initialization_func_t ()) {} template @@ -494,7 +704,7 @@ inline bool message_queue_t::timed_send template inline bool message_queue_t::do_send(block_t block, - const void *buffer, size_type buffer_size, + const void *buffer, size_type buffer_size, unsigned int priority, const boost::posix_time::ptime &abs_time) { ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); @@ -503,13 +713,13 @@ inline bool message_queue_t::do_send(block_t block, throw interprocess_exception(size_error); } + bool was_empty = false; //--------------------------------------------- scoped_lock lock(p_hdr->m_mutex); //--------------------------------------------- { //If the queue is full execute blocking logic if (p_hdr->is_full()) { - switch(block){ case non_blocking : return false; @@ -536,47 +746,47 @@ inline bool message_queue_t::do_send(block_t block, break; } } - - //Get the first free message from free message queue - ipcdetail::msg_hdr_t *free_msg = p_hdr->free_msg(); - if (free_msg == 0) { - throw interprocess_exception("boost::interprocess::message_queue corrupted"); - } + + was_empty = p_hdr->is_empty(); + //Insert the first free message in the priority queue + ipcdetail::msg_hdr_t &free_msg_hdr = p_hdr->queue_free_msg(priority); + + //Sanity check, free msgs are always cleaned when received + assert(free_msg_hdr.priority == 0); + assert(free_msg_hdr.len == 0); //Copy control data to the free message - free_msg->priority = priority; - free_msg->len = buffer_size; + free_msg_hdr.priority = priority; + free_msg_hdr.len = buffer_size; //Copy user buffer to the message - std::memcpy(free_msg->data(), buffer, buffer_size); - -// bool was_empty = p_hdr->is_empty(); - //Insert the first free message in the priority queue - p_hdr->queue_free_msg(); - - //If this message changes the queue empty state, notify it to receivers -// if (was_empty){ - p_hdr->m_cond_recv.notify_one(); -// } + std::memcpy(free_msg_hdr.data(), buffer, buffer_size); } // Lock end + //Notify outside lock to avoid contention. This might produce some + //spurious wakeups, but it's usually far better than notifying inside. + //If this message changes the queue empty state, notify it to receivers + if (was_empty){ + p_hdr->m_cond_recv.notify_one(); + } + return true; } template -inline void message_queue_t::receive(void *buffer, size_type buffer_size, +inline void message_queue_t::receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority) { this->do_receive(blocking, buffer, buffer_size, recvd_size, priority, ptime()); } template inline bool - message_queue_t::try_receive(void *buffer, size_type buffer_size, + message_queue_t::try_receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority) { return this->do_receive(non_blocking, buffer, buffer_size, recvd_size, priority, ptime()); } template inline bool - message_queue_t::timed_receive(void *buffer, size_type buffer_size, + message_queue_t::timed_receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const boost::posix_time::ptime &abs_time) { @@ -590,7 +800,7 @@ inline bool template inline bool message_queue_t::do_receive(block_t block, - void *buffer, size_type buffer_size, + void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const boost::posix_time::ptime &abs_time) { @@ -600,6 +810,7 @@ inline bool throw interprocess_exception(size_error); } + bool was_full = false; //--------------------------------------------- scoped_lock lock(p_hdr->m_mutex); //--------------------------------------------- @@ -635,51 +846,52 @@ inline bool } } - //Thre is at least message ready to pick, get the top one - ipcdetail::msg_hdr_t *top_msg = p_hdr->top_msg(); - - //Paranoia check - if (top_msg == 0) { - throw interprocess_exception("boost::interprocess::message_queue corrupted"); - } + //There is at least one message ready to pick, get the top one + ipcdetail::msg_hdr_t &top_msg = p_hdr->top_msg(); //Get data from the message - recvd_size = top_msg->len; - priority = top_msg->priority; + recvd_size = top_msg.len; + priority = top_msg.priority; + + //Some cleanup to ease debugging + top_msg.len = 0; + top_msg.priority = 0; //Copy data to receiver's bufers - std::memcpy(buffer, top_msg->data(), recvd_size); + std::memcpy(buffer, top_msg.data(), recvd_size); -// bool was_full = p_hdr->is_full(); + was_full = p_hdr->is_full(); //Free top message and put it in the free message list p_hdr->free_top_msg(); - - //If this reception changes the queue full state, notify senders -// if (was_full){ - p_hdr->m_cond_send.notify_one(); -// } } //Lock end + //Notify outside lock to avoid contention. This might produce some + //spurious wakeups, but it's usually far better than notifying inside. + //If this reception changes the queue full state, notify senders + if (was_full){ + p_hdr->m_cond_send.notify_one(); + } + return true; } template inline typename message_queue_t::size_type message_queue_t::get_max_msg() const -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); return p_hdr ? p_hdr->m_max_num_msg : 0; } template inline typename message_queue_t::size_type message_queue_t::get_max_msg_size() const -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); - return p_hdr ? p_hdr->m_max_msg_size : 0; + return p_hdr ? p_hdr->m_max_msg_size : 0; } template inline typename message_queue_t::size_type message_queue_t::get_num_msg() -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); if(p_hdr){ //--------------------------------------------- @@ -688,7 +900,7 @@ inline typename message_queue_t::size_type message_queue_tm_cur_num_msg; } - return 0; + return 0; } template diff --git a/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp b/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp index a2cf47f4e..1f4a1995f 100644 --- a/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -23,34 +23,34 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include //!\file -//!Describes a named user memory allocation user class. +//!Describes a named user memory allocation user class. namespace boost { namespace interprocess { -//!A basic user memory named object creation class. Inherits all -//!basic functionality from +//!A basic user memory named object creation class. Inherits all +//!basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_external_buffer +class basic_managed_external_buffer : public ipcdetail::basic_managed_memory_impl { /// @cond - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_external_buffer) /// @endcond - + public: typedef typename base_t::size_type size_type; diff --git a/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp index 74869bb1f..868fdc556 100644 --- a/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -24,32 +24,32 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include //!\file -//!Describes a named heap memory allocation user class. +//!Describes a named heap memory allocation user class. namespace boost { namespace interprocess { -//!A basic heap memory named object creation class. Initializes the -//!heap memory segment. Inherits all basic functionality from +//!A basic heap memory named object creation class. Initializes the +//!heap memory segment. Inherits all basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_heap_memory +class basic_managed_heap_memory : public ipcdetail::basic_managed_memory_impl { /// @cond private: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_heap_memory) /// @endcond @@ -90,16 +90,16 @@ class basic_managed_heap_memory } //!Tries to resize internal heap memory so that - //!we have room for more objects. - //!WARNING: If memory is reallocated, all the objects will + //!we have room for more objects. + //!WARNING: If memory is reallocated, all the objects will //!be binary-copied to the new buffer. To be able to use //!this function, all pointers constructed in this buffer //!must be offset pointers. Otherwise, the result is undefined. //!Returns true if the growth has been successful, so you will - //!have some extra bytes to allocate new objects. If returns + //!have some extra bytes to allocate new objects. If returns //!false, the heap allocation has failed. bool grow(size_type extra_bytes) - { + { //If memory is reallocated, data will //be automatically copied BOOST_TRY{ @@ -129,7 +129,7 @@ class basic_managed_heap_memory private: //!Frees resources. Never throws. void priv_close() - { + { base_t::destroy_impl(); std::vector().swap(m_heapmem); } diff --git a/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp b/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp index 218fa9783..a802119a6 100644 --- a/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -26,44 +26,48 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include namespace boost { namespace interprocess { +namespace ipcdetail { -//!A basic mapped file named object creation class. Initializes the -//!mapped file. Inherits all basic functionality from +template +struct mfile_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < file_wrapper, AllocationAlgorithm::Alignment, true, false> type; +}; + +} //namespace ipcdetail { + +//!A basic mapped file named object creation class. Initializes the +//!mapped file. Inherits all basic functionality from //!basic_managed_memory_impl template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_mapped_file +class basic_managed_mapped_file : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset - > + ,ipcdetail::mfile_open_or_create::type::ManagedOpenOrCreateUserOffset> { /// @cond public: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset - > base_t; + ipcdetail::mfile_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; typedef ipcdetail::file_wrapper device_type; typedef typename base_t::size_type size_type; private: - typedef ipcdetail::create_open_func create_open_func_t; - typedef ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper - , AllocationAlgorithm::Alignment> managed_open_or_create_type; + typedef ipcdetail::create_open_func create_open_func_t; basic_managed_mapped_file *get_this_pointer() { return this; } @@ -75,16 +79,16 @@ class basic_managed_mapped_file public: //functions - //!Creates mapped file and creates and places the segment manager. + //!Creates mapped file and creates and places the segment manager. //!This can throw. basic_managed_mapped_file() {} - //!Creates mapped file and creates and places the segment manager. + //!Creates mapped file and creates and places the segment manager. //!This can throw. - basic_managed_mapped_file(create_only_t create_only, const char *name, + basic_managed_mapped_file(create_only_t, const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_mfile(create_only, name, size, read_write, addr, + : m_mfile(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -92,40 +96,40 @@ class basic_managed_mapped_file //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_mapped_file (open_or_create_t open_or_create, - const char *name, size_type size, + basic_managed_mapped_file (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) : m_mfile(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created mapped file and its segment manager. //!This can throw. - basic_managed_mapped_file (open_only_t open_only, const char* name, + basic_managed_mapped_file (open_only_t, const char* name, const void *addr = 0) : m_mfile(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created mapped file and its segment manager //!in copy_on_write mode. //!This can throw. - basic_managed_mapped_file (open_copy_on_write_t, const char* name, + basic_managed_mapped_file (open_copy_on_write_t, const char* name, const void *addr = 0) - : m_mfile(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), + : m_mfile(open_only, name, copy_on_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created mapped file and its segment manager //!in read-only mode. //!This can throw. - basic_managed_mapped_file (open_read_only_t, const char* name, + basic_managed_mapped_file (open_read_only_t, const char* name, const void *addr = 0) - : m_mfile(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), + : m_mfile(open_only, name, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -167,8 +171,8 @@ class basic_managed_mapped_file bool flush() { return m_mfile.flush(); } - //!Tries to resize mapped file so that we have room for - //!more objects. + //!Tries to resize mapped file so that we have room for + //!more objects. //! //!This function is not synchronized so no other thread or process should //!be reading or writing the file @@ -205,7 +209,7 @@ class basic_managed_mapped_file } private: - managed_open_or_create_type m_mfile; + typename ipcdetail::mfile_open_or_create::type m_mfile; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp index cec9591be..c20f39ca3 100644 --- a/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -25,37 +25,43 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include namespace boost { - namespace interprocess { -//!A basic shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +namespace ipcdetail { + +template +struct shmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < shared_memory_object, AllocationAlgorithm::Alignment, true, false> type; +}; + +} //namespace ipcdetail { + +//!A basic shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_shared_memory +class basic_managed_shared_memory : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> - , private ipcdetail::managed_open_or_create_impl + ,ipcdetail::shmem_open_or_create::type::ManagedOpenOrCreateUserOffset> + , private ipcdetail::shmem_open_or_create::type { /// @cond - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> base_t; - typedef ipcdetail::managed_open_or_create_impl - base2_t; + ipcdetail::shmem_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; + typedef typename ipcdetail::shmem_open_or_create::type base2_t; typedef ipcdetail::create_open_func create_open_func_t; @@ -87,12 +93,12 @@ class basic_managed_shared_memory basic_managed_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. - basic_managed_shared_memory(create_only_t create_only, const char *name, + basic_managed_shared_memory(create_only_t, const char *name, size_type size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(create_only, name, size, read_write, addr, + , base2_t(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -100,44 +106,44 @@ class basic_managed_shared_memory //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_shared_memory (open_or_create_t open_or_create, - const char *name, size_type size, + basic_managed_shared_memory (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!in copy_on_write mode. //!This can throw. - basic_managed_shared_memory (open_copy_on_write_t, const char* name, + basic_managed_shared_memory (open_copy_on_write_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, copy_on_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!in read-only mode. //!This can throw. - basic_managed_shared_memory (open_read_only_t, const char* name, + basic_managed_shared_memory (open_read_only_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!This can throw. - basic_managed_shared_memory (open_only_t open_only, const char* name, + basic_managed_shared_memory (open_only_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -168,7 +174,7 @@ class basic_managed_shared_memory } //!Tries to resize the managed shared memory object so that we have - //!room for more objects. + //!room for more objects. //! //!This function is not synchronized so no other thread or process should //!be reading or writing the file @@ -187,12 +193,6 @@ class basic_managed_shared_memory return base_t::template shrink_to_fit (shmname); } - - bool flush() - { - return this->base2_t::flush(); - } - /// @cond //!Tries to find a previous named allocation address. Returns a memory diff --git a/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp index 959194cc1..e553a707c 100644 --- a/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -25,15 +25,26 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include namespace boost { namespace interprocess { -//!A basic managed windows shared memory creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +namespace ipcdetail { + +template +struct wshmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < windows_shared_memory, AllocationAlgorithm::Alignment, false, false> type; +}; + +} //namespace ipcdetail { + +//!A basic managed windows shared memory creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl //!Unlike basic_managed_shared_memory, it has //!no kernel persistence and the shared memory is destroyed @@ -45,25 +56,20 @@ namespace interprocess { //!basic_managed_shared_memory can't communicate between them. template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_windows_shared_memory +class basic_managed_windows_shared_memory : public ipcdetail::basic_managed_memory_impl < CharType, AllocationAlgorithm, IndexType - , ipcdetail::managed_open_or_create_impl - < windows_shared_memory - , AllocationAlgorithm::Alignment - , false>::ManagedOpenOrCreateUserOffset - > + , ipcdetail::wshmem_open_or_create::type::ManagedOpenOrCreateUserOffset> { /// @cond private: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> base_t; + ipcdetail::wshmem_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; typedef ipcdetail::create_open_func create_open_func_t; basic_managed_windows_shared_memory *get_this_pointer() @@ -82,12 +88,12 @@ class basic_managed_windows_shared_memory basic_managed_windows_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. basic_managed_windows_shared_memory - (create_only_t create_only, const char *name, + (create_only_t, const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_wshm(create_only, name, size, read_write, addr, + : m_wshm(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -96,21 +102,21 @@ class basic_managed_windows_shared_memory //!segment. //!This can throw. basic_managed_windows_shared_memory - (open_or_create_t open_or_create, - const char *name, size_type size, + (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_wshm(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + : m_wshm(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!This can throw. basic_managed_windows_shared_memory - (open_only_t open_only, const char* name, const void *addr = 0) - : m_wshm(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + (open_only_t, const char* name, const void *addr = 0) + : m_wshm(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -119,7 +125,7 @@ class basic_managed_windows_shared_memory //!This can throw. basic_managed_windows_shared_memory (open_copy_on_write_t, const char* name, const void *addr = 0) - : m_wshm(open_only, name, copy_on_write, addr, + : m_wshm(open_only, name, copy_on_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -129,7 +135,7 @@ class basic_managed_windows_shared_memory basic_managed_windows_shared_memory (open_read_only_t, const char* name, const void *addr = 0) : base_t() - , m_wshm(open_only, name, read_only, addr, + , m_wshm(open_only, name, read_only, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -181,8 +187,7 @@ class basic_managed_windows_shared_memory } private: - ipcdetail::managed_open_or_create_impl< windows_shared_memory - , AllocationAlgorithm::Alignment, false> m_wshm; + typename ipcdetail::wshmem_open_or_create::type m_wshm; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp index 960192025..4ec7eba8d 100644 --- a/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // @@ -28,7 +28,7 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include @@ -36,32 +36,39 @@ namespace boost { namespace interprocess { -//!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from -//!basic_managed_memory_impl*/ +namespace ipcdetail { + +template +struct xsishmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl //!FileBased, StoreDevice + < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> type; +}; + +} //namespace ipcdetail { + +//!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from +//!basic_managed_memory_impl template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_xsi_shared_memory +class basic_managed_xsi_shared_memory : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> - , private ipcdetail::managed_open_or_create_impl - + ,ipcdetail::xsishmem_open_or_create::type::ManagedOpenOrCreateUserOffset> + , private ipcdetail::xsishmem_open_or_create::type { /// @cond public: typedef xsi_shared_memory_file_wrapper device_type; public: - typedef ipcdetail::managed_open_or_create_impl - base2_t; - typedef ipcdetail::basic_managed_memory_impl + typedef typename ipcdetail::xsishmem_open_or_create::type base2_t; + typedef ipcdetail::basic_managed_memory_impl base_t; @@ -92,12 +99,12 @@ class basic_managed_xsi_shared_memory basic_managed_xsi_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. - basic_managed_xsi_shared_memory(create_only_t create_only, const xsi_key &key, + basic_managed_xsi_shared_memory(create_only_t, const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(create_only, key, size, read_write, addr, + , base2_t(create_only, key, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -105,33 +112,33 @@ class basic_managed_xsi_shared_memory //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_xsi_shared_memory (open_or_create_t open_or_create, - const xsi_key &key, std::size_t size, + basic_managed_xsi_shared_memory (open_or_create_t, + const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(open_or_create, key, size, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_or_create, key, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!in read-only mode. //!This can throw. - basic_managed_xsi_shared_memory (open_read_only_t, const xsi_key &key, + basic_managed_xsi_shared_memory (open_read_only_t, const xsi_key &key, const void *addr = 0) : base_t() - , base2_t(open_only, key, read_only, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, key, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!This can throw. - basic_managed_xsi_shared_memory (open_only_t open_only, const xsi_key &key, + basic_managed_xsi_shared_memory (open_only_t, const xsi_key &key, const void *addr = 0) : base_t() - , base2_t(open_only, key, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, key, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} diff --git a/project/jni/boost/include/boost/interprocess/mapped_region.hpp b/project/jni/boost/include/boost/interprocess/mapped_region.hpp index eae3f3622..6a3366f49 100644 --- a/project/jni/boost/include/boost/interprocess/mapped_region.hpp +++ b/project/jni/boost/include/boost/interprocess/mapped_region.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -20,10 +20,23 @@ #include #include #include -#include +#include +//Some Unixes use caddr_t instead of void * in madvise +// SunOS Tru64 HP-UX AIX +#if defined(sun) || defined(__sun) || defined(__osf__) || defined(__osf) || defined(_hpux) || defined(hpux) || defined(_AIX) +#define BOOST_INTERPROCESS_MADVISE_USES_CADDR_T +#include +#endif -#if (defined BOOST_INTERPROCESS_WINDOWS) +//A lot of UNIXes have destructive semantics for MADV_DONTNEED, so +//we need to be careful to allow it. +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) +#define BOOST_INTERPROCESS_MADV_DONTNEED_HAS_NONDESTRUCTIVE_SEMANTICS +#endif + +#if defined (BOOST_INTERPROCESS_WINDOWS) # include +# include #else # ifdef BOOST_HAS_UNISTD_H # include @@ -48,6 +61,13 @@ namespace boost { namespace interprocess { /// @cond + +//Solaris declares madvise only in some configurations but defines MADV_XXX, a bit confusing. +//Predeclare it here to avoid any compilation error +#if (defined(sun) || defined(__sun)) && defined(MADV_NORMAL) +extern "C" int madvise(caddr_t, size_t, int); +#endif + namespace ipcdetail{ class interprocess_tester; } namespace ipcdetail{ class raw_mapped_region_creator; } @@ -55,6 +75,10 @@ namespace ipcdetail{ class raw_mapped_region_creator; } //!The mapped_region class represents a portion or region created from a //!memory_mappable object. +//! +//!The OS can map a region bigger than the requested one, as region must +//!be multiple of the page size, but mapped_region will always refer to +//!the region specified by the user. class mapped_region { /// @cond @@ -65,9 +89,15 @@ class mapped_region public: //!Creates a mapping region of the mapped memory "mapping", starting in - //!offset "offset", and the mapping's size will be "size". The mapping - //!can be opened for read-only "read_only" or read-write - //!"read_write. + //!offset "offset", and the mapping's size will be "size". The mapping + //!can be opened for read only, read-write or copy-on-write. + //! + //!If an address is specified, both the offset and the address must be + //!multiples of the page size. + //! + //!The OS could allocate more pages than size/page_size(), but get_address() + //!will always return the address passed in this function (if not null) and + //!get_size() will return the specified size. template mapped_region(const MemoryMappable& mapping ,mode_t mode @@ -75,8 +105,8 @@ class mapped_region ,std::size_t size = 0 ,const void *address = 0); - //!Default constructor. Default constructor. Address will be 0 (nullptr). - //!Size and offset will be 0. + //!Default constructor. Address will be 0 (nullptr). + //!Size will be 0. //!Does not throw mapped_region(); @@ -84,12 +114,12 @@ class mapped_region //!region and "other" will be left in default constructor state. mapped_region(BOOST_RV_REF(mapped_region) other) #if defined (BOOST_INTERPROCESS_WINDOWS) - : m_base(0), m_size(0), m_offset(0) - , m_extra_offset(0) + : m_base(0), m_size(0) + , m_page_offset(0) , m_mode(read_only) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) #else - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only), m_is_xsi(false) #endif { this->swap(other); } @@ -106,33 +136,67 @@ class mapped_region return *this; } - //!Returns the size of the mapping. Note for windows users: If - //!windows_shared_memory is mapped using 0 as the size, it returns 0 - //!because the size is unknown. Never throws. + //!Swaps the mapped_region with another + //!mapped region + void swap(mapped_region &other); + + //!Returns the size of the mapping. Never throws. std::size_t get_size() const; //!Returns the base address of the mapping. //!Never throws. void* get_address() const; - //!Returns the offset of the mapping from the beginning of the - //!mapped memory. Never throws. - offset_t get_offset() const; - - //!Returns the mode of the mapping used to construct the mapped file. + //!Returns the mode of the mapping used to construct the mapped region. //!Never throws. mode_t get_mode() const; - //!Flushes to the disk a byte range within the mapped memory. - //!Never throws - bool flush(std::size_t mapping_offset = 0, std::size_t numbytes = 0); + //!Flushes to the disk a byte range within the mapped memory. + //!If 'async' is true, the function will return before flushing operation is completed + //!If 'async' is false, function will return once data has been written into the underlying + //!device (i.e., in mapped files OS cached information is written to disk). + //!Never throws. Returns false if operation could not be performed. + bool flush(std::size_t mapping_offset = 0, std::size_t numbytes = 0, bool async = true); - //!Swaps the mapped_region with another - //!mapped region - void swap(mapped_region &other); + //!Shrinks current mapped region. If after shrinking there is no longer need for a previously + //!mapped memory page, accessing that page can trigger a segmentation fault. + //!Depending on the OS, this operation might fail (XSI shared memory), it can decommit storage + //!and free a portion of the virtual address space (e.g.POSIX) or this + //!function can release some physical memory wihout freeing any virtual address space(Windows). + //!Returns true on success. Never throws. + bool shrink_by(std::size_t bytes, bool from_back = true); + + //!This enum specifies region usage behaviors that an application can specify + //!to the mapped region implementation. + enum advice_types{ + //!Specifies that the application has no advice to give on its behavior with respect to + //!the region. It is the default characteristic if no advice is given for a range of memory. + advice_normal, + //!Specifies that the application expects to access the region sequentially from + //!lower addresses to higher addresses. The implementation can lower the priority of + //!preceding pages within the region once a page have been accessed. + advice_sequential, + //!Specifies that the application expects to access the region in a random order, + //!and prefetching is likely not advantageous. + advice_random, + //!Specifies that the application expects to access the region in the near future. + //!The implementation can prefetch pages of the region. + advice_willneed, + //!Specifies that the application expects that it will not access the region in the near future. + //!The implementation can unload pages within the range to save system resources. + advice_dontneed + }; + + //!Advises the implementation on the expected behavior of the application with respect to the data + //!in the region. The implementation may use this information to optimize handling of the region data. + //!This function has no effect on the semantics of access to memory in the region, although it may affect + //!the performance of access. + //!If the advise type is not known to the implementation, the function returns false. True otherwise. + bool advise(advice_types advise); //!Returns the size of the page. This size is the minimum memory that - //!will be used by the system when mapping a memory mappable source. + //!will be used by the system when mapping a memory mappable source and + //!will restrict the address and the offset to map. static std::size_t get_page_size(); /// @cond @@ -140,6 +204,14 @@ class mapped_region //!Closes a previously opened memory mapping. Never throws void priv_close(); + void* priv_map_address() const; + std::size_t priv_map_size() const; + bool priv_flush_param_check(std::size_t mapping_offset, void *&addr, std::size_t &numbytes) const; + bool priv_shrink_param_check(std::size_t bytes, bool from_back, void *&shrink_page_start, std::size_t &shrink_page_bytes); + static void priv_size_from_mapping_size + (offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size); + static offset_t priv_page_offset_addr_fixup(offset_t page_offset, const void *&addr); + template struct page_size_holder { @@ -149,11 +221,10 @@ class mapped_region void* m_base; std::size_t m_size; - offset_t m_offset; - offset_t m_extra_offset; + std::size_t m_page_offset; mode_t m_mode; - #if (defined BOOST_INTERPROCESS_WINDOWS) - file_handle_t m_file_mapping_hnd; + #if defined(BOOST_INTERPROCESS_WINDOWS) + file_handle_t m_file_or_mapping_hnd; #else bool m_is_xsi; #endif @@ -161,6 +232,10 @@ class mapped_region friend class ipcdetail::interprocess_tester; friend class ipcdetail::raw_mapped_region_creator; void dont_close_on_destruction(); + #if defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + template + static void destroy_syncs_in_range(const void *addr, std::size_t size); + #endif /// @endcond }; @@ -175,20 +250,106 @@ inline mapped_region::~mapped_region() inline std::size_t mapped_region::get_size() const { return m_size; } -inline offset_t mapped_region::get_offset() const -{ return m_offset; } - inline mode_t mapped_region::get_mode() const { return m_mode; } inline void* mapped_region::get_address() const { return m_base; } +inline void* mapped_region::priv_map_address() const +{ return static_cast(m_base) - m_page_offset; } + +inline std::size_t mapped_region::priv_map_size() const +{ return m_size + m_page_offset; } + +inline bool mapped_region::priv_flush_param_check + (std::size_t mapping_offset, void *&addr, std::size_t &numbytes) const +{ + //Check some errors + if(m_base == 0) + return false; + + if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){ + return false; + } + + //Update flush size if the user does not provide it + if(numbytes == 0){ + numbytes = m_size - mapping_offset; + } + addr = (char*)this->priv_map_address() + mapping_offset; + numbytes += m_page_offset; + return true; +} + +inline bool mapped_region::priv_shrink_param_check + (std::size_t bytes, bool from_back, void *&shrink_page_start, std::size_t &shrink_page_bytes) +{ + //Check some errors + if(m_base == 0 || bytes > m_size){ + return false; + } + else if(bytes == m_size){ + this->priv_close(); + return true; + } + else{ + const std::size_t page_size = mapped_region::get_page_size(); + if(from_back){ + const std::size_t new_pages = (m_size + m_page_offset - bytes - 1)/page_size + 1; + shrink_page_start = static_cast(this->priv_map_address()) + new_pages*page_size; + shrink_page_bytes = m_page_offset + m_size - new_pages*page_size; + m_size -= bytes; + } + else{ + shrink_page_start = this->priv_map_address(); + m_page_offset += bytes; + shrink_page_bytes = (m_page_offset/page_size)*page_size; + m_page_offset = m_page_offset % page_size; + m_size -= bytes; + m_base = static_cast(m_base) + bytes; + assert(shrink_page_bytes%page_size == 0); + } + return true; + } +} + +inline void mapped_region::priv_size_from_mapping_size + (offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size) +{ + //Check if mapping size fits in the user address space + //as offset_t is the maximum file size and its signed. + if(mapping_size < offset || + boost::uintmax_t(mapping_size - (offset - page_offset)) > + boost::uintmax_t(std::size_t(-1))){ + error_info err(size_error); + throw interprocess_exception(err); + } + size = static_cast(mapping_size - (offset - page_offset)); +} + +inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, const void *&address) +{ + //We can't map any offset so we have to obtain system's + //memory granularity + const std::size_t page_size = mapped_region::get_page_size(); + + //We calculate the difference between demanded and valid offset + //(always less than a page in std::size_t, thus, representable by std::size_t) + const std::size_t page_offset = + static_cast(offset - (offset / page_size) * page_size); + //Update the mapping address + if(address){ + address = static_cast(address) - page_offset; + } + return page_offset; +} + #if defined (BOOST_INTERPROCESS_WINDOWS) inline mapped_region::mapped_region() - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) {} template @@ -206,169 +367,177 @@ inline mapped_region::mapped_region ,offset_t offset ,std::size_t size ,const void *address) - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + : m_base(0), m_size(0), m_page_offset(0), m_mode(mode) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) { mapping_handle_t mhandle = mapping.get_mapping_handle(); - file_handle_t native_mapping_handle = 0; - - //Set accesses - unsigned long file_map_access = 0; - unsigned long map_access = 0; - - switch(mode) { - case read_only: - case read_private: - file_map_access |= winapi::page_readonly; - map_access |= winapi::file_map_read; - break; - case read_write: - file_map_access |= winapi::page_readwrite; - map_access |= winapi::file_map_write; - break; - case copy_on_write: - file_map_access |= winapi::page_writecopy; - map_access |= winapi::file_map_copy; - break; - default: - { - error_info err(mode_error); + file_handle_t native_mapping_handle = 0; + + //Set accesses + //For "create_file_mapping" + unsigned long protection = 0; + //For "mapviewoffile" + unsigned long map_access = 0; + + switch(mode) + { + case read_only: + case read_private: + protection |= winapi::page_readonly; + map_access |= winapi::file_map_read; + break; + case read_write: + protection |= winapi::page_readwrite; + map_access |= winapi::file_map_write; + break; + case copy_on_write: + protection |= winapi::page_writecopy; + map_access |= winapi::file_map_copy; + break; + default: + { + error_info err(mode_error); + throw interprocess_exception(err); + } + break; + } + + //For file mapping (including emulated shared memory through temporary files), + //the device is a file handle so we need to obtain file's size and call create_file_mapping + //to obtain the mapping handle. + //For files we don't need the file mapping after mapping the memory, as the file is there + //so we'll program the handle close + void * handle_to_close = winapi::invalid_handle_value; + if(!mhandle.is_shm){ + //Create mapping handle + native_mapping_handle = winapi::create_file_mapping + ( ipcdetail::file_handle_from_mapping_handle(mapping.get_mapping_handle()) + , protection, 0, 0, 0); + + //Check if all is correct + if(!native_mapping_handle){ + error_info err = winapi::get_last_error(); throw interprocess_exception(err); } - break; - } + handle_to_close = native_mapping_handle; + } + else{ + //For windows_shared_memory the device handle is already a mapping handle + //and we need to maintain it + native_mapping_handle = mhandle.handle; + } + //RAII handle close on scope exit + const winapi::handle_closer close_handle(handle_to_close); + (void)close_handle; - if(!mhandle.is_shm){ - //Update mapping size if the user does not specify it + const offset_t page_offset = priv_page_offset_addr_fixup(offset, address); + + //Obtain mapping size if user provides 0 size if(size == 0){ - __int64 total_size; - if(!winapi::get_file_size - (ipcdetail::file_handle_from_mapping_handle - (mapping.get_mapping_handle()), total_size)){ - error_info err(winapi::get_last_error()); + offset_t mapping_size; + if(!winapi::get_file_mapping_size(native_mapping_handle, mapping_size)){ + error_info err = winapi::get_last_error(); throw interprocess_exception(err); } - - if(static_cast(total_size) > - (std::numeric_limits::max)()){ - error_info err(size_error); - throw interprocess_exception(err); - } - size = static_cast(total_size - offset); + //This can throw + priv_size_from_mapping_size(mapping_size, offset, page_offset, size); } - //Create file mapping - native_mapping_handle = - winapi::create_file_mapping - (ipcdetail::file_handle_from_mapping_handle(mapping.get_mapping_handle()), file_map_access, 0, 0, 0, 0); - //Check if all is correct - if(!native_mapping_handle){ + //Map with new offsets and size + void *base = winapi::map_view_of_file_ex + (native_mapping_handle, + map_access, + offset - page_offset, + static_cast(page_offset + size), + const_cast(address)); + //Check error + if(!base){ error_info err = winapi::get_last_error(); - this->priv_close(); throw interprocess_exception(err); } + + //Calculate new base for the user + m_base = static_cast(base) + page_offset; + m_page_offset = page_offset; + m_size = size; } - - //We can't map any offset so we have to obtain system's - //memory granularity - unsigned long granularity = 0; - unsigned long foffset_low; - unsigned long foffset_high; - - winapi::system_info info; - get_system_info(&info); - granularity = info.dwAllocationGranularity; - - //Now we calculate valid offsets - foffset_low = (unsigned long)(offset / granularity) * granularity; - foffset_high = (unsigned long)(((offset / granularity) * granularity) >> 32); - - //We calculate the difference between demanded and valid offset - m_extra_offset = (offset - (offset / granularity) * granularity); - - //Store user values in memory - m_offset = offset; - m_size = size; - - //Update the mapping address - if(address){ - address = static_cast(address) - m_extra_offset; - } - - if(mhandle.is_shm){ - //Windows shared memory needs the duplication of the handle if we want to - //make mapped_region independent from the mappable device - if(!winapi::duplicate_current_process_handle(mhandle.handle, &m_file_mapping_hnd)){ - error_info err = winapi::get_last_error(); - this->priv_close(); - throw interprocess_exception(err); - } - native_mapping_handle = m_file_mapping_hnd; - } - - //Map with new offsets and size - m_base = winapi::map_view_of_file_ex - (native_mapping_handle, - map_access, - foffset_high, - foffset_low, - m_size ? static_cast(m_extra_offset + m_size) : 0, - const_cast(address)); - - if(!mhandle.is_shm){ - //For files we don't need the file mapping anymore - winapi::close_handle(native_mapping_handle); - } - - //Check error - if(!m_base){ + //Windows shared memory needs the duplication of the handle if we want to + //make mapped_region independent from the mappable device + // + //For mapped files, we duplicate the file handle to be able to FlushFileBuffers + if(!winapi::duplicate_current_process_handle(mhandle.handle, &m_file_or_mapping_hnd)){ error_info err = winapi::get_last_error(); this->priv_close(); throw interprocess_exception(err); } - - //Calculate new base for the user - m_base = static_cast(m_base) + m_extra_offset; } -inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes) +inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool async) { - //Check some errors - if(m_base == 0) - return false; - - if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){ + void *addr; + if(!this->priv_flush_param_check(mapping_offset, addr, numbytes)){ return false; } - - //Update flush size if the user does not provide it - if(m_size == 0){ - numbytes = 0; - } - else if(numbytes == 0){ - numbytes = m_size - mapping_offset; - } - //Flush it all - return winapi::flush_view_of_file - (static_cast(m_base)+mapping_offset, - static_cast(numbytes)); + if(!winapi::flush_view_of_file(addr, numbytes)){ + return false; + } + //m_file_or_mapping_hnd can be a file handle or a mapping handle. + //so flushing file buffers has only sense for files... + else if(async && m_file_or_mapping_hnd != winapi::invalid_handle_value && + winapi::get_file_type(m_file_or_mapping_hnd) == winapi::file_type_disk){ + return winapi::flush_file_buffers(m_file_or_mapping_hnd); + } + return true; +} + +inline bool mapped_region::shrink_by(std::size_t bytes, bool from_back) +{ + void *shrink_page_start; + std::size_t shrink_page_bytes; + if(!this->priv_shrink_param_check(bytes, from_back, shrink_page_start, shrink_page_bytes)){ + return false; + } + else if(shrink_page_bytes){ + //In Windows, we can't decommit the storage or release the virtual address space, + //the best we can do is try to remove some memory from the process working set. + //With a bit of luck we can free some physical memory. + unsigned long old_protect_ignored; + bool b_ret = winapi::virtual_unlock(shrink_page_start, shrink_page_bytes) + || (winapi::get_last_error() == winapi::error_not_locked); + (void)old_protect_ignored; + //Change page protection to forbid any further access + b_ret = b_ret && winapi::virtual_protect + (shrink_page_start, shrink_page_bytes, winapi::page_noaccess, old_protect_ignored); + return b_ret; + } + else{ + return true; + } +} + +inline bool mapped_region::advise(advice_types) +{ + //Windows has no madvise/posix_madvise equivalent + return false; } inline void mapped_region::priv_close() { if(m_base){ - winapi::unmap_view_of_file(static_cast(m_base) - m_extra_offset); + void *addr = this->priv_map_address(); + #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + mapped_region::destroy_syncs_in_range<0>(addr, m_size); + #endif + winapi::unmap_view_of_file(addr); m_base = 0; } - #if (defined BOOST_INTERPROCESS_WINDOWS) - if(m_file_mapping_hnd != ipcdetail::invalid_file()){ - winapi::close_handle(m_file_mapping_hnd); - m_file_mapping_hnd = ipcdetail::invalid_file(); - } - #endif + if(m_file_or_mapping_hnd != ipcdetail::invalid_file()){ + winapi::close_handle(m_file_or_mapping_hnd); + m_file_or_mapping_hnd = ipcdetail::invalid_file(); + } } inline void mapped_region::dont_close_on_destruction() @@ -377,7 +546,7 @@ inline void mapped_region::dont_close_on_destruction() #else //#if (defined BOOST_INTERPROCESS_WINDOWS) inline mapped_region::mapped_region() - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only), m_is_xsi(false) {} template @@ -391,7 +560,7 @@ inline mapped_region::mapped_region , offset_t offset , std::size_t size , const void *address) - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(mode), m_is_xsi(false) { mapping_handle_t map_hnd = mapping.get_mapping_handle(); @@ -430,33 +599,36 @@ inline mapped_region::mapped_region } //Update members m_base = base; - m_offset = offset; m_size = size; m_mode = mode; - m_extra_offset = 0; + m_page_offset = 0; m_is_xsi = true; return; } #endif //ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + + //We calculate the difference between demanded and valid offset + const offset_t page_offset = priv_page_offset_addr_fixup(offset, address); + if(size == 0){ struct ::stat buf; if(0 != fstat(map_hnd.handle, &buf)){ error_info err(system_error_code()); throw interprocess_exception(err); } - std::size_t filesize = (std::size_t)buf.st_size; - if((std::size_t)offset >= filesize){ - error_info err(size_error); - throw interprocess_exception(err); - } - - filesize -= offset; - size = filesize; + //This can throw + priv_size_from_mapping_size(buf.st_size, offset, page_offset, size); } //Create new mapping int prot = 0; - int flags = 0; + int flags = + #ifdef MAP_NOSYNC + //Avoid excessive syncing in BSD systems + MAP_NOSYNC; + #else + 0; + #endif switch(mode) { @@ -488,35 +660,23 @@ inline mapped_region::mapped_region break; } - //We calculate the difference between demanded and valid offset - const std::size_t page_size = this->get_page_size(); - const offset_t extra_offset = offset - (offset / page_size) * page_size; - - - //Update the mapping address - if(address){ - address = static_cast(address) - extra_offset; - } - //Map it to the address space void* base = mmap ( const_cast(address) - , static_cast(extra_offset + size) + , static_cast(page_offset + size) , prot , flags , mapping.get_mapping_handle().handle - , offset - extra_offset); + , offset - page_offset); //Check if mapping was successful if(base == MAP_FAILED){ error_info err = system_error_code(); - this->priv_close(); throw interprocess_exception(err); } //Calculate new base for the user - m_base = static_cast(base) + extra_offset; - m_extra_offset = extra_offset; - m_offset = offset; + m_base = static_cast(base) + page_offset; + m_page_offset = page_offset; m_size = size; //Check for fixed mapping error @@ -527,17 +687,107 @@ inline mapped_region::mapped_region } } -inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes) +inline bool mapped_region::shrink_by(std::size_t bytes, bool from_back) { - if(mapping_offset >= m_size || (mapping_offset+numbytes)> m_size){ + void *shrink_page_start = 0; + std::size_t shrink_page_bytes = 0; + if(m_is_xsi || !this->priv_shrink_param_check(bytes, from_back, shrink_page_start, shrink_page_bytes)){ return false; } + else if(shrink_page_bytes){ + //In UNIX we can decommit and free virtual address space. + return 0 == munmap(shrink_page_start, shrink_page_bytes); + } + else{ + return true; + } +} - if(numbytes == 0){ - numbytes = m_size - mapping_offset; +inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool async) +{ + void *addr; + if(m_is_xsi || !this->priv_flush_param_check(mapping_offset, addr, numbytes)){ + return false; } //Flush it all - return msync(static_cast(m_base)+mapping_offset, numbytes, MS_ASYNC) == 0; + return msync(addr, numbytes, async ? MS_ASYNC : MS_SYNC) == 0; +} + +inline bool mapped_region::advise(advice_types advice) +{ + int unix_advice = 0; + //Modes; 0: none, 2: posix, 1: madvise + const unsigned int mode_none = 0; + const unsigned int mode_padv = 1; + const unsigned int mode_madv = 2; + unsigned int mode = mode_none; + //Choose advice either from POSIX (preferred) or native Unix + switch(advice){ + case advice_normal: + #if defined(POSIX_MADV_NORMAL) + unix_advice = POSIX_MADV_NORMAL; + mode = mode_padv; + #elif defined(MADV_NORMAL) + unix_advice = MADV_NORMAL; + mode = mode_madv; + #endif + break; + case advice_sequential: + #if defined(POSIX_MADV_SEQUENTIAL) + unix_advice = POSIX_MADV_SEQUENTIAL; + mode = mode_padv; + #elif defined(MADV_SEQUENTIAL) + unix_advice = MADV_SEQUENTIAL; + mode = mode_madv; + #endif + break; + case advice_random: + #if defined(POSIX_MADV_RANDOM) + unix_advice = POSIX_MADV_RANDOM; + mode = mode_padv; + #elif defined(MADV_RANDOM) + unix_advice = MADV_RANDOM; + mode = mode_madv; + #endif + break; + case advice_willneed: + #if defined(POSIX_MADV_WILLNEED) + unix_advice = POSIX_MADV_WILLNEED; + mode = mode_padv; + #elif defined(MADV_WILLNEED) + unix_advice = MADV_WILLNEED; + mode = mode_madv; + #endif + break; + case advice_dontneed: + #if defined(POSIX_MADV_DONTNEED) + unix_advice = POSIX_MADV_DONTNEED; + mode = mode_padv; + #elif defined(MADV_DONTNEED) && defined(BOOST_INTERPROCESS_MADV_DONTNEED_HAS_NONDESTRUCTIVE_SEMANTICS) + unix_advice = MADV_DONTNEED; + mode = mode_madv; + #endif + break; + default: + return false; + } + switch(mode){ + #if defined(POSIX_MADV_NORMAL) + case mode_padv: + return 0 == posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice); + #endif + #if defined(MADV_NORMAL) + case mode_madv: + return 0 == madvise( + #if defined(BOOST_INTERPROCESS_MADVISE_USES_CADDR_T) + (caddr_t) + #endif + this->priv_map_address(), this->priv_map_size(), unix_advice); + #endif + default: + return false; + + } } inline void mapped_region::priv_close() @@ -551,7 +801,7 @@ inline void mapped_region::priv_close() return; } #endif //#ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS - munmap(static_cast(m_base) - m_extra_offset, m_size + m_extra_offset); + munmap(this->priv_map_address(), this->priv_map_size()); m_base = 0; } } @@ -577,11 +827,10 @@ inline void mapped_region::swap(mapped_region &other) { ipcdetail::do_swap(this->m_base, other.m_base); ipcdetail::do_swap(this->m_size, other.m_size); - ipcdetail::do_swap(this->m_offset, other.m_offset); - ipcdetail::do_swap(this->m_extra_offset, other.m_extra_offset); + ipcdetail::do_swap(this->m_page_offset, other.m_page_offset); ipcdetail::do_swap(this->m_mode, other.m_mode); #if (defined BOOST_INTERPROCESS_WINDOWS) - ipcdetail::do_swap(this->m_file_mapping_hnd, other.m_file_mapping_hnd); + ipcdetail::do_swap(this->m_file_or_mapping_hnd, other.m_file_or_mapping_hnd); #else ipcdetail::do_swap(this->m_is_xsi, other.m_is_xsi); #endif @@ -592,6 +841,9 @@ struct null_mapped_region_function { bool operator()(void *, std::size_t , bool) const { return true; } + + std::size_t get_min_size() const + { return 0; } }; /// @endcond @@ -603,3 +855,32 @@ struct null_mapped_region_function #endif //BOOST_INTERPROCESS_MAPPED_REGION_HPP +#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) + +#ifndef BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP +#define BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP + +#if defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) +# include +# include + +namespace boost { +namespace interprocess { + +template +inline void mapped_region::destroy_syncs_in_range(const void *addr, std::size_t size) +{ + ipcdetail::sync_handles &handles = + ipcdetail::windows_intermodule_singleton::get(); + handles.destroy_syncs_in_range(addr, size); +} + +} //namespace interprocess { +} //namespace boost { + +#endif //defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + +#endif //#ifdef BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP + +#endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) + diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp index d609f46ae..a6936ec3d 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,37 @@ namespace boost { namespace interprocess { namespace ipcdetail { +template +class basic_multiallocation_chain + : public boost::container::container_detail:: + basic_multiallocation_chain +{ + BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain) + typedef boost::container::container_detail:: + basic_multiallocation_chain base_t; + public: + + basic_multiallocation_chain() + : base_t() + {} + + basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other) + : base_t(::boost::move(static_cast(other))) + {} + + basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other) + { + this->base_t::operator=(::boost::move(static_cast(other))); + return *this; + } + + void *pop_front() + { + return boost::interprocess::ipcdetail::to_raw_pointer(this->base_t::pop_front()); + } +}; + + //!This class implements several allocation functions shared by different algorithms //!(aligned allocation, multiple allocation...). template @@ -81,15 +113,15 @@ class memory_algorithm_common static size_type multiple_of_units(size_type size) { return get_rounded_size(size, Alignment); } - static multiallocation_chain allocate_many - (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements) + static void allocate_many + (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) { - return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0); + return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0, chain); } - static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain) + static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) { - return this_type::priv_deallocate_many(memory_algo, boost::move(chain)); + return this_type::priv_deallocate_many(memory_algo, chain); } static bool calculate_lcm_and_needs_backwards_lcmed @@ -117,7 +149,7 @@ class memory_algorithm_common lcm_val = max; //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the + //and minbytes if maxbytes can't be achieved, calculate the //biggest of all possibilities current_forward = get_truncated_size_po2(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; @@ -176,7 +208,7 @@ class memory_algorithm_common lcm_val = lcm(max, min); } //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the + //and minbytes if maxbytes can't be achieved, calculate the //biggest of all possibilities current_forward = get_truncated_size(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; @@ -187,19 +219,20 @@ class memory_algorithm_common return true; } - static multiallocation_chain allocate_many + static void allocate_many ( MemoryAlgorithm *memory_algo , const size_type *elem_sizes , size_type n_elements - , size_type sizeof_element) + , size_type sizeof_element + , multiallocation_chain &chain) { - return this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element); + this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element, chain); } static void* allocate_aligned (MemoryAlgorithm *memory_algo, size_type nbytes, size_type alignment) { - + //Ensure power of 2 if ((alignment & (alignment - size_type(1u))) != 0){ //Alignment is not power of two @@ -215,7 +248,7 @@ class memory_algorithm_common if(nbytes > UsableByPreviousChunk) nbytes -= UsableByPreviousChunk; - + //We can find a aligned portion if we allocate a block that has alignment //nbytes + alignment bytes or more. size_type minimum_allocation = max_value @@ -223,13 +256,13 @@ class memory_algorithm_common //Since we will split that block, we must request a bit more memory //if the alignment is near the beginning of the buffer, because otherwise, //there is no space for a new block before the alignment. - // + // // ____ Aligned here // | // ----------------------------------------------------- - // | MBU | + // | MBU | // ----------------------------------------------------- - size_type request = + size_type request = minimum_allocation + (2*MinBlockUnits*Alignment - AllocatedCtrlBytes //prevsize - UsableByPreviousChunk ); @@ -263,7 +296,7 @@ class memory_algorithm_common } //Buffer not aligned, find the aligned part. - // + // // ____ Aligned here // | // ----------------------------------------------------- @@ -324,7 +357,7 @@ class memory_algorithm_common return memory_algo->priv_get_user_buffer(second); } - static bool try_shrink + static bool try_shrink (MemoryAlgorithm *memory_algo, void *ptr ,const size_type max_size, const size_type preferred_size ,size_type &received_size) @@ -361,8 +394,8 @@ class memory_algorithm_common if(old_user_units == preferred_user_units) return true; - size_type shrunk_user_units = - ((BlockCtrlUnits - AllocatedCtrlUnits) > preferred_user_units) + size_type shrunk_user_units = + ((BlockCtrlUnits - AllocatedCtrlUnits) >= preferred_user_units) ? (BlockCtrlUnits - AllocatedCtrlUnits) : preferred_user_units; @@ -380,7 +413,7 @@ class memory_algorithm_common return true; } - static bool shrink + static bool shrink (MemoryAlgorithm *memory_algo, void *ptr ,const size_type max_size, const size_type preferred_size ,size_type &received_size) @@ -389,7 +422,7 @@ class memory_algorithm_common block_ctrl *block = memory_algo->priv_get_block(ptr); size_type old_block_units = (size_type)block->m_size; - if(!try_shrink + if(!try_shrink (memory_algo, ptr, max_size, preferred_size, received_size)){ return false; } @@ -416,11 +449,12 @@ class memory_algorithm_common } private: - static multiallocation_chain priv_allocate_many + static void priv_allocate_many ( MemoryAlgorithm *memory_algo , const size_type *elem_sizes , size_type n_elements - , size_type sizeof_element) + , size_type sizeof_element + , multiallocation_chain &chain) { //Note: sizeof_element == 0 indicates that we want to //allocate n_elements of the same size "*elem_sizes" @@ -436,111 +470,114 @@ class memory_algorithm_common } else{ for(size_type i = 0; i < n_elements; ++i){ + if(multiplication_overflows(elem_sizes[i], sizeof_element)){ + total_request_units = 0; + break; + } elem_units = memory_algo->priv_get_total_units(elem_sizes[i]*sizeof_element); elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; + if(sum_overflows(total_request_units, elem_units)){ + total_request_units = 0; + break; + } total_request_units += elem_units; } } - multiallocation_chain chain; + if(total_request_units && !multiplication_overflows(total_request_units, Alignment)){ + size_type low_idx = 0; + while(low_idx < n_elements){ + size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; + size_type min_allocation = (!sizeof_element) + ? elem_units + : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); + min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type low_idx = 0; - while(low_idx < n_elements){ - size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type min_allocation = (!sizeof_element) - ? elem_units - : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - - size_type received_size; - std::pair ret = memory_algo->priv_allocate - (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0); - if(!ret.first){ - break; - } - - block_ctrl *block = memory_algo->priv_get_block(ret.first); - size_type received_units = (size_type)block->m_size; - char *block_address = reinterpret_cast(block); - - size_type total_used_units = 0; -// block_ctrl *prev_block = 0; - while(total_used_units < received_units){ - if(sizeof_element){ - elem_units = memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; - } - if(total_used_units + elem_units > received_units) + size_type received_size; + std::pair ret = memory_algo->priv_allocate + (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0); + if(!ret.first){ break; - total_request_units -= elem_units; - //This is the position where the new block must be created - block_ctrl *new_block = reinterpret_cast(block_address); - assert_alignment(new_block); + } - //The last block should take all the remaining space - if((low_idx + 1) == n_elements || - (total_used_units + elem_units + - ((!sizeof_element) - ? elem_units - : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units)) - ) > received_units){ - //By default, the new block will use the rest of the buffer - new_block->m_size = received_units - total_used_units; - memory_algo->priv_mark_new_allocated_block(new_block); + block_ctrl *block = memory_algo->priv_get_block(ret.first); + size_type received_units = (size_type)block->m_size; + char *block_address = reinterpret_cast(block); - //If the remaining units are bigger than needed and we can - //split it obtaining a new free memory block do it. - if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){ - size_type shrunk_received; - size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - bool shrink_ok = shrink - (memory_algo - ,memory_algo->priv_get_user_buffer(new_block) - ,shrunk_request - ,shrunk_request - ,shrunk_received); - (void)shrink_ok; - //Shrink must always succeed with passed parameters - BOOST_ASSERT(shrink_ok); - //Some sanity checks - BOOST_ASSERT(shrunk_request == shrunk_received); - BOOST_ASSERT(elem_units == ((shrunk_request-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits)); - //"new_block->m_size" must have been reduced to elem_units by "shrink" - BOOST_ASSERT(new_block->m_size == elem_units); - //Now update the total received units with the reduction - received_units = elem_units + total_used_units; + size_type total_used_units = 0; + while(total_used_units < received_units){ + if(sizeof_element){ + elem_units = memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); + elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; } - } - else{ - new_block->m_size = elem_units; - memory_algo->priv_mark_new_allocated_block(new_block); - } + if(total_used_units + elem_units > received_units) + break; + total_request_units -= elem_units; + //This is the position where the new block must be created + block_ctrl *new_block = reinterpret_cast(block_address); + assert_alignment(new_block); - block_address += new_block->m_size*Alignment; - total_used_units += (size_type)new_block->m_size; - //Check we have enough room to overwrite the intrusive pointer - BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); - void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0); - chain.push_back(p); - ++low_idx; - //prev_block = new_block; + //The last block should take all the remaining space + if((low_idx + 1) == n_elements || + (total_used_units + elem_units + + ((!sizeof_element) + ? elem_units + : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units)) + ) > received_units){ + //By default, the new block will use the rest of the buffer + new_block->m_size = received_units - total_used_units; + memory_algo->priv_mark_new_allocated_block(new_block); + + //If the remaining units are bigger than needed and we can + //split it obtaining a new free memory block do it. + if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){ + size_type shrunk_received; + size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; + bool shrink_ok = shrink + (memory_algo + ,memory_algo->priv_get_user_buffer(new_block) + ,shrunk_request + ,shrunk_request + ,shrunk_received); + (void)shrink_ok; + //Shrink must always succeed with passed parameters + BOOST_ASSERT(shrink_ok); + //Some sanity checks + BOOST_ASSERT(shrunk_request == shrunk_received); + BOOST_ASSERT(elem_units == ((shrunk_request-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits)); + //"new_block->m_size" must have been reduced to elem_units by "shrink" + BOOST_ASSERT(new_block->m_size == elem_units); + //Now update the total received units with the reduction + received_units = elem_units + total_used_units; + } + } + else{ + new_block->m_size = elem_units; + memory_algo->priv_mark_new_allocated_block(new_block); + } + + block_address += new_block->m_size*Alignment; + total_used_units += (size_type)new_block->m_size; + //Check we have enough room to overwrite the intrusive pointer + BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); + void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0); + chain.push_back(p); + ++low_idx; + } + //Sanity check + BOOST_ASSERT(total_used_units == received_units); + } + + if(low_idx != n_elements){ + priv_deallocate_many(memory_algo, chain); } - //Sanity check - BOOST_ASSERT(total_used_units == received_units); } - - if(low_idx != n_elements){ - priv_deallocate_many(memory_algo, boost::move(chain)); - } - return boost::move(chain); } - static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain) + static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) { while(!chain.empty()){ - void *addr = to_raw_pointer(chain.front()); - chain.pop_front(); - memory_algo->priv_deallocate(addr); + memory_algo->priv_deallocate(to_raw_pointer(chain.pop_front())); } } }; diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp index 378cd82fd..1fb95a5bd 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -60,7 +60,7 @@ class simple_seq_fit_impl simple_seq_fit_impl(); simple_seq_fit_impl(const simple_seq_fit_impl &); simple_seq_fit_impl &operator=(const simple_seq_fit_impl &); - + typedef typename boost::intrusive:: pointer_traits::template rebind_pointer::type char_ptr; @@ -93,10 +93,10 @@ class simple_seq_fit_impl public: //!Offset pointer to the next block. block_ctrl_ptr m_next; - //!This block's memory size (including block_ctrl + //!This block's memory size (including block_ctrl //!header) in BasicSize units size_type m_size; - + size_type get_user_bytes() const { return this->m_size*Alignment - BlockCtrlBytes; } @@ -126,7 +126,7 @@ class simple_seq_fit_impl typedef ipcdetail::memory_algorithm_common algo_impl_t; public: - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl) //!offset that the allocator should not use at all. simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes); @@ -145,27 +145,25 @@ class simple_seq_fit_impl /// @cond //!Multiple element allocation, same size - multiallocation_chain - allocate_many(size_type elem_bytes, size_type num_elements) + void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_bytes, num_elements); + algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain); } //!Multiple element allocation, different size - multiallocation_chain - allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element) + void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element); + algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain); } //!Multiple element deallocation - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); /// @endcond @@ -197,12 +195,12 @@ class simple_seq_fit_impl template std::pair allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr = 0); std::pair raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr = 0, size_type sizeof_object = 1); //!Returns the size of the buffer previously allocated pointed by ptr @@ -306,7 +304,7 @@ simple_seq_fit_impl size_type uint_this = (std::size_t)this_ptr; size_type uint_aligned_this = uint_this/Alignment*Alignment; size_type this_disalignment = (uint_this - uint_aligned_this); - size_type block1_off = + size_type block1_off = ipcdetail::get_rounded_size(sizeof(simple_seq_fit_impl) + extra_hdr_bytes + this_disalignment, Alignment) - this_disalignment; algo_impl_t::assert_alignment(this_disalignment + block1_off); @@ -322,7 +320,7 @@ simple_seq_fit_impl size_type uint_this = (std::size_t)this; size_type uint_aligned_this = uint_this/Alignment*Alignment; size_type this_disalignment = (uint_this - uint_aligned_this); - size_type old_end = + size_type old_end = ipcdetail::get_truncated_size(m_header.m_size + this_disalignment, Alignment) - this_disalignment; algo_impl_t::assert_alignment(old_end + this_disalignment); @@ -331,11 +329,11 @@ simple_seq_fit_impl template inline simple_seq_fit_impl:: - simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes) + simple_seq_fit_impl(size_type segment_size, size_type extra_hdr_bytes) { //Initialize sizes and counters m_header.m_allocated = 0; - m_header.m_size = size; + m_header.m_size = segment_size; m_header.m_extra_hdr_bytes = extra_hdr_bytes; //Initialize pointers @@ -344,7 +342,7 @@ inline simple_seq_fit_impl:: m_header.m_root.m_next = reinterpret_cast ((reinterpret_cast(this) + block1_off)); algo_impl_t::assert_alignment(ipcdetail::to_raw_pointer(m_header.m_root.m_next)); - m_header.m_root.m_next->m_size = (size - block1_off)/Alignment; + m_header.m_root.m_next->m_size = (segment_size - block1_off)/Alignment; m_header.m_root.m_next->m_next = &m_header.m_root; } @@ -426,7 +424,7 @@ void simple_seq_fit_impl::shrink_to_fit() (void)addr; BOOST_ASSERT(addr); BOOST_ASSERT(received_size == last_units*Alignment - AllocatedCtrlBytes); - + //Shrink it m_header.m_size /= Alignment; m_header.m_size -= last->m_size; @@ -462,19 +460,19 @@ void *simple_seq_fit_impl:: } template -inline void simple_seq_fit_impl::priv_add_segment(void *addr, size_type size) -{ +inline void simple_seq_fit_impl::priv_add_segment(void *addr, size_type segment_size) +{ algo_impl_t::assert_alignment(addr); //Check size - BOOST_ASSERT(!(size < MinBlockSize)); - if(size < MinBlockSize) + BOOST_ASSERT(!(segment_size < MinBlockSize)); + if(segment_size < MinBlockSize) return; //Construct big block using the new segment block_ctrl *new_block = static_cast(addr); - new_block->m_size = size/Alignment; + new_block->m_size = segment_size/Alignment; new_block->m_next = 0; //Simulate this block was previously allocated - m_header.m_allocated += new_block->m_size*Alignment; + m_header.m_allocated += new_block->m_size*Alignment; //Return block and insert it in the free block list this->priv_deallocate(priv_get_user_buffer(new_block)); } @@ -488,7 +486,7 @@ template inline typename simple_seq_fit_impl::size_type simple_seq_fit_impl::get_free_memory() const { - return m_header.m_size - m_header.m_allocated - + return m_header.m_size - m_header.m_allocated - algo_impl_t::multiple_of_units(sizeof(*this) + m_header.m_extra_hdr_bytes); } @@ -523,7 +521,7 @@ inline void simple_seq_fit_impl::zero_free_memory() //Iterate through all free portions do{ - //Just clear user the memory part reserved for the user + //Just clear user the memory part reserved for the user std::memset( priv_get_user_buffer(block) , 0 , block->get_user_bytes()); @@ -583,19 +581,19 @@ inline void* simple_seq_fit_impl:: template inline void* simple_seq_fit_impl:: allocate_aligned(size_type nbytes, size_type alignment) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- return algo_impl_t:: - allocate_aligned(this, nbytes, alignment); + allocate_aligned(this, nbytes, alignment); } template template inline std::pair simple_seq_fit_impl:: allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr) { std::pair ret = priv_allocation_command @@ -608,7 +606,7 @@ inline std::pair simple_seq_fit_impl:: template inline std::pair simple_seq_fit_impl:: raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects, - size_type preferred_objects,size_type &received_objects, + size_type preferred_objects,size_type &received_objects, void *reuse_ptr, size_type sizeof_object) { if(!sizeof_object) @@ -627,7 +625,7 @@ inline std::pair simple_seq_fit_impl:: template inline std::pair simple_seq_fit_impl:: priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size, size_type &received_size, + size_type preferred_size, size_type &received_size, void *reuse_ptr, size_type sizeof_object) { command &= ~boost::interprocess::expand_bwd; @@ -653,8 +651,7 @@ inline std::pair simple_seq_fit_impl:: template inline typename simple_seq_fit_impl::size_type -simple_seq_fit_impl:: - size(const void *ptr) const +simple_seq_fit_impl::size(const void *ptr) const { //We need no synchronization since this block is not going //to be modified @@ -696,9 +693,9 @@ void* simple_seq_fit_impl:: return 0; } - size_type needs_backwards = + size_type needs_backwards = ipcdetail::get_rounded_size(preferred_size - extra_forward, Alignment); - + if(!only_preferred_backwards){ max_value(ipcdetail::get_rounded_size(min_size - extra_forward, Alignment) ,min_value(prev->get_user_bytes(), needs_backwards)); @@ -710,16 +707,16 @@ void* simple_seq_fit_impl:: if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){ BOOST_ASSERT(0); } - + //We need a minimum size to split the previous one if((prev->get_user_bytes() - needs_backwards) > 2*BlockCtrlBytes){ block_ctrl *new_block = reinterpret_cast (reinterpret_cast(reuse) - needs_backwards - BlockCtrlBytes); new_block->m_next = 0; - new_block->m_size = + new_block->m_size = BlockCtrlUnits + (needs_backwards + extra_forward)/Alignment; - prev->m_size = + prev->m_size = (prev->get_total_bytes() - needs_backwards)/Alignment - BlockCtrlUnits; received_size = needs_backwards + extra_forward; m_header.m_allocated += needs_backwards + BlockCtrlBytes; @@ -744,15 +741,13 @@ void* simple_seq_fit_impl:: template inline void simple_seq_fit_impl:: - deallocate_many(typename simple_seq_fit_impl::multiallocation_chain chain) + deallocate_many(typename simple_seq_fit_impl::multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- while(!chain.empty()){ - void *addr = chain.front(); - chain.pop_front(); - this->priv_deallocate(addr); + this->priv_deallocate(to_raw_pointer(chain.pop_front())); } } @@ -775,7 +770,7 @@ std::pair simple_seq_fit_impl:: ,void *reuse_ptr) { if(command & boost::interprocess::shrink_in_place){ - bool success = + bool success = algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size); return std::pair ((success ? reuse_ptr : 0), true); } @@ -885,7 +880,7 @@ inline typename simple_seq_fit_impl::block_ctrl * } template -inline +inline std::pair::block_ctrl * ,typename simple_seq_fit_impl::block_ctrl *> simple_seq_fit_impl:: @@ -969,7 +964,7 @@ inline bool simple_seq_fit_impl:: //We can fill expand. Merge both blocks, block->m_next = next_block->m_next; block->m_size = merged_size; - + //Find the previous free block of next_block block_ctrl *prev = &m_header.m_root; while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){ @@ -978,7 +973,7 @@ inline bool simple_seq_fit_impl:: //Now insert merged block in the free list //This allows reusing allocation logic in this function - m_header.m_allocated -= old_block_size*Alignment; + m_header.m_allocated -= old_block_size*Alignment; prev->m_next = block; //Now use check and allocate to do the allocation logic @@ -992,7 +987,7 @@ inline bool simple_seq_fit_impl:: BOOST_ASSERT(0); return false; } - return true; + return true; } template inline @@ -1006,7 +1001,7 @@ void* simple_seq_fit_impl::priv_check_and_allocate bool found = false; if (block->m_size > upper_nunits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first's size will be "units" //the second's size will be "block->m_size-units" size_type total_size = block->m_size; @@ -1057,7 +1052,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Let's get free block list. List is always sorted //by memory address to allow block merging. - //Pointer next always points to the first + //Pointer next always points to the first //(lower address) block block_ctrl * prev = &m_header.m_root; block_ctrl * pos = ipcdetail::to_raw_pointer(m_header.m_root.m_next); @@ -1071,9 +1066,9 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) size_type total_size = Alignment*block->m_size; BOOST_ASSERT(m_header.m_allocated >= total_size); - + //Update used memory count - m_header.m_allocated -= total_size; + m_header.m_allocated -= total_size; //Let's find the previous and the next block of the block to deallocate //This ordering comparison must be done with original pointers @@ -1087,7 +1082,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Try to combine with upper block char *block_char_ptr = reinterpret_cast(ipcdetail::to_raw_pointer(block)); - if ((block_char_ptr + Alignment*block->m_size) == + if ((block_char_ptr + Alignment*block->m_size) == reinterpret_cast(ipcdetail::to_raw_pointer(pos))){ block->m_size += pos->m_size; block->m_next = pos->m_next; @@ -1098,7 +1093,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Try to combine with lower block if ((reinterpret_cast(ipcdetail::to_raw_pointer(prev)) - + Alignment*prev->m_size) == + + Alignment*prev->m_size) == block_char_ptr){ diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp index f6f0c03a1..7853ede8e 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -88,8 +88,7 @@ class rbtree_best_fit typedef MutexFamily mutex_family; //!Pointer type to be used with the rest of the Interprocess framework typedef VoidPointer void_pointer; - typedef boost::container::container_detail:: - basic_multiallocation_chain multiallocation_chain; + typedef ipcdetail::basic_multiallocation_chain multiallocation_chain; typedef typename boost::intrusive::pointer_traits::difference_type difference_type; typedef typename boost::make_unsigned::type size_type; @@ -105,7 +104,7 @@ class rbtree_best_fit struct SizeHolder { - //!This block's memory size (including block_ctrl + //!This block's memory size (including block_ctrl //!header) in Alignment units size_type m_prev_size : sizeof(size_type)*CHAR_BIT; size_type m_size : sizeof(size_type)*CHAR_BIT - 2; @@ -132,7 +131,7 @@ class rbtree_best_fit { return size < block.m_size; } bool operator()(const block_ctrl &block, size_type size) const - { return block.m_size < size; } + { return block.m_size < size; } }; //!Shared mutex to protect memory allocate/deallocate @@ -157,13 +156,13 @@ class rbtree_best_fit } m_header; friend class ipcdetail::memory_algorithm_common; - + typedef ipcdetail::memory_algorithm_common algo_impl_t; public: /// @endcond - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit) //!offset that the allocator should not use at all. rbtree_best_fit (size_type size, size_type extra_hdr_bytes); @@ -184,27 +183,25 @@ class rbtree_best_fit //Experimental. Dont' use //!Multiple element allocation, same size - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) + void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain) { - //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_bytes, num_elements); + algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain); } //!Multiple element allocation, different size - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element) + void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { - //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element); + algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain); } //!Multiple element allocation, different size - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); /// @endcond @@ -238,12 +235,12 @@ class rbtree_best_fit template std::pair allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr = 0); std::pair raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object, - size_type preferred_object,size_type &received_object, + size_type preferred_object,size_type &received_object, void *reuse_ptr = 0, size_type sizeof_object = 1); //!Returns the size of the buffer previously allocated pointed by ptr @@ -263,7 +260,7 @@ class rbtree_best_fit std::pair priv_allocation_command(boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr, size_type sizeof_object); @@ -339,7 +336,7 @@ class rbtree_best_fit void priv_add_segment(void *addr, size_type size); public: - + static const size_type Alignment = !MemAlignment ? size_type(::boost::alignment_of< ::boost::detail::max_align>::value) : size_type(MemAlignment) @@ -370,7 +367,7 @@ class rbtree_best_fit /// @cond template -inline typename rbtree_best_fit::size_type +inline typename rbtree_best_fit::size_type rbtree_best_fit ::priv_first_block_offset_from_this(const void *this_ptr, size_type extra_hdr_bytes) { @@ -385,29 +382,29 @@ inline typename rbtree_best_fit::size_ty template void rbtree_best_fit:: - priv_add_segment(void *addr, size_type size) -{ + priv_add_segment(void *addr, size_type segment_size) +{ //Check alignment algo_impl_t::check_alignment(addr); //Check size - BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes)); + BOOST_ASSERT(segment_size >= (BlockCtrlBytes + EndCtrlBlockBytes)); //Initialize the first big block and the "end" node block_ctrl *first_big_block = new(addr)block_ctrl; - first_big_block->m_size = size/Alignment - EndCtrlBlockUnits; + first_big_block->m_size = segment_size/Alignment - EndCtrlBlockUnits; BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits); //The "end" node is just a node of size 0 with the "end" bit set - block_ctrl *end_block = static_cast + block_ctrl *end_block = static_cast (new (reinterpret_cast(addr) + first_big_block->m_size*Alignment)SizeHolder); //This will overwrite the prev part of the "end" node priv_mark_as_free_block (first_big_block); #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - first_big_block->m_prev_size = end_block->m_size = + first_big_block->m_prev_size = end_block->m_size = (reinterpret_cast(first_big_block) - reinterpret_cast(end_block))/Alignment; #else - first_big_block->m_prev_size = end_block->m_size = + first_big_block->m_prev_size = end_block->m_size = (reinterpret_cast(end_block) - reinterpret_cast(first_big_block))/Alignment; #endif end_block->m_allocated = 1; @@ -444,25 +441,25 @@ inline typename rbtree_best_fit::block_c { size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); const size_type original_first_block_size = m_header.m_size/Alignment*Alignment - block1_off/Alignment*Alignment - EndCtrlBlockBytes; - block_ctrl *end_block = reinterpret_cast + block_ctrl *end_block = reinterpret_cast (reinterpret_cast(this) + block1_off + original_first_block_size); return end_block; } template inline rbtree_best_fit:: - rbtree_best_fit(size_type size, size_type extra_hdr_bytes) + rbtree_best_fit(size_type segment_size, size_type extra_hdr_bytes) { //Initialize the header m_header.m_allocated = 0; - m_header.m_size = size; + m_header.m_size = segment_size; m_header.m_extra_hdr_bytes = extra_hdr_bytes; //Now write calculate the offset of the first big block that will //cover the whole segment - BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size); + BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= segment_size); size_type block1_off = priv_first_block_offset_from_this(this, extra_hdr_bytes); - priv_add_segment(reinterpret_cast(this) + block1_off, size - block1_off); + priv_add_segment(reinterpret_cast(this) + block1_off, segment_size - block1_off); } template @@ -479,7 +476,7 @@ void rbtree_best_fit::grow(size_type ext //Get the address of the first block block_ctrl *first_block = priv_first_block(); block_ctrl *old_end_block = priv_end_block(); - size_type old_border_offset = (size_type)(reinterpret_cast(old_end_block) - + size_type old_border_offset = (size_type)(reinterpret_cast(old_end_block) - reinterpret_cast(this)) + EndCtrlBlockBytes; //Update managed buffer's size @@ -500,10 +497,10 @@ void rbtree_best_fit::grow(size_type ext //between them new_end_block->m_allocated = 1; #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - new_end_block->m_size = (reinterpret_cast(first_block) - + new_end_block->m_size = (reinterpret_cast(first_block) - reinterpret_cast(new_end_block))/Alignment; #else - new_end_block->m_size = (reinterpret_cast(new_end_block) - + new_end_block->m_size = (reinterpret_cast(new_end_block) - reinterpret_cast(first_block))/Alignment; #endif first_block->m_prev_size = new_end_block->m_size; @@ -512,7 +509,7 @@ void rbtree_best_fit::grow(size_type ext //The old end block is the new block block_ctrl *new_block = old_end_block; - new_block->m_size = (reinterpret_cast(new_end_block) - + new_block->m_size = (reinterpret_cast(new_end_block) - reinterpret_cast(new_block))/Alignment; BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_as_allocated_block(new_block); @@ -568,18 +565,18 @@ void rbtree_best_fit::shrink_to_fit() //Erase block from the free tree, since we will erase it m_header.m_imultiset.erase(Imultiset::s_iterator_to(*last_block)); - size_type shrunk_border_offset = (size_type)(reinterpret_cast(last_block) - + size_type shrunk_border_offset = (size_type)(reinterpret_cast(last_block) - reinterpret_cast(this)) + EndCtrlBlockBytes; - + block_ctrl *new_end_block = last_block; algo_impl_t::assert_alignment(new_end_block); //Write new end block attributes #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - new_end_block->m_size = first_block->m_prev_size = + new_end_block->m_size = first_block->m_prev_size = (reinterpret_cast(first_block) - reinterpret_cast(new_end_block))/Alignment; #else - new_end_block->m_size = first_block->m_prev_size = + new_end_block->m_size = first_block->m_prev_size = (reinterpret_cast(new_end_block) - reinterpret_cast(first_block))/Alignment; #endif @@ -604,7 +601,7 @@ template typename rbtree_best_fit::size_type rbtree_best_fit::get_free_memory() const { - return m_header.m_size - m_header.m_allocated - + return m_header.m_size - m_header.m_allocated - priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); } @@ -614,7 +611,7 @@ rbtree_best_fit:: get_min_size (size_type extra_hdr_bytes) { return (algo_impl_t::ceil_units(sizeof(rbtree_best_fit)) + - algo_impl_t::ceil_units(extra_hdr_bytes) + + algo_impl_t::ceil_units(extra_hdr_bytes) + MinBlockUnits + EndCtrlBlockUnits)*Alignment; } @@ -625,13 +622,13 @@ inline bool rbtree_best_fit:: //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - size_type block1_off = + size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); - return m_header.m_allocated == 0 && + return m_header.m_allocated == 0 && m_header.m_imultiset.begin() != m_header.m_imultiset.end() && (++m_header.m_imultiset.begin()) == m_header.m_imultiset.end() - && m_header.m_imultiset.begin()->m_size == + && m_header.m_imultiset.begin()->m_size == (m_header.m_size - block1_off - EndCtrlBlockBytes)/Alignment; } @@ -659,7 +656,7 @@ bool rbtree_best_fit:: return false; } - size_type block1_off = + size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); //Check free bytes are less than size @@ -672,7 +669,7 @@ bool rbtree_best_fit:: template inline void* rbtree_best_fit:: allocate(size_type nbytes) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- @@ -684,18 +681,18 @@ inline void* rbtree_best_fit:: template inline void* rbtree_best_fit:: allocate_aligned(size_type nbytes, size_type alignment) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_aligned(this, nbytes, alignment); + return algo_impl_t::allocate_aligned(this, nbytes, alignment); } template template inline std::pair rbtree_best_fit:: allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr) { std::pair ret = priv_allocation_command @@ -708,7 +705,7 @@ inline std::pair rbtree_best_fit inline std::pair rbtree_best_fit:: raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects, - size_type preferred_objects,size_type &received_objects, + size_type preferred_objects,size_type &received_objects, void *reuse_ptr, size_type sizeof_object) { if(!sizeof_object) @@ -728,7 +725,7 @@ inline std::pair rbtree_best_fit inline std::pair rbtree_best_fit:: priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr, size_type sizeof_object) { std::pair ret; @@ -815,7 +812,7 @@ void* rbtree_best_fit:: //Obtain the real size of the block block_ctrl *reuse = priv_get_block(reuse_ptr); - //Sanity check + //Sanity check //BOOST_ASSERT(reuse->m_size == priv_tail_size(reuse)); algo_impl_t::assert_alignment(reuse); @@ -859,12 +856,12 @@ void* rbtree_best_fit:: (reinterpret_cast(reuse) - needs_backwards_aligned); //Free old previous buffer - new_block->m_size = + new_block->m_size = AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment; BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_as_allocated_block(new_block); - prev_block->m_size = (reinterpret_cast(new_block) - + prev_block->m_size = (reinterpret_cast(new_block) - reinterpret_cast(prev_block))/Alignment; BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits); priv_mark_as_free_block(prev_block); @@ -875,7 +872,7 @@ void* rbtree_best_fit:: { imultiset_iterator prev_block_it(Imultiset::s_iterator_to(*prev_block)); imultiset_iterator was_smaller_it(prev_block_it); - if(prev_block_it != m_header.m_imultiset.begin() && + if(prev_block_it != m_header.m_imultiset.begin() && (--(was_smaller_it = prev_block_it))->m_size > prev_block->m_size){ m_header.m_imultiset.erase(prev_block_it); m_header.m_imultiset.insert(m_header.m_imultiset.begin(), *prev_block); @@ -884,7 +881,7 @@ void* rbtree_best_fit:: received_size = needs_backwards_aligned + received_size; m_header.m_allocated += needs_backwards_aligned; - + //Check alignment algo_impl_t::assert_alignment(new_block); @@ -930,12 +927,12 @@ void* rbtree_best_fit:: template inline void rbtree_best_fit:: - deallocate_many(typename rbtree_best_fit::multiallocation_chain chain) + deallocate_many(typename rbtree_best_fit::multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - algo_impl_t::deallocate_many(this, boost::move(chain)); + algo_impl_t::deallocate_many(this, chain); } template @@ -951,7 +948,7 @@ std::pair rbtree_best_fit: //command &= (~boost::interprocess::expand_bwd); if(command & boost::interprocess::shrink_in_place){ - bool success = + bool success = algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size); return std::pair ((success ? reuse_ptr : 0), true); } @@ -1044,7 +1041,7 @@ bool rbtree_best_fit:: //The block must be marked as allocated and the sizes must be equal BOOST_ASSERT(priv_is_allocated_block(block)); //BOOST_ASSERT(old_block_units == priv_tail_size(block)); - + //Put this to a safe value received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk; if(received_size >= preferred_size || received_size >= min_size) @@ -1084,7 +1081,7 @@ bool rbtree_best_fit:: //Check if we can split the next one in two parts if((merged_units - intended_units) >= BlockCtrlUnits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first one will be merged and //the second's size will be the remaining space BOOST_ASSERT(next_block->m_size == priv_next_block(next_block)->m_prev_size); @@ -1098,9 +1095,9 @@ bool rbtree_best_fit:: //overwrite the tree hook of the old next block. So we first erase the //old if needed and we'll insert the new one after creating the new next imultiset_iterator old_next_block_it(Imultiset::s_iterator_to(*next_block)); - const bool size_invariants_broken = + const bool size_invariants_broken = (next_block->m_size - rem_units ) < BlockCtrlUnits || - (old_next_block_it != m_header.m_imultiset.begin() && + (old_next_block_it != m_header.m_imultiset.begin() && (--imultiset_iterator(old_next_block_it))->m_size > rem_units); if(size_invariants_broken){ m_header.m_imultiset.erase(old_next_block_it); @@ -1267,7 +1264,7 @@ void* rbtree_best_fit::priv_check_and_al algo_impl_t::assert_alignment(block); if (block->m_size >= upper_nunits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first's size will be "units" and //the second's size "block->m_size-units" size_type block_old_size = block->m_size; @@ -1298,7 +1295,7 @@ void* rbtree_best_fit::priv_check_and_al m_header.m_imultiset.erase(it_old); m_header.m_imultiset.insert(m_header.m_imultiset.begin(), *rem_block); } - + } else if (block->m_size >= nunits){ m_header.m_imultiset.erase(it_old); @@ -1318,9 +1315,9 @@ void* rbtree_best_fit::priv_check_and_al //Clear the memory occupied by the tree hook, since this won't be //cleared with zero_free_memory TreeHook *t = static_cast(block); - //Just clear the memory part reserved for the user + //Just clear the memory part reserved for the user std::size_t tree_hook_offset_in_block = (char*)t - (char*)block; - //volatile char *ptr = + //volatile char *ptr = char *ptr = reinterpret_cast(block)+tree_hook_offset_in_block; const std::size_t s = BlockCtrlBytes - tree_hook_offset_in_block; std::memset(ptr, 0, s); @@ -1344,7 +1341,7 @@ void rbtree_best_fit::priv_deallocate(vo if(!addr) return; block_ctrl *block = priv_get_block(addr); - + //The blocks must be marked as allocated and the sizes must be equal BOOST_ASSERT(priv_is_allocated_block(block)); // BOOST_ASSERT(block->m_size == priv_tail_size(block)); diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp index 5cc92c110..ba50c166e 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -31,7 +31,7 @@ namespace interprocess { //!This class implements the simple sequential fit algorithm with a simply //!linked list of free buffers. template -class simple_seq_fit +class simple_seq_fit : public ipcdetail::simple_seq_fit_impl { /// @cond @@ -41,11 +41,11 @@ class simple_seq_fit public: typedef typename base_t::size_type size_type; - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit) //!offset that the allocator should not use at all.*/ - simple_seq_fit (size_type size, size_type extra_hdr_bytes) - : base_t(size, extra_hdr_bytes){} + simple_seq_fit(size_type segment_size, size_type extra_hdr_bytes) + : base_t(segment_size, extra_hdr_bytes){} }; } //namespace interprocess { diff --git a/project/jni/boost/include/boost/interprocess/offset_ptr.hpp b/project/jni/boost/include/boost/interprocess/offset_ptr.hpp index 4187543d5..752c43586 100644 --- a/project/jni/boost/include/boost/interprocess/offset_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/offset_ptr.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -44,6 +44,175 @@ struct has_trivial_destructor; namespace interprocess { +/// @cond +namespace ipcdetail { + + template + union offset_ptr_internal + { + explicit offset_ptr_internal(OffsetType off) + : m_offset(off) + {} + OffsetType m_offset; //Distance between this object and pointee address + typename ::boost::aligned_storage + < sizeof(OffsetType) + , (OffsetAlignment == offset_type_alignment) ? + ::boost::alignment_of::value : OffsetAlignment + >::type alignment_helper; + }; + + //Note: using the address of a local variable to point to another address + //is not standard conforming and this can be optimized-away by the compiler. + //Non-inlining is a method to remain illegal but correct + + //Undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_XXX if your compiler can inline + //this code without breaking the library + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_raw_pointer + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + void * offset_ptr_to_raw_pointer(const volatile void *this_ptr, std::size_t offset) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + if(offset == 1){ + return 0; + } + else{ + caster_t caster((void*)this_ptr); + return caster_t(caster.size() + offset).pointer(); + } + #else + caster_t caster((void*)this_ptr); + return caster_t((caster.size() + offset) & -std::size_t(offset != 1)).pointer(); + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + #endif + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_offset + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + //Branchless seems slower in x86 + //#define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + std::size_t offset_ptr_to_offset(const volatile void *ptr, const volatile void *this_ptr) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + //offset == 1 && ptr != 0 is not legal for this pointer + if(!ptr){ + return 1; + } + else{ + caster_t this_caster((void*)this_ptr); + caster_t ptr_caster((void*)ptr); + std::size_t offset = ptr_caster.size() - this_caster.size(); + BOOST_ASSERT(offset != 1); + return offset; + } + #else + caster_t this_caster((void*)this_ptr); + caster_t ptr_caster((void*)ptr); + std::size_t offset = (ptr_caster.size() - this_caster.size() - 1) & -std::size_t(ptr != 0); + ++offset; + return offset; + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + #endif + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_offset_from_other + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + //Branchless seems slower in x86 + //#define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + std::size_t offset_ptr_to_offset_from_other + (const volatile void *this_ptr, const volatile void *other_ptr, std::size_t other_offset) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + if(other_offset == 1){ + return 1; + } + else{ + caster_t this_caster((void*)this_ptr); + caster_t other_caster((void*)other_ptr); + std::size_t offset = other_caster.size() - this_caster.size() + other_offset; + BOOST_ASSERT(offset != 1); + return offset; + } + #else + caster_t this_caster((void*)this_ptr); + caster_t other_caster((void*)other_ptr); + std::size_t offset = (other_caster.size() - this_caster.size()) & -std::size_t(other_offset != 1); + offset += other_offset; + return offset; + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + #endif + + //////////////////////////////////////////////////////////////////////// + // + // Let's assume cast to void and cv cast don't change any target address + // + //////////////////////////////////////////////////////////////////////// + template + struct offset_ptr_maintains_address + { + static const bool value = ipcdetail::is_cv_same::value + || ipcdetail::is_cv_same::value; + }; + +} //namespace ipcdetail { +/// @endcond + //!A smart pointer that stores the offset between between the pointer and the //!the object it points. This allows offset allows special properties, since //!the pointer is independent from the address address of the pointee, if the @@ -74,69 +243,111 @@ class offset_ptr public: //Public Functions + //!Default constructor (null pointer). + //!Never throws. + offset_ptr() + : internal(1) + {} + //!Constructor from raw pointer (allows "0" pointer conversion). //!Never throws. - offset_ptr(pointer ptr = 0) { this->set_offset(ptr); } + offset_ptr(pointer ptr) + : internal(static_cast(ipcdetail::offset_ptr_to_offset<0>(ptr, this))) + {} //!Constructor from other pointer. //!Never throws. template offset_ptr( T *ptr - , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) - { this->set_offset(static_cast(ptr)); } + , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr), this))) + {} //!Constructor from other offset_ptr //!Never throws. - offset_ptr(const offset_ptr& ptr) - { this->set_offset(ptr.get()); } + offset_ptr(const offset_ptr& ptr) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.internal.m_offset))) + {} - //!Constructor from other offset_ptr. If pointers of pointee types are + //!Constructor from other offset_ptr. If pointers of pointee types are //!convertible, offset_ptrs will be convertibles. Never throws. - template - offset_ptr( const offset_ptr &ptr - , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) - { this->set_offset(static_cast(ptr.get())); } + template + offset_ptr( const offset_ptr &ptr + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + , typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && ipcdetail::offset_ptr_maintains_address::value + >::type * = 0 + #endif + ) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.get_offset()))) + {} + + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + + //!Constructor from other offset_ptr. If pointers of pointee types are + //!convertible, offset_ptrs will be convertibles. Never throws. + template + offset_ptr( const offset_ptr &ptr + , typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && !ipcdetail::offset_ptr_maintains_address::value + >::type * = 0) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr.get()), this))) + {} + + #endif //!Emulates static_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::static_cast_tag) - { this->set_offset(static_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(r.get()), this))) + {} //!Emulates const_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::const_cast_tag) - { this->set_offset(const_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(const_cast(r.get()), this))) + {} //!Emulates dynamic_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::dynamic_cast_tag) - { this->set_offset(dynamic_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(dynamic_cast(r.get()), this))) + {} //!Emulates reinterpret_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::reinterpret_cast_tag) - { this->set_offset(reinterpret_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(reinterpret_cast(r.get()), this))) + {} //!Obtains raw pointer from offset. //!Never throws. - pointer get()const - { return this->to_raw_pointer(); } + pointer get() const + { return (pointer)ipcdetail::offset_ptr_to_raw_pointer<0>(this, this->internal.m_offset); } offset_type get_offset() const - { return internal.m_offset; } + { return this->internal.m_offset; } //!Pointer-like -> operator. It can return 0 pointer. //!Never throws. - pointer operator->() const + pointer operator->() const { return this->get(); } - //!Dereferencing operator, if it is a null offset_ptr behavior + //!Dereferencing operator, if it is a null offset_ptr behavior //! is undefined. Never throws. - reference operator* () const + reference operator* () const { pointer p = this->get(); reference r = *p; @@ -145,27 +356,57 @@ class offset_ptr //!Indexing operator. //!Never throws. - template - reference operator[](T idx) const + reference operator[](difference_type idx) const { return this->get()[idx]; } //!Assignment from pointer (saves extra conversion). //!Never throws. offset_ptr& operator= (pointer from) - { this->set_offset(from); return *this; } + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset<0>(from, this)); + return *this; + } //!Assignment from other offset_ptr. //!Never throws. - offset_ptr& operator= (const offset_ptr & pt) - { pointer p(pt.get()); (void)p; this->set_offset(p); return *this; } + offset_ptr& operator= (const offset_ptr & ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.internal.m_offset)); + return *this; + } - //!Assignment from related offset_ptr. If pointers of pointee types + //!Assignment from related offset_ptr. If pointers of pointee types //! are assignable, offset_ptrs will be assignable. Never throws. - template - typename ipcdetail::enable_if, offset_ptr&>::type - operator= (const offset_ptr & ptr) - { this->set_offset(static_cast(ptr.get())); return *this; } - + template + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && ipcdetail::offset_ptr_maintains_address::value + , offset_ptr&>::type + #else + offset_ptr& + #endif + operator= (const offset_ptr &ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.get_offset())); + return *this; + } + + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + template + typename ipcdetail::enable_if_c::value + && !ipcdetail::offset_ptr_maintains_address::value + , offset_ptr&>::type + operator= (const offset_ptr &ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr.get()), this)); + return *this; + } + #endif + //!offset_ptr += difference_type. //!Never throws. offset_ptr &operator+= (difference_type offset) @@ -173,39 +414,46 @@ class offset_ptr //!offset_ptr -= difference_type. //!Never throws. - template - offset_ptr &operator-= (T offset) + offset_ptr &operator-= (difference_type offset) { this->dec_offset(offset * sizeof (PointedType)); return *this; } //!++offset_ptr. //!Never throws. - offset_ptr& operator++ (void) + offset_ptr& operator++ (void) { this->inc_offset(sizeof (PointedType)); return *this; } //!offset_ptr++. //!Never throws. offset_ptr operator++ (int) - { offset_ptr temp(*this); ++*this; return temp; } + { + offset_ptr tmp(*this); + this->inc_offset(sizeof (PointedType)); + return tmp; + } //!--offset_ptr. //!Never throws. - offset_ptr& operator-- (void) + offset_ptr& operator-- (void) { this->dec_offset(sizeof (PointedType)); return *this; } //!offset_ptr--. //!Never throws. offset_ptr operator-- (int) - { offset_ptr temp(*this); --*this; return temp; } + { + offset_ptr tmp(*this); + this->dec_offset(sizeof (PointedType)); + return tmp; + } //!safe bool conversion operator. //!Never throws. - operator unspecified_bool_type() const - { return this->get()? &self_t::unspecified_bool_type_func : 0; } + operator unspecified_bool_type() const + { return this->internal.m_offset != 1? &self_t::unspecified_bool_type_func : 0; } - //!Not operator. Not needed in theory, but improves portability. + //!Not operator. Not needed in theory, but improves portability. //!Never throws bool operator! () const - { return this->get() == 0; } + { return this->internal.m_offset == 1; } //!Compatibility with pointer_traits //! @@ -220,23 +468,23 @@ class offset_ptr //!difference_type + offset_ptr //!operation - friend offset_ptr operator+(difference_type diff, const offset_ptr& right) - { offset_ptr tmp(right); tmp += diff; return tmp; } + friend offset_ptr operator+(difference_type diff, offset_ptr right) + { right += diff; return right; } //!offset_ptr + difference_type //!operation - friend offset_ptr operator+(const offset_ptr& left, difference_type diff) - { offset_ptr tmp(left); tmp += diff; return tmp; } + friend offset_ptr operator+(offset_ptr left, difference_type diff) + { left += diff; return left; } //!offset_ptr - diff //!operation - friend offset_ptr operator-(const offset_ptr &left, difference_type diff) - { offset_ptr tmp(left); tmp -= diff; return tmp; } + friend offset_ptr operator-(offset_ptr left, difference_type diff) + { left -= diff; return left; } //!offset_ptr - diff //!operation - friend offset_ptr operator-(difference_type diff, const offset_ptr &right) - { offset_ptr tmp(right); tmp -= diff; return tmp; } + friend offset_ptr operator-(difference_type diff, offset_ptr right) + { right -= diff; return right; } //!offset_ptr - offset_ptr //!operation @@ -309,114 +557,64 @@ class offset_ptr private: /// @cond - - //Note: using the address of a local variable to point to another address - //is not standard conforming and this can be optimized-away by the compiler. - //Non-inlining is a method to remain illegal and correct - #if defined(_MSC_VER) - __declspec(noinline) //this workaround is needed for MSVC compilers - #elif defined (__GNUC__)//this workaround is needed for GCC - __attribute__((__noinline__)) - #endif - void set_offset(const PointedType *ptr) - { - #if defined (__GNUC__) - //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect") - #endif - //offset == 1 && ptr != 0 is not legal for this pointer - if(!ptr){ - internal.m_offset = 1; - } - else{ - internal.m_offset = (OffsetType)((const char*)ptr - (const char*)(this)); - BOOST_ASSERT(internal.m_offset != 1); - } - } - - #if defined(_MSC_VER) && (_MSC_VER >= 1400) - __declspec(noinline) - #elif defined (__GNUC__) - __attribute__((__noinline__)) - #endif - PointedType * to_raw_pointer() const - { - #if defined (__GNUC__) - //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect") - #endif - return static_cast( - static_cast( - (internal.m_offset == 1) ? - 0 : - (const_cast(reinterpret_cast(this)) + internal.m_offset) - ) - ); - } - void inc_offset(DifferenceType bytes) { internal.m_offset += bytes; } void dec_offset(DifferenceType bytes) { internal.m_offset -= bytes; } - union internal_type{ - OffsetType m_offset; //Distance between this object and pointee address - typename ::boost::aligned_storage - < sizeof(OffsetType) - , (OffsetAlignment == offset_type_alignment) ? - ::boost::alignment_of::value : OffsetAlignment - >::type alignment_helper; - } internal; + ipcdetail::offset_ptr_internal internal; /// @endcond }; //!operator<< //!for offset ptr -template -inline std::basic_ostream & operator<< +template +inline std::basic_ostream & operator<< (std::basic_ostream & os, offset_ptr const & p) { return os << p.get_offset(); } -//!operator>> +//!operator>> //!for offset ptr -template -inline std::basic_istream & operator>> +template +inline std::basic_istream & operator>> (std::basic_istream & is, offset_ptr & p) { return is >> p.get_offset(); } //!Simulation of static_cast between pointers. Never throws. template -inline boost::interprocess::offset_ptr +inline boost::interprocess::offset_ptr static_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::static_cast_tag()); + (r, boost::interprocess::ipcdetail::static_cast_tag()); } //!Simulation of const_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr const_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::const_cast_tag()); + (r, boost::interprocess::ipcdetail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. Never throws. template -inline boost::interprocess::offset_ptr +inline boost::interprocess::offset_ptr dynamic_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::dynamic_cast_tag()); + (r, boost::interprocess::ipcdetail::dynamic_cast_tag()); } //!Simulation of reinterpret_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr reinterpret_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); + (r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); } } //namespace interprocess { @@ -425,29 +623,29 @@ inline boost::interprocess::offset_ptr //!has_trivial_constructor<> == true_type specialization for optimizations template -struct has_trivial_constructor< boost::interprocess::offset_ptr > +struct has_trivial_constructor< boost::interprocess::offset_ptr > { static const bool value = true; }; ///has_trivial_destructor<> == true_type specialization for optimizations template -struct has_trivial_destructor< boost::interprocess::offset_ptr > +struct has_trivial_destructor< boost::interprocess::offset_ptr > { static const bool value = true; }; -//#if !defined(_MSC_VER) || (_MSC_VER >= 1400) + namespace interprocess { -//#endif -//!to_raw_pointer() enables boost::mem_fn to recognize offset_ptr. + +//!to_raw_pointer() enables boost::mem_fn to recognize offset_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::offset_ptr const & p) -{ return p.get(); } -//#if !defined(_MSC_VER) || (_MSC_VER >= 1400) +{ return ipcdetail::to_raw_pointer(p); } + } //namespace interprocess -//#endif + /// @endcond } //namespace boost { @@ -479,28 +677,34 @@ struct pointer_plus_bits; template struct pointer_plus_bits, NumBits> { - typedef boost::interprocess::offset_ptr pointer; + typedef boost::interprocess::offset_ptr pointer; + typedef ::boost::interprocess::pointer_size_t_caster caster_t; //Bits are stored in the lower bits of the pointer except the LSB, //because this bit is used to represent the null pointer. - static const std::size_t Mask = ((std::size_t(1) << NumBits)-1)<<1u; + static const std::size_t Mask = ((std::size_t(1) << NumBits) - 1) << 1u; static pointer get_pointer(const pointer &n) - { return reinterpret_cast(std::size_t(n.get()) & ~std::size_t(Mask)); } - - static void set_pointer(pointer &n, pointer p) { - std::size_t pint = std::size_t(p.get()); - BOOST_ASSERT(0 == (std::size_t(pint) & Mask)); - n = reinterpret_cast(pint | (std::size_t(n.get()) & std::size_t(Mask))); + caster_t caster(n.get()); + return pointer(caster_t(caster.size() & ~Mask).pointer()); + } + + static void set_pointer(pointer &n, const pointer &p) + { + caster_t n_caster(n.get()); + caster_t p_caster(p.get()); + BOOST_ASSERT(0 == (p_caster.size() & Mask)); + n = caster_t(p_caster.size() | (n_caster.size() & Mask)).pointer(); } static std::size_t get_bits(const pointer &n) - { return(std::size_t(n.get()) & std::size_t(Mask)) >> 1u; } + { return (caster_t(n.get()).size() & Mask) >> 1u; } static void set_bits(pointer &n, std::size_t b) { BOOST_ASSERT(b < (std::size_t(1) << NumBits)); - n = reinterpret_cast(std::size_t(get_pointer(n).get()) | (b << 1u)); + caster_t n_caster(n.get()); + n = caster_t((n_caster.size() & ~Mask) | (b << 1u)).pointer(); } }; @@ -510,8 +714,6 @@ struct pointer_plus_bits, NumBits> template struct pointer_to_other; - - //Backwards compatibility with pointer_to_other template struct pointer_to_other diff --git a/project/jni/boost/include/boost/interprocess/permissions.hpp b/project/jni/boost/include/boost/interprocess/permissions.hpp index 745f8a8e0..4266b24af 100644 --- a/project/jni/boost/include/boost/interprocess/permissions.hpp +++ b/project/jni/boost/include/boost/interprocess/permissions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/segment_manager.hpp b/project/jni/boost/include/boost/interprocess/segment_manager.hpp index 442469599..a0f948f6c 100644 --- a/project/jni/boost/include/boost/interprocess/segment_manager.hpp +++ b/project/jni/boost/include/boost/interprocess/segment_manager.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -69,9 +69,9 @@ class segment_manager_base typedef typename MemoryAlgorithm::void_pointer void_pointer; typedef typename MemoryAlgorithm::mutex_family mutex_family; typedef MemoryAlgorithm memory_algorithm; - + /// @cond - + //Experimental. Don't use typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain; typedef typename MemoryAlgorithm::difference_type difference_type; @@ -88,14 +88,14 @@ class segment_manager_base //!"size" is the size of the memory segment where //!the basic segment manager is being constructed. //! - //!"reserved_bytes" is the number of bytes + //!"reserved_bytes" is the number of bytes //!after the end of the memory algorithm object itself //!that the memory algorithm will exclude from //!dynamic allocation //! //!Can throw - segment_manager_base(size_type size, size_type reserved_bytes) - : MemoryAlgorithm(size, reserved_bytes) + segment_manager_base(size_type sz, size_type reserved_bytes) + : MemoryAlgorithm(sz, reserved_bytes) { BOOST_ASSERT((sizeof(segment_manager_base) == sizeof(MemoryAlgorithm))); } @@ -115,7 +115,7 @@ class segment_manager_base static size_type get_min_size (size_type size) { return MemoryAlgorithm::get_min_size(size); } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Never throws void * allocate (size_type nbytes, std::nothrow_t) { return MemoryAlgorithm::allocate(nbytes); } @@ -123,64 +123,65 @@ class segment_manager_base /// @cond //Experimental. Dont' use. - //!Allocates n_elements of - //!elem_size bytes. Throws bad_alloc on failure. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) + //!Allocates n_elements of elem_bytes bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) { - multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements)); - if(mem.empty()) throw bad_alloc(); - return boost::move(mem); + size_type prev_size = chain.size(); + MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); + if(!elem_bytes || chain.size() == prev_size){ + throw bad_alloc(); + } } - //!Allocates n_elements, each one of - //!element_lenghts[i]*sizeof_element bytes. Throws bad_alloc on failure. - multiallocation_chain allocate_many - (const size_type *element_lenghts, size_type n_elements, size_type sizeof_element = 1) + //!Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { - multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element)); - if(mem.empty()) throw bad_alloc(); - return boost::move(mem); + size_type prev_size = chain.size(); + MemoryAlgorithm::allocate_many(element_lengths, n_elements, sizeof_element, chain); + if(!sizeof_element || chain.size() == prev_size){ + throw bad_alloc(); + } } - //!Allocates n_elements of - //!elem_size bytes. Returns a default constructed iterator on failure. - multiallocation_chain allocate_many - (size_type elem_bytes, size_type num_elements, std::nothrow_t) - { return MemoryAlgorithm::allocate_many(elem_bytes, num_elements); } + //!Allocates n_elements of elem_bytes bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); } //!Allocates n_elements, each one of - //!element_lenghts[i]*sizeof_element bytes. - //!Returns a default constructed iterator on failure. - multiallocation_chain allocate_many - (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, std::nothrow_t) - { return MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element); } + //!element_lengths[i]*sizeof_element bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element, chain); } - //!Deallocates elements pointed by the - //!multiallocation iterator range. - void deallocate_many(multiallocation_chain chain) - { MemoryAlgorithm::deallocate_many(boost::move(chain)); } + //!Deallocates all elements contained in chain. + //!Never throws. + void deallocate_many(multiallocation_chain &chain) + { MemoryAlgorithm::deallocate_many(chain); } /// @endcond //!Allocates nbytes bytes. Throws boost::interprocess::bad_alloc //!on failure void * allocate(size_type nbytes) - { + { void * ret = MemoryAlgorithm::allocate(nbytes); if(!ret) throw bad_alloc(); return ret; } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Never throws void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t) { return MemoryAlgorithm::allocate_aligned(nbytes, alignment); } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Throws bad_alloc when fails void * allocate_aligned(size_type nbytes, size_type alignment) - { + { void * ret = MemoryAlgorithm::allocate_aligned(nbytes, alignment); if(!ret) throw bad_alloc(); @@ -269,7 +270,7 @@ class segment_manager_base throw bad_alloc(); } else{ - return 0; + return 0; } } @@ -293,7 +294,7 @@ class segment_manager_base void prot_anonymous_destroy(const void *object, ipcdetail::in_place_interface &table) { - //Get control data from associated with this object + //Get control data from associated with this object typedef ipcdetail::block_header block_header_t; block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment); @@ -318,9 +319,9 @@ class segment_manager_base //!This object is placed in the beginning of memory segment and //!implements the allocation (named or anonymous) of portions //!of the segment. This object contains two indexes that -//!maintain an association between a name and a portion of the segment. +//!maintain an association between a name and a portion of the segment. //! -//!The first index contains the mappings for normal named objects using the +//!The first index contains the mappings for normal named objects using the //!char type specified in the template parameter. //! //!The second index contains the association for unique instances. The key will @@ -336,7 +337,7 @@ template class IndexType> class segment_manager : public segment_manager_base -{ +{ /// @cond //Non-copyable segment_manager(); @@ -407,8 +408,8 @@ class segment_manager //!"size" is the size of the memory segment where //!the segment manager is being constructed. //!Can throw - segment_manager(size_type size) - : Base(size, priv_get_reserved_bytes()) + explicit segment_manager(size_type segment_size) + : Base(segment_size, priv_get_reserved_bytes()) , m_header(static_cast(get_this_pointer())) { (void) anonymous_instance; (void) unique_instance; @@ -446,7 +447,7 @@ class segment_manager //!Returns throwing "construct" proxy //!object template - typename construct_proxy::type + typename construct_proxy::type construct(char_ptr_holder_t name) { return typename construct_proxy::type (this, name, false, true); } @@ -466,39 +467,39 @@ class segment_manager //!Returns no throwing "search or construct" //!proxy object template - typename construct_proxy::type + typename construct_proxy::type find_or_construct(char_ptr_holder_t name, std::nothrow_t) { return typename construct_proxy::type (this, name, true, false); } //!Returns throwing "construct from iterators" proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type construct_it(char_ptr_holder_t name) { return typename construct_iter_proxy::type (this, name, false, true); } //!Returns throwing "search or construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name) { return typename construct_iter_proxy::type (this, name, true, true); } //!Returns no throwing "construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type construct_it(char_ptr_holder_t name, std::nothrow_t) { return typename construct_iter_proxy::type (this, name, false, false); } //!Returns no throwing "search or construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name, std::nothrow_t) { return typename construct_iter_proxy::type (this, name, true, false); } - //!Calls object function blocking recursive interprocess_mutex and guarantees that - //!no new named_alloc or destroy will be executed by any process while + //!Calls object function blocking recursive interprocess_mutex and guarantees that + //!no new named_alloc or destroy will be executed by any process while //!executing the object function call*/ template void atomic_func(Func &f) @@ -571,22 +572,22 @@ class segment_manager static instance_type get_instance_type(const T *ptr) { return priv_get_instance_type(block_header_t::block_header_from_value(ptr)); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" named objects in the managed memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_named_objects(size_type num) - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - m_header.m_named_index.reserve(num); + m_header.m_named_index.reserve(num); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" unique objects in the managed memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_unique_objects(size_type num) - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- @@ -596,32 +597,32 @@ class segment_manager //!Calls shrink_to_fit in both named and unique object indexes //!to try to free unused memory from those indexes. void shrink_to_fit_indexes() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - m_header.m_named_index.shrink_to_fit(); - m_header.m_unique_index.shrink_to_fit(); + m_header.m_named_index.shrink_to_fit(); + m_header.m_unique_index.shrink_to_fit(); } //!Returns the number of named objects stored in //!the segment. size_type get_num_named_objects() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - return m_header.m_named_index.size(); + return m_header.m_named_index.size(); } //!Returns the number of unique objects stored in //!the segment. size_type get_num_unique_objects() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - return m_header.m_unique_index.size(); + return m_header.m_unique_index.size(); } //!Obtains the minimum size needed by the @@ -693,13 +694,13 @@ class segment_manager /// @cond - //!Generic named/anonymous new function. Offers all the possibilities, - //!such as throwing, search before creating, and the constructor is + //!Generic named/anonymous new function. Offers all the possibilities, + //!such as throwing, search before creating, and the constructor is //!encapsulated in an object function. template - T *generic_construct(const CharType *name, - size_type num, - bool try2find, + T *generic_construct(const CharType *name, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table) { @@ -713,20 +714,20 @@ class segment_manager //!returned pair is 0. template std::pair priv_find_impl (const CharType* name, bool lock) - { + { //The name can't be null, no anonymous object can be found by name BOOST_ASSERT(name != 0); ipcdetail::placement_destroy table; - size_type size; + size_type sz; void *ret; if(name == reinterpret_cast(-1)){ - ret = priv_generic_find (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), lock); + ret = priv_generic_find (typeid(T).name(), m_header.m_unique_index, table, sz, is_intrusive_t(), lock); } else{ - ret = priv_generic_find (name, m_header.m_named_index, table, size, is_intrusive_t(), lock); + ret = priv_generic_find (name, m_header.m_named_index, table, sz, is_intrusive_t(), lock); } - return std::pair(static_cast(ret), size); + return std::pair(static_cast(ret), sz); } //!Tries to find a previous unique allocation. Returns the address @@ -737,13 +738,13 @@ class segment_manager { ipcdetail::placement_destroy table; size_type size; - void *ret = priv_generic_find(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock); + void *ret = priv_generic_find(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock); return std::pair(static_cast(ret), size); } - void *priv_generic_construct(const CharType *name, - size_type num, - bool try2find, + void *priv_generic_construct(const CharType *name, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table) { @@ -805,7 +806,7 @@ class segment_manager return 0; } CharType *name = static_cast(ctrl_data->template name()); - + //Sanity checks BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharType)); BOOST_ASSERT(ctrl_data->m_num_char == std::char_traits::length(name)); @@ -837,7 +838,7 @@ class segment_manager template void *priv_generic_find - (const CharT* name, + (const CharT* name, IndexType > &index, ipcdetail::in_place_interface &table, size_type &length, @@ -877,7 +878,7 @@ class segment_manager template void *priv_generic_find - (const CharT* name, + (const CharT* name, IndexType > &index, ipcdetail::in_place_interface &table, size_type &length, @@ -941,7 +942,7 @@ class segment_manager } template - bool priv_generic_named_destroy(const CharT *name, + bool priv_generic_named_destroy(const CharT *name, IndexType > &index, ipcdetail::in_place_interface &table, ipcdetail::true_ is_intrusive_index) @@ -951,7 +952,7 @@ class segment_manager typedef ipcdetail::index_key index_key_t; typedef typename index_type::iterator index_it; typedef typename index_type::value_type intrusive_value_type; - + //------------------------------- scoped_lock guard(m_header); //------------------------------- @@ -972,7 +973,7 @@ class segment_manager void *memory = iv; void *values = ctrl_data->value(); std::size_t num = ctrl_data->m_value_bytes/table.size; - + //Sanity check BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char()); @@ -992,7 +993,7 @@ class segment_manager } template - bool priv_generic_named_destroy(const CharT *name, + bool priv_generic_named_destroy(const CharT *name, IndexType > &index, ipcdetail::in_place_interface &table, ipcdetail::false_ is_intrusive_index) @@ -1006,7 +1007,7 @@ class segment_manager scoped_lock guard(m_header); //------------------------------- //Try to find the name in the index - index_it it = index.find(key_type (name, + index_it it = index.find(key_type (name, std::char_traits::length(name))); //If not found, return false @@ -1033,7 +1034,7 @@ class segment_manager char *stored_name = static_cast(static_cast(const_cast(it->first.name()))); (void)stored_name; - //Check if the distance between the name pointer and the memory pointer + //Check if the distance between the name pointer and the memory pointer //is correct (this can detect incorrect type in destruction) std::size_t num = ctrl_data->m_value_bytes/table.size; void *values = ctrl_data->value(); @@ -1070,8 +1071,8 @@ class segment_manager template void * priv_generic_named_construct(unsigned char type, const CharT *name, - size_type num, - bool try2find, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table, IndexType > &index, @@ -1095,12 +1096,12 @@ class segment_manager //------------------------------- //Insert the node. This can throw. //First, we want to know if the key is already present before - //we allocate any memory, and if the key is not present, we + //we allocate any memory, and if the key is not present, we //want to allocate all memory in a single buffer that will //contain the name and the user buffer. // //Since equal_range(key) + insert(hint, value) approach is - //quite inefficient in container implementations + //quite inefficient in container implementations //(they re-test if the position is correct), I've chosen //to insert the node, do an ugly un-const cast and modify //the key (which is a smart pointer) to an equivalent one @@ -1138,7 +1139,7 @@ class segment_manager } //Allocates buffer for name + data, this can throw (it hurts) - void *buffer_ptr; + void *buffer_ptr; //Check if there is enough memory if(dothrow){ @@ -1149,7 +1150,7 @@ class segment_manager buffer_ptr = this->allocate (block_info.template total_size_with_header(), std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } //Now construct the intrusive hook plus the header @@ -1184,7 +1185,7 @@ class segment_manager //the memory allocation as the intrusive value is built in that //memory value_eraser v_eraser(index, it); - + //Construct array, this can throw ipcdetail::array_construct(ptr, num, table); @@ -1197,10 +1198,10 @@ class segment_manager //!Generic named new function for //!named functions template - void * priv_generic_named_construct(unsigned char type, + void * priv_generic_named_construct(unsigned char type, const CharT *name, - size_type num, - bool try2find, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table, IndexType > &index, @@ -1227,12 +1228,12 @@ class segment_manager //------------------------------- //Insert the node. This can throw. //First, we want to know if the key is already present before - //we allocate any memory, and if the key is not present, we + //we allocate any memory, and if the key is not present, we //want to allocate all memory in a single buffer that will //contain the name and the user buffer. // //Since equal_range(key) + insert(hint, value) approach is - //quite inefficient in container implementations + //quite inefficient in container implementations //(they re-test if the position is correct), I've chosen //to insert the node, do an ugly un-const cast and modify //the key (which is a smart pointer) to an equivalent one @@ -1265,7 +1266,7 @@ class segment_manager value_eraser v_eraser(index, it); //Allocates buffer for name + data, this can throw (it hurts) - void *buffer_ptr; + void *buffer_ptr; block_header_t * hdr; //Allocate and construct the headers @@ -1277,7 +1278,7 @@ class segment_manager else{ buffer_ptr = this->allocate(total_size, std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } index_it *idr = new(buffer_ptr) index_it(it); hdr = block_header_t::template from_first_header(idr); @@ -1289,7 +1290,7 @@ class segment_manager else{ buffer_ptr = this->allocate(block_info.total_size(), std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } hdr = static_cast(buffer_ptr); } @@ -1303,7 +1304,7 @@ class segment_manager std::char_traits::copy(name_ptr, name, namelen+1); //Do the ugly cast, please mama, forgive me! - //This new key points to an identical string, so it must have the + //This new key points to an identical string, so it must have the //same position than the overwritten key according to the predicate const_cast(it->first).name(name_ptr); it->second.m_ptr = hdr; @@ -1346,7 +1347,7 @@ class segment_manager { named_index_t m_named_index; unique_index_t m_unique_index; - + header_t(Base *restricted_segment_mngr) : m_named_index (restricted_segment_mngr) , m_unique_index(restricted_segment_mngr) diff --git a/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp b/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp index 7c8fcf61b..c501ee1a8 100644 --- a/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp +++ b/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -28,7 +28,7 @@ #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY) # include //System V shared memory... #elif defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) -# include //O_CREAT, O_*... +# include //O_CREAT, O_*... # include //shm_xxx # include //ftruncate, close # include //mode_t, S_IRWXG, S_IRWXO, S_IRWXU, @@ -71,26 +71,26 @@ class shared_memory_object shared_memory_object(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); } - //!Tries to open a shared memory object with name "name", with the access mode "mode". + //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. shared_memory_object(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw shared_memory_object(BOOST_RV_REF(shared_memory_object) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved) - { + { shared_memory_object tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps the shared_memory_objects. Does not throw @@ -99,7 +99,7 @@ class shared_memory_object //!Erases a shared memory object from the system. //!Returns false on error. Never throws static bool remove(const char *name); - + //!Sets the size of the shared memory mapping void truncate(offset_t length); @@ -142,11 +142,11 @@ class shared_memory_object /// @cond -inline shared_memory_object::shared_memory_object() +inline shared_memory_object::shared_memory_object() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline shared_memory_object::~shared_memory_object() +inline shared_memory_object::~shared_memory_object() { this->priv_close(); } @@ -157,10 +157,10 @@ inline bool shared_memory_object::get_size(offset_t &size) const { return ipcdetail::get_file_size((file_handle_t)m_handle, size); } inline void shared_memory_object::swap(shared_memory_object &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t shared_memory_object::get_mapping_handle() const @@ -268,7 +268,7 @@ inline bool use_filesystem_based_posix() } //shared_memory_object_detail inline bool shared_memory_object::priv_open_or_create - (ipcdetail::create_enum_t type, + (ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm) { diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp index 4aba77297..8447bf1b3 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -26,9 +26,9 @@ //!Describes the functor to delete objects from the segment. namespace boost { -namespace interprocess { +namespace interprocess { -//!A deleter that uses the segment manager's destroy_ptr +//!A deleter that uses the segment manager's destroy_ptr //!function to destroy the passed pointer resource. //! //!This deleter is used @@ -56,7 +56,7 @@ class deleter { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); } }; -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp index 0150ef6c0..f0006fb1b 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Peter Dimov and Multi Media Ltd. 2001, 2002, 2003 // (C) Copyright Peter Dimov 2004-2005 -// (C) Copyright Ion Gaztanaga 2006-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include // std::less @@ -99,7 +99,7 @@ class shared_count counted_impl_allocator alloc(a); m_pi = alloc.allocate(1); //Anti-exception deallocator - scoped_ptr > deallocator(m_pi, alloc); //It's more correct to use VoidAllocator::construct but @@ -116,7 +116,7 @@ class shared_count } ~shared_count() // nothrow - { + { if(m_pi) m_pi->release(); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp index 24d96ee48..d03965cdc 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp index edb39eeeb..74f65f181 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp @@ -9,7 +9,7 @@ // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // Copyright 2004-2005 Peter Dimov -// Copyright 2007-2011 Ion Gaztanaga +// Copyright 2007-2012 Ion Gaztanaga // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp index 4e2e664c8..2d29ae62b 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -63,10 +63,10 @@ struct scoped_ptr_dealloc_functor { if (ptr) priv_deallocate(ptr, alloc_version()); } }; - + template -class sp_counted_impl_pd +class sp_counted_impl_pd : public sp_counted_base , boost::container::allocator_traits::template portable_rebind_alloc< sp_counted_impl_pd >::type @@ -122,7 +122,7 @@ class sp_counted_impl_pd this_pointer this_ptr (this); //Do it now! scoped_ptr< this_type, scoped_ptr_dealloc_functor > - deleter(this_ptr, a_copy); + deleter_ptr(this_ptr, a_copy); typedef typename this_allocator::value_type value_type; ipcdetail::to_raw_pointer(this_ptr)->~value_type(); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp index 9c8c7918f..d9f16aece 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/enable_shared_from_this.hpp // // (C) Copyright Peter Dimov 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp index 3f086f536..897c5da4e 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/intrusive_ptr.hpp // // (C) Copyright Peter Dimov 2001, 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -33,12 +33,12 @@ namespace interprocess { //!The intrusive_ptr class template stores a pointer to an object //!with an embedded reference count. intrusive_ptr is parameterized on -//!T (the type of the object pointed to) and VoidPointer(a void pointer type +//!T (the type of the object pointed to) and VoidPointer(a void pointer type //!that defines the type of pointer that intrusive_ptr will store). //!intrusive_ptr defines a class with a T* member whereas //!intrusive_ptr > defines a class with a offset_ptr member. //!Relies on unqualified calls to: -//! +//! //! void intrusive_ptr_add_ref(T * p); //! void intrusive_ptr_release(T * p); //! @@ -69,7 +69,7 @@ class intrusive_ptr intrusive_ptr(): m_ptr(0) {} - //!Constructor. Copies pointer and if "p" is not zero and + //!Constructor. Copies pointer and if "p" is not zero and //!"add_ref" is true calls intrusive_ptr_add_ref(to_raw_pointer(p)). //!Does not throw intrusive_ptr(const pointer &p, bool add_ref = true): m_ptr(p) @@ -101,7 +101,7 @@ class intrusive_ptr if(m_ptr != 0) intrusive_ptr_release(ipcdetail::to_raw_pointer(m_ptr)); } - //!Assignment operator. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment operator. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw intrusive_ptr & operator=(intrusive_ptr const & rhs) { @@ -109,7 +109,7 @@ class intrusive_ptr return *this; } - //!Assignment from related. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment from related. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw template intrusive_ptr & operator= (intrusive_ptr const & rhs) @@ -118,14 +118,14 @@ class intrusive_ptr return *this; } - //!Assignment from pointer. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment from pointer. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw intrusive_ptr & operator=(pointer rhs) { this_type(rhs).swap(*this); return *this; } - + //!Returns a reference to the internal pointer. //!Does not throw pointer &get() @@ -175,7 +175,7 @@ class intrusive_ptr //!Returns a.get() == b.get(). //!Does not throw template inline -bool operator==(intrusive_ptr const & a, +bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) { return a.get() == b.get(); } @@ -217,11 +217,11 @@ bool operator!=(const typename intrusive_ptr::pointer &a, //!Returns a.get() < b.get(). //!Does not throw template inline -bool operator<(intrusive_ptr const & a, +bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) -{ +{ return std::less::pointer>() - (a.get(), b.get()); + (a.get(), b.get()); } //!Exchanges the contents of the two intrusive_ptrs. @@ -233,7 +233,7 @@ void swap(intrusive_ptr & lhs, // operator<< template -inline std::basic_ostream & operator<< +inline std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p) { os << p.get(); return os; } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp index 1885838ff..8a2ba363f 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // (C) Copyright Peter Dimov 2001, 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -27,14 +27,14 @@ namespace boost { namespace interprocess { -//!scoped_ptr stores a pointer to a dynamically allocated object. +//!scoped_ptr stores a pointer to a dynamically allocated object. //!The object pointed to is guaranteed to be deleted, either on destruction //!of the scoped_ptr, or via an explicit reset. The user can avoid this //!deletion using release(). -//!scoped_ptr is parameterized on T (the type of the object pointed to) and +//!scoped_ptr is parameterized on T (the type of the object pointed to) and //!Deleter (the functor to be executed to delete the internal pointer). -//!The internal pointer will be of the same pointer type as typename -//!Deleter::pointer type (that is, if typename Deleter::pointer is +//!The internal pointer will be of the same pointer type as typename +//!Deleter::pointer type (that is, if typename Deleter::pointer is //!offset_ptr, the internal pointer will be offset_ptr). template class scoped_ptr @@ -60,10 +60,10 @@ class scoped_ptr : Deleter(d), m_ptr(p) // throws if pointer/Deleter copy ctor throws {} - //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. + //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. //!calling the operator() of the stored deleter. Never throws ~scoped_ptr() - { + { if(m_ptr){ Deleter &del = static_cast(*this); del(m_ptr); diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp index 61829078e..302eb149f 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // (C) Copyright Peter Dimov 2001, 2002, 2003 -// (C) Copyright Ion Gaztanaga 2006-2011. +// (C) Copyright Ion Gaztanaga 2006-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) @@ -52,7 +52,7 @@ inline void sp_enable_shared_from_this (shared_count const & pn ,enable_shared_from_this *pe ,T *ptr) - + { (void)ptr; if(pe != 0){ @@ -66,17 +66,17 @@ inline void sp_enable_shared_from_this(shared_count c } // namespace ipcdetail -//!shared_ptr stores a pointer to a dynamically allocated object. -//!The object pointed to is guaranteed to be deleted when the last shared_ptr pointing to +//!shared_ptr stores a pointer to a dynamically allocated object. +//!The object pointed to is guaranteed to be deleted when the last shared_ptr pointing to //!it is destroyed or reset. //! -//!shared_ptr is parameterized on +//!shared_ptr is parameterized on //!T (the type of the object pointed to), VoidAllocator (the void allocator to be used -//!to allocate the auxiliary data) and Deleter (the deleter whose +//!to allocate the auxiliary data) and Deleter (the deleter whose //!operator() will be used to delete the object. //! -//!The internal pointer will be of the same pointer type as typename -//!VoidAllocator::pointer type (that is, if typename VoidAllocator::pointer is +//!The internal pointer will be of the same pointer type as typename +//!VoidAllocator::pointer type (that is, if typename VoidAllocator::pointer is //!offset_ptr, the internal pointer will be offset_ptr). //! //!Because the implementation uses reference counting, cycles of shared_ptr @@ -125,7 +125,7 @@ class shared_ptr //!Requirements: Deleter and A's copy constructor must not throw. explicit shared_ptr(const pointer&p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) : m_pn(p, a, d) - { + { //Check that the pointer passed is of the same type that //the pointer the allocator defines or it's a raw pointer typedef typename boost::intrusive:: @@ -134,25 +134,30 @@ class shared_ptr BOOST_STATIC_ASSERT((ipcdetail::is_same::value) || (ipcdetail::is_pointer::value)); - ipcdetail::sp_enable_shared_from_this( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) ); + ipcdetail::sp_enable_shared_from_this( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) ); } + //!Copy constructs a shared_ptr. If r is empty, constructs an empty shared_ptr. Otherwise, constructs + //!a shared_ptr that shares ownership with r. Never throws. + shared_ptr(const shared_ptr &r) + : m_pn(r.m_pn) // never throws + {} - //!Constructs a shared_ptr that shares ownership with r and stores p. + //!Constructs a shared_ptr that shares ownership with other and stores p. //!Postconditions: get() == p && use_count() == r.use_count(). //!Throws: nothing. shared_ptr(const shared_ptr &other, const pointer &p) : m_pn(other.m_pn, p) {} - //!If r is empty, constructs an empty shared_ptr. Otherwise, constructs + //!If r is empty, constructs an empty shared_ptr. Otherwise, constructs //!a shared_ptr that shares ownership with r. Never throws. template shared_ptr(shared_ptr const & r) : m_pn(r.m_pn) // never throws {} - //!Constructs a shared_ptr that shares ownership with r and stores + //!Constructs a shared_ptr that shares ownership with r and stores //!a copy of the pointer stored in r. template explicit shared_ptr(weak_ptr const & r) @@ -170,19 +175,19 @@ class shared_ptr template shared_ptr(shared_ptr const & r, ipcdetail::static_cast_tag) : m_pn( pointer(static_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) {} template shared_ptr(shared_ptr const & r, ipcdetail::const_cast_tag) : m_pn( pointer(const_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) {} template shared_ptr(shared_ptr const & r, ipcdetail::dynamic_cast_tag) : m_pn( pointer(dynamic_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) { if(!m_pn.to_raw_pointer()){ // need to allocate new counter -- the cast failed m_pn = ipcdetail::shared_count(); @@ -218,15 +223,15 @@ class shared_ptr //!This is equivalent to: //!this_type().swap(*this); void reset() - { - this_type().swap(*this); + { + this_type().swap(*this); } //!This is equivalent to: //!this_type(p, a, d).swap(*this); template void reset(const Pointer &p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) - { + { //Check that the pointer passed is of the same type that //the pointer the allocator defines or it's a raw pointer typedef typename boost::intrusive:: @@ -234,7 +239,7 @@ class shared_ptr rebind_pointer::type ParameterPointer; BOOST_STATIC_ASSERT((ipcdetail::is_same::value) || (ipcdetail::is_pointer::value)); - this_type(p, a, d).swap(*this); + this_type(p, a, d).swap(*this); } template @@ -248,12 +253,12 @@ class shared_ptr reference operator* () const // never throws { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return *m_pn.to_raw_pointer(); } - //!Returns the pointer pointing + //!Returns the pointer pointing //!to the owned object pointer operator-> () const // never throws { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return m_pn.to_raw_pointer(); } - //!Returns the pointer pointing + //!Returns the pointer pointing //!to the owned object pointer get() const // never throws { return m_pn.to_raw_pointer(); } @@ -292,7 +297,7 @@ class shared_ptr /// @cond - template + template bool _internal_less(shared_ptr const & rhs) const { return m_pn < rhs.m_pn; } @@ -311,19 +316,19 @@ class shared_ptr /// @endcond }; // shared_ptr -template inline +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) { return a.get() == b.get(); } -template inline +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) { return a.get() != b.get(); } -template inline +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) { return a._internal_less(b); } -template inline +template inline void swap(shared_ptr & a, shared_ptr & b) { a.swap(b); } @@ -331,11 +336,11 @@ template inline shared_ptr static_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::static_cast_tag()); } -template inline +template inline shared_ptr const_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::const_cast_tag()); } -template inline +template inline shared_ptr dynamic_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::dynamic_cast_tag()); } @@ -346,7 +351,7 @@ T * to_raw_pointer(shared_ptr const & p) // operator<< template inline -std::basic_ostream & operator<< +std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) { os << p.get(); return os; } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp index 547038b69..e6503e262 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp @@ -5,7 +5,7 @@ // This file is the adaptation for Interprocess of // Howard Hinnant's unique_ptr emulation code. // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-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) // @@ -272,20 +272,20 @@ class unique_ptr //!Returns: A reference to the stored deleter. //! //!Throws: nothing. - deleter_reference get_deleter() + deleter_reference get_deleter() { return ptr_.second(); } //!Returns: A const reference to the stored deleter. //! //!Throws: nothing. - deleter_const_reference get_deleter() const + deleter_const_reference get_deleter() const { return ptr_.second(); } //!Returns: An unspecified value that, when used in boolean //!contexts, is equivalent to get() != 0. //! //!Throws: nothing. - operator int nat::*() const + operator int nat::*() const { return ptr_.first() ? &nat::for_bool_ : 0; } //!Postcondition: get() == 0. @@ -328,7 +328,7 @@ class unique_ptr BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_ptr) template unique_ptr(unique_ptr&); template unique_ptr(U&, typename ipcdetail::unique_ptr_error::type = 0); - + template unique_ptr& operator=(unique_ptr&); template typename ipcdetail::unique_ptr_error::type operator=(U&); /// @endcond @@ -539,7 +539,7 @@ template inline typename managed_unique_ptr::type make_managed_unique_ptr(T *constructed_object, ManagedMemory &managed_memory) { - return typename managed_unique_ptr::type + return typename managed_unique_ptr::type (constructed_object, managed_memory.template get_deleter()); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp index 7126d055a..99c8a6319 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/weak_ptr.hpp // // (C) Copyright Peter Dimov 2001, 2002, 2003 -// (C) Copyright Ion Gaztanaga 2006-2011. +// (C) Copyright Ion Gaztanaga 2006-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) @@ -31,7 +31,7 @@ namespace boost{ namespace interprocess{ //!The weak_ptr class template stores a "weak reference" to an object -//!that's already managed by a shared_ptr. To access the object, a weak_ptr +//!that's already managed by a shared_ptr. To access the object, a weak_ptr //!can be converted to a shared_ptr using the shared_ptr constructor or the //!member function lock. When the last shared_ptr to the object goes away //!and the object is deleted, the attempt to obtain a shared_ptr from the @@ -99,11 +99,11 @@ class weak_ptr template weak_ptr(weak_ptr const & r) : m_pn(r.m_pn) // never throws - { + { //Construct a temporary shared_ptr so that nobody //can destroy the value while constructing this const shared_ptr &ref = r.lock(); - m_pn.set_pointer(ref.get()); + m_pn.set_pointer(ref.get()); } //!Effects: If r is empty, constructs an empty weak_ptr; otherwise, @@ -126,7 +126,7 @@ class weak_ptr //!implied guarantees) via different means, without creating a temporary. template weak_ptr & operator=(weak_ptr const & r) // never throws - { + { //Construct a temporary shared_ptr so that nobody //can destroy the value while constructing this const shared_ptr &ref = r.lock(); @@ -174,7 +174,7 @@ class weak_ptr //!testing purposes, not for production code. long use_count() const // never throws { return m_pn.use_count(); } - + //!Returns: Returns: use_count() == 0. //! //!Throws: nothing. @@ -196,10 +196,10 @@ class weak_ptr { ipcdetail::do_swap(m_pn, other.m_pn); } /// @cond - template + template bool _internal_less(weak_ptr const & rhs) const { return m_pn < rhs.m_pn; } - + template void _internal_assign(const ipcdetail::shared_count & pn2) { @@ -216,7 +216,7 @@ class weak_ptr /// @endcond }; // weak_ptr -template inline +template inline bool operator<(weak_ptr const & a, weak_ptr const & b) { return a._internal_less(b); } diff --git a/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp b/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp index 834b3d1e0..9a2681abf 100644 --- a/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp +++ b/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -8,7 +8,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005. +// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005-2012. // Changed internal SGI string to a buffer. Added efficient // internal buffer get/set/swap functions, so that we can obtain/establish the // internal buffer without any reallocation or copy. Kill those temporaries! @@ -42,7 +42,7 @@ #include #include #include -#include // char traits +#include // char traits #include // ptrdiff_t #include #include @@ -53,7 +53,7 @@ namespace boost { namespace interprocess { //!a basic_xbufferstream. The elements are transmitted from a to a fixed //!size buffer template -class basic_bufferbuf +class basic_bufferbuf : public std::basic_streambuf { public: @@ -74,24 +74,24 @@ class basic_bufferbuf //!Constructor. Assigns formatting buffer. //!Does not throw. - explicit basic_bufferbuf(CharT *buffer, std::size_t length, + explicit basic_bufferbuf(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) - : base_t(), m_mode(mode), m_buffer(buffer), m_length(length) + : base_t(), m_mode(mode), m_buffer(buf), m_length(length) { this->set_pointers(); } virtual ~basic_bufferbuf(){} public: - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return std::pair(m_buffer, m_length); } //!Sets the underlying buffer to a new value //!Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buffer = buffer; m_length = length; this->set_pointers(); } + void buffer(CharT *buf, std::size_t length) + { m_buffer = buf; m_length = length; this->set_pointers(); } /// @cond private: @@ -172,13 +172,13 @@ class basic_bufferbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { bool in = false; bool out = false; - - const std::ios_base::openmode inout = + + const std::ios_base::openmode inout = std::ios_base::in | std::ios_base::out; if((mode & inout) == inout) { @@ -205,7 +205,7 @@ class basic_bufferbuf newoff = static_cast(m_length); break; case std::ios_base::cur: - newoff = in ? static_cast(this->gptr() - this->eback()) + newoff = in ? static_cast(this->gptr() - this->eback()) : static_cast(this->pptr() - this->pbase()); break; default: @@ -237,7 +237,7 @@ class basic_bufferbuf return pos_type(off); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -275,10 +275,10 @@ class basic_ibufferstream //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_ibufferstream(const CharT *buffer, std::size_t length, - std::ios_base::openmode mode = std::ios_base::in) - : basic_ios_t(), base_t(0), - m_buf(const_cast(buffer), length, mode | std::ios_base::in) + basic_ibufferstream(const CharT *buf, std::size_t length, + std::ios_base::openmode mode = std::ios_base::in) + : basic_ios_t(), base_t(0), + m_buf(const_cast(buf), length, mode | std::ios_base::in) { basic_ios_t::init(&m_buf); } ~basic_ibufferstream(){}; @@ -289,15 +289,15 @@ class basic_ibufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(const CharT *buffer, std::size_t length) - { m_buf.buffer(const_cast(buffer), length); } + void buffer(const CharT *buf, std::size_t length) + { m_buf.buffer(const_cast(buf), length); } /// @cond private: @@ -333,10 +333,10 @@ class basic_obufferstream //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_obufferstream(CharT *buffer, std::size_t length, + basic_obufferstream(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::out) - : basic_ios_t(), base_t(0), - m_buf(buffer, length, mode | std::ios_base::out) + : basic_ios_t(), base_t(0), + m_buf(buf, length, mode | std::ios_base::out) { basic_ios_t::init(&m_buf); } ~basic_obufferstream(){} @@ -347,15 +347,15 @@ class basic_obufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buf.buffer(buffer, length); } + void buffer(CharT *buf, std::size_t length) + { m_buf.buffer(buf, length); } /// @cond private: @@ -367,7 +367,7 @@ class basic_obufferstream //!A basic_iostream class that uses a fixed size character buffer //!as its formatting buffer. template -class basic_bufferstream +class basic_bufferstream : public std::basic_iostream { @@ -388,17 +388,17 @@ class basic_bufferstream public: //!Constructor. //!Does not throw. - basic_bufferstream(std::ios_base::openmode mode + basic_bufferstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_bufferstream(CharT *buffer, std::size_t length, + basic_bufferstream(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) - : basic_ios_t(), base_t(0), m_buf(buffer, length, mode) + : basic_ios_t(), base_t(0), m_buf(buf, length, mode) { basic_ios_t::init(&m_buf); } ~basic_bufferstream(){} @@ -409,15 +409,15 @@ class basic_bufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buf.buffer(buffer, length); } + void buffer(CharT *buf, std::size_t length) + { m_buf.buffer(buf, length); } /// @cond private: diff --git a/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp b/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp index 83041f2b2..0c9f540e3 100644 --- a/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp +++ b/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -8,7 +8,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005. +// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005-2012. // Changed internal SGI string to a generic, templatized vector. Added efficient // internal buffer get/set/swap functions, so that we can obtain/establish the // internal buffer without any reallocation or copy. Kill those temporaries! @@ -30,7 +30,7 @@ //!This file defines basic_vectorbuf, basic_ivectorstream, //!basic_ovectorstream, and basic_vectorstreamclasses. These classes //!represent streamsbufs and streams whose sources or destinations are -//!STL-like vectors that can be swapped with external vectors to avoid +//!STL-like vectors that can be swapped with external vectors to avoid //!unnecessary allocations/copies. #ifndef BOOST_INTERPROCESS_VECTORSTREAM_HPP @@ -43,7 +43,7 @@ #include #include #include -#include // char traits +#include // char traits #include // ptrdiff_t #include #include @@ -51,9 +51,9 @@ namespace boost { namespace interprocess { //!A streambuf class that controls the transmission of elements to and from -//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. +//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. //!It holds a character vector specified by CharVector template parameter -//!as its formatting buffer. The vector must have contiguous storage, like +//!as its formatting buffer. The vector must have contiguous storage, like //!std::vector, boost::interprocess::vector or boost::interprocess::basic_string template class basic_vectorbuf @@ -96,11 +96,11 @@ class basic_vectorbuf public: - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) - { + { if (this->m_mode & std::ios_base::out){ //Update high water if necessary //And resize vector to remove extra size @@ -118,8 +118,8 @@ class basic_vectorbuf //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const - { + const vector_type &vector() const + { if (this->m_mode & std::ios_base::out){ if (mp_high_water < base_t::pptr()){ //Restore the vector's size if necessary @@ -137,13 +137,13 @@ class basic_vectorbuf const_cast(this)->base_t::pbump(old_pos); } } - return m_vect; + return m_vect; } //!Preallocates memory from the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's memory allocation throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { if (this->m_mode & std::ios_base::out && size > m_vect.size()){ typename vector_type::difference_type write_pos = base_t::pptr() - base_t::pbase(); @@ -282,7 +282,7 @@ class basic_vectorbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { //Get seek mode @@ -325,7 +325,7 @@ class basic_vectorbuf newoff = limit; break; case std::ios_base::cur: - newoff = in ? static_cast(this->gptr() - this->eback()) + newoff = in ? static_cast(this->gptr() - this->eback()) : static_cast(this->pptr() - this->pbase()); break; default: @@ -350,7 +350,7 @@ class basic_vectorbuf return pos_type(newoff); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -413,7 +413,7 @@ class basic_ivectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -421,18 +421,18 @@ class basic_ivectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf().clear(); } }; @@ -488,7 +488,7 @@ class basic_ovectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -496,13 +496,13 @@ class basic_ovectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } }; @@ -534,7 +534,7 @@ class basic_vectorstream public: //!Constructor. Throws if vector_type default //!constructor throws. - basic_vectorstream(std::ios_base::openmode mode + basic_vectorstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } @@ -554,7 +554,7 @@ class basic_vectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -562,18 +562,18 @@ class basic_vectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf.vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf.reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf.clear(); } /// @cond diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp new file mode 100644 index 000000000..09643b408 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp @@ -0,0 +1,394 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP +#define BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// +// Condition variable algorithm taken from pthreads-win32 discussion. +// +// The algorithm was developed by Alexander Terekhov in colaboration with +// Louis Thomas. +// +// Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL +// +// semBlockLock - bin.semaphore +// semBlockQueue - semaphore +// mtxExternal - mutex or CS +// mtxUnblockLock - mutex or CS +// nWaitersGone - int +// nWaitersBlocked - int +// nWaitersToUnblock - int +// +// wait( timeout ) { +// +// [auto: register int result ] // error checking omitted +// [auto: register int nSignalsWasLeft ] +// [auto: register int nWaitersWasGone ] +// +// sem_wait( semBlockLock ); +// nWaitersBlocked++; +// sem_post( semBlockLock ); +// +// unlock( mtxExternal ); +// bTimedOut = sem_wait( semBlockQueue,timeout ); +// +// lock( mtxUnblockLock ); +// if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { +// if ( bTimedOut ) { // timeout (or canceled) +// if ( 0 != nWaitersBlocked ) { +// nWaitersBlocked--; +// } +// else { +// nWaitersGone++; // count spurious wakeups. +// } +// } +// if ( 0 == --nWaitersToUnblock ) { +// if ( 0 != nWaitersBlocked ) { +// sem_post( semBlockLock ); // open the gate. +// nSignalsWasLeft = 0; // do not open the gate +// // below again. +// } +// else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { +// nWaitersGone = 0; +// } +// } +// } +// else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or +// // spurious semaphore :-) +// sem_wait( semBlockLock ); +// nWaitersBlocked -= nWaitersGone; // something is going on here +// // - test of timeouts? :-) +// sem_post( semBlockLock ); +// nWaitersGone = 0; +// } +// unlock( mtxUnblockLock ); +// +// if ( 1 == nSignalsWasLeft ) { +// if ( 0 != nWaitersWasGone ) { +// // sem_adjust( semBlockQueue,-nWaitersWasGone ); +// while ( nWaitersWasGone-- ) { +// sem_wait( semBlockQueue ); // better now than spurious later +// } +// } sem_post( semBlockLock ); // open the gate +// } +// +// lock( mtxExternal ); +// +// return ( bTimedOut ) ? ETIMEOUT : 0; +// } +// +// signal(bAll) { +// +// [auto: register int result ] +// [auto: register int nSignalsToIssue] +// +// lock( mtxUnblockLock ); +// +// if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! +// if ( 0 == nWaitersBlocked ) { // NO-OP +// return unlock( mtxUnblockLock ); +// } +// if (bAll) { +// nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; +// nWaitersBlocked = 0; +// } +// else { +// nSignalsToIssue = 1; +// nWaitersToUnblock++; +// nWaitersBlocked--; +// } +// } +// else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! +// sem_wait( semBlockLock ); // close the gate +// if ( 0 != nWaitersGone ) { +// nWaitersBlocked -= nWaitersGone; +// nWaitersGone = 0; +// } +// if (bAll) { +// nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; +// nWaitersBlocked = 0; +// } +// else { +// nSignalsToIssue = nWaitersToUnblock = 1; +// nWaitersBlocked--; +// } +// } +// else { // NO-OP +// return unlock( mtxUnblockLock ); +// } +// +// unlock( mtxUnblockLock ); +// sem_post( semBlockQueue,nSignalsToIssue ); +// return result; +// } +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + + +// Required interface for ConditionMembers +// class ConditionMembers +// { +// typedef implementation_defined semaphore_type; +// typedef implementation_defined mutex_type; +// typedef implementation_defined integer_type; +// +// integer_type &get_nwaiters_blocked() +// integer_type &get_nwaiters_gone() +// integer_type &get_nwaiters_to_unblock() +// semaphore_type &get_sem_block_queue() +// semaphore_type &get_sem_block_lock() +// mutex_type &get_mtx_unblock_lock() +// }; +// +// Must be initialized as following +// +// get_nwaiters_blocked() == 0 +// get_nwaiters_gone() == 0 +// get_nwaiters_to_unblock() == 0 +// get_sem_block_queue() == initial count 0 +// get_sem_block_lock() == initial count 1 +// get_mtx_unblock_lock() (unlocked) +// +template +class condition_algorithm_8a +{ + private: + condition_algorithm_8a(); + ~condition_algorithm_8a(); + condition_algorithm_8a(const condition_algorithm_8a &); + condition_algorithm_8a &operator=(const condition_algorithm_8a &); + + typedef typename ConditionMembers::semaphore_type semaphore_type; + typedef typename ConditionMembers::mutex_type mutex_type; + typedef typename ConditionMembers::integer_type integer_type; + + public: + template + static bool wait ( ConditionMembers &data, Lock &lock + , bool timeout_enabled, const boost::posix_time::ptime &abs_time); + static void signal(ConditionMembers &data, bool broadcast); +}; + +template +inline void condition_algorithm_8a::signal(ConditionMembers &data, bool broadcast) +{ + integer_type nsignals_to_issue; + + { + scoped_lock locker(data.get_mtx_unblock_lock()); + + if ( 0 != data.get_nwaiters_to_unblock() ) { // the gate is closed!!! + if ( 0 == data.get_nwaiters_blocked() ) { // NO-OP + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + return; + } + if (broadcast) { + data.get_nwaiters_to_unblock() += nsignals_to_issue = data.get_nwaiters_blocked(); + data.get_nwaiters_blocked() = 0; + } + else { + nsignals_to_issue = 1; + data.get_nwaiters_to_unblock()++; + data.get_nwaiters_blocked()--; + } + } + else if ( data.get_nwaiters_blocked() > data.get_nwaiters_gone() ) { // HARMLESS RACE CONDITION! + data.get_sem_block_lock().wait(); // close the gate + if ( 0 != data.get_nwaiters_gone() ) { + data.get_nwaiters_blocked() -= data.get_nwaiters_gone(); + data.get_nwaiters_gone() = 0; + } + if (broadcast) { + nsignals_to_issue = data.get_nwaiters_to_unblock() = data.get_nwaiters_blocked(); + data.get_nwaiters_blocked() = 0; + } + else { + nsignals_to_issue = data.get_nwaiters_to_unblock() = 1; + data.get_nwaiters_blocked()--; + } + } + else { // NO-OP + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + return; + } + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + } + data.get_sem_block_queue().post(nsignals_to_issue); +} + +template +template +inline bool condition_algorithm_8a::wait + ( ConditionMembers &data + , Lock &lock + , bool tout_enabled + , const boost::posix_time::ptime &abs_time + ) +{ + //Initialize to avoid warnings + integer_type nsignals_was_left = 0; + integer_type nwaiters_was_gone = 0; + + data.get_sem_block_lock().wait(); + ++data.get_nwaiters_blocked(); + data.get_sem_block_lock().post(); + + //Unlock external lock and program for relock + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + + bool bTimedOut = tout_enabled + ? !data.get_sem_block_queue().timed_wait(abs_time) + : (data.get_sem_block_queue().wait(), false); + + { + scoped_lock locker(data.get_mtx_unblock_lock()); + if ( 0 != (nsignals_was_left = data.get_nwaiters_to_unblock()) ) { + if ( bTimedOut ) { // timeout (or canceled) + if ( 0 != data.get_nwaiters_blocked() ) { + data.get_nwaiters_blocked()--; + } + else { + data.get_nwaiters_gone()++; // count spurious wakeups. + } + } + if ( 0 == --data.get_nwaiters_to_unblock() ) { + if ( 0 != data.get_nwaiters_blocked() ) { + data.get_sem_block_lock().post(); // open the gate. + nsignals_was_left = 0; // do not open the gate below again. + } + else if ( 0 != (nwaiters_was_gone = data.get_nwaiters_gone()) ) { + data.get_nwaiters_gone() = 0; + } + } + } + else if ( (std::numeric_limits::max)()/2 + == ++data.get_nwaiters_gone() ) { // timeout/canceled or spurious semaphore :-) + data.get_sem_block_lock().wait(); + data.get_nwaiters_blocked() -= data.get_nwaiters_gone(); // something is going on here - test of timeouts? :-) + data.get_sem_block_lock().post(); + data.get_nwaiters_gone() = 0; + } + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + } + + if ( 1 == nsignals_was_left ) { + if ( 0 != nwaiters_was_gone ) { + // sem_adjust( data.get_sem_block_queue(),-nwaiters_was_gone ); + while ( nwaiters_was_gone-- ) { + data.get_sem_block_queue().wait(); // better now than spurious later + } + } + data.get_sem_block_lock().post(); // open the gate + } + + //lock.lock(); called from unlocker destructor + + return ( bTimedOut ) ? false : true; +} + + +template +class condition_8a_wrapper +{ + //Non-copyable + condition_8a_wrapper(const condition_8a_wrapper &); + condition_8a_wrapper &operator=(const condition_8a_wrapper &); + + ConditionMembers m_data; + typedef ipcdetail::condition_algorithm_8a algo_type; + + public: + + condition_8a_wrapper(){} + + ~condition_8a_wrapper(){} + + ConditionMembers & get_members() + { return m_data; } + + const ConditionMembers & get_members() const + { return m_data; } + + void notify_one() + { algo_type::signal(m_data, false); } + + void notify_all() + { algo_type::signal(m_data, true); } + + template + void wait(L& lock) + { + if (!lock) + throw lock_exception(); + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + void wait(L& lock, Pr pred) + { + if (!lock) + throw lock_exception(); + + while (!pred()) + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock); + return true; + } + if (!lock) + throw lock_exception(); + return algo_type::wait(m_data, lock, true, abs_time); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock, pred); + return true; + } + if (!lock) + throw lock_exception(); + while (!pred()){ + if (!algo_type::wait(m_data, lock, true, abs_time)) + return pred(); + } + return true; + } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp new file mode 100644 index 000000000..a276f826b --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp @@ -0,0 +1,224 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP +#define BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// +// Condition variable 'any' (able to use any type of external mutex) +// +// The code is based on Howard E. Hinnant's ISO C++ N2406 paper. +// Many thanks to Howard for his support and comments. +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + +// Required interface for ConditionAnyMembers +// class ConditionAnyMembers +// { +// typedef implementation_defined mutex_type; +// typedef implementation_defined condvar_type; +// +// condvar &get_condvar() +// mutex_type &get_mutex() +// }; +// +// Must be initialized as following +// +// get_condvar() [no threads blocked] +// get_mutex() [unlocked] + +template +class condition_any_algorithm +{ + private: + condition_any_algorithm(); + ~condition_any_algorithm(); + condition_any_algorithm(const condition_any_algorithm &); + condition_any_algorithm &operator=(const condition_any_algorithm &); + + typedef typename ConditionAnyMembers::mutex_type mutex_type; + typedef typename ConditionAnyMembers::condvar_type condvar_type; + + template + static void do_wait(ConditionAnyMembers &data, Lock& lock); + + template + static bool do_timed_wait(ConditionAnyMembers &data, Lock& lock, const boost::posix_time::ptime &abs_time); + + public: + template + static bool wait ( ConditionAnyMembers &data, Lock &mut + , bool timeout_enabled, const boost::posix_time::ptime &abs_time); + static void signal( ConditionAnyMembers &data, bool broadcast); +}; + +template +void condition_any_algorithm::signal(ConditionAnyMembers &data, bool broadcast) +{ + scoped_lock internal_lock(data.get_mutex()); + if(broadcast){ + data.get_condvar().notify_all(); + } + else{ + data.get_condvar().notify_one(); + } +} + +template +template +bool condition_any_algorithm::wait + ( ConditionAnyMembers &data + , Lock &lock + , bool tout_enabled + , const boost::posix_time::ptime &abs_time) +{ + if(tout_enabled){ + return condition_any_algorithm::do_timed_wait(data, lock, abs_time); + } + else{ + condition_any_algorithm::do_wait(data, lock); + return true; + } +} + +template +template +void condition_any_algorithm::do_wait + (ConditionAnyMembers &data, Lock& lock) +{ + //lock internal before unlocking external to avoid race with a notifier + scoped_lock internal_lock(data.get_mutex()); + { + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + { //unlock internal first to avoid deadlock with near simultaneous waits + scoped_lock internal_unlock; + internal_lock.swap(internal_unlock); + data.get_condvar().wait(internal_unlock); + } + } +} + +template +template +bool condition_any_algorithm::do_timed_wait + (ConditionAnyMembers &data, Lock& lock, const boost::posix_time::ptime &abs_time) +{ + //lock internal before unlocking external to avoid race with a notifier + scoped_lock internal_lock(data.get_mutex()); + { + //Unlock external lock and program for relock + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + { //unlock internal first to avoid deadlock with near simultaneous waits + scoped_lock internal_unlock; + internal_lock.swap(internal_unlock); + return data.get_condvar().timed_wait(internal_unlock, abs_time); + } + } +} + + +template +class condition_any_wrapper +{ + //Non-copyable + condition_any_wrapper(const condition_any_wrapper &); + condition_any_wrapper &operator=(const condition_any_wrapper &); + + ConditionAnyMembers m_data; + typedef ipcdetail::condition_any_algorithm algo_type; + + public: + + condition_any_wrapper(){} + + ~condition_any_wrapper(){} + + ConditionAnyMembers & get_members() + { return m_data; } + + const ConditionAnyMembers & get_members() const + { return m_data; } + + void notify_one() + { algo_type::signal(m_data, false); } + + void notify_all() + { algo_type::signal(m_data, true); } + + template + void wait(L& lock) + { + if (!lock) + throw lock_exception(); + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + void wait(L& lock, Pr pred) + { + if (!lock) + throw lock_exception(); + + while (!pred()) + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock); + return true; + } + if (!lock) + throw lock_exception(); + return algo_type::wait(m_data, lock, true, abs_time); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock, pred); + return true; + } + if (!lock) + throw lock_exception(); + while (!pred()){ + if (!algo_type::wait(m_data, lock, true, abs_time)) + return pred(); + } + return true; + } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp new file mode 100644 index 000000000..fbb003aa0 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_LOCKS_HPP +#define BOOST_INTERPROCESS_DETAIL_LOCKS_HPP + +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +template +class internal_mutex_lock +{ + typedef void (internal_mutex_lock::*unspecified_bool_type)(); + public: + + typedef typename Lock::mutex_type::internal_mutex_type mutex_type; + + + internal_mutex_lock(Lock &l) + : l_(l) + {} + + mutex_type* mutex() const + { return l_ ? &l_.mutex()->internal_mutex() : 0; } + + void lock() { l_.lock(); } + + void unlock() { l_.unlock(); } + + operator unspecified_bool_type() const + { return l_ ? &internal_mutex_lock::lock : 0; } + + private: + Lock &l_; +}; + +template +class lock_inverter +{ + Lock &l_; + public: + lock_inverter(Lock &l) + : l_(l) + {} + void lock() { l_.unlock(); } + void unlock() { l_.lock(); } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_LOCKS_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp index a60b814a4..ef1c68a44 100644 --- a/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -53,21 +53,21 @@ class file_lock //!exist or there are no operating system resources. file_lock(const char *name); - //!Moves the ownership of "moved"'s file mapping object to *this. - //!After the call, "moved" does not represent any file mapping object. + //!Moves the ownership of "moved"'s file mapping object to *this. + //!After the call, "moved" does not represent any file mapping object. //!Does not throw file_lock(BOOST_RV_REF(file_lock) moved) : m_file_hnd(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s file mapping to *this. - //!After the call, "moved" does not represent any file mapping. + //!After the call, "moved" does not represent any file mapping. //!Does not throw file_lock &operator=(BOOST_RV_REF(file_lock) moved) - { + { file_lock tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Closes a file lock. Does not throw. @@ -81,7 +81,7 @@ class file_lock m_file_hnd = other.m_file_hnd; other.m_file_hnd = tmp; } - + //Exclusive locking //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, @@ -101,12 +101,12 @@ class file_lock //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, or sharable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -120,21 +120,21 @@ class file_lock //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership of the - //! mutex this succeeds. + //! mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive ownership of - //! the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); /// @cond @@ -171,7 +171,7 @@ class file_lock bool timed_acquire_file_lock_sharable (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime &abs_time) - { + { //Obtain current count and target time boost::posix_time::ptime now = microsec_clock::universal_time(); using namespace boost::detail; diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp index b0e74fc34..c30e870d7 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,9 +31,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -54,6 +55,11 @@ class named_condition; //!This class is a condition variable that can be placed in shared memory or //!memory mapped files. +//!Destroys the object of type std::condition_variable_any +//! +//!Unlike std::condition_variable in C++11, it is NOT safe to invoke the destructor if all +//!threads have been only notified. It is required that they have exited their respective wait +//!functions. class interprocess_condition { /// @cond @@ -62,15 +68,18 @@ class interprocess_condition interprocess_condition &operator=(const interprocess_condition &); friend class named_condition; /// @endcond + public: //!Constructs a interprocess_condition. On error throws interprocess_exception. - interprocess_condition(){} + interprocess_condition() + {} //!Destroys *this //!liberating system resources. - ~interprocess_condition(){} + ~interprocess_condition() + {} - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect. void notify_one() { m_condition.notify_one(); } @@ -80,15 +89,14 @@ class interprocess_condition void notify_all() { m_condition.notify_all(); } - //!Releases the lock on the interprocess_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock) - { - if (!lock) - throw lock_exception(); - this->do_wait(*lock.mutex()); + { + ipcdetail::internal_mutex_lock internal_lock(lock); + m_condition.wait(internal_lock); } //!The same as: @@ -96,58 +104,34 @@ class interprocess_condition template void wait(L& lock, Pr pred) { - if (!lock) - throw lock_exception(); - - while (!pred()) - this->do_wait(*lock.mutex()); + ipcdetail::internal_mutex_lock internal_lock(lock); + m_condition.wait(internal_lock, pred); } - //!Releases the lock on the interprocess_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(abs_time, *lock.mutex()); + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_condition.timed_wait(internal_lock, abs_time); } - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - while (!pred()){ - if (!this->do_timed_wait(abs_time, *lock.mutex())) - return pred(); - } - - return true; + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_condition.timed_wait(internal_lock, abs_time, pred); } /// @cond - void do_wait(interprocess_mutex &mut) - { m_condition.do_wait(mut.mutex); } - - bool do_timed_wait(const boost::posix_time::ptime &abs_time, interprocess_mutex &mut) - { return m_condition.do_timed_wait(abs_time, mut.mutex); } - private: #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp new file mode 100644 index 000000000..dd2079467 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp @@ -0,0 +1,129 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +/// @cond + +#include +#include + +#include +#include +#include +#include +#include + +/// @endcond + +//!\file +//!Describes process-shared variables interprocess_condition_any class + +namespace boost { + +namespace posix_time +{ class ptime; } + +namespace interprocess { + +//!This class is a condition variable that can be placed in shared memory or +//!memory mapped files. +//! +//!The interprocess_condition_any class is a generalization of interprocess_condition. +//!Whereas interprocess_condition works only on Locks with mutex_type == interprocess_mutex +//!interprocess_condition_any can operate on any user-defined lock that meets the BasicLockable +//!requirements (lock()/unlock() member functions). +//! +//!Unlike std::condition_variable_any in C++11, it is NOT safe to invoke the destructor if all +//!threads have been only notified. It is required that they have exited their respective wait +//!functions. +class interprocess_condition_any +{ + /// @cond + //Non-copyable + interprocess_condition_any(const interprocess_condition_any &); + interprocess_condition_any &operator=(const interprocess_condition_any &); + + class members + { + public: + typedef interprocess_condition condvar_type; + typedef interprocess_mutex mutex_type; + + condvar_type &get_condvar() { return m_cond; } + mutex_type &get_mutex() { return m_mut; } + + private: + condvar_type m_cond; + mutex_type m_mut; + }; + + ipcdetail::condition_any_wrapper m_cond; + + /// @endcond + public: + //!Constructs a interprocess_condition_any. On error throws interprocess_exception. + interprocess_condition_any(){} + + //!Destroys *this + //!liberating system resources. + ~interprocess_condition_any(){} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect. + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { m_cond.wait(lock, pred); } + + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } +}; + +} //namespace interprocess +} // namespace boost + +#include + +#endif // BOOST_INTERPROCESS_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp index 478cf78cc..5615e8b9a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -31,9 +31,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -61,7 +61,7 @@ namespace interprocess { class interprocess_condition; -//!Wraps a interprocess_mutex that can be placed in shared memory and can be +//!Wraps a interprocess_mutex that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_mutex { @@ -70,6 +70,25 @@ class interprocess_mutex interprocess_mutex(const interprocess_mutex &); interprocess_mutex &operator=(const interprocess_mutex &); friend class interprocess_condition; + + public: + #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) + #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION + typedef ipcdetail::spin_mutex internal_mutex_type; + private: + friend class ipcdetail::robust_emulation_helpers::mutex_traits; + void take_ownership(){ m_mutex.take_ownership(); } + public: + #elif defined(BOOST_INTERPROCESS_USE_POSIX) + #undef BOOST_INTERPROCESS_USE_POSIX + typedef ipcdetail::posix_mutex internal_mutex_type; + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + #undef BOOST_INTERPROCESS_USE_WINDOWS + typedef ipcdetail::windows_mutex internal_mutex_type; + #else + #error "Unknown platform for interprocess_mutex" + #endif + /// @endcond public: @@ -98,32 +117,25 @@ class interprocess_mutex //!Effects: The calling thread will try to obtain exclusive ownership of the //! mutex if it can do so in until the specified time is reached. If the //! mutex supports recursive locking, the mutex must be unlocked the same - //! number of times it is locked. + //! number of times it is locked. //!Returns: If the thread acquires ownership of the mutex, returns true, if - //! the timeout expires returns false. + //! the timeout expires returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: interprocess_exception on error. void unlock(); - /// @cond - private: - #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) - #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION - friend class ipcdetail::robust_emulation_helpers::mutex_traits; - void take_ownership(){ mutex.take_ownership(); } - ipcdetail::spin_mutex mutex; - #elif defined(BOOST_INTERPROCESS_USE_POSIX) - #undef BOOST_INTERPROCESS_USE_POSIX - ipcdetail::posix_mutex mutex; - #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) - #undef BOOST_INTERPROCESS_USE_WINDOWS - ipcdetail::windows_mutex mutex; - #else - #error "Unknown platform for interprocess_mutex" - #endif + /// @cond + internal_mutex_type &internal_mutex() + { return m_mutex; } + + const internal_mutex_type &internal_mutex() const + { return m_mutex; } + + private: + internal_mutex_type m_mutex; /// @endcond }; @@ -144,23 +156,25 @@ inline void interprocess_mutex::lock() boost::posix_time::ptime wait_time = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS); - if (!mutex.timed_lock(wait_time)) + if (!m_mutex.timed_lock(wait_time)) { - throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?"); + throw interprocess_exception(timeout_when_locking_error + , "Interprocess mutex timeout when locking. Possible deadlock: " + "owner died without unlocking?"); } #else - mutex.lock(); + m_mutex.lock(); #endif } inline bool interprocess_mutex::try_lock() -{ return mutex.try_lock(); } +{ return m_mutex.try_lock(); } inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time) -{ return mutex.timed_lock(abs_time); } +{ return m_mutex.timed_lock(abs_time); } inline void interprocess_mutex::unlock() -{ mutex.unlock(); } +{ m_mutex.unlock(); } } //namespace interprocess { } //namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp index 308819ff2..1c5dad370 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -43,9 +43,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -72,8 +72,8 @@ class mutex_traits; namespace boost { namespace interprocess { -//!Wraps a interprocess_mutex that can be placed in shared memory and can be -//!shared between processes. Allows several locking calls by the same +//!Wraps a interprocess_mutex that can be placed in shared memory and can be +//!shared between processes. Allows several locking calls by the same //!process. Allows timed lock tries class interprocess_recursive_mutex { @@ -99,7 +99,7 @@ class interprocess_recursive_mutex //!Throws: interprocess_exception on error. void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. The mutex must be unlocked //!the same number of times it is locked. //!Throws: interprocess_exception if a severe error is found diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp index 4ffcdcf69..2fe058183 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -29,9 +29,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -45,7 +45,7 @@ namespace boost { namespace interprocess { -//!Wraps a interprocess_semaphore that can be placed in shared memory and can be +//!Wraps a interprocess_semaphore that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_semaphore { @@ -55,7 +55,7 @@ class interprocess_semaphore interprocess_semaphore &operator=(const interprocess_semaphore &); /// @endcond public: - //!Creates a interprocess_semaphore with the given initial count. + //!Creates a interprocess_semaphore with the given initial count. //!interprocess_exception if there is an error.*/ interprocess_semaphore(unsigned int initialCount); @@ -69,7 +69,7 @@ class interprocess_semaphore void post(); //!Decrements the interprocess_semaphore. If the interprocess_semaphore value is not greater than zero, - //!then the calling process/thread blocks until it can decrement the counter. + //!then the calling process/thread blocks until it can decrement the counter. //!If there is an error an interprocess_exception exception is thrown. void wait(); @@ -95,7 +95,7 @@ class interprocess_semaphore #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) #undef BOOST_INTERPROCESS_USE_WINDOWS ipcdetail::windows_semaphore m_sem; - #else + #else #undef BOOST_INTERPROCESS_USE_POSIX ipcdetail::posix_semaphore m_sem; #endif //#if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp new file mode 100644 index 000000000..98eeea415 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp @@ -0,0 +1,347 @@ +////////////////////////////////////////////////////////////////////////////// +// Code based on Howard Hinnant's shared_mutex class +// +// (C) Copyright Howard Hinnant 2007-2010. Distributed under the Boost +// Software License, Version 1.0. (see http://www.boost.org/LICENSE_1_0.txt) +// +// (C) Copyright Ion Gaztanaga 2005-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP +#define BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + + +//!\file +//!Describes interprocess_sharable_mutex class + +namespace boost { +namespace interprocess { + +//!Wraps a interprocess_sharable_mutex that can be placed in shared memory and can be +//!shared between processes. Allows timed lock tries +class interprocess_sharable_mutex +{ + //Non-copyable + interprocess_sharable_mutex(const interprocess_sharable_mutex &); + interprocess_sharable_mutex &operator=(const interprocess_sharable_mutex &); + + friend class interprocess_condition; + public: + + //!Constructs the sharable lock. + //!Throws interprocess_exception on error. + interprocess_sharable_mutex(); + + //!Destroys the sharable lock. + //!Does not throw. + ~interprocess_sharable_mutex(); + + //Exclusive locking + + //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, + //! and if another thread has exclusive or sharable ownership of + //! the mutex, it waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! without waiting. If no other thread has exclusive or sharable + //! ownership of the mutex this succeeds. + //!Returns: If it can acquire exclusive ownership immediately returns true. + //! If it has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! waiting if necessary until no other thread has exclusive or sharable + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock(); + + //Sharable locking + + //!Effects: The calling thread tries to obtain sharable ownership of the mutex, + //! and if another thread has exclusive ownership of the mutex, + //! waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! without waiting. If no other thread has exclusive ownership + //! of the mutex this succeeds. + //!Returns: If it can acquire sharable ownership immediately returns true. If it + //! has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! waiting if necessary until no other thread has exclusive + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock_sharable(); + + /// @cond + private: + typedef scoped_lock scoped_lock_t; + + //Pack all the control data in a word to be able + //to use atomic instructions in the future + struct control_word_t + { + unsigned exclusive_in : 1; + unsigned num_shared : sizeof(unsigned)*CHAR_BIT-1; + } m_ctrl; + + interprocess_mutex m_mut; + interprocess_condition m_first_gate; + interprocess_condition m_second_gate; + + private: + //Rollback structures for exceptions or failure return values + struct exclusive_rollback + { + exclusive_rollback(control_word_t &ctrl + ,interprocess_condition &first_gate) + : mp_ctrl(&ctrl), m_first_gate(first_gate) + {} + + void release() + { mp_ctrl = 0; } + + ~exclusive_rollback() + { + if(mp_ctrl){ + mp_ctrl->exclusive_in = 0; + m_first_gate.notify_all(); + } + } + control_word_t *mp_ctrl; + interprocess_condition &m_first_gate; + }; + + template + struct base_constants_t + { + static const unsigned max_readers + = ~(unsigned(1) << (sizeof(unsigned)*CHAR_BIT-1)); + }; + typedef base_constants_t<0> constants; + /// @endcond +}; + +/// @cond + +template +const unsigned interprocess_sharable_mutex::base_constants_t::max_readers; + +inline interprocess_sharable_mutex::interprocess_sharable_mutex() +{ + this->m_ctrl.exclusive_in = 0; + this->m_ctrl.num_shared = 0; +} + +inline interprocess_sharable_mutex::~interprocess_sharable_mutex() +{} + +inline void interprocess_sharable_mutex::lock() +{ + scoped_lock_t lck(m_mut); + + //The exclusive lock must block in the first gate + //if an exclusive lock has been acquired + while (this->m_ctrl.exclusive_in){ + this->m_first_gate.wait(lck); + } + + //Mark that exclusive lock has been acquired + this->m_ctrl.exclusive_in = 1; + + //Prepare rollback + exclusive_rollback rollback(this->m_ctrl, this->m_first_gate); + + //Now wait until all readers are gone + while (this->m_ctrl.num_shared){ + this->m_second_gate.wait(lck); + } + rollback.release(); +} + +inline bool interprocess_sharable_mutex::try_lock() +{ + scoped_lock_t lck(m_mut, try_to_lock); + + //If we can't lock or any has there is any exclusive + //or sharable mark return false; + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared){ + return false; + } + this->m_ctrl.exclusive_in = 1; + return true; +} + +inline bool interprocess_sharable_mutex::timed_lock + (const boost::posix_time::ptime &abs_time) +{ + if(abs_time == boost::posix_time::pos_infin){ + this->lock(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; + + //The exclusive lock must block in the first gate + //if an exclusive lock has been acquired + while (this->m_ctrl.exclusive_in){ + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in){ + return false; + } + break; + } + } + + //Mark that exclusive lock has been acquired + this->m_ctrl.exclusive_in = 1; + + //Prepare rollback + exclusive_rollback rollback(this->m_ctrl, this->m_first_gate); + + //Now wait until all readers are gone + while (this->m_ctrl.num_shared){ + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_shared){ + return false; + } + break; + } + } + rollback.release(); + return true; +} + +inline void interprocess_sharable_mutex::unlock() +{ + scoped_lock_t lck(m_mut); + this->m_ctrl.exclusive_in = 0; + this->m_first_gate.notify_all(); +} + +//Sharable locking + +inline void interprocess_sharable_mutex::lock_sharable() +{ + scoped_lock_t lck(m_mut); + + //The sharable lock must block in the first gate + //if an exclusive lock has been acquired + //or there are too many sharable locks + while(this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + this->m_first_gate.wait(lck); + } + + //Increment sharable count + ++this->m_ctrl.num_shared; +} + +inline bool interprocess_sharable_mutex::try_lock_sharable() +{ + scoped_lock_t lck(m_mut, try_to_lock); + + //The sharable lock must fail + //if an exclusive lock has been acquired + //or there are too many sharable locks + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + return false; + } + + //Increment sharable count + ++this->m_ctrl.num_shared; + return true; +} + +inline bool interprocess_sharable_mutex::timed_lock_sharable + (const boost::posix_time::ptime &abs_time) +{ + if(abs_time == boost::posix_time::pos_infin){ + this->lock_sharable(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; + + //The sharable lock must block in the first gate + //if an exclusive lock has been acquired + //or there are too many sharable locks + while (this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + return false; + } + break; + } + } + + //Increment sharable count + ++this->m_ctrl.num_shared; + return true; +} + +inline void interprocess_sharable_mutex::unlock_sharable() +{ + scoped_lock_t lck(m_mut); + //Decrement sharable count + --this->m_ctrl.num_shared; + if (this->m_ctrl.num_shared == 0){ + this->m_second_gate.notify_one(); + } + //Check if there are blocked sharables because of + //there were too many sharables + else if(this->m_ctrl.num_shared == (constants::max_readers-1)){ + this->m_first_gate.notify_all(); + } +} + +/// @endcond + +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp index 048407f4b..0ba6b4a9b 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp @@ -1,6 +1,8 @@ -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// Code based on Howard Hinnant's upgrade_mutex class +// +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -30,7 +32,7 @@ namespace boost { namespace interprocess { -//!Wraps a interprocess_upgradable_mutex that can be placed in shared memory and can be +//!Wraps a interprocess_upgradable_mutex that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_upgradable_mutex { @@ -67,13 +69,13 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -87,21 +89,21 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -115,7 +117,7 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -124,74 +126,74 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release their sharable lock. + //! sharable ownership release their sharable lock. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. */ bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! upgradable ownership. This operation will fail if there are threads with sharable - //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //! or upgradable ownership, but it will maintain sharable ownership. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock_upgradable(); @@ -249,7 +251,7 @@ class interprocess_upgradable_mutex if(mp_ctrl){ //Recover upgradable lock mp_ctrl->upgradable_in = 1; - ++mp_ctrl->num_upr_shar; + ++mp_ctrl->num_upr_shar; //Execute the second half of exclusive locking mp_ctrl->exclusive_in = 0; } @@ -260,7 +262,7 @@ class interprocess_upgradable_mutex template struct base_constants_t { - static const unsigned max_readers + static const unsigned max_readers = ~(unsigned(3) << (sizeof(unsigned)*CHAR_BIT-2)); }; typedef base_constants_t<0> constants; @@ -284,12 +286,12 @@ inline interprocess_upgradable_mutex::~interprocess_upgradable_mutex() inline void interprocess_upgradable_mutex::lock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The exclusive lock must block in the first gate //if an exclusive or upgradable lock has been acquired while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Mark that exclusive lock has been acquired @@ -300,19 +302,19 @@ inline void interprocess_upgradable_mutex::lock() //Now wait until all readers are gone while (this->m_ctrl.num_upr_shar){ - this->m_second_gate.wait(lock); + this->m_second_gate.wait(lck); } rollback.release(); } inline bool interprocess_upgradable_mutex::try_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); - //If we can't lock or any has there is any exclusive, upgradable + //If we can't lock or any has there is any exclusive, upgradable //or sharable mark return false; - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar){ return false; } @@ -327,14 +329,18 @@ inline bool interprocess_upgradable_mutex::timed_lock this->lock(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The exclusive lock must block in the first gate //if an exclusive or upgradable lock has been acquired while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ - if(!this->m_first_gate.timed_wait(lock, abs_time)) - return !(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ + return false; + } + break; + } } //Mark that exclusive lock has been acquired @@ -345,8 +351,11 @@ inline bool interprocess_upgradable_mutex::timed_lock //Now wait until all readers are gone while (this->m_ctrl.num_upr_shar){ - if(!this->m_second_gate.timed_wait(lock, abs_time)){ - return !(this->m_ctrl.num_upr_shar); + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_upr_shar){ + return false; + } + break; } } rollback.release(); @@ -355,7 +364,7 @@ inline bool interprocess_upgradable_mutex::timed_lock inline void interprocess_upgradable_mutex::unlock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); this->m_ctrl.exclusive_in = 0; this->m_first_gate.notify_all(); } @@ -364,14 +373,14 @@ inline void interprocess_upgradable_mutex::unlock() inline void interprocess_upgradable_mutex::lock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The upgradable lock must block in the first gate //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks while(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Mark that upgradable lock has been acquired @@ -382,14 +391,14 @@ inline void interprocess_upgradable_mutex::lock_upgradable() inline bool interprocess_upgradable_mutex::try_lock_upgradable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The upgradable lock must fail //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks - if(!lock.owns() - || this->m_ctrl.exclusive_in - || this->m_ctrl.upgradable_in + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ return false; } @@ -408,19 +417,22 @@ inline bool interprocess_upgradable_mutex::timed_lock_upgradable this->lock_upgradable(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The upgradable lock must block in the first gate //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks - while(this->m_ctrl.exclusive_in + while(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - if(!this->m_first_gate.timed_wait(lock, abs_time)){ - return!(this->m_ctrl.exclusive_in - || this->m_ctrl.upgradable_in - || this->m_ctrl.num_upr_shar == constants::max_readers); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if((this->m_ctrl.exclusive_in + || this->m_ctrl.upgradable_in + || this->m_ctrl.num_upr_shar == constants::max_readers)){ + return false; + } + break; } } @@ -433,7 +445,7 @@ inline bool interprocess_upgradable_mutex::timed_lock_upgradable inline void interprocess_upgradable_mutex::unlock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Mark that upgradable lock has been acquired //And add upgradable to the sharable count this->m_ctrl.upgradable_in = 0; @@ -445,14 +457,14 @@ inline void interprocess_upgradable_mutex::unlock_upgradable() inline void interprocess_upgradable_mutex::lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The sharable lock must block in the first gate //if an exclusive lock has been acquired //or there are too many sharable locks while(this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Increment sharable count @@ -461,12 +473,12 @@ inline void interprocess_upgradable_mutex::lock_sharable() inline bool interprocess_upgradable_mutex::try_lock_sharable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The sharable lock must fail //if an exclusive lock has been acquired //or there are too many sharable locks - if(!lock.owns() + if(!lck.owns() || this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ return false; @@ -484,17 +496,20 @@ inline bool interprocess_upgradable_mutex::timed_lock_sharable this->lock_sharable(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The sharable lock must block in the first gate //if an exclusive lock has been acquired //or there are too many sharable locks while (this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - if(!this->m_first_gate.timed_wait(lock, abs_time)){ - return!(this->m_ctrl.exclusive_in - || this->m_ctrl.num_upr_shar == constants::max_readers); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in + || this->m_ctrl.num_upr_shar == constants::max_readers){ + return false; + } + break; } } @@ -505,7 +520,7 @@ inline bool interprocess_upgradable_mutex::timed_lock_sharable inline void interprocess_upgradable_mutex::unlock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Decrement sharable count --this->m_ctrl.num_upr_shar; if (this->m_ctrl.num_upr_shar == 0){ @@ -522,7 +537,7 @@ inline void interprocess_upgradable_mutex::unlock_sharable() inline void interprocess_upgradable_mutex::unlock_and_lock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as exclusive this->m_ctrl.exclusive_in = 0; //Mark it as upgradable @@ -535,7 +550,7 @@ inline void interprocess_upgradable_mutex::unlock_and_lock_upgradable() inline void interprocess_upgradable_mutex::unlock_and_lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as exclusive this->m_ctrl.exclusive_in = 0; //The sharable count should be 0 so increment it @@ -546,7 +561,7 @@ inline void interprocess_upgradable_mutex::unlock_and_lock_sharable() inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as upgradable (we don't have to decrement count) this->m_ctrl.upgradable_in = 0; //Notify readers/upgradable that they can enter @@ -557,11 +572,11 @@ inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable() inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Simulate unlock_upgradable() without //notifying sharables. this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; //Execute the second half of exclusive locking this->m_ctrl.exclusive_in = 1; @@ -569,22 +584,22 @@ inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock() upgradable_to_exclusive_rollback rollback(m_ctrl); while (this->m_ctrl.num_upr_shar){ - this->m_second_gate.wait(lock); + this->m_second_gate.wait(lck); } rollback.release(); } inline bool interprocess_upgradable_mutex::try_unlock_upgradable_and_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //Check if there are no readers - if(!lock.owns() + if(!lck.owns() || this->m_ctrl.num_upr_shar != 1){ return false; } //Now unlock upgradable and mark exclusive this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; this->m_ctrl.exclusive_in = 1; return true; } @@ -592,13 +607,17 @@ inline bool interprocess_upgradable_mutex::try_unlock_upgradable_and_lock() inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock (const boost::posix_time::ptime &abs_time) { - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + if(abs_time == boost::posix_time::pos_infin){ + this->unlock_upgradable_and_lock(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //Simulate unlock_upgradable() without //notifying sharables. this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; //Execute the second half of exclusive locking this->m_ctrl.exclusive_in = 1; @@ -606,8 +625,11 @@ inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock upgradable_to_exclusive_rollback rollback(m_ctrl); while (this->m_ctrl.num_upr_shar){ - if(!this->m_second_gate.timed_wait(lock, abs_time)){ - return !(this->m_ctrl.num_upr_shar); + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_upr_shar){ + return false; + } + break; } } rollback.release(); @@ -616,12 +638,12 @@ inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); - //If we can't lock or any has there is any exclusive, upgradable + //If we can't lock or any has there is any exclusive, upgradable //or sharable mark return false; - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar != 1){ return false; @@ -633,12 +655,12 @@ inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock() inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock_upgradable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The upgradable lock must fail //if an exclusive or upgradable lock has been acquired - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ return false; } diff --git a/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp b/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp index 74f3399a4..1139d83a1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp b/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp index a9215e24f..0636de0d4 100644 --- a/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -29,7 +29,7 @@ namespace boost { namespace interprocess { -//!Describes interprocess_mutex family to use with Interprocess framework +//!Describes interprocess_mutex family to use with Interprocess framework //!based on boost::interprocess synchronization objects. struct mutex_family { @@ -37,7 +37,7 @@ struct mutex_family typedef boost::interprocess::interprocess_recursive_mutex recursive_mutex_type; }; -//!Describes interprocess_mutex family to use with Interprocess frameworks +//!Describes interprocess_mutex family to use with Interprocess frameworks //!based on null operation synchronization objects. struct null_mutex_family { diff --git a/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp index c5529eda6..7c570f4ba 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -22,7 +22,13 @@ #include #include #include -#include +#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif //!\file //!Describes a named condition class for inter-process synchronization @@ -50,7 +56,7 @@ class named_condition //!If the condition can't be created throws interprocess_exception named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global condition with a name. + //!Opens or creates a global condition with a name. //!If the condition is created, this call is equivalent to //!named_condition(create_only_t, ... ) //!If the condition is already created, this call is equivalent @@ -71,7 +77,7 @@ class named_condition //!use remove(). ~named_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect.*/ void notify_one(); @@ -79,8 +85,8 @@ class named_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock); @@ -90,16 +96,16 @@ class named_condition template void wait(L& lock, Pr pred); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time); - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred); @@ -110,7 +116,12 @@ class named_condition /// @cond private: - ipcdetail::shm_named_condition m_cond; + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_condition condition_type; + #else + typedef ipcdetail::shm_named_condition condition_type; + #endif + condition_type m_cond; friend class ipcdetail::interprocess_tester; void dont_close_on_destruction() @@ -143,24 +154,38 @@ inline void named_condition::notify_all() template inline void named_condition::wait(L& lock) -{ m_cond.wait(lock); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock); +} template inline void named_condition::wait(L& lock, Pr pred) -{ m_cond.wait(lock, pred); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock, pred); +} template inline bool named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) -{ return m_cond.timed_wait(lock, abs_time); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time); +} template inline bool named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) -{ return m_cond.timed_wait(lock, abs_time, pred); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time, pred); +} inline bool named_condition::remove(const char *name) -{ return ipcdetail::shm_named_condition::remove(name); } +{ + return condition_type::remove(name); +} /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp new file mode 100644 index 000000000..f8f204bc1 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp @@ -0,0 +1,151 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif + +//!\file +//!Describes a named condition class for inter-process synchronization + +namespace boost { +namespace interprocess { + +/// @cond +namespace ipcdetail{ class interprocess_tester; } +/// @endcond + +//! A global condition variable that can be created by name. +//! This condition variable is designed to work with named_mutex and +//! can't be placed in shared memory or memory mapped files. +class named_condition_any +{ + /// @cond + //Non-copyable + named_condition_any(); + named_condition_any(const named_condition_any &); + named_condition_any &operator=(const named_condition_any &); + /// @endcond + public: + //!Creates a global condition with a name. + //!If the condition can't be created throws interprocess_exception + named_condition_any(create_only_t, const char *name, const permissions &perm = permissions()) + : m_cond(create_only_t(), name, perm) + {} + + //!Opens or creates a global condition with a name. + //!If the condition is created, this call is equivalent to + //!named_condition_any(create_only_t, ... ) + //!If the condition is already created, this call is equivalent + //!named_condition_any(open_only_t, ... ) + //!Does not throw + named_condition_any(open_or_create_t, const char *name, const permissions &perm = permissions()) + : m_cond(open_or_create_t(), name, perm) + {} + + //!Opens a global condition with a name if that condition is previously + //!created. If it is not previously created this function throws + //!interprocess_exception. + named_condition_any(open_only_t, const char *name) + : m_cond(open_only_t(), name) + {} + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~named_condition_any() + {} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect.*/ + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { return m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { return m_cond.wait(lock, pred); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } + + //!Erases a named condition from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name) + { return condition_any_type::remove(name); } + + /// @cond + private: + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_condition_any condition_any_type; + #else + typedef ipcdetail::shm_named_condition_any condition_any_type; + #endif + condition_any_type m_cond; + + friend class ipcdetail::interprocess_tester; + void dont_close_on_destruction() + { ipcdetail::interprocess_tester::dont_close_on_destruction(m_cond); } + /// @endcond +}; + +} //namespace interprocess +} //namespace boost + +#include + +#endif // BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp index 3e56b8179..7deb400ab 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -24,7 +24,11 @@ #include #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) -#include + #include + #define BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #else #include #endif @@ -37,7 +41,7 @@ namespace interprocess { class named_condition; -//!A mutex with a global name, so it can be found from different +//!A mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named_mutex. class named_mutex @@ -56,7 +60,7 @@ class named_mutex //!Throws interprocess_exception on error. named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global mutex with a name. + //!Opens or creates a global mutex with a name. //!If the mutex is created, this call is equivalent to //!named_mutex(create_only_t, ... ) //!If the mutex is already created, this call is equivalent @@ -85,7 +89,7 @@ class named_mutex //!Throws interprocess_exception if a severe error is found void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found bool try_lock(); @@ -104,16 +108,20 @@ class named_mutex friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - typedef ipcdetail::posix_named_mutex impl_t; - impl_t m_mut; - #else - typedef ipcdetail::shm_named_mutex impl_t; - impl_t m_mut; public: - interprocess_mutex *mutex() const - { return m_mut.mutex(); } + #if defined(BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES) + typedef ipcdetail::posix_named_mutex internal_mutex_type; + #undef BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_mutex internal_mutex_type; + #undef BOOST_INTERPROCESS_USE_WINDOWS + #else + typedef ipcdetail::shm_named_mutex internal_mutex_type; #endif + internal_mutex_type &internal_mutex() + { return m_mut; } + + internal_mutex_type m_mut; /// @endcond }; @@ -151,7 +159,7 @@ inline bool named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { return m_mut.timed_lock(abs_time); } inline bool named_mutex::remove(const char *name) -{ return impl_t::remove(name); } +{ return internal_mutex_type::remove(name); } /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp index 28768cea6..5849a92d6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -20,7 +20,12 @@ #include #include #include -#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif //!\file //!Describes a named named_recursive_mutex class for inter-process synchronization @@ -32,7 +37,7 @@ namespace interprocess { namespace ipcdetail{ class interprocess_tester; } /// @endcond -//!A recursive mutex with a global name, so it can be found from different +//!A recursive mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named_recursive_mutex. class named_recursive_mutex @@ -49,7 +54,7 @@ class named_recursive_mutex //!If the recursive_mutex can't be created throws interprocess_exception named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global recursive_mutex with a name. + //!Opens or creates a global recursive_mutex with a name. //!If the recursive_mutex is created, this call is equivalent to //!named_recursive_mutex(create_only_t, ... ) //!If the recursive_mutex is already created, this call is equivalent @@ -78,7 +83,7 @@ class named_recursive_mutex //!Throws interprocess_exception if a severe error is found. void lock(); - //!Tries to lock the named_recursive_mutex, returns false when named_recursive_mutex + //!Tries to lock the named_recursive_mutex, returns false when named_recursive_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found. bool try_lock(); @@ -97,7 +102,12 @@ class named_recursive_mutex friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - typedef ipcdetail::shm_named_recursive_mutex impl_t; + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_recursive_mutex impl_t; + #undef BOOST_INTERPROCESS_USE_WINDOWS + #else + typedef ipcdetail::shm_named_recursive_mutex impl_t; + #endif impl_t m_mut; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp index 33e06964f..147724588 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -25,6 +25,10 @@ #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES) #include +//Experimental... +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #else #include #endif @@ -35,8 +39,8 @@ namespace boost { namespace interprocess { -//!A semaphore with a global name, so it can be found from different -//!processes. Allows several resource sharing patterns and efficient +//!A semaphore with a global name, so it can be found from different +//!processes. Allows several resource sharing patterns and efficient //!acknowledgment mechanisms. class named_semaphore { @@ -49,11 +53,11 @@ class named_semaphore /// @endcond public: - //!Creates a global semaphore with a name, and an initial count. + //!Creates a global semaphore with a name, and an initial count. //!If the semaphore can't be created throws interprocess_exception named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); - //!Opens or creates a global semaphore with a name, and an initial count. + //!Opens or creates a global semaphore with a name, and an initial count. //!If the semaphore is created, this call is equivalent to //!named_semaphore(create_only_t, ...) //!If the semaphore is already created, this call is equivalent to @@ -80,7 +84,7 @@ class named_semaphore void post(); //!Decrements the semaphore. If the semaphore value is not greater than zero, - //!then the calling process/thread blocks until it can decrement the counter. + //!then the calling process/thread blocks until it can decrement the counter. //!If there is an error an interprocess_exception exception is thrown. void wait(); @@ -106,9 +110,12 @@ class named_semaphore void dont_close_on_destruction(); #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES) - typedef ipcdetail::posix_named_semaphore impl_t; + typedef ipcdetail::posix_named_semaphore impl_t; + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + #undef BOOST_INTERPROCESS_USE_WINDOWS + typedef ipcdetail::windows_named_semaphore impl_t; #else - typedef ipcdetail::shm_named_semaphore impl_t; + typedef ipcdetail::shm_named_semaphore impl_t; #endif impl_t m_sem; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp new file mode 100644 index 000000000..6ebcebfd2 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp @@ -0,0 +1,230 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP +#define BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!\file +//!Describes a named sharable mutex class for inter-process synchronization + +namespace boost { +namespace interprocess { + +/// @cond +namespace ipcdetail{ class interprocess_tester; } +/// @endcond + +class named_condition; + +//!A sharable mutex with a global name, so it can be found from different +//!processes. This mutex can't be placed in shared memory, and +//!each process should have it's own named sharable mutex. +class named_sharable_mutex +{ + /// @cond + //Non-copyable + named_sharable_mutex(); + named_sharable_mutex(const named_sharable_mutex &); + named_sharable_mutex &operator=(const named_sharable_mutex &); + /// @endcond + public: + + //!Creates a global sharable mutex with a name. + //!If the sharable mutex can't be created throws interprocess_exception + named_sharable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); + + //!Opens or creates a global sharable mutex with a name. + //!If the sharable mutex is created, this call is equivalent to + //!named_sharable_mutex(create_only_t, ...) + //!If the sharable mutex is already created, this call is equivalent to + //!named_sharable_mutex(open_only_t, ... ). + named_sharable_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); + + //!Opens a global sharable mutex with a name if that sharable mutex + //!is previously. + //!created. If it is not previously created this function throws + //!interprocess_exception. + named_sharable_mutex(open_only_t open_only, const char *name); + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~named_sharable_mutex(); + + //Exclusive locking + + //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, + //! and if another thread has exclusive or sharable ownership of + //! the mutex, it waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! without waiting. If no other thread has exclusive or sharable + //! ownership of the mutex this succeeds. + //!Returns: If it can acquire exclusive ownership immediately returns true. + //! If it has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! waiting if necessary until no other thread has exclusive, or sharable + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock(); + + //Sharable locking + + //!Effects: The calling thread tries to obtain sharable ownership of the mutex, + //! and if another thread has exclusive ownership of the mutex, + //! waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! without waiting. If no other thread has exclusive ownership + //! of the mutex this succeeds. + //!Returns: If it can acquire sharable ownership immediately returns true. If it + //! has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! waiting if necessary until no other thread has exclusive + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock_sharable(); + + //!Erases a named sharable mutex from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name); + + /// @cond + private: + friend class ipcdetail::interprocess_tester; + void dont_close_on_destruction(); + + interprocess_sharable_mutex *mutex() const + { return static_cast(m_shmem.get_user_address()); } + + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; + typedef ipcdetail::named_creation_functor construct_func_t; + /// @endcond +}; + +/// @cond + +inline named_sharable_mutex::~named_sharable_mutex() +{} + +inline named_sharable_mutex::named_sharable_mutex + (create_only_t, const char *name, const permissions &perm) + : m_shmem (create_only + ,name + ,sizeof(interprocess_sharable_mutex) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoCreate) + ,perm) +{} + +inline named_sharable_mutex::named_sharable_mutex + (open_or_create_t, const char *name, const permissions &perm) + : m_shmem (open_or_create + ,name + ,sizeof(interprocess_sharable_mutex) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoOpenOrCreate) + ,perm) +{} + +inline named_sharable_mutex::named_sharable_mutex + (open_only_t, const char *name) + : m_shmem (open_only + ,name + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoOpen)) +{} + +inline void named_sharable_mutex::dont_close_on_destruction() +{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); } + +inline void named_sharable_mutex::lock() +{ this->mutex()->lock(); } + +inline void named_sharable_mutex::unlock() +{ this->mutex()->unlock(); } + +inline bool named_sharable_mutex::try_lock() +{ return this->mutex()->try_lock(); } + +inline bool named_sharable_mutex::timed_lock + (const boost::posix_time::ptime &abs_time) +{ return this->mutex()->timed_lock(abs_time); } + +inline void named_sharable_mutex::lock_sharable() +{ this->mutex()->lock_sharable(); } + +inline void named_sharable_mutex::unlock_sharable() +{ this->mutex()->unlock_sharable(); } + +inline bool named_sharable_mutex::try_lock_sharable() +{ return this->mutex()->try_lock_sharable(); } + +inline bool named_sharable_mutex::timed_lock_sharable + (const boost::posix_time::ptime &abs_time) +{ return this->mutex()->timed_lock_sharable(abs_time); } + +inline bool named_sharable_mutex::remove(const char *name) +{ return shared_memory_object::remove(name); } + +/// @endcond + +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp index 61c6bb408..95e0ed509 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -38,7 +38,7 @@ namespace ipcdetail{ class interprocess_tester; } class named_condition; -//!A upgradable mutex with a global name, so it can be found from different +//!A upgradable mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named upgradable mutex. class named_upgradable_mutex @@ -52,11 +52,11 @@ class named_upgradable_mutex /// @endcond public: - //!Creates a global upgradable mutex with a name. + //!Creates a global upgradable mutex with a name. //!If the upgradable mutex can't be created throws interprocess_exception named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global upgradable mutex with a name, and an initial count. + //!Opens or creates a global upgradable mutex with a name. //!If the upgradable mutex is created, this call is equivalent to //!named_upgradable_mutex(create_only_t, ...) //!If the upgradable mutex is already created, this call is equivalent to @@ -95,13 +95,13 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -115,21 +115,21 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -143,7 +143,7 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -152,69 +152,75 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release it. + //! sharable ownership release it. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The thread atomically releases sharable ownership and tries to acquire + //! upgradable ownership. This operation will fail if there are threads with sharable + //! or upgradable ownership, but it will maintain sharable ownership. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock_upgradable(); //!Erases a named upgradable mutex from the system. @@ -229,7 +235,8 @@ class named_upgradable_mutex interprocess_upgradable_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -244,8 +251,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -257,8 +263,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) @@ -288,13 +293,7 @@ inline bool named_upgradable_mutex::try_lock() inline bool named_upgradable_mutex::timed_lock (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock(); - return true; - } - return this->mutex()->timed_lock(abs_time); -} +{ return this->mutex()->timed_lock(abs_time); } inline void named_upgradable_mutex::lock_upgradable() { this->mutex()->lock_upgradable(); } @@ -307,13 +306,7 @@ inline bool named_upgradable_mutex::try_lock_upgradable() inline bool named_upgradable_mutex::timed_lock_upgradable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_upgradable(); - return true; - } - return this->mutex()->timed_lock_upgradable(abs_time); -} +{ return this->mutex()->timed_lock_upgradable(abs_time); } inline void named_upgradable_mutex::lock_sharable() { this->mutex()->lock_sharable(); } @@ -326,13 +319,7 @@ inline bool named_upgradable_mutex::try_lock_sharable() inline bool named_upgradable_mutex::timed_lock_sharable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_sharable(); - return true; - } - return this->mutex()->timed_lock_sharable(abs_time); -} +{ return this->mutex()->timed_lock_sharable(abs_time); } inline void named_upgradable_mutex::unlock_and_lock_upgradable() { this->mutex()->unlock_and_lock_upgradable(); } diff --git a/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp index afe444ed3..d9f69a695 100644 --- a/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp index 213e4ce8b..2deea0f71 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ class posix_condition //!liberating system resources. ~posix_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect. void notify_one(); @@ -52,8 +52,8 @@ class posix_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the posix_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the posix_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock) @@ -75,9 +75,9 @@ class posix_condition this->do_wait(*lock.mutex()); } - //!Releases the lock on the posix_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the posix_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template @@ -92,8 +92,8 @@ class posix_condition return this->do_timed_wait(abs_time, *lock.mutex()); } - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) @@ -145,21 +145,21 @@ inline posix_condition::~posix_condition() { int res = 0; res = pthread_cond_destroy(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::notify_one() { int res = 0; res = pthread_cond_signal(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::notify_all() { int res = 0; res = pthread_cond_broadcast(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::do_wait(posix_mutex &mut) @@ -167,7 +167,7 @@ inline void posix_condition::do_wait(posix_mutex &mut) pthread_mutex_t* pmutex = &mut.m_mut; int res = 0; res = pthread_cond_wait(&m_condition, pmutex); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline bool posix_condition::do_timed_wait diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp index 22e2ec04b..344c5e90a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include @@ -80,7 +80,7 @@ inline posix_mutex::posix_mutex() mut.release(); } -inline posix_mutex::~posix_mutex() +inline posix_mutex::~posix_mutex() { int res = pthread_mutex_destroy(&m_mut); BOOST_ASSERT(res == 0);(void)res; @@ -88,7 +88,7 @@ inline posix_mutex::~posix_mutex() inline void posix_mutex::lock() { - if (pthread_mutex_lock(&m_mut) != 0) + if (pthread_mutex_lock(&m_mut) != 0) throw lock_exception(); } @@ -140,6 +140,7 @@ inline void posix_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); + (void)res; BOOST_ASSERT(res == 0); } diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp index 931c731ef..1b03b7def 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp index f0327a461..0b7ca8bba 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp index c09ce200c..9e989d58b 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace interprocess { @@ -29,7 +29,7 @@ namespace ipcdetail{ #if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED //!Makes pthread_mutexattr_t cleanup easy when using exceptions - struct mutexattr_wrapper + struct mutexattr_wrapper { //!Constructor mutexattr_wrapper(bool recursive = false) @@ -51,7 +51,7 @@ namespace ipcdetail{ }; //!Makes pthread_condattr_t cleanup easy when using exceptions - struct condattr_wrapper + struct condattr_wrapper { //!Constructor condattr_wrapper() @@ -86,7 +86,7 @@ namespace ipcdetail{ void release() {mp_mut = 0; } - private: + private: pthread_mutex_t *mp_mut; }; @@ -94,7 +94,7 @@ namespace ipcdetail{ class condition_initializer { public: - condition_initializer(pthread_cond_t &cond, pthread_condattr_t &cond_attr) + condition_initializer(pthread_cond_t &cond, pthread_condattr_t &cond_attr) : mp_cond(&cond) { if(pthread_cond_init(mp_cond, &cond_attr)!= 0) @@ -105,7 +105,7 @@ namespace ipcdetail{ void release() { mp_cond = 0; } - private: + private: pthread_cond_t *mp_cond; }; @@ -114,7 +114,7 @@ namespace ipcdetail{ #if defined(BOOST_INTERPROCESS_POSIX_BARRIERS) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) //!Makes pthread_barrierattr_t cleanup easy when using exceptions - struct barrierattr_wrapper + struct barrierattr_wrapper { //!Constructor barrierattr_wrapper() @@ -138,8 +138,8 @@ namespace ipcdetail{ { public: //!Constructor. Takes barrier attributes to initialize the barrier - barrier_initializer(pthread_barrier_t &mut, - pthread_barrierattr_t &mut_attr, + barrier_initializer(pthread_barrier_t &mut, + pthread_barrierattr_t &mut_attr, int count) : mp_barrier(&mut) { @@ -151,7 +151,7 @@ namespace ipcdetail{ void release() {mp_barrier = 0; } - private: + private: pthread_barrier_t *mp_barrier; }; diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp index 7d787353b..3e20dc707 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp index baa670fa9..385d714fb 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -78,7 +78,7 @@ inline posix_recursive_mutex::~posix_recursive_mutex() inline void posix_recursive_mutex::lock() { - if (pthread_mutex_lock(&m_mut) != 0) + if (pthread_mutex_lock(&m_mut) != 0) throw lock_exception(); } @@ -130,7 +130,7 @@ inline void posix_recursive_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp index b7f62cc42..5d7dfa8d6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp index 1aeef4766..f6aef56ea 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -18,7 +18,7 @@ #include #include -#include //O_CREAT, O_*... +#include //O_CREAT, O_*... #include //close #include //std::string #include //sem_* family, SEM_VALUE_MAX @@ -42,7 +42,7 @@ namespace interprocess { namespace ipcdetail { inline bool semaphore_open - (sem_t *&handle, create_enum_t type, const char *origname, + (sem_t *&handle, create_enum_t type, const char *origname, unsigned int count = 0, const permissions &perm = permissions()) { std::string name; @@ -103,7 +103,7 @@ inline bool semaphore_open inline void semaphore_close(sem_t *handle) { int ret = sem_close(handle); - if(ret != 0){ + if(ret != 0){ BOOST_ASSERT(0); } } @@ -138,7 +138,7 @@ inline void semaphore_init(sem_t *handle, unsigned int initialCount) inline void semaphore_destroy(sem_t *handle) { int ret = sem_destroy(handle); - if(ret != 0){ + if(ret != 0){ BOOST_ASSERT(0); } } diff --git a/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp index bfef63a30..5709f6ff6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -89,7 +89,7 @@ class scoped_lock : mp_mutex(&m), m_locked(true) {} - //!Effects: m.try_lock(). + //!Effects: m.try_lock(). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.try_lock() executed within the constructor. //!Notes: The constructor will take ownership of the mutex if it can do @@ -101,7 +101,7 @@ class scoped_lock : mp_mutex(&m), m_locked(mp_mutex->try_lock()) {} - //!Effects: m.timed_lock(abs_time). + //!Effects: m.timed_lock(abs_time). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock(abs_time) executed within the constructor. //!Notes: The constructor will take ownership of the mutex if it can do @@ -128,7 +128,7 @@ class scoped_lock { mp_mutex = scop.release(); } //!Effects: If upgr.owns() then calls unlock_upgradable_and_lock() on the - //! referenced mutex. upgr.release() is called. + //! referenced mutex. upgr.release() is called. //!Postconditions: mutex() == the value upgr.mutex() had before the construction. //! upgr.mutex() == 0. owns() == upgr.owns() before the construction. //! upgr.owns() == false after the construction. @@ -155,12 +155,12 @@ class scoped_lock //!Effects: If upgr.owns() then calls try_unlock_upgradable_and_lock() on the //!referenced mutex: //! a)if try_unlock_upgradable_and_lock() returns true then mutex() obtains - //! the value from upgr.release() and owns() is set to true. + //! the value from upgr.release() and owns() is set to true. //! b)if try_unlock_upgradable_and_lock() returns false then upgr is - //! unaffected and this scoped_lock construction as the same effects as - //! a default construction. + //! unaffected and this scoped_lock construction as the same effects as + //! a default construction. //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false + //! and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex //! ownership from upgr immediately, while changing the lock type from a //! "read lock" to a "write lock". If the "read lock" isn't held in the @@ -186,12 +186,12 @@ class scoped_lock //!Effects: If upgr.owns() then calls timed_unlock_upgradable_and_lock(abs_time) //! on the referenced mutex: //! a)if timed_unlock_upgradable_and_lock(abs_time) returns true then mutex() - //! obtains the value from upgr.release() and owns() is set to true. + //! obtains the value from upgr.release() and owns() is set to true. //! b)if timed_unlock_upgradable_and_lock(abs_time) returns false then upgr //! is unaffected and this scoped_lock construction as the same effects //! as a default construction. //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false + //! and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex ownership //! from upgr immediately, while changing the lock type from a "read lock" to a //! "write lock". If the "read lock" isn't held in the first place, the mutex @@ -214,14 +214,14 @@ class scoped_lock } //!Effects: If shar.owns() then calls try_unlock_sharable_and_lock() on the - //!referenced mutex. + //!referenced mutex. //! a)if try_unlock_sharable_and_lock() returns true then mutex() obtains - //! the value from shar.release() and owns() is set to true. + //! the value from shar.release() and owns() is set to true. //! b)if try_unlock_sharable_and_lock() returns false then shar is //! unaffected and this scoped_lock construction has the same - //! effects as a default construction. + //! effects as a default construction. //! c)Else shar.owns() is false. mutex() obtains the value from - //! shar.release() and owns() is set to false + //! shar.release() and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex //! ownership from shar immediately, while changing the lock type from a //! "read lock" to a "write lock". If the "read lock" isn't held in the @@ -253,13 +253,13 @@ class scoped_lock } //!Effects: If owns() before the call, then unlock() is called on mutex(). - //! *this gets the state of scop and scop gets set to a default constructed state. + //! *this gets the state of scop and scop gets set to a default constructed state. //!Notes: With a recursive mutex it is possible that both this and scop own //! the same mutex before the assignment. In this case, this will own the //! mutex after the assignment (and scop will not), but the mutex's lock //! count will be decremented by one. scoped_lock &operator=(BOOST_RV_REF(scoped_lock) scop) - { + { if(this->owns()) this->unlock(); m_locked = scop.owns(); @@ -281,7 +281,7 @@ class scoped_lock } //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls try_lock() on the referenced mutex. + //! exception. Calls try_lock() on the referenced mutex. //!Postconditions: owns() == the value returned from mutex()->try_lock(). //!Notes: The scoped_lock changes from a state of not owning the mutex, to //! owning the mutex, but only if blocking was not required. If the @@ -348,8 +348,8 @@ class scoped_lock m_locked = false; return mut; } - - //!Effects: Swaps state with moved lock. + + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap( scoped_lock &other) { @@ -359,7 +359,7 @@ class scoped_lock /// @cond private: - mutex_type *mp_mutex; + mutex_type *mp_mutex; bool m_locked; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp index c8b7c1d26..113019572 100644 --- a/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -67,7 +67,7 @@ class sharable_lock {} //!Effects: m.lock_sharable(). - //!Postconditions: owns() == true and mutex() == &m. + //!Postconditions: owns() == true and mutex() == &m. //!Notes: The constructor will take sharable-ownership of the mutex. If //! another thread already owns the mutex with exclusive ownership //! (scoped_lock), this thread will block until the mutex is released. @@ -104,7 +104,7 @@ class sharable_lock : mp_mutex(&m), m_locked(false) { m_locked = mp_mutex->try_lock_sharable(); } - //!Effects: m.timed_lock_sharable(abs_time) + //!Effects: m.timed_lock_sharable(abs_time) //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock_sharable() executed within the constructor. //!Notes: The constructor will take sharable-ownership of the mutex if it @@ -132,7 +132,7 @@ class sharable_lock //! referenced mutex. //!Postconditions: mutex() == the value upgr.mutex() had before the construction. //! upgr.mutex() == 0 owns() == the value of upgr.owns() before construction. - //! upgr.owns() == false after the construction. + //! upgr.owns() == false after the construction. //!Notes: If upgr is locked, this constructor will lock this sharable_lock while //! unlocking upgr. Only a moved sharable_lock's will match this //! signature. An non-moved upgradable_lock can be moved with the expression: @@ -156,7 +156,7 @@ class sharable_lock //! scop.mutex() == 0 owns() == scop.owns() before the constructor. After the //! construction, scop.owns() == false. //!Notes: If scop is locked, this constructor will transfer the exclusive ownership - //! to a sharable-ownership of this sharable_lock. + //! to a sharable-ownership of this sharable_lock. //! Only a moved scoped_lock's will match this //! signature. An non-moved scoped_lock can be moved with the expression: //! "boost::move(lock);". @@ -184,12 +184,12 @@ class sharable_lock } //!Effects: If owns() before the call, then unlock_sharable() is called on mutex(). - //! *this gets the state of upgr and upgr gets set to a default constructed state. + //! *this gets the state of upgr and upgr gets set to a default constructed state. //!Notes: With a recursive mutex it is possible that both this and upgr own the mutex //! before the assignment. In this case, this will own the mutex after the assignment //! (and upgr will not), but the mutex's lock count will be decremented by one. sharable_lock &operator=(BOOST_RV_REF(sharable_lock) upgr) - { + { if(this->owns()) this->unlock(); m_locked = upgr.owns(); @@ -203,7 +203,7 @@ class sharable_lock //!Notes: The sharable_lock changes from a state of not owning the //! mutex, to owning the mutex, blocking if necessary. void lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); mp_mutex->lock_sharable(); @@ -219,7 +219,7 @@ class sharable_lock //! mutex_type does not support try_lock_sharable(), this function will //! fail at compile time if instantiated, but otherwise have no effect. bool try_lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->try_lock_sharable(); @@ -236,7 +236,7 @@ class sharable_lock //! timed_lock_sharable(), this function will fail at compile time if //! instantiated, but otherwise have no effect. bool timed_lock(const boost::posix_time::ptime& abs_time) - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->timed_lock_sharable(abs_time); @@ -282,7 +282,7 @@ class sharable_lock return mut; } - //!Effects: Swaps state with moved lock. + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap(sharable_lock &other) { diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp index 0d67c2575..bec1b600d 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -28,9 +28,12 @@ #include #include #include -#if defined BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES -#include -#include +#if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) + #include + #include + #include +#else + #include #endif @@ -42,7 +45,7 @@ namespace interprocess { namespace ipcdetail { /// @cond -namespace ipcdetail{ class interprocess_tester; } +class interprocess_tester; /// @endcond //! A global condition variable that can be created by name. @@ -61,7 +64,7 @@ class shm_named_condition //!If the condition can't be created throws interprocess_exception shm_named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global condition with a name. + //!Opens or creates a global condition with a name. //!If the condition is created, this call is equivalent to //!shm_named_condition(create_only_t, ... ) //!If the condition is already created, this call is equivalent @@ -82,7 +85,7 @@ class shm_named_condition //!use remove(). ~shm_named_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect.*/ void notify_one(); @@ -90,8 +93,8 @@ class shm_named_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock); @@ -101,16 +104,16 @@ class shm_named_condition template void wait(L& lock, Pr pred); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time); - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred); @@ -122,103 +125,36 @@ class shm_named_condition /// @cond private: - struct condition_holder - { - interprocess_condition cond_; - //If named_mutex is implemented using semaphores - //we need to store an additional mutex - #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - interprocess_mutex mutex_; - #endif - }; - - interprocess_condition *condition() const - { return &static_cast(m_shmem.get_user_address())->cond_; } - - template - class lock_inverter - { - Lock &l_; - public: - lock_inverter(Lock &l) - : l_(l) - {} - void lock() { l_.unlock(); } - void unlock() { l_.lock(); } - }; - #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - interprocess_mutex *mutex() const - { return &static_cast(m_shmem.get_user_address())->mutex_; } + class internal_condition_members + { + public: + typedef interprocess_mutex mutex_type; + typedef interprocess_condition condvar_type; + + condvar_type& get_condvar() { return m_cond; } + mutex_type& get_mutex() { return m_mtx; } - template - void do_wait(Lock& lock) - { - //shm_named_condition only works with named_mutex - BOOST_STATIC_ASSERT((is_convertible::value == true)); - - //lock internal before unlocking external to avoid race with a notifier - scoped_lock internal_lock(*this->mutex()); - lock_inverter inverted_lock(lock); - scoped_lock > external_unlock(inverted_lock); + private: + mutex_type m_mtx; + condvar_type m_cond; + }; - //unlock internal first to avoid deadlock with near simultaneous waits - scoped_lock internal_unlock; - internal_lock.swap(internal_unlock); - this->condition()->wait(internal_unlock); - } + typedef ipcdetail::condition_any_wrapper internal_condition; + #else //defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) + typedef interprocess_condition internal_condition; + #endif //defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - template - bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time) - { - //shm_named_condition only works with named_mutex - BOOST_STATIC_ASSERT((is_convertible::value == true)); - //lock internal before unlocking external to avoid race with a notifier - scoped_lock internal_lock(*this->mutex(), abs_time); - if(!internal_lock) return false; - lock_inverter inverted_lock(lock); - scoped_lock > external_unlock(inverted_lock); - - //unlock internal first to avoid deadlock with near simultaneous waits - scoped_lock internal_unlock; - internal_lock.swap(internal_unlock); - return this->condition()->timed_wait(internal_unlock, abs_time); - } - #else - template - class lock_wrapper - { - typedef void (lock_wrapper::*unspecified_bool_type)(); - public: - - typedef interprocess_mutex mutex_type; - - lock_wrapper(Lock &l) - : l_(l) - {} - - mutex_type* mutex() const - { return l_.mutex()->mutex(); } - - void lock() { l_.lock(); } - - void unlock() { l_.unlock(); } - - operator unspecified_bool_type() const - { return l_ ? &lock_wrapper::lock : 0; } - - private: - Lock &l_; - }; - #endif + internal_condition m_cond; friend class boost::interprocess::ipcdetail::interprocess_tester; void dont_close_on_destruction(); - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; template friend class boost::interprocess::ipcdetail::named_creation_functor; - typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; + typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -230,9 +166,8 @@ inline shm_named_condition::~shm_named_condition() inline shm_named_condition::shm_named_condition(create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name - ,sizeof(condition_holder) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate) @@ -242,9 +177,8 @@ inline shm_named_condition::shm_named_condition(create_only_t, const char *name, inline shm_named_condition::shm_named_condition(open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name - ,sizeof(condition_holder) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate) @@ -265,102 +199,65 @@ inline void shm_named_condition::dont_close_on_destruction() #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) inline void shm_named_condition::notify_one() -{ - scoped_lock internal_lock(*this->mutex()); - this->condition()->notify_one(); -} +{ m_cond.notify_one(); } inline void shm_named_condition::notify_all() -{ - scoped_lock internal_lock(*this->mutex()); - this->condition()->notify_all(); -} +{ m_cond.notify_all(); } template inline void shm_named_condition::wait(L& lock) -{ - if (!lock) - throw lock_exception(); - this->do_wait(lock); -} +{ m_cond.wait(lock); } template inline void shm_named_condition::wait(L& lock, Pr pred) -{ - if (!lock) - throw lock_exception(); - while (!pred()) - this->do_wait(lock); -} +{ m_cond.wait(lock, pred); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(lock, abs_time); -} +{ return m_cond.timed_wait(lock, abs_time); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - - while (!pred()){ - if(!this->do_timed_wait(lock, abs_time)){ - return pred(); - } - } - return true; -} +{ return m_cond.timed_wait(lock, abs_time, pred); } #else inline void shm_named_condition::notify_one() -{ this->condition()->notify_one(); } +{ m_cond.notify_one(); } inline void shm_named_condition::notify_all() -{ this->condition()->notify_all(); } +{ m_cond.notify_all(); } template inline void shm_named_condition::wait(L& lock) { - lock_wrapper newlock(lock); - this->condition()->wait(newlock); + internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock); } template inline void shm_named_condition::wait(L& lock, Pr pred) { - lock_wrapper newlock(lock); - this->condition()->wait(newlock, pred); + internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock, pred); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) { - lock_wrapper newlock(lock); - return this->condition()->timed_wait(newlock, abs_time); + internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) { - lock_wrapper newlock(lock); - return this->condition()->timed_wait(newlock, abs_time, pred); + internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time, pred); } #endif diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp new file mode 100644 index 000000000..7bac854c9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp @@ -0,0 +1,191 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!\file +//!Describes process-shared variables interprocess_condition class + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +/// @cond +class interprocess_tester; +/// @endcond + +//! A global condition variable that can be created by name. +//! This condition variable is designed to work with named_mutex and +//! can't be placed in shared memory or memory mapped files. +class shm_named_condition_any +{ + /// @cond + //Non-copyable + shm_named_condition_any(); + shm_named_condition_any(const shm_named_condition_any &); + shm_named_condition_any &operator=(const shm_named_condition_any &); + /// @endcond + public: + //!Creates a global condition with a name. + //!If the condition can't be created throws interprocess_exception + shm_named_condition_any(create_only_t create_only, const char *name, const permissions &perm = permissions()) + : m_shmem (create_only + ,name + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(DoCreate) + ,perm) + {} + + //!Opens or creates a global condition with a name. + //!If the condition is created, this call is equivalent to + //!shm_named_condition_any(create_only_t, ... ) + //!If the condition is already created, this call is equivalent + //!shm_named_condition_any(open_only_t, ... ) + //!Does not throw + shm_named_condition_any(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()) + : m_shmem (open_or_create + ,name + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(DoOpenOrCreate) + ,perm) + {} + + //!Opens a global condition with a name if that condition is previously + //!created. If it is not previously created this function throws + //!interprocess_exception. + shm_named_condition_any(open_only_t open_only, const char *name) + : m_shmem (open_only + ,name + ,read_write + ,0 + ,construct_func_t(DoOpen)) + {} + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~shm_named_condition_any() + {} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect.*/ + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { m_cond.wait(lock, pred); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } + + //!Erases a named condition from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name) + { return shared_memory_object::remove(name); } + + /// @cond + private: + + class internal_condition_members + { + public: + typedef interprocess_mutex mutex_type; + typedef interprocess_condition condvar_type; + + condvar_type& get_condvar() { return m_cond; } + mutex_type& get_mutex() { return m_mtx; } + + private: + mutex_type m_mtx; + condvar_type m_cond; + }; + + typedef ipcdetail::condition_any_wrapper internal_condition; + + internal_condition m_cond; + + friend class boost::interprocess::ipcdetail::interprocess_tester; + void dont_close_on_destruction() + { interprocess_tester::dont_close_on_destruction(m_shmem); } + + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; + + template friend class boost::interprocess::ipcdetail::named_creation_functor; + typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; + /// @endcond +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif // BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp index 11a1db1d6..cdfff99bf 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-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) // @@ -38,7 +38,7 @@ class named_creation_functor { new(address)T(m_arg); } bool operator()(void *address, std::size_t, bool created) const - { + { switch(m_creation_type){ case DoOpen: return true; @@ -56,6 +56,10 @@ class named_creation_functor break; } } + + std::size_t get_min_size() const + { return sizeof(T); } + private: create_enum_t m_creation_type; Arg m_arg; diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp index a71eb4fe6..9532f8d8d 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -37,7 +37,7 @@ namespace ipcdetail { class named_condition; -//!A mutex with a global name, so it can be found from different +//!A mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named mutex. class shm_named_mutex @@ -56,7 +56,7 @@ class shm_named_mutex //!Throws interprocess_exception on error. shm_named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global mutex with a name. + //!Opens or creates a global mutex with a name. //!If the mutex is created, this call is equivalent to //!shm_named_mutex(create_only_t, ... ) //!If the mutex is already created, this call is equivalent @@ -85,7 +85,7 @@ class shm_named_mutex //!Throws interprocess_exception if a severe error is found void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found bool try_lock(); @@ -100,14 +100,15 @@ class shm_named_mutex static bool remove(const char *name); /// @cond - interprocess_mutex *mutex() const - { return static_cast(m_shmem.get_user_address()); } + typedef interprocess_mutex internal_mutex_type; + interprocess_mutex &internal_mutex() + { return *static_cast(m_shmem.get_user_address()); } private: friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -124,8 +125,7 @@ inline shm_named_mutex::shm_named_mutex(create_only_t, const char *name, const p : m_shmem (create_only ,name ,sizeof(interprocess_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -136,8 +136,7 @@ inline shm_named_mutex::shm_named_mutex(open_or_create_t, const char *name, cons : m_shmem (open_or_create ,name ,sizeof(interprocess_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) @@ -153,13 +152,13 @@ inline shm_named_mutex::shm_named_mutex(open_only_t, const char *name) {} inline void shm_named_mutex::lock() -{ this->mutex()->lock(); } +{ this->internal_mutex().lock(); } inline void shm_named_mutex::unlock() -{ this->mutex()->unlock(); } +{ this->internal_mutex().unlock(); } inline bool shm_named_mutex::try_lock() -{ return this->mutex()->try_lock(); } +{ return this->internal_mutex().try_lock(); } inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { @@ -167,7 +166,7 @@ inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time this->lock(); return true; } - return this->mutex()->timed_lock(abs_time); + return this->internal_mutex().timed_lock(abs_time); } inline bool shm_named_mutex::remove(const char *name) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp index 461c97eb3..0250e3108 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -51,7 +51,7 @@ class shm_named_recursive_mutex //!If the recursive_mutex can't be created throws interprocess_exception shm_named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global recursive_mutex with a name. + //!Opens or creates a global recursive_mutex with a name. //!If the recursive_mutex is created, this call is equivalent to //!shm_named_recursive_mutex(create_only_t, ... ) //!If the recursive_mutex is already created, this call is equivalent @@ -80,7 +80,7 @@ class shm_named_recursive_mutex //!Throws interprocess_exception if a severe error is found. void lock(); - //!Tries to lock the shm_named_recursive_mutex, returns false when shm_named_recursive_mutex + //!Tries to lock the shm_named_recursive_mutex, returns false when shm_named_recursive_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found. bool try_lock(); @@ -101,8 +101,8 @@ class shm_named_recursive_mutex interprocess_recursive_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef named_creation_functor construct_func_t; /// @endcond }; @@ -117,8 +117,7 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const : m_shmem (create_only ,name ,sizeof(interprocess_recursive_mutex) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate) @@ -129,8 +128,7 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, co : m_shmem (open_or_create ,name ,sizeof(interprocess_recursive_mutex) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp index c6d3830db..ebd7e0982 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -65,7 +65,8 @@ class shm_named_semaphore interprocess_semaphore *semaphore() const { return static_cast(m_shmem.get_user_address()); } - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef named_creation_functor construct_func_t; /// @endcond }; @@ -81,8 +82,7 @@ inline shm_named_semaphore::shm_named_semaphore : m_shmem (create_only ,name ,sizeof(interprocess_semaphore) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate, initialCount) @@ -94,8 +94,7 @@ inline shm_named_semaphore::shm_named_semaphore : m_shmem (open_or_create ,name ,sizeof(interprocess_semaphore) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate, initialCount) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp index 338fa98f7..26a0747e6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -38,7 +38,7 @@ namespace ipcdetail{ class interprocess_tester; } class named_condition; -//!A upgradable mutex with a global name, so it can be found from different +//!A upgradable mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named upgradable mutex. class named_upgradable_mutex @@ -52,11 +52,11 @@ class named_upgradable_mutex /// @endcond public: - //!Creates a global upgradable mutex with a name. + //!Creates a global upgradable mutex with a name. //!If the upgradable mutex can't be created throws interprocess_exception named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global upgradable mutex with a name, and an initial count. + //!Opens or creates a global upgradable mutex with a name, and an initial count. //!If the upgradable mutex is created, this call is equivalent to //!named_upgradable_mutex(create_only_t, ...) //!If the upgradable mutex is already created, this call is equivalent to @@ -95,13 +95,13 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -115,21 +115,21 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -143,7 +143,7 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -152,66 +152,66 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release it. + //! sharable ownership release it. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); @@ -229,7 +229,8 @@ class named_upgradable_mutex interprocess_upgradable_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -244,8 +245,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -257,8 +257,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp index 5a37d9be2..7c3306d09 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -110,7 +110,7 @@ inline spin_condition::spin_condition() } inline spin_condition::~spin_condition() -{ +{ //Trivial destructor } @@ -126,15 +126,15 @@ inline void spin_condition::notify_all() inline void spin_condition::notify(boost::uint32_t command) { - //This mutex guarantees that no other thread can enter to the + //This mutex guarantees that no other thread can enter to the //do_timed_wait method logic, so that thread count will be //constant until the function writes a NOTIFY_ALL command. - //It also guarantees that no other notification can be signaled + //It also guarantees that no other notification can be signaled //on this spin_condition before this one ends m_enter_mut.lock(); //Return if there are no waiters - if(!atomic_read32(&m_num_waiters)) { + if(!atomic_read32(&m_num_waiters)) { m_enter_mut.unlock(); return; } @@ -167,18 +167,18 @@ inline bool spin_condition::do_timed_wait template inline bool spin_condition::do_timed_wait(bool tout_enabled, - const boost::posix_time::ptime &abs_time, + const boost::posix_time::ptime &abs_time, InterprocessMutex &mut) { boost::posix_time::ptime now = microsec_clock::universal_time(); - + if(tout_enabled){ if(now >= abs_time) return false; } typedef boost::interprocess::scoped_lock InternalLock; - //The enter mutex guarantees that while executing a notification, - //no other thread can execute the do_timed_wait method. + //The enter mutex guarantees that while executing a notification, + //no other thread can execute the do_timed_wait method. { //--------------------------------------------------------------- InternalLock lock; @@ -205,8 +205,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, //By default, we suppose that no timeout has happened bool timed_out = false, unlock_enter_mut= false; - - //Loop until a notification indicates that the thread should + + //Loop until a notification indicates that the thread should //exit or timeout occurs while(1){ //The thread sleeps/spins until a spin_condition commands a notification @@ -229,8 +229,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, //There is an ongoing notification, we will try again later continue; } - //No notification in execution, since enter mutex is locked. - //We will execute time-out logic, so we will decrement count, + //No notification in execution, since enter mutex is locked. + //We will execute time-out logic, so we will decrement count, //release the enter mutex and return false. break; } @@ -253,7 +253,7 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, continue; } else if(result == NOTIFY_ONE){ - //If it was a NOTIFY_ONE command, only this thread should + //If it was a NOTIFY_ONE command, only this thread should //exit. This thread has atomically marked command as sleep before //so no other thread will exit. //Decrement wait count. @@ -262,8 +262,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, break; } else{ - //If it is a NOTIFY_ALL command, all threads should return - //from do_timed_wait function. Decrement wait count. + //If it is a NOTIFY_ALL command, all threads should return + //from do_timed_wait function. Decrement wait count. unlock_enter_mut = 1 == atomic_dec32(const_cast(&m_num_waiters)); //Check if this is the last thread of notify_all waiters //Only the last thread will release the mutex @@ -275,7 +275,7 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, } } - //Unlock the enter mutex if it is a single notification, if this is + //Unlock the enter mutex if it is a single notification, if this is //the last notified thread in a notify_all or a timeout has occurred if(unlock_enter_mut){ m_enter_mut.unlock(); diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp index ef0b47d95..94c26a16a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -45,15 +45,15 @@ class spin_mutex volatile boost::uint32_t m_s; }; -inline spin_mutex::spin_mutex() - : m_s(0) +inline spin_mutex::spin_mutex() + : m_s(0) { //Note that this class is initialized to zero. //So zeroed memory can be interpreted as an //initialized mutex } -inline spin_mutex::~spin_mutex() +inline spin_mutex::~spin_mutex() { //Trivial destructor } @@ -73,7 +73,7 @@ inline void spin_mutex::lock(void) inline bool spin_mutex::try_lock(void) { - boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast(&m_s), 1, 0); + boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast(&m_s), 1, 0); return m_s == 1 && prev_s == 0; } diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp index 05ad65eac..38e9dcaa1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -68,7 +68,7 @@ class spin_recursive_mutex volatile boost::uint32_t m_s; }; -inline spin_recursive_mutex::spin_recursive_mutex() +inline spin_recursive_mutex::spin_recursive_mutex() : m_nLockCount(0), m_nOwner(ipcdetail::get_invalid_systemwide_thread_id()){} inline spin_recursive_mutex::~spin_recursive_mutex(){} @@ -83,7 +83,7 @@ inline void spin_recursive_mutex::lock() if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; } else{ @@ -103,7 +103,7 @@ inline bool spin_recursive_mutex::try_lock() if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; return true; } @@ -129,7 +129,7 @@ inline bool spin_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; return true; } diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp index 1b8cac35a..a5ba3b1b1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp index 93c2ed6bc..6b766fd67 100644 --- a/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -85,7 +85,7 @@ class upgradable_lock : mp_mutex(&m), m_locked(true) {} - //!Effects: m.try_lock_upgradable(). + //!Effects: m.try_lock_upgradable(). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.try_lock_upgradable() executed within the constructor. //!Notes: The constructor will take upgradable-ownership of the mutex @@ -97,7 +97,7 @@ class upgradable_lock : mp_mutex(&m), m_locked(false) { m_locked = mp_mutex->try_lock_upgradable(); } - //!Effects: m.timed_lock_upgradable(abs_time) + //!Effects: m.timed_lock_upgradable(abs_time) //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock_upgradable() executed within the constructor. //!Notes: The constructor will take upgradable-ownership of the mutex if it @@ -123,7 +123,7 @@ class upgradable_lock : mp_mutex(0), m_locked(upgr.owns()) { mp_mutex = upgr.release(); } - //!Effects: If scop.owns(), m_.unlock_and_lock_upgradable(). + //!Effects: If scop.owns(), m_.unlock_and_lock_upgradable(). //!Postconditions: mutex() == the value scop.mutex() had before the construction. //! scop.mutex() == 0. owns() == scop.owns() before the constructor. After the //! construction, scop.owns() == false. @@ -146,12 +146,12 @@ class upgradable_lock } //!Effects: If shar.owns() then calls try_unlock_sharable_and_lock_upgradable() - //! on the referenced mutex. + //! on the referenced mutex. //! a)if try_unlock_sharable_and_lock_upgradable() returns true then mutex() - //! obtains the value from shar.release() and owns() is set to true. + //! obtains the value from shar.release() and owns() is set to true. //! b)if try_unlock_sharable_and_lock_upgradable() returns false then shar is //! unaffected and this upgradable_lock construction has the same - //! effects as a default construction. + //! effects as a default construction. //! c)Else shar.owns() is false. mutex() obtains the value from shar.release() //! and owns() is set to false. //!Notes: This construction will not block. It will try to obtain mutex @@ -207,7 +207,7 @@ class upgradable_lock //!Notes: The sharable_lock changes from a state of not owning the mutex, //! to owning the mutex, blocking if necessary. void lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); mp_mutex->lock_upgradable(); @@ -223,7 +223,7 @@ class upgradable_lock //! mutex_type does not support try_lock_upgradable(), this function will //! fail at compile time if instantiated, but otherwise have no effect. bool try_lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->try_lock_upgradable(); @@ -240,7 +240,7 @@ class upgradable_lock //! timed_lock_upgradable(abs_time), this function will fail at compile //! time if instantiated, but otherwise have no effect. bool timed_lock(const boost::posix_time::ptime& abs_time) - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->timed_lock_upgradable(abs_time); @@ -286,7 +286,7 @@ class upgradable_lock return mut; } - //!Effects: Swaps state with moved lock. + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap(upgradable_lock &other) { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp index 167b8730c..627795172 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -20,133 +20,8 @@ #include #include #include -#include -#include +#include -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -// -// Condition variable algorithm taken from pthreads-win32 discussion. -// -// The algorithm was developed by Alexander Terekhov in colaboration with -// Louis Thomas. -// -// Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL -// -// semBlockLock - bin.semaphore -// semBlockQueue - semaphore -// mtxExternal - mutex or CS -// mtxUnblockLock - mutex or CS -// nWaitersGone - int -// nWaitersBlocked - int -// nWaitersToUnblock - int -// -// wait( timeout ) { -// -// [auto: register int result ] // error checking omitted -// [auto: register int nSignalsWasLeft ] -// [auto: register int nWaitersWasGone ] -// -// sem_wait( semBlockLock ); -// nWaitersBlocked++; -// sem_post( semBlockLock ); -// -// unlock( mtxExternal ); -// bTimedOut = sem_wait( semBlockQueue,timeout ); -// -// lock( mtxUnblockLock ); -// if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { -// if ( bTimedOut ) { // timeout (or canceled) -// if ( 0 != nWaitersBlocked ) { -// nWaitersBlocked--; -// } -// else { -// nWaitersGone++; // count spurious wakeups. -// } -// } -// if ( 0 == --nWaitersToUnblock ) { -// if ( 0 != nWaitersBlocked ) { -// sem_post( semBlockLock ); // open the gate. -// nSignalsWasLeft = 0; // do not open the gate -// // below again. -// } -// else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { -// nWaitersGone = 0; -// } -// } -// } -// else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or -// // spurious semaphore :-) -// sem_wait( semBlockLock ); -// nWaitersBlocked -= nWaitersGone; // something is going on here -// // - test of timeouts? :-) -// sem_post( semBlockLock ); -// nWaitersGone = 0; -// } -// unlock( mtxUnblockLock ); -// -// if ( 1 == nSignalsWasLeft ) { -// if ( 0 != nWaitersWasGone ) { -// // sem_adjust( semBlockQueue,-nWaitersWasGone ); -// while ( nWaitersWasGone-- ) { -// sem_wait( semBlockQueue ); // better now than spurious later -// } -// } sem_post( semBlockLock ); // open the gate -// } -// -// lock( mtxExternal ); -// -// return ( bTimedOut ) ? ETIMEOUT : 0; -// } -// -// signal(bAll) { -// -// [auto: register int result ] -// [auto: register int nSignalsToIssue] -// -// lock( mtxUnblockLock ); -// -// if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! -// if ( 0 == nWaitersBlocked ) { // NO-OP -// return unlock( mtxUnblockLock ); -// } -// if (bAll) { -// nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; -// nWaitersBlocked = 0; -// } -// else { -// nSignalsToIssue = 1; -// nWaitersToUnblock++; -// nWaitersBlocked--; -// } -// } -// else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! -// sem_wait( semBlockLock ); // close the gate -// if ( 0 != nWaitersGone ) { -// nWaitersBlocked -= nWaitersGone; -// nWaitersGone = 0; -// } -// if (bAll) { -// nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; -// nWaitersBlocked = 0; -// } -// else { -// nSignalsToIssue = nWaitersToUnblock = 1; -// nWaitersBlocked--; -// } -// } -// else { // NO-OP -// return unlock( mtxUnblockLock ); -// } -// -// unlock( mtxUnblockLock ); -// sem_post( semBlockQueue,nSignalsToIssue ); -// return result; -// } -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// namespace boost { namespace interprocess { @@ -156,224 +31,83 @@ class windows_condition { windows_condition(const windows_condition &); windows_condition &operator=(const windows_condition &); - public: - windows_condition(); - ~windows_condition(); - void notify_one(); - void notify_all(); + public: + windows_condition() + : m_condition_data() + {} + + ~windows_condition() + {} + + void notify_one() + { m_condition_data.notify_one(); } + + void notify_all() + { m_condition_data.notify_all(); } template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) - { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(abs_time, *lock.mutex()); - } + { return m_condition_data.timed_wait(lock, abs_time); } template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) - { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - while (!pred()){ - if (!this->do_timed_wait(abs_time, *lock.mutex())) - return pred(); - } - return true; - } + { return m_condition_data.timed_wait(lock, abs_time, pred); } template void wait(L& lock) - { - if (!lock) - throw lock_exception(); - do_wait(*lock.mutex()); - } + { m_condition_data.wait(lock); } template void wait(L& lock, Pr pred) - { - if (!lock) - throw lock_exception(); - - while (!pred()) - do_wait(*lock.mutex()); - } - - template - void do_wait(InterprocessMutex &mut); - - template - bool do_timed_wait(const boost::posix_time::ptime &abs_time, InterprocessMutex &mut); + { m_condition_data.wait(lock, pred); } private: - template - bool do_timed_wait(bool timeout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mut); - void do_signal (bool broadcast); + struct condition_data + { + typedef boost::int32_t integer_type; + typedef windows_semaphore semaphore_type; + typedef windows_mutex mutex_type; - boost::int32_t m_nwaiters_blocked; - boost::int32_t m_nwaiters_gone; - boost::int32_t m_nwaiters_to_unblock; - windows_semaphore m_sem_block_queue; - windows_semaphore m_sem_block_lock; - windows_mutex m_mtx_unblock_lock; + condition_data() + : m_nwaiters_blocked(0) + , m_nwaiters_gone(0) + , m_nwaiters_to_unblock(0) + , m_sem_block_queue(0) + , m_sem_block_lock(1) + , m_mtx_unblock_lock() + {} + + integer_type &get_nwaiters_blocked() + { return m_nwaiters_blocked; } + + integer_type &get_nwaiters_gone() + { return m_nwaiters_gone; } + + integer_type &get_nwaiters_to_unblock() + { return m_nwaiters_to_unblock; } + + semaphore_type &get_sem_block_queue() + { return m_sem_block_queue; } + + semaphore_type &get_sem_block_lock() + { return m_sem_block_lock; } + + mutex_type &get_mtx_unblock_lock() + { return m_mtx_unblock_lock; } + + boost::int32_t m_nwaiters_blocked; + boost::int32_t m_nwaiters_gone; + boost::int32_t m_nwaiters_to_unblock; + windows_semaphore m_sem_block_queue; + windows_semaphore m_sem_block_lock; + windows_mutex m_mtx_unblock_lock; + }; + + ipcdetail::condition_8a_wrapper m_condition_data; }; -inline windows_condition::windows_condition() - : m_nwaiters_blocked(0) - , m_nwaiters_gone(0) - , m_nwaiters_to_unblock(0) - , m_sem_block_queue(0) - , m_sem_block_lock(1) - , m_mtx_unblock_lock() -{} - -inline windows_condition::~windows_condition() -{} - -inline void windows_condition::notify_one() -{ this->do_signal(false); } - -inline void windows_condition::notify_all() -{ this->do_signal(true); } - -inline void windows_condition::do_signal(bool broadcast) -{ - boost::int32_t nsignals_to_issue; - - { - scoped_lock locker(m_mtx_unblock_lock); - - if ( 0 != m_nwaiters_to_unblock ) { // the gate is closed!!! - if ( 0 == m_nwaiters_blocked ) { // NO-OP - //locker's destructor triggers m_mtx_unblock_lock.unlock() - return; - } - if (broadcast) { - m_nwaiters_to_unblock += nsignals_to_issue = m_nwaiters_blocked; - m_nwaiters_blocked = 0; - } - else { - nsignals_to_issue = 1; - m_nwaiters_to_unblock++; - m_nwaiters_blocked--; - } - } - else if ( m_nwaiters_blocked > m_nwaiters_gone ) { // HARMLESS RACE CONDITION! - m_sem_block_lock.wait(); // close the gate - if ( 0 != m_nwaiters_gone ) { - m_nwaiters_blocked -= m_nwaiters_gone; - m_nwaiters_gone = 0; - } - if (broadcast) { - nsignals_to_issue = m_nwaiters_to_unblock = m_nwaiters_blocked; - m_nwaiters_blocked = 0; - } - else { - nsignals_to_issue = m_nwaiters_to_unblock = 1; - m_nwaiters_blocked--; - } - } - else { // NO-OP - //locker's destructor triggers m_mtx_unblock_lock.unlock() - return; - } - //locker's destructor triggers m_mtx_unblock_lock.unlock() - } - m_sem_block_queue.post(nsignals_to_issue); -} - -template -inline void windows_condition::do_wait(InterprocessMutex &mut) -{ this->do_timed_wait(false, boost::posix_time::ptime(), mut); } - -template -inline bool windows_condition::do_timed_wait - (const boost::posix_time::ptime &abs_time, InterprocessMutex &mut) -{ return this->do_timed_wait(true, abs_time, mut); } - -template -inline bool windows_condition::do_timed_wait - (bool tout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mtxExternal) -{ - //Initialize to avoid warnings - boost::int32_t nsignals_was_left = 0; - boost::int32_t nwaiters_was_gone = 0; - - m_sem_block_lock.wait(); - ++m_nwaiters_blocked; - m_sem_block_lock.post(); - - struct scoped_unlock - { - InterprocessMutex & mut; - scoped_unlock(InterprocessMutex & m) - : mut(m) - { m.unlock(); } - - ~scoped_unlock() - { mut.lock(); } - } unlocker(mtxExternal); - - - bool bTimedOut = tout_enabled ? !m_sem_block_queue.timed_wait(abs_time) : (m_sem_block_queue.wait(), false); - - { - scoped_lock locker(m_mtx_unblock_lock); - if ( 0 != (nsignals_was_left = m_nwaiters_to_unblock) ) { - if ( bTimedOut ) { // timeout (or canceled) - if ( 0 != m_nwaiters_blocked ) { - m_nwaiters_blocked--; - } - else { - m_nwaiters_gone++; // count spurious wakeups. - } - } - if ( 0 == --m_nwaiters_to_unblock ) { - if ( 0 != m_nwaiters_blocked ) { - m_sem_block_lock.post(); // open the gate. - nsignals_was_left = 0; // do not open the gate below again. - } - else if ( 0 != (nwaiters_was_gone = m_nwaiters_gone) ) { - m_nwaiters_gone = 0; - } - } - } - else if ( (std::numeric_limits::max)()/2 - == ++m_nwaiters_gone ) { // timeout/canceled or spurious semaphore :-) - m_sem_block_lock.wait(); - m_nwaiters_blocked -= m_nwaiters_gone; // something is going on here - test of timeouts? :-) - m_sem_block_lock.post(); - m_nwaiters_gone = 0; - } - //locker's destructor triggers m_mtx_unblock_lock.unlock() - } - - if ( 1 == nsignals_was_left ) { - if ( 0 != nwaiters_was_gone ) { - // sem_adjust( m_sem_block_queue,-nwaiters_was_gone ); - while ( nwaiters_was_gone-- ) { - m_sem_block_queue.wait(); // better now than spurious later - } - } - m_sem_block_lock.post(); // open the gate - } - - //mtxExternal.lock(); called from unlocker - - return ( bTimedOut ) ? false : true; -} - } //namespace ipcdetail } //namespace interprocess } //namespace boost diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp index 5eca52233..7da70f4d5 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -19,8 +19,9 @@ #include #include #include -#include +#include #include +#include #include @@ -47,85 +48,61 @@ class windows_mutex const sync_id id_; }; -inline windows_mutex::windows_mutex() - : id_() +inline windows_mutex::windows_mutex() + : id_(this) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //Create mutex with the initial count bool open_or_created; - handles.obtain_mutex(this->id_, &open_or_created); + (void)handles.obtain_mutex(this->id_, &open_or_created); //The mutex must be created, never opened assert(open_or_created); assert(open_or_created && winapi::get_last_error() != winapi::error_already_exists); (void)open_or_created; } -inline windows_mutex::~windows_mutex() +inline windows_mutex::~windows_mutex() { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); handles.destroy_handle(this->id_); } inline void windows_mutex::lock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + mut.lock(); } inline bool windows_mutex::try_lock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, 0); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.try_lock(); } inline bool windows_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->lock(); - return true; - } - boost::posix_time::ptime now - = boost::posix_time::microsec_clock::universal_time(); - - unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds(); sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, ms); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.timed_lock(abs_time); } inline void windows_mutex::unlock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - int ret = winapi::release_mutex(hnd); - (void)ret; - assert(ret); + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.unlock(); } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp new file mode 100644 index 000000000..472448234 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp @@ -0,0 +1,34 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +typedef windows_named_condition_any windows_named_condition; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp new file mode 100644 index 000000000..0d3b915b3 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp @@ -0,0 +1,241 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class windows_named_condition_any +{ + /// @cond + + //Non-copyable + windows_named_condition_any(); + windows_named_condition_any(const windows_named_condition_any &); + windows_named_condition_any &operator=(const windows_named_condition_any &); + /// @endcond + + public: + windows_named_condition_any + (create_only_t, const char *name, const permissions &perm) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); + } + + windows_named_condition_any + (open_or_create_t, const char *name, const permissions &perm) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); + } + + windows_named_condition_any(open_only_t, const char *name) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); + } + + ~windows_named_condition_any() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.close(callbacks); + } + + void notify_one() + { m_condition_data.notify_one(); } + + void notify_all() + { m_condition_data.notify_all(); } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_condition_data.timed_wait(lock, abs_time); } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_condition_data.timed_wait(lock, abs_time, pred); } + + template + void wait(L& lock) + { m_condition_data.wait(lock); } + + template + void wait(L& lock, Pr pred) + { m_condition_data.wait(lock, pred); } + + static bool remove(const char *name) + { return windows_named_sync::remove(name); } + + /// @cond + private: + + void windows_named_condition_any::dont_close_on_destruction() + {} + + friend class interprocess_tester; + + struct condition_data + { + typedef boost::int32_t integer_type; + typedef winapi_semaphore_wrapper semaphore_type; + typedef winapi_mutex_wrapper mutex_type; + + integer_type &get_nwaiters_blocked() + { return m_nwaiters_blocked; } + + integer_type &get_nwaiters_gone() + { return m_nwaiters_gone; } + + integer_type &get_nwaiters_to_unblock() + { return m_nwaiters_to_unblock; } + + semaphore_type &get_sem_block_queue() + { return m_sem_block_queue; } + + semaphore_type &get_sem_block_lock() + { return m_sem_block_lock; } + + mutex_type &get_mtx_unblock_lock() + { return m_mtx_unblock_lock; } + + integer_type m_nwaiters_blocked; + integer_type m_nwaiters_gone; + integer_type m_nwaiters_to_unblock; + winapi_semaphore_wrapper m_sem_block_queue; + winapi_semaphore_wrapper m_sem_block_lock; + winapi_mutex_wrapper m_mtx_unblock_lock; + }; + + ipcdetail::condition_8a_wrapper m_condition_data; + + class named_cond_callbacks : public windows_named_sync_interface + { + typedef __int64 sem_count_t; + mutable sem_count_t sem_counts [2]; + + public: + named_cond_callbacks(condition_data &cond_data) + : m_condition_data(cond_data) + {} + + virtual std::size_t get_data_size() const + { return sizeof(sem_counts); } + + virtual const void *buffer_with_final_data_to_file() + { + sem_counts[0] = m_condition_data.m_sem_block_queue.value(); + sem_counts[1] = m_condition_data.m_sem_block_lock.value(); + return &sem_counts; + } + + virtual const void *buffer_with_init_data_to_file() + { + sem_counts[0] = 0; + sem_counts[1] = 1; + return &sem_counts; + } + + virtual void *buffer_to_store_init_data_from_file() + { return &sem_counts; } + + virtual bool open(create_enum_t, const char *id_name) + { + m_condition_data.m_nwaiters_blocked = 0; + m_condition_data.m_nwaiters_gone = 0; + m_condition_data.m_nwaiters_to_unblock = 0; + + //Now open semaphores and mutex. + //Use local variables + swap to guarantee consistent + //initialization and cleanup in case any opening fails + permissions perm; + perm.set_unrestricted(); + std::string aux_str = "Global\\bipc.cond."; + aux_str += id_name; + std::size_t pos = aux_str.size(); + + //sem_block_queue + aux_str += "_bq"; + winapi_semaphore_wrapper sem_block_queue; + bool created; + if(!sem_block_queue.open_or_create + (aux_str.c_str(), sem_counts[0], winapi_semaphore_wrapper::MaxCount, perm, created)) + return false; + aux_str.erase(pos); + + //sem_block_lock + aux_str += "_bl"; + winapi_semaphore_wrapper sem_block_lock; + if(!sem_block_lock.open_or_create + (aux_str.c_str(), sem_counts[1], winapi_semaphore_wrapper::MaxCount, perm, created)) + return false; + aux_str.erase(pos); + + //mtx_unblock_lock + aux_str += "_ul"; + winapi_mutex_wrapper mtx_unblock_lock; + if(!mtx_unblock_lock.open_or_create(aux_str.c_str(), perm)) + return false; + + //All ok, commit data + m_condition_data.m_sem_block_queue.swap(sem_block_queue); + m_condition_data.m_sem_block_lock.swap(sem_block_lock); + m_condition_data.m_mtx_unblock_lock.swap(mtx_unblock_lock); + return true; + } + + virtual void close() + { + m_condition_data.m_sem_block_queue.close(); + m_condition_data.m_sem_block_lock.close(); + m_condition_data.m_mtx_unblock_lock.close(); + m_condition_data.m_nwaiters_blocked = 0; + m_condition_data.m_nwaiters_gone = 0; + m_condition_data.m_nwaiters_to_unblock = 0; + } + + virtual ~named_cond_callbacks() + {} + + private: + condition_data &m_condition_data; + }; + + windows_named_sync m_named_sync; + /// @endcond +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp new file mode 100644 index 000000000..8ea6b3e1e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp @@ -0,0 +1,175 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + + +class windows_named_mutex +{ + /// @cond + + //Non-copyable + windows_named_mutex(); + windows_named_mutex(const windows_named_mutex &); + windows_named_mutex &operator=(const windows_named_mutex &); + /// @endcond + + public: + windows_named_mutex(create_only_t, const char *name, const permissions &perm = permissions()); + + windows_named_mutex(open_or_create_t, const char *name, const permissions &perm = permissions()); + + windows_named_mutex(open_only_t, const char *name); + + ~windows_named_mutex(); + + void unlock(); + void lock(); + bool try_lock(); + bool timed_lock(const boost::posix_time::ptime &abs_time); + + static bool remove(const char *name); + + /// @cond + private: + friend class interprocess_tester; + void dont_close_on_destruction(); + winapi_mutex_wrapper m_mtx_wrapper; + windows_named_sync m_named_sync; + + class named_mut_callbacks : public windows_named_sync_interface + { + public: + named_mut_callbacks(winapi_mutex_wrapper &mtx_wrapper) + : m_mtx_wrapper(mtx_wrapper) + {} + + virtual std::size_t get_data_size() const + { return 0u; } + + virtual const void *buffer_with_init_data_to_file() + { return 0; } + + virtual const void *buffer_with_final_data_to_file() + { return 0; } + + virtual void *buffer_to_store_init_data_from_file() + { return 0; } + + virtual bool open(create_enum_t, const char *id_name) + { + std::string aux_str = "Global\\bipc.mut."; + aux_str += id_name; + // + permissions mut_perm; + mut_perm.set_unrestricted(); + return m_mtx_wrapper.open_or_create(aux_str.c_str(), mut_perm); + } + + virtual void close() + { + m_mtx_wrapper.close(); + } + + virtual ~named_mut_callbacks() + {} + + private: + winapi_mutex_wrapper& m_mtx_wrapper; + }; + /// @endcond +}; + +inline windows_named_mutex::~windows_named_mutex() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.close(callbacks); +} + +inline void windows_named_mutex::dont_close_on_destruction() +{} + +inline windows_named_mutex::windows_named_mutex + (create_only_t, const char *name, const permissions &perm) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); +} + +inline windows_named_mutex::windows_named_mutex + (open_or_create_t, const char *name, const permissions &perm) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); +} + +inline windows_named_mutex::windows_named_mutex(open_only_t, const char *name) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); +} + +inline void windows_named_mutex::unlock() +{ + m_mtx_wrapper.unlock(); +} + +inline void windows_named_mutex::lock() +{ + m_mtx_wrapper.lock(); +} + +inline bool windows_named_mutex::try_lock() +{ + return m_mtx_wrapper.try_lock(); +} + +inline bool windows_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) +{ + return m_mtx_wrapper.timed_lock(abs_time); +} + +inline bool windows_named_mutex::remove(const char *name) +{ + return windows_named_sync::remove(name); +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP \ No newline at end of file diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp new file mode 100644 index 000000000..cb2ef79ac --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp @@ -0,0 +1,58 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP +#define BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + +class windows_named_recursive_mutex + //Windows mutexes based on CreateMutex are already recursive... + : public windows_named_mutex +{ + /// @cond + + //Non-copyable + windows_named_recursive_mutex(); + windows_named_recursive_mutex(const windows_named_mutex &); + windows_named_recursive_mutex &operator=(const windows_named_mutex &); + /// @endcond + + public: + windows_named_recursive_mutex(create_only_t, const char *name, const permissions &perm = permissions()) + : windows_named_mutex(create_only_t(), name, perm) + {} + + windows_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm = permissions()) + : windows_named_mutex(open_or_create_t(), name, perm) + {} + + windows_named_recursive_mutex(open_only_t, const char *name) + : windows_named_mutex(open_only_t(), name) + {} +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp new file mode 100644 index 000000000..8f48d4df9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp @@ -0,0 +1,178 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + + +class windows_named_semaphore +{ + /// @cond + + //Non-copyable + windows_named_semaphore(); + windows_named_semaphore(const windows_named_semaphore &); + windows_named_semaphore &operator=(const windows_named_semaphore &); + /// @endcond + + public: + windows_named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); + + windows_named_semaphore(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); + + windows_named_semaphore(open_only_t, const char *name); + + ~windows_named_semaphore(); + + void post(); + void wait(); + bool try_wait(); + bool timed_wait(const boost::posix_time::ptime &abs_time); + + static bool remove(const char *name); + + /// @cond + private: + friend class interprocess_tester; + void dont_close_on_destruction(); + winapi_semaphore_wrapper m_sem_wrapper; + windows_named_sync m_named_sync; + + class named_sem_callbacks : public windows_named_sync_interface + { + public: + typedef __int64 sem_count_t; + named_sem_callbacks(winapi_semaphore_wrapper &sem_wrapper, sem_count_t sem_cnt) + : m_sem_wrapper(sem_wrapper), m_sem_count(sem_cnt) + {} + + virtual std::size_t get_data_size() const + { return sizeof(sem_count_t); } + + virtual const void *buffer_with_final_data_to_file() + { return &m_sem_count; } + + virtual const void *buffer_with_init_data_to_file() + { return &m_sem_count; } + + virtual void *buffer_to_store_init_data_from_file() + { return &m_sem_count; } + + virtual bool open(create_enum_t, const char *id_name) + { + std::string aux_str = "Global\\bipc.sem."; + aux_str += id_name; + // + permissions sem_perm; + sem_perm.set_unrestricted(); + bool created; + return m_sem_wrapper.open_or_create + ( aux_str.c_str(), static_cast(m_sem_count) + , winapi_semaphore_wrapper::MaxCount, sem_perm, created); + } + + virtual void close() + { + m_sem_wrapper.close(); + } + + virtual ~named_sem_callbacks() + {} + + private: + sem_count_t m_sem_count; + winapi_semaphore_wrapper& m_sem_wrapper; + }; + + /// @endcond +}; + +inline windows_named_semaphore::~windows_named_semaphore() +{ + named_sem_callbacks callbacks(m_sem_wrapper, m_sem_wrapper.value()); + m_named_sync.close(callbacks); +} + +inline void windows_named_semaphore::dont_close_on_destruction() +{} + +inline windows_named_semaphore::windows_named_semaphore + (create_only_t, const char *name, unsigned int initial_count, const permissions &perm) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, initial_count); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); +} + +inline windows_named_semaphore::windows_named_semaphore + (open_or_create_t, const char *name, unsigned int initial_count, const permissions &perm) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, initial_count); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); +} + +inline windows_named_semaphore::windows_named_semaphore(open_only_t, const char *name) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, 0); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); +} + +inline void windows_named_semaphore::post() +{ + m_sem_wrapper.post(); +} + +inline void windows_named_semaphore::wait() +{ + m_sem_wrapper.wait(); +} + +inline bool windows_named_semaphore::try_wait() +{ + return m_sem_wrapper.try_wait(); +} + +inline bool windows_named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time) +{ + return m_sem_wrapper.timed_wait(abs_time); +} + +inline bool windows_named_semaphore::remove(const char *name) +{ + return windows_named_sync::remove(name); +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp new file mode 100644 index 000000000..41f299f8e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp @@ -0,0 +1,215 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class windows_named_sync_interface +{ + public: + virtual std::size_t get_data_size() const = 0; + virtual const void *buffer_with_final_data_to_file() = 0; + virtual const void *buffer_with_init_data_to_file() = 0; + virtual void *buffer_to_store_init_data_from_file() = 0; + virtual bool open(create_enum_t creation_type, const char *id_name) = 0; + virtual void close() = 0; + virtual ~windows_named_sync_interface() = 0; +}; + +inline windows_named_sync_interface::~windows_named_sync_interface() +{} + +class windows_named_sync +{ + /// @cond + + //Non-copyable + windows_named_sync(const windows_named_sync &); + windows_named_sync &operator=(const windows_named_sync &); + /// @endcond + + public: + windows_named_sync(); + void open_or_create(create_enum_t creation_type, const char *name, const permissions &perm, windows_named_sync_interface &sync_interface); + void close(windows_named_sync_interface &sync_interface); + + static bool remove(const char *name); + + /// @cond + private: + void *m_file_hnd; + + /// @endcond +}; + +inline windows_named_sync::windows_named_sync() + : m_file_hnd(winapi::invalid_handle_value) +{} + +inline void windows_named_sync::close(windows_named_sync_interface &sync_interface) +{ + const std::size_t buflen = sync_interface.get_data_size(); + const std::size_t sizeof_file_info = sizeof(sync_id::internal_type) + buflen; + winapi::interprocess_overlapped overlapped; + if(winapi::lock_file_ex + (m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){ + if(winapi::set_file_pointer_ex(m_file_hnd, sizeof(sync_id::internal_type), 0, winapi::file_begin)){ + const void *buf = sync_interface.buffer_with_final_data_to_file(); + + unsigned long written_or_read = 0; + if(winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0)){ + //... + } + } + } + sync_interface.close(); + if(m_file_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_file_hnd); + m_file_hnd = winapi::invalid_handle_value; + } +} + +inline void windows_named_sync::open_or_create + ( create_enum_t creation_type + , const char *name + , const permissions &perm + , windows_named_sync_interface &sync_interface) +{ + std::string aux_str(name); + m_file_hnd = winapi::invalid_handle_value; + //Use a file to emulate POSIX lifetime semantics. After this logic + //we'll obtain the ID of the native handle to open in aux_str + { + create_tmp_and_clean_old_and_get_filename(name, aux_str); + //Create a file with required permissions. + m_file_hnd = winapi::create_file + ( aux_str.c_str() + , winapi::generic_read | winapi::generic_write + , creation_type == DoOpen ? winapi::open_existing : + (creation_type == DoCreate ? winapi::create_new : winapi::open_always) + , 0 + , (winapi::interprocess_security_attributes*)perm.get_permissions()); + + //Obtain OS error in case something has failed + error_info err; + bool success = false; + if(m_file_hnd != winapi::invalid_handle_value){ + //Now lock the file + const std::size_t buflen = sync_interface.get_data_size(); + typedef __int64 unique_id_type; + const std::size_t sizeof_file_info = sizeof(unique_id_type) + buflen; + winapi::interprocess_overlapped overlapped; + if(winapi::lock_file_ex + (m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){ + __int64 filesize = 0; + //Obtain the unique id to open the native semaphore. + //If file size was created + if(winapi::get_file_size(m_file_hnd, filesize)){ + unsigned long written_or_read = 0; + unique_id_type unique_id_val; + if(static_cast(filesize) != sizeof_file_info){ + winapi::set_end_of_file(m_file_hnd); + winapi::query_performance_counter(&unique_id_val); + const void *buf = sync_interface.buffer_with_init_data_to_file(); + //Write unique ID in file. This ID will be used to calculate the semaphore name + if(winapi::write_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) && + written_or_read == sizeof(unique_id_val) && + winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0) && + written_or_read == buflen ){ + success = true; + } + winapi::get_file_size(m_file_hnd, filesize); + assert(std::size_t(filesize) == sizeof_file_info); + } + else{ + void *buf = sync_interface.buffer_to_store_init_data_from_file(); + if(winapi::read_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) && + written_or_read == sizeof(unique_id_val) && + winapi::read_file(m_file_hnd, buf, buflen, &written_or_read, 0) && + written_or_read == buflen ){ + success = true; + } + } + if(success){ + //Now create a global semaphore name based on the unique id + char unique_id_name[sizeof(unique_id_val)*2+1]; + std::size_t name_suffix_length = sizeof(unique_id_name); + bytes_to_str(&unique_id_val, sizeof(unique_id_val), &unique_id_name[0], name_suffix_length); + success = sync_interface.open(creation_type, unique_id_name); + } + } + + //Obtain OS error in case something has failed + err = system_error_code(); + + //If this fails we have no possible rollback so don't check the return + if(!winapi::unlock_file_ex(m_file_hnd, 0, sizeof_file_info, 0, &overlapped)){ + err = system_error_code(); + } + } + else{ + //Obtain OS error in case something has failed + err = system_error_code(); + } + } + else{ + err = system_error_code(); + } + + if(!success){ + if(m_file_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_file_hnd); + m_file_hnd = winapi::invalid_handle_value; + } + //Throw as something went wrong + throw interprocess_exception(err); + } + } +} + +inline bool windows_named_sync::remove(const char *name) +{ + try{ + //Make sure a temporary path is created for shared memory + std::string semfile; + ipcdetail::tmp_filename(name, semfile); + return winapi::unlink_file(semfile.c_str()); + } + catch(...){ + return false; + } +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp index 9565cb6fb..2b4797e17 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp index d5835ceec..a8625a6bf 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -19,8 +19,9 @@ #include #include #include -#include +#include #include +#include #include @@ -46,11 +47,11 @@ class windows_semaphore const sync_id id_; }; -inline windows_semaphore::windows_semaphore(unsigned int initialCount) - : id_() +inline windows_semaphore::windows_semaphore(unsigned int initialCount) + : id_(this) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //Force smeaphore creation with the initial count bool open_or_created; handles.obtain_semaphore(this->id_, initialCount, &open_or_created); @@ -60,72 +61,46 @@ inline windows_semaphore::windows_semaphore(unsigned int initialCount) (void)open_or_created; } -inline windows_semaphore::~windows_semaphore() +inline windows_semaphore::~windows_semaphore() { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); handles.destroy_handle(this->id_); } inline void windows_semaphore::wait(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + sem.wait(); } inline bool windows_semaphore::try_wait(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, 0); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + return sem.try_wait(); } inline bool windows_semaphore::timed_wait(const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(); - return true; - } - boost::posix_time::ptime now - = boost::posix_time::microsec_clock::universal_time(); - - unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds(); sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, ms); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + return sem.timed_wait(abs_time); } inline void windows_semaphore::post(long release_count) { sync_handles &handles = - intermodule_singleton::get(); - //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - long prev_count; - int ret = winapi::release_semaphore(hnd, release_count, &prev_count); - (void)ret; - assert(ret); + windows_intermodule_singleton::get(); + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + sem.post(release_count); } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp index 89c4aeda0..92d8e55a1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -21,7 +21,16 @@ #include #include #include -#include +#include +#include + +//Shield against external warnings +#include + #include +#include + + +#include #include namespace boost { @@ -32,6 +41,7 @@ inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *ou { const std::size_t need_mem = mem_length*2+1; if(out_length < need_mem){ + out_length = need_mem; return false; } @@ -49,40 +59,57 @@ inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *ou return true; } -struct sync_id +class sync_id { - sync_id() - { winapi::query_performance_counter(&rand); } + public: + typedef __int64 internal_type; + sync_id(const void *map_addr) + : map_addr_(map_addr) + { winapi::query_performance_counter(&rand_); } - __int64 rand; + explicit sync_id(internal_type val, const void *map_addr) + : map_addr_(map_addr) + { rand_ = val; } + + const internal_type &internal_pod() const + { return rand_; } + + internal_type &internal_pod() + { return rand_; } + + const void *map_address() const + { return map_addr_; } friend std::size_t hash_value(const sync_id &m) - { return boost::hash_value(m.rand); } + { return boost::hash_value(m.rand_); } friend bool operator==(const sync_id &l, const sync_id &r) - { return l.rand == r.rand; } + { return l.rand_ == r.rand_ && l.map_addr_ == r.map_addr_; } + + private: + internal_type rand_; + const void * const map_addr_; }; -/* -#define BOOST_NO_LONG_LONG ss -#if defined(BOOST_NO_LONG_LONG) - -#error "defined(BOOST_NO_LONG_LONG)" -#else -#error "NOT defined(BOOST_NO_LONG_LONG)" -#endif -*/ class sync_handles { public: enum type { MUTEX, SEMAPHORE }; private: - typedef boost::unordered_map map_type; + struct address_less + { + bool operator()(sync_id const * const l, sync_id const * const r) const + { return l->map_address() < r->map_address(); } + }; + + typedef boost::unordered_map umap_type; + typedef boost::container::map map_type; static const std::size_t LengthOfGlobal = sizeof("Global\\boost.ipc")-1; static const std::size_t StrSize = LengthOfGlobal + (sizeof(sync_id)*2+1); typedef char NameBuf[StrSize]; + void fill_name(NameBuf &name, const sync_id &id) { const char *n = "Global\\boost.ipc"; @@ -92,13 +119,12 @@ class sync_handles ++i; } while(n[i]); std::size_t len = sizeof(NameBuf) - LengthOfGlobal; - bytes_to_str(&id.rand, sizeof(id.rand), &name[LengthOfGlobal], len); + bytes_to_str(&id.internal_pod(), sizeof(id.internal_pod()), &name[LengthOfGlobal], len); } - void erase_and_throw_if_error(void *hnd_val, const sync_id &id) + void throw_if_error(void *hnd_val) { if(!hnd_val){ - map_.erase(id); error_info err(winapi::get_last_error()); throw interprocess_exception(err); } @@ -108,58 +134,95 @@ class sync_handles { NameBuf name; fill_name(name, id); - void *hnd_val = winapi::open_or_create_semaphore - (name, (long)initial_count, (long)(((unsigned long)(-1))>>1), unrestricted_security.get_attributes()); - erase_and_throw_if_error(hnd_val, id); - return hnd_val; + permissions unrestricted_security; + unrestricted_security.set_unrestricted(); + winapi_semaphore_wrapper sem_wrapper; + bool created; + sem_wrapper.open_or_create + (name, (long)initial_count, winapi_semaphore_wrapper::MaxCount, unrestricted_security, created); + throw_if_error(sem_wrapper.handle()); + return sem_wrapper.release(); } void* open_or_create_mutex(const sync_id &id) { NameBuf name; fill_name(name, id); - void *hnd_val = winapi::open_or_create_mutex - (name, false, unrestricted_security.get_attributes()); - erase_and_throw_if_error(hnd_val, id); - return hnd_val; + permissions unrestricted_security; + unrestricted_security.set_unrestricted(); + winapi_mutex_wrapper mtx_wrapper; + mtx_wrapper.open_or_create(name, unrestricted_security); + throw_if_error(mtx_wrapper.handle()); + return mtx_wrapper.release(); } public: void *obtain_mutex(const sync_id &id, bool *popen_created = 0) { + umap_type::value_type v(id, (void*)0); scoped_lock lock(mtx_); - void *&hnd_val = map_[id]; + umap_type::iterator it = umap_.insert(v).first; + void *&hnd_val = it->second; if(!hnd_val){ + map_[&it->first] = it; hnd_val = open_or_create_mutex(id); if(popen_created) *popen_created = true; } + else if(popen_created){ + *popen_created = false; + } return hnd_val; } void *obtain_semaphore(const sync_id &id, unsigned int initial_count, bool *popen_created = 0) { + umap_type::value_type v(id, (void*)0); scoped_lock lock(mtx_); - void *&hnd_val = map_[id]; + umap_type::iterator it = umap_.insert(v).first; + void *&hnd_val = it->second; if(!hnd_val){ + map_[&it->first] = it; hnd_val = open_or_create_semaphore(id, initial_count); if(popen_created) *popen_created = true; } + else if(popen_created){ + *popen_created = false; + } return hnd_val; } void destroy_handle(const sync_id &id) { scoped_lock lock(mtx_); - map_type::iterator it = map_.find(id); - if(it != map_.end()){ + umap_type::iterator it = umap_.find(id); + umap_type::iterator itend = umap_.end(); + + if(it != itend){ winapi::close_handle(it->second); - map_.erase(it); + const map_type::key_type &k = &it->first; + map_.erase(k); + umap_.erase(it); + } + } + + void destroy_syncs_in_range(const void *addr, std::size_t size) + { + const sync_id low_id(addr); + const sync_id hig_id(static_cast(addr)+size); + scoped_lock lock(mtx_); + map_type::iterator itlow(map_.lower_bound(&low_id)), + ithig(map_.lower_bound(&hig_id)); + while(itlow != ithig){ + void * const hnd = umap_[*itlow->first]; + winapi::close_handle(hnd); + umap_.erase(*itlow->first); + itlow = map_.erase(itlow); } } private: - winapi::interprocess_all_access_security unrestricted_security; spin_mutex mtx_; + umap_type umap_; map_type map_; }; diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp new file mode 100644 index 000000000..0be96011c --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp @@ -0,0 +1,163 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP +#define BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class winapi_mutex_functions +{ + /// @cond + + //Non-copyable + winapi_mutex_functions(const winapi_mutex_functions &); + winapi_mutex_functions &operator=(const winapi_mutex_functions &); + /// @endcond + + public: + winapi_mutex_functions(void *mtx_hnd) + : m_mtx_hnd(mtx_hnd) + {} + + void unlock() + { + winapi::release_mutex(m_mtx_hnd); + } + + void lock() + { + if(winapi::wait_for_single_object(m_mtx_hnd, winapi::infinite_time) != winapi::wait_object_0){ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool try_lock() + { + unsigned long ret = winapi::wait_for_single_object(m_mtx_hnd, 0); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool timed_lock(const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->lock(); + return true; + } + + unsigned long ret = winapi::wait_for_single_object + (m_mtx_hnd, (abs_time - microsec_clock::universal_time()).total_milliseconds()); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + /// @cond + protected: + void *m_mtx_hnd; + /// @endcond +}; + +//Swappable mutex wrapper +class winapi_mutex_wrapper + : public winapi_mutex_functions +{ + /// @cond + + //Non-copyable + winapi_mutex_wrapper(const winapi_mutex_wrapper &); + winapi_mutex_wrapper &operator=(const winapi_mutex_wrapper &); + /// @endcond + + public: + winapi_mutex_wrapper(void *mtx_hnd = winapi::invalid_handle_value) + : winapi_mutex_functions(mtx_hnd) + {} + + ~winapi_mutex_wrapper() + { this->close(); } + + void *release() + { + void *hnd = m_mtx_hnd; + m_mtx_hnd = winapi::invalid_handle_value; + return hnd; + } + + void *handle() const + { return m_mtx_hnd; } + + bool open_or_create(const char *name, const permissions &perm) + { + if(m_mtx_hnd == winapi::invalid_handle_value){ + m_mtx_hnd = winapi::open_or_create_mutex + ( name + , false + , (winapi::interprocess_security_attributes*)perm.get_permissions() + ); + return m_mtx_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + void close() + { + if(m_mtx_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_mtx_hnd); + m_mtx_hnd = winapi::invalid_handle_value; + } + } + + void swap(winapi_mutex_wrapper &other) + { void *tmp = m_mtx_hnd; m_mtx_hnd = other.m_mtx_hnd; other.m_mtx_hnd = tmp; } +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp new file mode 100644 index 000000000..de5185ac9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp @@ -0,0 +1,198 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP +#define BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class winapi_semaphore_functions +{ + /// @cond + + //Non-copyable + winapi_semaphore_functions(const winapi_semaphore_functions &); + winapi_semaphore_functions &operator=(const winapi_semaphore_functions &); + /// @endcond + + public: + winapi_semaphore_functions(void *hnd) + : m_sem_hnd(hnd) + {} + + void post(long count = 1) + { + long prev_count; + winapi::release_semaphore(m_sem_hnd, count, &prev_count); + } + + void wait() + { + if(winapi::wait_for_single_object(m_sem_hnd, winapi::infinite_time) != winapi::wait_object_0){ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool try_wait() + { + unsigned long ret = winapi::wait_for_single_object(m_sem_hnd, 0); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool timed_wait(const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(); + return true; + } + + unsigned long ret = winapi::wait_for_single_object + (m_sem_hnd, (abs_time - microsec_clock::universal_time()).total_milliseconds()); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + long value() const + { + long l_count, l_limit; + if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit)) + return 0; + return l_count; + } + + long limit() const + { + long l_count, l_limit; + if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit)) + return 0; + return l_limit; + } + + /// @cond + protected: + void *m_sem_hnd; + /// @endcond +}; + + +//Swappable semaphore wrapper +class winapi_semaphore_wrapper + : public winapi_semaphore_functions +{ + winapi_semaphore_wrapper(const winapi_semaphore_wrapper &); + winapi_semaphore_wrapper &operator=(const winapi_semaphore_wrapper &); + + public: + + //Long is 32 bits in windows + static const long MaxCount = long(0x7FFFFFFF); + + winapi_semaphore_wrapper(void *hnd = winapi::invalid_handle_value) + : winapi_semaphore_functions(hnd) + {} + + ~winapi_semaphore_wrapper() + { this->close(); } + + void *release() + { + void *hnd = m_sem_hnd; + m_sem_hnd = winapi::invalid_handle_value; + return hnd; + } + + void *handle() const + { return m_sem_hnd; } + + bool open_or_create( const char *name + , long sem_count + , long max_count + , const permissions &perm + , bool &created) + { + if(m_sem_hnd == winapi::invalid_handle_value){ + m_sem_hnd = winapi::open_or_create_semaphore + ( name + , sem_count + , max_count + , (winapi::interprocess_security_attributes*)perm.get_permissions() + ); + created = winapi::get_last_error() != winapi::error_already_exists; + return m_sem_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + bool open_semaphore(const char *name) + { + if(m_sem_hnd == winapi::invalid_handle_value){ + m_sem_hnd = winapi::open_semaphore(name); + return m_sem_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + void close() + { + if(m_sem_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_sem_hnd); + m_sem_hnd = winapi::invalid_handle_value; + } + } + + void swap(winapi_semaphore_wrapper &other) + { void *tmp = m_sem_hnd; m_sem_hnd = other.m_sem_hnd; other.m_sem_hnd = tmp; } +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp index 266e7c5da..deb429a3c 100644 --- a/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-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) // diff --git a/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp index 3dffdcc2e..f69f9cda8 100644 --- a/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (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) // @@ -62,20 +62,20 @@ class xsi_named_mutex xsi_named_mutex(open_or_create_t, const char *path, boost::uint8_t id, int perm = 0666) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, path, id, perm); } - //!Moves the ownership of "moved"'s named mutex to *this. - //!After the call, "moved" does not represent any named mutex + //!Moves the ownership of "moved"'s named mutex to *this. + //!After the call, "moved" does not represent any named mutex //!Does not throw xsi_named_mutex(BOOST_RV_REF(xsi_named_mutex) moved) { this->swap(moved); } //!Moves the ownership of "moved"'s named mutex to *this. - //!After the call, "moved" does not represent any named mutex. + //!After the call, "moved" does not represent any named mutex. //!Does not throw xsi_named_mutex &operator=(BOOST_RV_REF(xsi_named_mutex) moved) - { + { xsi_named_mutex tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_named_mutex. Does not throw @@ -126,11 +126,11 @@ class xsi_named_mutex /// @cond -inline xsi_named_mutex::xsi_named_mutex() +inline xsi_named_mutex::xsi_named_mutex() : m_semid(-1), m_key(-1), m_id(0), m_perm(0), m_path() {} -inline xsi_named_mutex::~xsi_named_mutex() +inline xsi_named_mutex::~xsi_named_mutex() { this->priv_close(); } inline const char *xsi_named_mutex::get_path() const @@ -142,7 +142,7 @@ inline void xsi_named_mutex::swap(xsi_named_mutex &other) std::swap(m_id, other.m_id); std::swap(m_semid, other.m_semid); std::swap(m_perm, other.m_perm); - m_path.swap(other.m_path); + m_path.swap(other.m_path); } inline mapping_handle_t xsi_named_mutex::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp index 9a8b3f47d..f2195ac2f 100644 --- a/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-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) // @@ -72,26 +72,26 @@ class windows_shared_memory windows_shared_memory(open_or_create_t, const char *name, mode_t mode, std::size_t size, const permissions& perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, size, perm); } - //!Tries to open a shared memory object with name "name", with the access mode "mode". + //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. windows_shared_memory(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, 0, permissions()); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw windows_shared_memory(BOOST_RV_REF(windows_shared_memory) moved) : m_handle(0) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved) - { + { windows_shared_memory tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to shared_memory_objects. Does not throw @@ -129,21 +129,21 @@ class windows_shared_memory /// @cond -inline windows_shared_memory::windows_shared_memory() +inline windows_shared_memory::windows_shared_memory() : m_handle(0) {} -inline windows_shared_memory::~windows_shared_memory() +inline windows_shared_memory::~windows_shared_memory() { this->priv_close(); } inline const char *windows_shared_memory::get_name() const { return m_name.c_str(); } inline void windows_shared_memory::swap(windows_shared_memory &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_name.swap(other.m_name); + m_name.swap(other.m_name); } inline mapping_handle_t windows_shared_memory::get_mapping_handle() const @@ -157,22 +157,26 @@ inline bool windows_shared_memory::priv_open_or_create { m_name = filename ? filename : ""; - unsigned long file_map_access = 0; + unsigned long protection = 0; unsigned long map_access = 0; switch(mode) { + //"protection" is for "create_file_mapping" + //"map_access" is for "open_file_mapping" + //Add section query (strange that read or access does not grant it...) + //to obtain the size of the mapping. copy_on_write is equal to section_query. case read_only: - file_map_access |= winapi::page_readonly; - map_access |= winapi::file_map_read; + protection |= winapi::page_readonly; + map_access |= winapi::file_map_read | winapi::section_query; break; case read_write: - file_map_access |= winapi::page_readwrite; - map_access |= winapi::file_map_write; + protection |= winapi::page_readwrite; + map_access |= winapi::file_map_write | winapi::section_query; break; case copy_on_write: - file_map_access |= winapi::page_writecopy; - map_access |= winapi::file_map_copy; + protection |= winapi::page_writecopy; + map_access |= winapi::file_map_copy; break; default: { @@ -184,16 +188,13 @@ inline bool windows_shared_memory::priv_open_or_create switch(type){ case ipcdetail::DoOpen: - m_handle = winapi::open_file_mapping - (map_access, filename); + m_handle = winapi::open_file_mapping(map_access, filename); break; case ipcdetail::DoCreate: case ipcdetail::DoOpenOrCreate: { - __int64 s = size; - unsigned long high_size(s >> 32), low_size((boost::uint32_t)s); m_handle = winapi::create_file_mapping - ( winapi::invalid_handle_value, file_map_access, high_size, low_size, filename + ( winapi::invalid_handle_value, protection, size, filename , (winapi::interprocess_security_attributes*)perm.get_permissions()); } break; diff --git a/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp index 3d09c7739..11cfe1d10 100644 --- a/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009. Distributed under the Boost +// (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) // @@ -78,21 +78,21 @@ class xsi_shared_memory xsi_shared_memory(open_only_t, const xsi_key &key) { this->priv_open_or_create(ipcdetail::DoOpen, key, permissions(), 0); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw xsi_shared_memory(BOOST_RV_REF(xsi_shared_memory) moved) : m_shmid(-1) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw xsi_shared_memory &operator=(BOOST_RV_REF(xsi_shared_memory) moved) - { + { xsi_shared_memory tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memorys. Does not throw @@ -129,11 +129,11 @@ class xsi_shared_memory /// @cond -inline xsi_shared_memory::xsi_shared_memory() +inline xsi_shared_memory::xsi_shared_memory() : m_shmid(-1) {} -inline xsi_shared_memory::~xsi_shared_memory() +inline xsi_shared_memory::~xsi_shared_memory() {} inline int xsi_shared_memory::get_shmid() const diff --git a/project/jni/boost/include/boost/intrusive/any_hook.hpp b/project/jni/boost/include/boost/intrusive/any_hook.hpp index cccc820e7..7d60de001 100644 --- a/project/jni/boost/include/boost/intrusive/any_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/any_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -50,7 +50,7 @@ struct make_any_base_hook Options... #endif >::type packed_options; - + typedef detail::generic_hook < get_any_node_algo , typename packed_options::tag @@ -63,13 +63,13 @@ struct make_any_base_hook //! Derive a class from this hook in order to store objects of that class //! in an intrusive container. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<> and //! \c link_mode<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its //! unique tag. //! //! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link). @@ -94,27 +94,27 @@ class any_base_hook public: //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. any_base_hook(); //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_base_hook(const any_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_base_hook& operator=(const any_base_hook& ); @@ -122,17 +122,17 @@ class any_base_hook //! Effects: If link_mode is \c normal_link, the destructor does //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a container an assertion is raised. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~any_base_hook(); //! Precondition: link_mode must be \c safe_link. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c container::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; #endif }; @@ -148,7 +148,7 @@ struct make_any_member_hook { /// @cond typedef typename pack_options - < hook_defaults, + < hook_defaults, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) O1, O2, O3 #else @@ -168,10 +168,10 @@ struct make_any_member_hook //! Store this hook in a class to be inserted //! in an intrusive container. -//! +//! //! The hook admits the following options: \c void_pointer<> and //! \c link_mode<>. -//! +//! //! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link). //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -194,27 +194,27 @@ class any_member_hook public: //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. any_member_hook(); //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_member_hook(const any_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_member_hook& operator=(const any_member_hook& ); @@ -222,17 +222,17 @@ class any_member_hook //! Effects: If link_mode is \c normal_link, the destructor does //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a container an assertion is raised. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~any_member_hook(); //! Precondition: link_mode must be \c safe_link. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c container::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; #endif }; @@ -336,8 +336,8 @@ struct any_to_unordered_set_hook {}; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avl_set.hpp b/project/jni/boost/include/boost/intrusive/avl_set.hpp index 92baf473c..9e17aa7e4 100644 --- a/project/jni/boost/include/boost/intrusive/avl_set.hpp +++ b/project/jni/boost/include/boost/intrusive/avl_set.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -22,9 +22,9 @@ namespace boost { namespace intrusive { -//! The class template avl_set is an intrusive container, that mimics most of +//! The class template avl_set is an intrusive container, that mimics most of //! the interface of std::set as described in the C++ standard. -//! +//! //! The template parameter \c T is the type to be managed by the container. //! The user can specify additional options and if no options are provided //! default options are used. @@ -79,30 +79,30 @@ class avl_set_impl /// @endcond public: - //! Effects: Constructs an empty avl_set. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty avl_set. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor of the value_compare object throws. - avl_set_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + //! or the copy constructor of the value_compare object throws. + explicit avl_set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : tree_(cmp, v_traits) {} - //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. //! cmp must be a comparison function that induces a strict weak ordering. - //! - //! Effects: Constructs an empty avl_set and inserts elements from + //! + //! Effects: Constructs an empty avl_set and inserts elements from //! [b, e). - //! - //! Complexity: Linear in N if [b, e) is already sorted using + //! + //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is std::distance(last, first). - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. + //! or the copy constructor/operator() of the value_compare object throws. template avl_set_impl( Iterator b, Iterator e , const value_compare &cmp = value_compare() @@ -111,135 +111,135 @@ class avl_set_impl {} //! Effects: to-do - //! - avl_set_impl(BOOST_RV_REF(avl_set_impl) x) + //! + avl_set_impl(BOOST_RV_REF(avl_set_impl) x) : tree_(::boost::move(x.tree_)) {} //! Effects: to-do - //! - avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x) + //! + avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x) { tree_ = ::boost::move(x.tree_); return *this; } - //! Effects: Detaches all elements from this. The objects in the avl_set + //! Effects: Detaches all elements from this. The objects in the avl_set //! are not deleted (i.e. no destructors are called). - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - ~avl_set_impl() + ~avl_set_impl() {} //! Effects: Returns an iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return tree_.cbegin(); } //! Effects: Returns an iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return tree_.cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return tree_.crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return tree_.crend(); } //! Precondition: end_iterator must be a valid end iterator //! of avl_set. - //! + //! //! Effects: Returns a const reference to the avl_set associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avl_set_impl &container_from_end_iterator(iterator end_iterator) { @@ -250,11 +250,11 @@ class avl_set_impl //! Precondition: end_iterator must be a valid end const_iterator //! of avl_set. - //! + //! //! Effects: Returns a const reference to the set associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator) { @@ -264,11 +264,11 @@ class avl_set_impl } //! Precondition: it must be a valid iterator of set. - //! + //! //! Effects: Returns a reference to the set associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avl_set_impl &container_from_iterator(iterator it) { @@ -278,11 +278,11 @@ class avl_set_impl } //! Precondition: it must be a valid const_iterator of set. - //! + //! //! Effects: Returns a const reference to the set associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avl_set_impl &container_from_iterator(const_iterator it) { @@ -292,42 +292,42 @@ class avl_set_impl } //! Effects: Returns the key_compare object used by the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If key_compare copy-constructor throws. key_compare key_comp() const { return tree_.value_comp(); } //! Effects: Returns the value_compare object used by the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return tree_.value_comp(); } //! Effects: Returns true is the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return tree_.empty(); } //! Effects: Returns the number of elements stored in the avl_set. - //! + //! //! Complexity: Linear to elements contained in *this if, //! constant-time size option is enabled. Constant-time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { return tree_.size(); } //! Effects: Swaps the contents of two sets. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the swap() call for the comparison functor //! found using ADL throws. Strong guarantee. void swap(avl_set_impl& other) @@ -337,22 +337,22 @@ class avl_set_impl //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer) { tree_.clone_from(src.tree_, cloner, disposer); } //! Requires: value must be an lvalue - //! + //! //! Effects: Treaps to inserts value into the avl_set. //! //! Returns: If the value @@ -360,39 +360,39 @@ class avl_set_impl //! iterator to the new value and true. If there is an equivalent value //! returns a pair containing an iterator to the already present value //! and false. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. std::pair insert(reference value) { return tree_.insert_unique(value); } //! Requires: value must be an lvalue - //! - //! Effects: Treaps to to insert x into the avl_set, using "hint" + //! + //! Effects: Treaps to to insert x into the avl_set, using "hint" //! as a hint to where it will be inserted. //! - //! Returns: An iterator that points to the position where the + //! Returns: An iterator that points to the position where the //! new element was inserted into the avl_set. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(const_iterator hint, reference value) { return tree_.insert_unique(hint, value); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the avl_set, using //! a user provided key instead of the value itself. //! @@ -401,16 +401,16 @@ class avl_set_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! node that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that + //! than the value_type and this function offers the possibility to use that //! part to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use @@ -424,12 +424,12 @@ class avl_set_impl (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) { return tree_.insert_unique_check(key, key_value_comp, commit_data); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the avl_set, using - //! a user provided key instead of the value itself, using "hint" + //! a user provided key instead of the value itself, using "hint" //! as a hint to where it will be inserted. //! //! Returns: If there is an equivalent value @@ -437,23 +437,23 @@ class avl_set_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! constructing that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that key + //! than the value_type and this function offers the possibility to use that key //! to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use //! "insert_commit" to insert the object in constant-time. This can give a total //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). - //! + //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the avl_set. template @@ -466,33 +466,33 @@ class avl_set_impl //! must have been obtained from a previous call to "insert_check". //! No objects should have been inserted or erased from the avl_set between //! the "insert_check" that filled "commit_data" and the call to "insert_commit". - //! + //! //! Effects: Inserts the value in the avl_set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Returns: An iterator to the newly inserted object. - //! + //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. iterator insert_commit(reference value, const insert_commit_data &commit_data) { return tree_.insert_unique_commit(value, commit_data); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a range into the avl_set. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template @@ -505,11 +505,11 @@ class avl_set_impl //! inserted key according to the predicate. //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" or "value" is not unique tree ordering and uniqueness //! invariants will be broken respectively. @@ -522,11 +522,11 @@ class avl_set_impl //! any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than or equal to the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -539,11 +539,11 @@ class avl_set_impl //! than any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than or equal to the the mimum inserted key tree ordering or uniqueness //! invariants will be broken. @@ -553,41 +553,41 @@ class avl_set_impl void push_front(reference value) { tree_.push_front(value); } - //! Effects: Erases the element pointed to by pos. - //! + //! Effects: Erases the element pointed to by pos. + //! //! Complexity: Average complexity is constant time. - //! + //! //! Returns: An iterator to the element after the erased element. //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) { return tree_.erase(i); } - //! Effects: Erases the range pointed to by b end e. - //! - //! Complexity: Average complexity for erase range is at most + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Returns: An iterator to the element after the erased elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { return tree_.erase(b, e); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size()) + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -595,13 +595,13 @@ class avl_set_impl //! Effects: Erases all the elements that compare equal with //! the given key and the given comparison functor. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If the comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -614,16 +614,16 @@ class avl_set_impl //! Requires: Disposer::operator()(pointer) shouldn't throw. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Returns: An iterator to the element after the erased element. - //! + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -639,14 +639,14 @@ class avl_set_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Returns: An iterator to the element after the erased elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -657,13 +657,13 @@ class avl_set_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: If the internal value_compare ordering function throws. - //! + //! //! Complexity: O(log(size() + this->count(value)). Basic guarantee. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -677,11 +677,11 @@ class avl_set_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -693,26 +693,26 @@ class avl_set_impl { return tree_.erase_and_dispose(key, comp, disposer); } //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() { return tree_.clear(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. - //! + //! //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -720,20 +720,20 @@ class avl_set_impl { return tree_.clear_and_dispose(disposer); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If the internal value_compare ordering function throws. size_type count(const_reference value) const { return tree_.find(value) != end(); } //! Effects: Returns the number of contained elements with the same key //! compared with the given comparison functor. - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If comp ordering function throws. template size_type count(const KeyType& key, KeyValueCompare comp) const @@ -741,9 +741,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator lower_bound(const_reference value) { return tree_.lower_bound(value); } @@ -753,13 +753,13 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -769,9 +769,9 @@ class avl_set_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator lower_bound(const_reference value) const { return tree_.lower_bound(value); } @@ -781,13 +781,13 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -797,9 +797,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator upper_bound(const_reference value) { return tree_.upper_bound(value); } @@ -809,11 +809,11 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -825,9 +825,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator upper_bound(const_reference value) const { return tree_.upper_bound(value); } @@ -837,11 +837,11 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -851,11 +851,11 @@ class avl_set_impl const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const { return tree_.upper_bound(key, comp); } - //! Effects: Finds an iterator to the first element whose value is + //! Effects: Finds an iterator to the first element whose value is //! "value" or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator find(const_reference value) { return tree_.find(value); } @@ -864,12 +864,12 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds an iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -879,11 +879,11 @@ class avl_set_impl iterator find(const KeyType& key, KeyValueCompare comp) { return tree_.find(key, comp); } - //! Effects: Finds a const_iterator to the first element whose value is + //! Effects: Finds a const_iterator to the first element whose value is //! "value" or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator find(const_reference value) const { return tree_.find(value); } @@ -892,12 +892,12 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a const_iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -910,9 +910,9 @@ class avl_set_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) { return tree_.equal_range(value); } @@ -921,13 +921,13 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -940,9 +940,9 @@ class avl_set_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) const @@ -952,13 +952,13 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -969,16 +969,101 @@ class avl_set_impl equal_range(const KeyType& key, KeyValueCompare comp) const { return tree_.equal_range(key, comp); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair + bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair + bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -986,14 +1071,14 @@ class avl_set_impl //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static const_iterator s_iterator_to(const_reference value) @@ -1001,48 +1086,48 @@ class avl_set_impl //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return tree_.iterator_to(value); } //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return tree_.iterator_to(value); } //! Requires: value shall not be in a avl_set/avl_multiset. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) { tree_type::init_node(value); } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -1052,14 +1137,14 @@ class avl_set_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -1233,9 +1318,9 @@ class avl_set #endif -//! The class template avl_multiset is an intrusive container, that mimics most of +//! The class template avl_multiset is an intrusive container, that mimics most of //! the interface of std::avl_multiset as described in the C++ standard. -//! +//! //! The template parameter \c T is the type to be managed by the container. //! The user can specify additional options and if no options are provided //! default options are used. @@ -1289,30 +1374,30 @@ class avl_multiset_impl /// @endcond public: - //! Effects: Constructs an empty avl_multiset. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty avl_multiset. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. - avl_multiset_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + //! or the copy constructor/operator() of the value_compare object throws. + explicit avl_multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : tree_(cmp, v_traits) {} - //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. //! cmp must be a comparison function that induces a strict weak ordering. - //! - //! Effects: Constructs an empty avl_multiset and inserts elements from + //! + //! Effects: Constructs an empty avl_multiset and inserts elements from //! [b, e). - //! + //! //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is the distance between first and last - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. + //! or the copy constructor/operator() of the value_compare object throws. template avl_multiset_impl( Iterator b, Iterator e , const value_compare &cmp = value_compare() @@ -1321,135 +1406,135 @@ class avl_multiset_impl {} //! Effects: to-do - //! - avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x) + //! + avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x) : tree_(::boost::move(x.tree_)) {} //! Effects: to-do - //! - avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x) + //! + avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x) { tree_ = ::boost::move(x.tree_); return *this; } - //! Effects: Detaches all elements from this. The objects in the avl_multiset + //! Effects: Detaches all elements from this. The objects in the avl_multiset //! are not deleted (i.e. no destructors are called). - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - ~avl_multiset_impl() + ~avl_multiset_impl() {} //! Effects: Returns an iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return tree_.cbegin(); } //! Effects: Returns an iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return tree_.cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return tree_.crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return tree_.crend(); } //! Precondition: end_iterator must be a valid end iterator //! of avl_multiset. - //! + //! //! Effects: Returns a const reference to the avl_multiset associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avl_multiset_impl &container_from_end_iterator(iterator end_iterator) { @@ -1460,11 +1545,11 @@ class avl_multiset_impl //! Precondition: end_iterator must be a valid end const_iterator //! of avl_multiset. - //! + //! //! Effects: Returns a const reference to the avl_multiset associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator) { @@ -1474,11 +1559,11 @@ class avl_multiset_impl } //! Precondition: it must be a valid iterator of multiset. - //! + //! //! Effects: Returns a const reference to the multiset associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avl_multiset_impl &container_from_iterator(iterator it) { @@ -1488,11 +1573,11 @@ class avl_multiset_impl } //! Precondition: it must be a valid const_iterator of multiset. - //! + //! //! Effects: Returns a const reference to the multiset associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avl_multiset_impl &container_from_iterator(const_iterator it) { @@ -1502,42 +1587,42 @@ class avl_multiset_impl } //! Effects: Returns the key_compare object used by the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If key_compare copy-constructor throws. key_compare key_comp() const { return tree_.value_comp(); } //! Effects: Returns the value_compare object used by the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return tree_.value_comp(); } //! Effects: Returns true is the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return tree_.empty(); } //! Effects: Returns the number of elements stored in the avl_multiset. - //! + //! //! Complexity: Linear to elements contained in *this if, //! constant-time size option is enabled. Constant-time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { return tree_.size(); } //! Effects: Swaps the contents of two avl_multisets. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the swap() call for the comparison functor //! found using ADL throws. Strong guarantee. void swap(avl_multiset_impl& other) @@ -1547,69 +1632,69 @@ class avl_multiset_impl //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer) { tree_.clone_from(src.tree_, cloner, disposer); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the avl_multiset. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(reference value) { return tree_.insert_equal(value); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts x into the avl_multiset, using pos as a hint to //! where it will be inserted. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(const_iterator hint, reference value) { return tree_.insert_equal(hint, value); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a range into the avl_multiset. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template @@ -1622,11 +1707,11 @@ class avl_multiset_impl //! inserted key according to the predicate. //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" or "value" is not unique tree ordering and uniqueness //! invariants will be broken respectively. @@ -1639,11 +1724,11 @@ class avl_multiset_impl //! any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than or equal to the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -1656,11 +1741,11 @@ class avl_multiset_impl //! than any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than or equal to the the mimum inserted key tree ordering or uniqueness //! invariants will be broken. @@ -1670,41 +1755,41 @@ class avl_multiset_impl void push_front(reference value) { tree_.push_front(value); } - //! Effects: Erases the element pointed to by pos. - //! + //! Effects: Erases the element pointed to by pos. + //! //! Complexity: Average complexity is constant time. - //! + //! //! Returns: An iterator to the element after the erased element. //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) { return tree_.erase(i); } - //! Effects: Erases the range pointed to by b end e. + //! Effects: Erases the range pointed to by b end e. //! //! Returns: An iterator to the element after the erased elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { return tree_.erase(b, e); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -1712,13 +1797,13 @@ class avl_multiset_impl //! Effects: Erases all the elements that compare equal with //! the given key and the given comparison functor. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1733,14 +1818,14 @@ class avl_multiset_impl //! //! Returns: An iterator to the element after the erased element. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -1758,12 +1843,12 @@ class avl_multiset_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -1774,13 +1859,13 @@ class avl_multiset_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1794,11 +1879,11 @@ class avl_multiset_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -1810,26 +1895,26 @@ class avl_multiset_impl { return tree_.erase_and_dispose(key, comp, disposer); } //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() { return tree_.clear(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. - //! + //! //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1837,20 +1922,20 @@ class avl_multiset_impl { return tree_.clear_and_dispose(disposer); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If the internal value_compare ordering function throws. size_type count(const_reference value) const { return tree_.count(value); } //! Effects: Returns the number of contained elements with the same key //! compared with the given comparison functor. - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If comp ordering function throws. template size_type count(const KeyType& key, KeyValueCompare comp) const @@ -1858,9 +1943,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator lower_bound(const_reference value) { return tree_.lower_bound(value); } @@ -1870,13 +1955,13 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -1886,9 +1971,9 @@ class avl_multiset_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator lower_bound(const_reference value) const { return tree_.lower_bound(value); } @@ -1898,13 +1983,13 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -1914,9 +1999,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator upper_bound(const_reference value) { return tree_.upper_bound(value); } @@ -1926,11 +2011,11 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1942,9 +2027,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator upper_bound(const_reference value) const { return tree_.upper_bound(value); } @@ -1954,11 +2039,11 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1968,11 +2053,11 @@ class avl_multiset_impl const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const { return tree_.upper_bound(key, comp); } - //! Effects: Finds an iterator to the first element whose value is + //! Effects: Finds an iterator to the first element whose value is //! "value" or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator find(const_reference value) { return tree_.find(value); } @@ -1981,12 +2066,12 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds an iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1996,11 +2081,11 @@ class avl_multiset_impl iterator find(const KeyType& key, KeyValueCompare comp) { return tree_.find(key, comp); } - //! Effects: Finds a const_iterator to the first element whose value is + //! Effects: Finds a const_iterator to the first element whose value is //! "value" or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator find(const_reference value) const { return tree_.find(value); } @@ -2009,12 +2094,12 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a const_iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2027,9 +2112,9 @@ class avl_multiset_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) { return tree_.equal_range(value); } @@ -2038,13 +2123,13 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2057,9 +2142,9 @@ class avl_multiset_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) const @@ -2069,13 +2154,13 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2086,16 +2171,101 @@ class avl_multiset_impl equal_range(const KeyType& key, KeyValueCompare comp) const { return tree_.equal_range(key, comp); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair + bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair + bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_multiset //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -2103,14 +2273,14 @@ class avl_multiset_impl //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_multiset that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static const_iterator s_iterator_to(const_reference value) @@ -2118,48 +2288,48 @@ class avl_multiset_impl //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_multiset //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return tree_.iterator_to(value); } //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_multiset that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return tree_.iterator_to(value); } //! Requires: value shall not be in a avl_multiset/avl_multiset. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) { tree_type::init_node(value); } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -2169,14 +2339,14 @@ class avl_multiset_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -2290,7 +2460,7 @@ template template #endif class avl_multiset - : public make_avl_multiset diff --git a/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp b/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp index 23b1f0bd8..825921f50 100644 --- a/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -61,16 +61,16 @@ struct make_avl_set_base_hook typedef implementation_defined type; }; -//! Derive a class from avl_set_base_hook in order to store objects in -//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain +//! Derive a class from avl_set_base_hook in order to store objects in +//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain //! the avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<>, //! \c link_mode<> and \c optimize_size<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its //! unique tag. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -99,27 +99,27 @@ class avl_set_base_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. avl_set_base_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_base_hook(const avl_set_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_base_hook& operator=(const avl_set_base_hook& ); @@ -128,37 +128,37 @@ class avl_set_base_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~avl_set_base_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(avl_set_base_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; @@ -195,7 +195,7 @@ struct make_avl_set_member_hook //! Put a public data member avl_set_member_hook in order to store objects of this class in //! an avl_set/avl_multiset. avl_set_member_hook holds the data necessary for maintaining the //! avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. -//! +//! //! The hook admits the following options: \c void_pointer<>, //! \c link_mode<> and \c optimize_size<>. //! @@ -225,27 +225,27 @@ class avl_set_member_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. avl_set_member_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_member_hook(const avl_set_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_member_hook& operator=(const avl_set_member_hook& ); @@ -254,43 +254,43 @@ class avl_set_member_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~avl_set_member_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(avl_set_member_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avltree.hpp b/project/jni/boost/include/boost/intrusive/avltree.hpp index 20903ddef..b6311c403 100644 --- a/project/jni/boost/include/boost/intrusive/avltree.hpp +++ b/project/jni/boost/include/boost/intrusive/avltree.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -65,7 +65,7 @@ struct avl_set_defaults //! The class template avltree is an intrusive AVL tree container, that //! is used to construct intrusive avl_set and avl_multiset containers. -//! The no-throw guarantee holds only, if the value_compare object +//! The no-throw guarantee holds only, if the value_compare object //! doesn't throw. //! //! The template parameter \c T is the type to be managed by the container. @@ -89,7 +89,7 @@ class avltree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits @@ -134,7 +134,7 @@ class avltree_impl //noncopyable, movable BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl) - enum { safemode_or_autounlink = + enum { safemode_or_autounlink = (int)real_value_traits::link_mode == (int)auto_unlink || (int)real_value_traits::link_mode == (int)safe_link }; @@ -160,7 +160,7 @@ class avltree_impl {} node_plus_pred_t node_plus_pred_; } data_; - + const value_compare &priv_comp() const { return data_.node_plus_pred_.get(); } @@ -212,18 +212,18 @@ class avltree_impl typedef typename node_algorithms::insert_commit_data insert_commit_data; - //! Effects: Constructs an empty tree. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) //! or the copy constructor of the value_compare object throws. Basic guarantee. - avltree_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + explicit avltree_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : data_(cmp, v_traits) - { - node_algorithms::init_header(this->priv_header_ptr()); + { + node_algorithms::init_header(this->priv_header_ptr()); this->priv_size_traits().set_size(size_type(0)); } @@ -235,7 +235,7 @@ class avltree_impl //! //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is the distance between first and last. - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) //! or the copy constructor/operator() of the value_compare object throws. Basic guarantee. @@ -254,58 +254,58 @@ class avltree_impl } //! Effects: to-do - //! + //! avltree_impl(BOOST_RV_REF(avltree_impl) x) : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits())) { - node_algorithms::init_header(this->priv_header_ptr()); + node_algorithms::init_header(this->priv_header_ptr()); this->priv_size_traits().set_size(size_type(0)); this->swap(x); } //! Effects: to-do - //! - avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) + //! + avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) { this->swap(x); return *this; } - //! Effects: Detaches all elements from this. The objects in the set - //! are not deleted (i.e. no destructors are called), but the nodes according to - //! the value_traits template parameter are reinitialized and thus can be reused. - //! + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! //! Complexity: Linear to elements contained in *this. - //! + //! //! Throws: Nothing. - ~avltree_impl() + ~avltree_impl() {} //! Effects: Returns an iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return iterator (node_traits::get_left(this->priv_header_ptr()), this); } //! Effects: Returns a const_iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return cbegin(); } //! Effects: Returns a const_iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); } //! Effects: Returns an iterator pointing to the end of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return iterator (this->priv_header_ptr(), this); } @@ -313,138 +313,138 @@ class avltree_impl //! Effects: Returns a const_iterator pointing to the end of the tree. //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return cend(); } //! Effects: Returns a const_iterator pointing to the end of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return const_iterator (uncast(this->priv_header_ptr()), this); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return reverse_iterator(end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return reverse_iterator(begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } //! Precondition: end_iterator must be a valid end iterator //! of avltree. - //! + //! //! Effects: Returns a const reference to the avltree associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avltree_impl &container_from_end_iterator(iterator end_iterator) { return priv_container_from_end_iterator(end_iterator); } //! Precondition: end_iterator must be a valid end const_iterator //! of avltree. - //! + //! //! Effects: Returns a const reference to the avltree associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avltree_impl &container_from_end_iterator(const_iterator end_iterator) { return priv_container_from_end_iterator(end_iterator); } //! Precondition: it must be a valid iterator //! of rbtree. - //! + //! //! Effects: Returns a const reference to the tree associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avltree_impl &container_from_iterator(iterator it) { return priv_container_from_iterator(it); } //! Precondition: it must be a valid end const_iterator //! of rbtree. - //! + //! //! Effects: Returns a const reference to the tree associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avltree_impl &container_from_iterator(const_iterator it) { return priv_container_from_iterator(it); } //! Effects: Returns the value_compare object used by the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return priv_comp(); } //! Effects: Returns true if the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return node_algorithms::unique(this->priv_header_ptr()); } //! Effects: Returns the number of elements stored in the tree. - //! + //! //! Complexity: Linear to elements contained in *this //! if constant-time size option is disabled. Constant time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { @@ -456,9 +456,9 @@ class avltree_impl } //! Effects: Swaps the contents of two avltrees. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the comparison functor's swap call throws. void swap(avltree_impl& other) { @@ -475,14 +475,14 @@ class avltree_impl } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the tree before the upper bound. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_equal(reference value) @@ -500,16 +500,16 @@ class avltree_impl //! Requires: value must be an lvalue, and "hint" must be //! a valid iterator. - //! + //! //! Effects: Inserts x into the tree, using "hint" as a hint to //! where it will be inserted. If "hint" is the upper_bound //! the insertion takes constant time (two comparisons in the worst case) - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_equal(const_iterator hint, reference value) @@ -525,38 +525,38 @@ class avltree_impl return ret; } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a each element of a range into the tree //! before the upper bound of the key of each element. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template void insert_equal(Iterator b, Iterator e) { - iterator end(this->end()); + iterator iend(this->end()); for (; b != e; ++b) - this->insert_equal(end, *b); + this->insert_equal(iend, *b); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the tree if the value //! is not already present. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. std::pair insert_unique(reference value) @@ -570,16 +570,16 @@ class avltree_impl //! Requires: value must be an lvalue, and "hint" must be //! a valid iterator - //! + //! //! Effects: Tries to insert x into the tree, using "hint" as a hint //! to where it will be inserted. - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time (two comparisons in the worst case) //! if t is inserted immediately before hint. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_unique(const_iterator hint, reference value) @@ -591,26 +591,26 @@ class avltree_impl return insert_unique_commit(value, commit_data); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Tries to insert each element of a range into the tree. - //! - //! Complexity: Insert range is in general O(N * log(N)), where N is the - //! size of the range. However, it is linear in N if the range is already sorted + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template void insert_unique(Iterator b, Iterator e) { if(this->empty()){ - iterator end(this->end()); + iterator iend(this->end()); for (; b != e; ++b) - this->insert_unique(end, *b); + this->insert_unique(iend, *b); } else{ for (; b != e; ++b) @@ -618,10 +618,10 @@ class avltree_impl } } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the container, using //! a user provided key instead of the value itself. //! @@ -630,16 +630,16 @@ class avltree_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! node that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that + //! than the value_type and this function offers the possibility to use that //! part to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use @@ -654,18 +654,18 @@ class avltree_impl { detail::key_nodeptr_comp comp(key_value_comp, this); - std::pair ret = + std::pair ret = (node_algorithms::insert_unique_check (this->priv_header_ptr(), key, comp, commit_data)); return std::pair(iterator(ret.first, this), ret.second); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the container, using - //! a user provided key instead of the value itself, using "hint" + //! a user provided key instead of the value itself, using "hint" //! as a hint to where it will be inserted. //! //! Returns: If there is an equivalent value @@ -673,23 +673,23 @@ class avltree_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! constructing that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that key + //! than the value_type and this function offers the possibility to use that key //! to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use //! "insert_commit" to insert the object in constant-time. This can give a total //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). - //! + //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. template @@ -699,7 +699,7 @@ class avltree_impl { detail::key_nodeptr_comp comp(key_value_comp, this); - std::pair ret = + std::pair ret = (node_algorithms::insert_unique_check (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data)); return std::pair(iterator(ret.first, this), ret.second); @@ -709,16 +709,16 @@ class avltree_impl //! must have been obtained from a previous call to "insert_check". //! No objects should have been inserted or erased from the container between //! the "insert_check" that filled "commit_data" and the call to "insert_commit". - //! + //! //! Effects: Inserts the value in the avl_set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Returns: An iterator to the newly inserted object. - //! + //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. @@ -738,11 +738,11 @@ class avltree_impl //! once inserted according to the predicate //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" tree ordering invariant will be broken. //! This is a low-level function to be used only for performance reasons @@ -762,11 +762,11 @@ class avltree_impl //! than the greatest inserted key //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -785,11 +785,11 @@ class avltree_impl //! than the minimum inserted key //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than the minimum inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -804,12 +804,12 @@ class avltree_impl this->priv_size_traits().increment(); } - //! Effects: Erases the element pointed to by pos. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) @@ -826,26 +826,26 @@ class avltree_impl return ret.unconst(); } - //! Effects: Erases the range pointed to by b end e. - //! - //! Complexity: Average complexity for erase range is at most + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { size_type n; return private_erase(b, e, n); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -855,11 +855,11 @@ class avltree_impl //! according to the comparison functor "comp". //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -877,14 +877,14 @@ class avltree_impl //! Requires: Disposer::operator()(pointer) shouldn't throw. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -905,12 +905,12 @@ class avltree_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -921,13 +921,13 @@ class avltree_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -946,11 +946,11 @@ class avltree_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -966,13 +966,13 @@ class avltree_impl return n; } - //! Effects: Erases all of the elements. - //! + //! Effects: Erases all of the elements. + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() @@ -990,9 +990,9 @@ class avltree_impl //! each node to be erased. //! Complexity: Average complexity for is at most O(log(size() + N)), //! where N is the number of elements in the container. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. Calls N times to disposer functor. template @@ -1005,19 +1005,19 @@ class avltree_impl } //! Effects: Returns the number of contained elements with the given value - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given value. - //! + //! //! Throws: Nothing. size_type count(const_reference value) const { return this->count(value, priv_comp()); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: Nothing. template size_type count(const KeyType &key, KeyValueCompare comp) const @@ -1028,27 +1028,27 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator lower_bound(const_reference value) { return this->lower_bound(value, priv_comp()); } //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator lower_bound(const_reference value) const { return this->lower_bound(value, priv_comp()); } //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator lower_bound(const KeyType &key, KeyValueCompare comp) @@ -1061,9 +1061,9 @@ class avltree_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const @@ -1076,9 +1076,9 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator upper_bound(const_reference value) { return this->upper_bound(value, priv_comp()); } @@ -1088,7 +1088,7 @@ class avltree_impl //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator upper_bound(const KeyType &key, KeyValueCompare comp) @@ -1101,9 +1101,9 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator upper_bound(const_reference value) const { return this->upper_bound(value, priv_comp()); } @@ -1113,7 +1113,7 @@ class avltree_impl //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const @@ -1124,20 +1124,20 @@ class avltree_impl (this->priv_header_ptr(), key, key_node_comp), this); } - //! Effects: Finds an iterator to the first element whose key is + //! Effects: Finds an iterator to the first element whose key is //! k or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator find(const_reference value) { return this->find(value, priv_comp()); } - //! Effects: Finds an iterator to the first element whose key is + //! Effects: Finds an iterator to the first element whose key is //! k or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator find(const KeyType &key, KeyValueCompare comp) @@ -1148,20 +1148,20 @@ class avltree_impl (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this); } - //! Effects: Finds a const_iterator to the first element whose key is + //! Effects: Finds a const_iterator to the first element whose key is //! k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator find(const_reference value) const { return this->find(value, priv_comp()); } - //! Effects: Finds a const_iterator to the first element whose key is + //! Effects: Finds a const_iterator to the first element whose key is //! k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator find(const KeyType &key, KeyValueCompare comp) const @@ -1175,9 +1175,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. std::pair equal_range(const_reference value) { return this->equal_range(value, priv_comp()); } @@ -1185,9 +1185,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template std::pair equal_range(const KeyType &key, KeyValueCompare comp) @@ -1202,9 +1202,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. std::pair equal_range(const_reference value) const @@ -1213,9 +1213,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template std::pair @@ -1228,19 +1228,117 @@ class avltree_impl return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::bounded_range + (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::bounded_range + (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + //! Requires: Disposer::operator()(pointer) shouldn't throw. //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer) @@ -1261,11 +1359,11 @@ class avltree_impl } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -1284,14 +1382,14 @@ class avltree_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -1307,14 +1405,14 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -1325,17 +1423,17 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. - static const_iterator s_iterator_to(const_reference value) + static const_iterator s_iterator_to(const_reference value) { BOOST_STATIC_ASSERT((!stateful_value_traits)); return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); @@ -1343,37 +1441,37 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return iterator (value_traits::to_node_ptr(value), this); } //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } //! Requires: value shall not be in a tree. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) @@ -1381,12 +1479,12 @@ class avltree_impl /* //! Effects: removes x from a tree of the appropriate type. It has no effect, - //! if x is not in such a tree. - //! + //! if x is not in such a tree. + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This static function is only usable with the "safe mode" //! hook and non-constant time size lists. Otherwise, the user must use //! the non-static "erase(reference )" member. If the user calls @@ -1396,7 +1494,7 @@ class avltree_impl static void remove_node(T& value) { //This function is only usable for safe mode hooks and non-constant - //time lists. + //time lists. //BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size))); BOOST_STATIC_ASSERT((!constant_time_size)); BOOST_STATIC_ASSERT((boost::is_convertible::value)); @@ -1680,8 +1778,8 @@ class avltree #endif -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp b/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp index 9b917c767..11463c71f 100644 --- a/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Daniel K. O. 2005. -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -45,25 +45,25 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_parent(const_node_ptr n); -//! +//! //! static void set_parent(node_ptr n, node_ptr parent); //! //! static node_ptr get_left(const_node_ptr n); -//! +//! //! static void set_left(node_ptr n, node_ptr left); //! //! static node_ptr get_right(const_node_ptr n); -//! +//! //! static void set_right(node_ptr n, node_ptr right); -//! +//! //! static balance get_balance(const_node_ptr n); -//! +//! //! static void set_balance(node_ptr n, balance b); -//! +//! //! static balance negative(); -//! +//! //! static balance zero(); -//! +//! //! static balance positive(); template class avltree_algorithms @@ -88,7 +88,7 @@ class avltree_algorithms avltree_node_cloner(F f) : base_t(f) {} - + node_ptr operator()(const node_ptr &p) { node_ptr n = base_t::get()(p); @@ -120,27 +120,27 @@ class avltree_algorithms //! Requires: header1 and header2 must be the header nodes //! of two trees. - //! - //! Effects: Swaps two trees. After the function header1 will contain + //! + //! Effects: Swaps two trees. After the function header1 will contain //! links to the second tree and header2 will have links to the first tree. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. static void swap_tree(const node_ptr & header1, const node_ptr & header2) { return tree_algorithms::swap_tree(header1, header2); } //! Requires: node1 and node2 can't be header nodes //! of two trees. - //! + //! //! Effects: Swaps two nodes. After the function node1 will be inserted //! in the position node2 before the function. node2 will be inserted in the //! position node1 had before the function. - //! - //! Complexity: Logarithmic. - //! + //! + //! Complexity: Logarithmic. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! node1 and node2 are not equivalent according to the ordering rules. //! @@ -149,22 +149,22 @@ class avltree_algorithms { if(node1 == node2) return; - + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); swap_nodes(node1, header1, node2, header2); } //! Requires: node1 and node2 can't be header nodes //! of two trees with header header1 and header2. - //! + //! //! Effects: Swaps two nodes. After the function node1 will be inserted //! in the position node2 before the function. node2 will be inserted in the //! position node1 had before the function. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! node1 and node2 are not equivalent according to the ordering rules. //! @@ -176,20 +176,20 @@ class avltree_algorithms tree_algorithms::swap_nodes(node1, header1, node2, header2); //Swap balance balance c = NodeTraits::get_balance(node1); - NodeTraits::set_balance(node1, NodeTraits::get_balance(node2)); - NodeTraits::set_balance(node2, c); + NodeTraits::set_balance(node1, NodeTraits::get_balance(node2)); + NodeTraits::set_balance(node2, c); } //! Requires: node_to_be_replaced must be inserted in a tree //! and new_node must not be inserted in a tree. - //! + //! //! Effects: Replaces node_to_be_replaced in its position in the //! tree with new_node. The tree does not need to be rebalanced - //! - //! Complexity: Logarithmic. - //! + //! + //! Complexity: Logarithmic. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting @@ -205,14 +205,14 @@ class avltree_algorithms //! Requires: node_to_be_replaced must be inserted in a tree //! with header "header" and new_node must not be inserted in a tree. - //! + //! //! Effects: Replaces node_to_be_replaced in its position in the //! tree with new_node. The tree does not need to be rebalanced - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting @@ -222,15 +222,15 @@ class avltree_algorithms static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node) { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); - NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); + NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); } //! Requires: node is a tree node but not the header. - //! + //! //! Effects: Unlinks the node and rebalances the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. static void unlink(const node_ptr & node) { @@ -243,14 +243,14 @@ class avltree_algorithms } //! Requires: header is the header of a tree. - //! + //! //! Effects: Unlinks the leftmost node from the tree, and //! updates the header link to the new leftmost node. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -260,51 +260,51 @@ class avltree_algorithms //! Requires: node is a node of the tree or an node initialized //! by init(...). - //! + //! //! Effects: Returns true if the node is initialized by init(). - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. static bool unique(const const_node_ptr & node) { return tree_algorithms::unique(node); } //! Requires: node is a node of the tree but it's not the header. - //! + //! //! Effects: Returns the number of nodes of the subtree. - //! + //! //! Complexity: Linear time. - //! + //! //! Throws: Nothing. static std::size_t count(const const_node_ptr & node) { return tree_algorithms::count(node); } //! Requires: header is the header node of the tree. - //! + //! //! Effects: Returns the number of nodes above the header. - //! + //! //! Complexity: Linear time. - //! + //! //! Throws: Nothing. static std::size_t size(const const_node_ptr & header) { return tree_algorithms::size(header); } //! Requires: p is a node from the tree except the header. - //! + //! //! Effects: Returns the next node of the tree. - //! + //! //! Complexity: Average constant time. - //! + //! //! Throws: Nothing. static node_ptr next_node(const node_ptr & p) { return tree_algorithms::next_node(p); } //! Requires: p is a node from the tree except the leftmost node. - //! + //! //! Effects: Returns the previous node of the tree. - //! + //! //! Complexity: Average constant time. - //! + //! //! Throws: Nothing. static node_ptr prev_node(const node_ptr & p) { return tree_algorithms::prev_node(p); } @@ -312,9 +312,9 @@ class avltree_algorithms //! Requires: node must not be part of any tree. //! //! Effects: After the function unique(node) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. @@ -325,25 +325,25 @@ class avltree_algorithms //! //! Effects: Initializes the header to represent an empty tree. //! unique(header) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. static void init_header(const node_ptr & header) { tree_algorithms::init_header(header); - NodeTraits::set_balance(header, NodeTraits::zero()); + NodeTraits::set_balance(header, NodeTraits::zero()); } //! Requires: header must be the header of a tree, z a node //! of that tree and z != header. //! //! Effects: Erases node "z" from the tree with header "header". - //! + //! //! Complexity: Amortized constant time. - //! + //! //! Throws: Nothing. static node_ptr erase(const node_ptr & header, const node_ptr & z) { @@ -361,18 +361,18 @@ class avltree_algorithms //! object taking a node_ptr and returning a new cloned node of it. "disposer" must //! take a node_ptr and shouldn't throw. //! - //! Effects: First empties target tree calling + //! Effects: First empties target tree calling //! void disposer::operator()(const node_ptr &) for every node of the tree //! except the header. - //! + //! //! Then, duplicates the entire tree pointed by "source_header" cloning each - //! source node with node_ptr Cloner::operator()(const node_ptr &) to obtain + //! source node with node_ptr Cloner::operator()(const node_ptr &) to obtain //! the nodes of the target tree. If "cloner" throws, the cloned target nodes //! are disposed using void disposer(const node_ptr &). - //! + //! //! Complexity: Linear to the number of element of the source tree plus the. //! number of elements of tree target tree when calling this function. - //! + //! //! Throws: If cloner functor throws. If this happens target nodes are disposed. template static void clone @@ -385,13 +385,13 @@ class avltree_algorithms //! Requires: "disposer" must be an object function //! taking a node_ptr parameter and shouldn't throw. //! - //! Effects: Empties the target tree calling + //! Effects: Empties the target tree calling //! void disposer::operator()(const node_ptr &) for every node of the tree //! except the header. - //! + //! //! Complexity: Linear to the number of element of the source tree plus the. //! number of elements of tree target tree when calling this function. - //! + //! //! Throws: If cloner functor throws. If this happens target nodes are disposed. template static void clear_and_dispose(const node_ptr & header, Disposer disposer) @@ -407,7 +407,7 @@ class avltree_algorithms //! not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr lower_bound @@ -423,7 +423,7 @@ class avltree_algorithms //! than "key" according to "comp" or "header" if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr upper_bound @@ -439,7 +439,7 @@ class avltree_algorithms //! "key" according to "comp" or "header" if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr find @@ -457,13 +457,38 @@ class avltree_algorithms //! if they there are no equivalent elements. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static std::pair equal_range (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) { return tree_algorithms::equal_range(header, key, comp); } + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + static std::pair bounded_range + (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + , bool left_closed, bool right_closed) + { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: "h" must be the header node of a tree. //! NodePtrCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the @@ -471,10 +496,10 @@ class avltree_algorithms //! //! Effects: Inserts new_node into the tree before the upper bound //! according to "comp". - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal_upper_bound @@ -492,10 +517,10 @@ class avltree_algorithms //! //! Effects: Inserts new_node into the tree before the lower bound //! according to "comp". - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal_lower_bound @@ -511,14 +536,14 @@ class avltree_algorithms //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from //! the "header"'s tree. - //! + //! //! Effects: Inserts new_node into the tree, using "hint" as a hint to //! where it will be inserted. If "hint" is the upper_bound //! the insertion takes constant time (two comparisons in the worst case). //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if new_node is inserted immediately before "hint". - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal @@ -534,13 +559,13 @@ class avltree_algorithms //! "pos" must be an iterator pointing to the successor to "new_node" //! once inserted according to the order of already inserted nodes. This function does not //! check "pos" and this precondition must be guaranteed by the caller. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "pos" is not the successor of the newly inserted "new_node" //! tree invariants might be broken. static node_ptr insert_before @@ -554,13 +579,13 @@ class avltree_algorithms //! Requires: "header" must be the header node of a tree. //! "new_node" must be, according to the used ordering no less than the //! greatest inserted key. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "new_node" is less than the greatest inserted key //! tree invariants are broken. This function is slightly faster than //! using "insert_before". @@ -573,13 +598,13 @@ class avltree_algorithms //! Requires: "header" must be the header node of a tree. //! "new_node" must be, according to the used ordering, no greater than the //! lowest inserted key. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "new_node" is greater than the lowest inserted key //! tree invariants are broken. This function is slightly faster than //! using "insert_before". @@ -593,7 +618,7 @@ class avltree_algorithms //! KeyNodePtrCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares KeyType with a node_ptr. - //! + //! //! Effects: Checks if there is an equivalent node to "key" in the //! tree according to "comp" and obtains the needed information to realize //! a constant-time node insertion if there is no equivalent node. @@ -604,11 +629,11 @@ class avltree_algorithms //! in the returned pair's boolean and fills "commit_data" that is meant to //! be used with the "insert_commit" function to achieve a constant-time //! insertion function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If "comp" throws. - //! + //! //! Notes: This function is used to improve performance when constructing //! a node is expensive and the user does not want to have two equivalent nodes //! in the tree: if there is an equivalent value @@ -634,12 +659,12 @@ class avltree_algorithms //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares KeyType with a node_ptr. //! "hint" is node from the "header"'s tree. - //! + //! //! Effects: Checks if there is an equivalent node to "key" in the //! tree according to "comp" using "hint" as a hint to where it should be //! inserted and obtains the needed information to realize - //! a constant-time node insertion if there is no equivalent node. - //! If "hint" is the upper_bound the function has constant time + //! a constant-time node insertion if there is no equivalent node. + //! If "hint" is the upper_bound the function has constant time //! complexity (two comparisons in the worst case). //! //! Returns: If there is an equivalent value @@ -648,12 +673,12 @@ class avltree_algorithms //! in the returned pair's boolean and fills "commit_data" that is meant to //! be used with the "insert_commit" function to achieve a constant-time //! insertion function. - //! + //! //! Complexity: Average complexity is at most logarithmic, but it is //! amortized constant time if new_node should be inserted immediately before "hint". //! //! Throws: If "comp" throws. - //! + //! //! Notes: This function is used to improve performance when constructing //! a node is expensive and the user does not want to have two equivalent nodes //! in the tree: if there is an equivalent value @@ -678,16 +703,16 @@ class avltree_algorithms //! "commit_data" must have been obtained from a previous call to //! "insert_unique_check". No objects should have been inserted or erased //! from the set between the "insert_unique_check" that filled "commit_data" - //! and the call to "insert_commit". - //! - //! + //! and the call to "insert_commit". + //! + //! //! Effects: Inserts new_node in the set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_unique_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. @@ -703,7 +728,7 @@ class avltree_algorithms //! Effects: Returns a pointer to the header node of the tree. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. static node_ptr get_header(const node_ptr & n) { return tree_algorithms::get_header(n); } @@ -712,11 +737,11 @@ class avltree_algorithms private: //! Requires: p is a node of a tree. - //! + //! //! Effects: Returns true if p is the header of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. static bool is_header(const const_node_ptr & p) { return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); } @@ -727,7 +752,7 @@ class avltree_algorithms for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) { const balance x_parent_balance = NodeTraits::get_balance(x_parent); if(x_parent_balance == NodeTraits::zero()){ - NodeTraits::set_balance(x_parent, + NodeTraits::set_balance(x_parent, (x == NodeTraits::get_right(x_parent) ? NodeTraits::negative() : NodeTraits::positive())); break; // the height didn't change, let's stop here } @@ -935,8 +960,8 @@ class avltree_algorithms /// @endcond }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp b/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp index bf8e2de09..682426a96 100644 --- a/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -63,16 +63,16 @@ struct make_bs_set_base_hook typedef implementation_defined type; }; -//! Derive a class from bs_set_base_hook in order to store objects in -//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain +//! Derive a class from bs_set_base_hook in order to store objects in +//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain //! the bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<>, //! \c link_mode<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its //! unique tag. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -99,27 +99,27 @@ class bs_set_base_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. bs_set_base_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_base_hook(const bs_set_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_base_hook& operator=(const bs_set_base_hook& ); @@ -128,37 +128,37 @@ class bs_set_base_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~bs_set_base_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(bs_set_base_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; @@ -198,7 +198,7 @@ struct make_bs_set_member_hook //! Put a public data member bs_set_member_hook in order to store objects of this class in //! a bs_set/bs_multiset. bs_set_member_hook holds the data necessary for maintaining the //! bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. -//! +//! //! The hook admits the following options: \c void_pointer<>, \c link_mode<>. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -224,27 +224,27 @@ class bs_set_member_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. bs_set_member_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_member_hook(const bs_set_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_member_hook& operator=(const bs_set_member_hook& ); @@ -253,43 +253,43 @@ class bs_set_member_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~bs_set_member_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(bs_set_member_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp b/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp index c5de423b6..5add320c8 100644 --- a/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -40,11 +40,11 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_previous(const_node_ptr n); -//! +//! //! static void set_previous(node_ptr n, node_ptr prev); -//! +//! //! static node_ptr get_next(const_node_ptr n); -//! +//! //! static void set_next(node_ptr n, node_ptr next); template class circular_list_algorithms @@ -57,9 +57,9 @@ class circular_list_algorithms //! Effects: Constructs an non-used list element, so that //! inited(this_node) == true - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init(const node_ptr &this_node) { @@ -69,20 +69,20 @@ class circular_list_algorithms //! Effects: Returns true is "this_node" is in a non-used state //! as if it was initialized by the "init" function. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. - static bool inited(const const_node_ptr &this_node) + static bool inited(const const_node_ptr &this_node) { return !NodeTraits::get_next(this_node); } //! Effects: Constructs an empty list, making this_node the only //! node of the circular list: //! NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node) //! == this_node. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init_header(const node_ptr &this_node) { @@ -92,12 +92,12 @@ class circular_list_algorithms //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns true is "this_node" is the only node of a circular list: //! return NodeTraits::get_next(this_node) == this_node - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static bool unique(const const_node_ptr &this_node) { @@ -106,14 +106,14 @@ class circular_list_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the number of nodes in a circular list. If the circular list //! is empty, returns 1. - //! - //! Complexity: Linear - //! + //! + //! Complexity: Linear + //! //! Throws: Nothing. - static std::size_t count(const const_node_ptr &this_node) + static std::size_t count(const const_node_ptr &this_node) { std::size_t result = 0; const_node_ptr p = this_node; @@ -125,11 +125,11 @@ class circular_list_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Unlinks the node from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static node_ptr unlink(const node_ptr &this_node) { @@ -146,11 +146,11 @@ class circular_list_algorithms } //! Requires: b and e must be nodes of the same circular list or an empty range. - //! + //! //! Effects: Unlinks the node [b, e) from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void unlink(const node_ptr &b, const node_ptr &e) { @@ -162,11 +162,11 @@ class circular_list_algorithms } //! Requires: nxt_node must be a node of a circular list. - //! + //! //! Effects: Links this_node before nxt_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_before(const node_ptr &nxt_node, const node_ptr &this_node) { @@ -174,18 +174,18 @@ class circular_list_algorithms NodeTraits::set_previous(this_node, prev); NodeTraits::set_next(this_node, nxt_node); //nxt_node might be an alias for prev->next_ - //so use it before update it before NodeTraits::set_next(prev, ...) + //so use it before NodeTraits::set_next(prev, ...) //is called and the reference changes it's value NodeTraits::set_previous(nxt_node, this_node); NodeTraits::set_next(prev, this_node); } //! Requires: prev_node must be a node of a circular list. - //! + //! //! Effects: Links this_node after prev_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_after(const node_ptr &prev_node, const node_ptr &this_node) { @@ -201,13 +201,13 @@ class circular_list_algorithms //! Requires: this_node and other_node must be nodes inserted //! in circular lists or be empty circular lists. - //! + //! //! Effects: Swaps the position of the nodes: this_node is inserted in //! other_nodes position in the second circular list and the other_node is inserted //! in this_node's position in the first circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. /* static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) @@ -248,22 +248,22 @@ class circular_list_algorithms */ //Watanabe version - private: - static void swap_prev(const node_ptr &this_node, const node_ptr &other_node) - { - node_ptr temp(NodeTraits::get_previous(this_node)); - NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); - NodeTraits::set_previous(other_node, temp); - } - static void swap_next(const node_ptr &this_node, const node_ptr &other_node) - { - node_ptr temp(NodeTraits::get_next(this_node)); - NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); - NodeTraits::set_next(other_node, temp); - } + private: + static void swap_prev(const node_ptr &this_node, const node_ptr &other_node) + { + node_ptr temp(NodeTraits::get_previous(this_node)); + NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); + NodeTraits::set_previous(other_node, temp); + } + static void swap_next(const node_ptr &this_node, const node_ptr &other_node) + { + node_ptr temp(NodeTraits::get_next(this_node)); + NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); + NodeTraits::set_next(other_node, temp); + } - public: - static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) + public: + static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) { if (other_node == this_node) return; @@ -276,15 +276,15 @@ class circular_list_algorithms init_header(other_node); } - node_ptr next_this(NodeTraits::get_next(this_node)); - node_ptr prev_this(NodeTraits::get_previous(this_node)); - node_ptr next_other(NodeTraits::get_next(other_node)); - node_ptr prev_other(NodeTraits::get_previous(other_node)); - //these first two swaps must happen before the other two - swap_prev(next_this, next_other); - swap_next(prev_this, prev_other); - swap_next(this_node, other_node); - swap_prev(this_node, other_node); + node_ptr next_this(NodeTraits::get_next(this_node)); + node_ptr prev_this(NodeTraits::get_previous(this_node)); + node_ptr next_other(NodeTraits::get_next(other_node)); + node_ptr prev_other(NodeTraits::get_previous(other_node)); + //these first two swaps must happen before the other two + swap_prev(next_this, next_other); + swap_next(prev_this, prev_other); + swap_next(this_node, other_node); + swap_prev(this_node, other_node); if(this_inited){ init(other_node); @@ -295,14 +295,14 @@ class circular_list_algorithms } //! Requires: b and e must be nodes of the same circular list or an empty range. - //! and p must be a node of a different circular list or may not be an iterator in + //! and p must be a node of a different circular list or may not be an iterator in // [b, e). - //! + //! //! Effects: Removes the nodes from [b, e) range from their circular list and inserts //! them before p in p's circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e) { @@ -321,13 +321,13 @@ class circular_list_algorithms //! Requires: i must a node of a circular list //! and p must be a node of a different circular list. - //! + //! //! Effects: Removes the node i from its circular list and inserts - //! it before p in p's circular list. + //! it before p in p's circular list. //! If p == i or p == NodeTraits::get_next(i), this function is a null operation. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer(const node_ptr &p, const node_ptr &i) { @@ -345,16 +345,16 @@ class circular_list_algorithms } } - //! Effects: Reverses the order of elements in the list. - //! + //! Effects: Reverses the order of elements in the list. + //! //! Throws: Nothing. - //! + //! //! Complexity: This function is linear time. static void reverse(const node_ptr &p) { node_ptr f(NodeTraits::get_next(p)); node_ptr i(NodeTraits::get_next(f)), e(p); - + while(i != e) { node_ptr n = i; i = NodeTraits::get_next(i); @@ -364,9 +364,9 @@ class circular_list_algorithms } //! Effects: Moves the node p n positions towards the end of the list. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of moved positions. static void move_backwards(const node_ptr &p, std::size_t n) { @@ -384,9 +384,9 @@ class circular_list_algorithms } //! Effects: Moves the node p n positions towards the beginning of the list. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of moved positions. static void move_forward(const node_ptr &p, std::size_t n) { @@ -405,8 +405,8 @@ class circular_list_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp b/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp index b843590c1..fc3848e83 100644 --- a/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -42,7 +42,7 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_next(const_node_ptr n); -//! +//! //! static void set_next(node_ptr n, node_ptr next); template class circular_slist_algorithms @@ -64,37 +64,37 @@ class circular_slist_algorithms //! Effects: Constructs an non-used list element, putting the next //! pointer to null: //! NodeTraits::get_next(this_node) == node_ptr() - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init(node_ptr this_node); //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns true is "this_node" is the only node of a circular list: //! or it's a not inserted node: //! return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node - //! + //! //! Complexity: Constant - //! + //! //! Throws: Nothing. static bool unique(const_node_ptr this_node); //! Effects: Returns true is "this_node" has the same state as //! if it was inited using "init(node_ptr)" - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static bool inited(const_node_ptr this_node); //! Requires: prev_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Unlinks the next node of prev_node from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void unlink_after(node_ptr prev_node); @@ -103,28 +103,28 @@ class circular_slist_algorithms //! //! Effects: Unlinks the range (prev_node, last_node) from the circular list. //! - //! Complexity: Constant + //! Complexity: Constant //! //! Throws: Nothing. static void unlink_after(node_ptr prev_node, node_ptr last_node); //! Requires: prev_node must be a node of a circular list. - //! + //! //! Effects: Links this_node after prev_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_after(node_ptr prev_node, node_ptr this_node); //! Requires: b and e must be nodes of the same circular list or an empty range. //! and p must be a node of a different circular list. - //! + //! //! Effects: Removes the nodes from (b, e] range from their circular list and inserts //! them after p in p's circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer_after(node_ptr p, node_ptr b, node_ptr e); @@ -133,57 +133,56 @@ class circular_slist_algorithms //! Effects: Constructs an empty list, making this_node the only //! node of the circular list: //! NodeTraits::get_next(this_node) == this_node. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init_header(const node_ptr &this_node) - { NodeTraits::set_next(this_node, this_node); } + { NodeTraits::set_next(this_node, this_node); } //! Requires: this_node and prev_init_node must be in the same circular list. - //! + //! //! Effects: Returns the previous node of this_node in the circular list starting. //! the search from prev_init_node. The first node checked for equality //! is NodeTraits::get_next(prev_init_node). - //! + //! //! Complexity: Linear to the number of elements between prev_init_node and this_node. - //! + //! //! Throws: Nothing. static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node) { return base_t::get_previous_node(prev_init_node, this_node); } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the previous node of this_node in the circular list. - //! + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. static node_ptr get_previous_node(const node_ptr & this_node) { return base_t::get_previous_node(this_node, this_node); } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the previous node of the previous node of this_node in the circular list. - //! + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. static node_ptr get_previous_previous_node(const node_ptr & this_node) { return get_previous_previous_node(this_node, this_node); } - //! Requires: this_node and prev_prev_init_node must be in the same circular list. - //! + //! Requires: this_node and p must be in the same circular list. + //! //! Effects: Returns the previous node of the previous node of this_node in the - //! circular list starting. the search from prev_init_node. The first node checked - //! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)). - //! + //! circular list starting. the search from p. The first node checked + //! for equality is NodeTraits::get_next((NodeTraits::get_next(p)). + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. - static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node) + static node_ptr get_previous_previous_node(node_ptr p, const node_ptr & this_node) { - node_ptr p = prev_prev_init_node; node_ptr p_next = NodeTraits::get_next(p); node_ptr p_next_next = NodeTraits::get_next(p_next); while (this_node != p_next_next){ @@ -195,14 +194,14 @@ class circular_slist_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the number of nodes in a circular list. If the circular list //! is empty, returns 1. - //! - //! Complexity: Linear - //! + //! + //! Complexity: Linear + //! //! Throws: Nothing. - static std::size_t count(const const_node_ptr & this_node) + static std::size_t count(const const_node_ptr & this_node) { std::size_t result = 0; const_node_ptr p = this_node; @@ -214,11 +213,11 @@ class circular_slist_algorithms } //! Requires: this_node must be in a circular list, be an empty circular list or be inited. - //! + //! //! Effects: Unlinks the node from the circular list. - //! - //! Complexity: Linear to the number of elements in the circular list - //! + //! + //! Complexity: Linear to the number of elements in the circular list + //! //! Throws: Nothing. static void unlink(const node_ptr & this_node) { @@ -227,24 +226,24 @@ class circular_slist_algorithms } //! Requires: nxt_node must be a node of a circular list. - //! + //! //! Effects: Links this_node before nxt_node in the circular list. - //! - //! Complexity: Linear to the number of elements in the circular list. - //! + //! + //! Complexity: Linear to the number of elements in the circular list. + //! //! Throws: Nothing. static void link_before (const node_ptr & nxt_node, const node_ptr & this_node) { base_t::link_after(get_previous_node(nxt_node), this_node); } //! Requires: this_node and other_node must be nodes inserted //! in circular lists or be empty circular lists. - //! + //! //! Effects: Swaps the position of the nodes: this_node is inserted in //! other_nodes position in the second circular list and the other_node is inserted //! in this_node's position in the first circular list. - //! - //! Complexity: Linear to number of elements of both lists - //! + //! + //! Complexity: Linear to number of elements of both lists + //! //! Throws: Nothing. static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node) { @@ -279,14 +278,14 @@ class circular_slist_algorithms } } - //! Effects: Reverses the order of elements in the list. - //! + //! Effects: Reverses the order of elements in the list. + //! //! Throws: Nothing. - //! + //! //! Complexity: This function is linear to the contained elements. static void reverse(const node_ptr & p) { - node_ptr i = NodeTraits::get_next(p), e(p); + node_ptr i = NodeTraits::get_next(p), e(p); for (;;) { node_ptr nxt(NodeTraits::get_next(i)); if (nxt == e) @@ -301,7 +300,7 @@ class circular_slist_algorithms //! Null if n leads to no movement. //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of elements plus the number moved positions. static node_ptr move_backwards(const node_ptr & p, std::size_t n) { @@ -348,12 +347,12 @@ class circular_slist_algorithms } //! Effects: Moves the node p n positions towards the beginning of the list. - //! + //! //! Returns: The previous node of p after the function if there has been any movement, //! Null if n leads equals to no movement. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of elements plus the number moved positions. static node_ptr move_forward(const node_ptr & p, std::size_t n) { @@ -382,7 +381,7 @@ class circular_slist_algorithms std::size_t new_before_last_pos = (distance - (n % distance))% distance; //If the shift is a multiple of the size there is nothing to do if(!new_before_last_pos) return node_ptr(); - + for( new_last = p ; new_before_last_pos-- ; new_last = node_traits::get_next(new_last)){ @@ -397,8 +396,8 @@ class circular_slist_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp b/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp index 38c5aa57c..0aae01b61 100644 --- a/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp +++ b/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -47,7 +47,7 @@ struct derivation_value_traits static const_node_ptr to_node_ptr(const_reference value) { return node_ptr(&value); } - static pointer to_value_ptr(const node_ptr &n) + static pointer to_value_ptr(const node_ptr &n) { // This still fails in gcc < 4.4 so forget about it // using ::boost::static_pointer_cast; @@ -64,7 +64,7 @@ struct derivation_value_traits } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP diff --git a/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp index bda9ad3c4..b274135a9 100644 --- a/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -100,10 +100,10 @@ struct any_unordered_node_traits { n->node_ptr_2 = prev; } static std::size_t get_hash(const const_node_ptr & n) - { return n->size_t_1; } + { return n->size_t_1; } static void set_hash(const node_ptr & n, std::size_t h) - { n->size_t_1 = h; } + { n->size_t_1 = h; } }; @@ -255,9 +255,9 @@ class any_algorithms //! Requires: node must not be part of any tree. //! //! Effects: After the function unique(node) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. @@ -265,9 +265,9 @@ class any_algorithms { node->node_ptr_1 = 0; }; //! Effects: Returns true if node is in the same state as if called init(node) - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. static bool inited(const const_node_ptr & node) { return !node->node_ptr_1; }; @@ -289,8 +289,8 @@ class any_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/assert.hpp b/project/jni/boost/include/boost/intrusive/detail/assert.hpp index cfe392bfb..33de97f70 100644 --- a/project/jni/boost/include/boost/intrusive/detail/assert.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/assert.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +11,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP -#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP +#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP #if defined(_MSC_VER)&&(_MSC_VER>=1200) #pragma once diff --git a/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp b/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp index dc600e669..f6aefcba0 100644 --- a/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -68,19 +68,28 @@ struct default_avltree_node_traits_impl typedef typename node::balance balance; - static const node_ptr & get_parent(const const_node_ptr & n) + static node_ptr get_parent(const const_node_ptr & n) + { return n->parent_; } + + static node_ptr get_parent(const node_ptr & n) { return n->parent_; } static void set_parent(const node_ptr & n, const node_ptr & p) { n->parent_ = p; } - static const node_ptr & get_left(const const_node_ptr & n) + static node_ptr get_left(const const_node_ptr & n) + { return n->left_; } + + static node_ptr get_left(const node_ptr & n) { return n->left_; } static void set_left(const node_ptr & n, const node_ptr & l) { n->left_ = l; } - static const node_ptr & get_right(const const_node_ptr & n) + static node_ptr get_right(const const_node_ptr & n) + { return n->right_; } + + static node_ptr get_right(const node_ptr & n) { return n->right_; } static void set_right(const node_ptr & n, const node_ptr & r) @@ -89,6 +98,9 @@ struct default_avltree_node_traits_impl static balance get_balance(const const_node_ptr & n) { return n->balance_; } + static balance get_balance(const node_ptr & n) + { return n->balance_; } + static void set_balance(const node_ptr & n, balance b) { n->balance_ = b; } @@ -125,13 +137,13 @@ struct compact_avltree_node_traits_impl static void set_parent(const node_ptr & n, const node_ptr & p) { ptr_bit::set_pointer(n->parent_, p); } - static const node_ptr & get_left(const const_node_ptr & n) + static node_ptr get_left(const const_node_ptr & n) { return n->left_; } static void set_left(const node_ptr & n, const node_ptr & l) { n->left_ = l; } - static const node_ptr & get_right(const const_node_ptr & n) + static node_ptr get_right(const const_node_ptr & n) { return n->right_; } static void set_right(const node_ptr & n, const node_ptr & r) @@ -172,13 +184,13 @@ struct avltree_node_traits , OptimizeSize && max_pointer_plus_bits < VoidPointer - , detail::alignment_of >::value + , detail::alignment_of >::value >::value >= 2u > {}; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp b/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp index 6765dfa05..1b5c27fff 100644 --- a/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp @@ -1,6 +1,6 @@ //////} // /////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-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) // diff --git a/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp b/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp index 15d6b3ff2..166f78d43 100644 --- a/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -31,9 +31,8 @@ class common_slist_algorithms typedef typename NodeTraits::const_node_ptr const_node_ptr; typedef NodeTraits node_traits; - static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node) + static node_ptr get_previous_node(node_ptr p, const node_ptr & this_node) { - node_ptr p = prev_init_node; for( node_ptr p_next ; this_node != (p_next = NodeTraits::get_next(p)) ; p = p_next){ @@ -44,11 +43,11 @@ class common_slist_algorithms return p; } - static void init_header(const node_ptr & this_node) - { NodeTraits::set_next(this_node, this_node); } + static void init_header(const node_ptr & this_node) + { NodeTraits::set_next(this_node, this_node); } - static void init(const node_ptr & this_node) - { NodeTraits::set_next(this_node, node_ptr()); } + static void init(const node_ptr & this_node) + { NodeTraits::set_next(this_node, node_ptr()); } static bool unique(const const_node_ptr & this_node) { @@ -56,7 +55,7 @@ class common_slist_algorithms return !next || next == this_node; } - static bool inited(const const_node_ptr & this_node) + static bool inited(const const_node_ptr & this_node) { return !NodeTraits::get_next(this_node); } static void unlink_after(const node_ptr & prev_node) @@ -80,7 +79,7 @@ class common_slist_algorithms NodeTraits::set_next(bp, b); NodeTraits::set_next(be, p); } - + static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be) { if (bp != bb && bp != be && bb != be) { @@ -95,8 +94,8 @@ class common_slist_algorithms }; } //namespace detail -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp b/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp index bb126fcdf..7d153368a 100644 --- a/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,10 +20,10 @@ #pragma warning (push) // //'function' : resolved overload was found by argument-dependent lookup - //A function found by argument-dependent lookup (Koenig lookup) was eventually + //A function found by argument-dependent lookup (Koenig lookup) was eventually //chosen by overload resolution. // - //In Visual C++ .NET and earlier compilers, a different function would have + //In Visual C++ .NET and earlier compilers, a different function would have //been called. To pick the original function, use an explicitly qualified name. // diff --git a/project/jni/boost/include/boost/intrusive/detail/config_end.hpp b/project/jni/boost/include/boost/intrusive/detail/config_end.hpp index 4277cb576..d653030da 100644 --- a/project/jni/boost/include/boost/intrusive/detail/config_end.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/config_end.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp b/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp index d4c2d1593..850d07432 100644 --- a/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Joaquin M Lopez Munoz 2006-2009 +// (C) Copyright Joaquin M Lopez Munoz 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp b/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp index e00a7efcf..08cee2d56 100644 --- a/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2009. +// (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 @@ -15,7 +15,7 @@ /////////////////////////////////////////////////////////////////////////////// // Copyright 2007 Alexandre Courpron // -// Permission to use, copy, modify, redistribute and sell this software, +// Permission to use, copy, modify, redistribute and sell this software, // provided that this copyright notice appears on all copies of the software. /////////////////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ namespace function_detector { public : \ static const int check = NotFound + (sizeof(Test(0, 0)) - sizeof(NotFoundType));\ };\ -}}} //namespace boost::intrusive::function_detector { +}}} //namespace boost::intrusive::function_detector { #define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \ ::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\ diff --git a/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp b/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp index fc35610b8..5ddd52074 100644 --- a/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -143,7 +143,7 @@ class generic_hook typedef Tag tag; typedef typename GetNodeAlgorithms::type::node_traits node_traits; static const bool is_base_hook = !detail::is_same::value; - static const bool safemode_or_autounlink = + static const bool safemode_or_autounlink = (int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link; }; @@ -163,14 +163,14 @@ class generic_hook } } - generic_hook(const generic_hook& ) + generic_hook(const generic_hook& ) { if(boost_intrusive_tags::safemode_or_autounlink){ node_algorithms::init(this->this_ptr()); } } - generic_hook& operator=(const generic_hook& ) + generic_hook& operator=(const generic_hook& ) { return *this; } ~generic_hook() @@ -179,13 +179,13 @@ class generic_hook (*this, detail::link_dispatch()); } - void swap_nodes(generic_hook &other) + void swap_nodes(generic_hook &other) { node_algorithms::swap_nodes (this->this_ptr(), other.this_ptr()); } - bool is_linked() const + bool is_linked() const { //is_linked() can be only used in safe-mode or auto-unlink BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink )); @@ -201,8 +201,8 @@ class generic_hook }; } //namespace detail -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp b/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp index 33811e321..5651b4c17 100644 --- a/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-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) // @@ -10,7 +10,7 @@ // sample.h -#if !BOOST_PP_IS_ITERATING +#if !defined(BOOST_PP_IS_ITERATING) #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED @@ -18,10 +18,11 @@ #include #include #include + #include #include #include - //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and //wrong SFINAE for GCC 4.2/4.3 #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED @@ -85,7 +86,7 @@ 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, public BaseMixin { Base(); }; template class Helper{}; template @@ -113,7 +114,7 @@ }; //! - #if !defined(_MSC_VER) || (_MSC_VER != 1600) + #if !defined(_MSC_VER) || (_MSC_VER < 1600) #if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) @@ -121,16 +122,16 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) { - //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and //wrong SFINAE for GCC 4.2/4.3 static const bool value = true; }; - #else + #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) //Special case for 0 args template< class F - , std::size_t N = + , std::size_t N = sizeof((boost::move_detail::declval(). BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) @@ -156,15 +157,15 @@ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); - template + template static boost_intrusive_has_member_function_callable_with::no_type Test(...); - + static const bool value = sizeof(Test< Fun >(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; - #endif + #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) - #else //#if !defined(_MSC_VER) || (_MSC_VER != 1600) + #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) template struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) @@ -180,7 +181,7 @@ static const bool value = sizeof(Test(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; - #endif //#if !defined(_MSC_VER) || (_MSC_VER != 1600) + #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) @@ -196,7 +197,7 @@ //Special case for 0 args template< class F - , std::size_t N = + , std::size_t N = sizeof((boost::move_detail::declval(). BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) @@ -222,9 +223,9 @@ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); - template + template static boost_intrusive_has_member_function_callable_with::no_type Test(...); - + static const bool value = sizeof(Test< Fun >(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; diff --git a/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp b/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp index ac6ab8194..86e607460 100644 --- a/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -40,7 +40,7 @@ struct prime_list_holder template const std::size_t prime_list_holder::prime_list[] = { - 3ul, 7ul, 11ul, 17ul, 29ul, + 3ul, 7ul, 11ul, 17ul, 29ul, 53ul, 97ul, 193ul, 389ul, 769ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, @@ -180,9 +180,9 @@ class hashtable_iterator { return hashtable_iterator(this->slist_it(), this->get_container()); } public: - hashtable_iterator& operator++() + hashtable_iterator& operator++() { this->increment(); return *this; } - + hashtable_iterator operator++(int) { hashtable_iterator result (*this); @@ -219,7 +219,7 @@ class hashtable_iterator size_type buckets_len = cont->bucket_count(); ++slist_it_; - if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() && + if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() && slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){ //Now get the bucket_impl from the iterator const bucket_type &b = static_cast diff --git a/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp b/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp index e38f4de45..8677c666d 100644 --- a/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2009. +// (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 diff --git a/project/jni/boost/include/boost/intrusive/detail/list_node.hpp b/project/jni/boost/include/boost/intrusive/detail/list_node.hpp index df99912dd..32274e65a 100644 --- a/project/jni/boost/include/boost/intrusive/detail/list_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/list_node.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -44,20 +44,26 @@ struct list_node_traits typedef typename pointer_traits :: template rebind_pointer::type const_node_ptr; - static const node_ptr &get_previous(const const_node_ptr & n) + static node_ptr get_previous(const const_node_ptr & n) + { return n->prev_; } + + static node_ptr get_previous(const node_ptr & n) { return n->prev_; } static void set_previous(const node_ptr & n, const node_ptr & prev) { n->prev_ = prev; } - static const node_ptr &get_next(const const_node_ptr & n) + static node_ptr get_next(const const_node_ptr & n) + { return n->next_; } + + static node_ptr get_next(const node_ptr & n) { return n->next_; } static void set_next(const node_ptr & n, const node_ptr & next) { n->next_ = next; } }; -// list_iterator provides some basic functions for a +// list_iterator provides some basic functions for a // node oriented bidirectional iterator: template class list_iterator @@ -76,7 +82,7 @@ class list_iterator typedef typename node_traits::node_ptr node_ptr; typedef typename pointer_traits:: template rebind_pointer::type void_pointer; - static const bool store_container_ptr = + static const bool store_container_ptr = detail::store_cont_ptr_on_it::value; public: @@ -103,14 +109,14 @@ class list_iterator { members_.nodeptr_ = node; return static_cast(*this); } public: - list_iterator& operator++() + list_iterator& operator++() { node_ptr p = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = p; - //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); - return static_cast (*this); + //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return static_cast (*this); } - + list_iterator operator++(int) { list_iterator result (*this); @@ -118,12 +124,12 @@ class list_iterator return result; } - list_iterator& operator--() - { - members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); - return static_cast (*this); + list_iterator& operator--() + { + members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); + return static_cast (*this); } - + list_iterator operator--(int) { list_iterator result (*this); @@ -182,8 +188,8 @@ class list_iterator } members_; }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp b/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp index ad026c6d6..7f69f91a1 100644 --- a/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp @@ -6,7 +6,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-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) // @@ -149,7 +149,7 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) template struct first_param { typedef void type; }; -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template