# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: fkmclane@gmail.com-20140508162948-o662m5sa418zjkuk # target_branch: bzr+ssh://bazaar.launchpad.net/~armagetronad-\ # dev/armagetronad/0.4-winlibs-work/ # testament_sha1: 006ed861247481660afa56b47ab73de6865612a4 # timestamp: 2014-05-08 12:30:10 -0400 # base_revision_id: z-man@users.sf.net-20130810174346-nbtc5699hvyc1776 # # Begin patch === modified file 'LIBRARIES.txt' --- LIBRARIES.txt 2011-12-14 21:52:27 +0000 +++ LIBRARIES.txt 2014-05-08 16:29:48 +0000 @@ -10,7 +10,7 @@ SDL: Version: 1.2.10 Link: http://www.libsdl.org/download-1.2.php (latest 1.2.10) - Download: Source Archiv + Download: Source Archive *directx: Version: 8.0 @@ -21,7 +21,7 @@ SDL_image: Version: 1.2.5 Link: http://www.libsdl.org/projects/SDL_image/ (latest 1.2.5) - Download: Source Archiv + Download: Source Archive *jpeg: Version: 6b @@ -50,7 +50,7 @@ SDL_mixer: Version: 1.2.7 Link: http://www.libsdl.org/projects/SDL_mixer/ (latest 1.2.7) - Download: Source Archiv + Download: Source Archive mikmod: Version: 3.1.9a is included with SDL_mixer(1.2.7) Homepage: http://mikmod.raphnet.net/ (latest 3.1.11) @@ -63,16 +63,16 @@ libogg: Version: 1.1.3 Link: http://www.xiph.org/downloads/ (latest 1.1.3) - Download: Source Archiv + Download: Source Archive libvorbis: Version: 1.1.2 Link: http://www.xiph.org/downloads/ (latest 1.1.2) - Download: Source Archiv + Download: Source Archive libiconv: Version: 1.9.2 Link: http://gnuwin32.sourceforge.net/packages/libiconv.htm (latest 1.9.2) - Download: Developer files Archiv + Download: Developer Files Archive Homepage: http://www.gnu.org/software/libiconv/ (latest 1.9.2) libxml2: @@ -83,17 +83,25 @@ FTGL: Version: 2.1.3-rc5 Link: http://homepages.paradise.net.nz/henryj/code/#FTGL (latest 2.1.3-rc5) - Download: Source Archiv + Download: Source Archive *freetype2: Version: 2.4.8 Link: http://gnuwin32.sourceforge.net/packages/freetype.htm (latest 2.3.5, so no good) - Download: Developer files Archiv + Download: Developer Files Archive Homepage: http://www.freetype.org/download.html#stable (latest 2.4.8) +protobuf: + Version: 2.5.0 + Link: https://code.google.com/p/protobuf/downloads/ + Download: Full Source and Protoc + Homepage: https://code.google.com/p/protobuf/ + + Use msys to run the configure script and import the resulting Makefile into Code::Blocks. Copy the protoc executable into the bin folder. + boost: - Version: 1.47.0 - http://sourceforge.net/projects/boost/files/boost/1.47.0/ + Version: 1.55.0 + http://sourceforge.net/projects/boost/files/boost/1.55.0/ Download: Source Archive and just extract required headers. Homepage: http://www.boost.org === modified file 'boost/includes/boost/accumulators/accumulators_fwd.hpp' --- boost/includes/boost/accumulators/accumulators_fwd.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/accumulators_fwd.hpp 2014-05-08 16:23:59 +0000 @@ -185,8 +185,18 @@ inline void ignore_variable(void const *) {} - #define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X)\ - namespace detail { inline void BOOST_PP_CAT(ignore_, X)() { boost::accumulators::detail::ignore_variable(&X); } } +#define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \ + namespace detail \ + { \ + struct BOOST_PP_CAT(ignore_, X) \ + { \ + void ignore() \ + { \ + boost::accumulators::detail::ignore_variable(&X); \ + } \ + }; \ + } \ + /**/ } }} // namespace boost::accumulators === modified file 'boost/includes/boost/accumulators/framework/accumulators/droppable_accumulator.hpp' --- boost/includes/boost/accumulators/framework/accumulators/droppable_accumulator.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/framework/accumulators/droppable_accumulator.hpp 2014-05-08 16:23:59 +0000 @@ -215,7 +215,7 @@ template void on_drop(Args const &args) { - // cache the result at the point this calcuation was dropped + // cache the result at the point this calculation was dropped BOOST_ASSERT(!this->has_result()); this->set(this->Accumulator::result(args)); } === modified file 'boost/includes/boost/accumulators/framework/parameters/accumulator.hpp' --- boost/includes/boost/accumulators/framework/parameters/accumulator.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/framework/parameters/accumulator.hpp 2014-05-08 16:23:59 +0000 @@ -9,11 +9,13 @@ #define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 #include +#include namespace boost { namespace accumulators { BOOST_PARAMETER_KEYWORD(tag, accumulator) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(accumulator) }} // namespace boost::accumulators === modified file 'boost/includes/boost/accumulators/framework/parameters/sample.hpp' --- boost/includes/boost/accumulators/framework/parameters/sample.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/framework/parameters/sample.hpp 2014-05-08 16:23:59 +0000 @@ -9,11 +9,13 @@ #define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 #include +#include namespace boost { namespace accumulators { BOOST_PARAMETER_KEYWORD(tag, sample) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(sample) }} // namespace boost::accumulators === modified file 'boost/includes/boost/accumulators/framework/parameters/weight.hpp' --- boost/includes/boost/accumulators/framework/parameters/weight.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/framework/parameters/weight.hpp 2014-05-08 16:23:59 +0000 @@ -9,12 +9,14 @@ #define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 #include +#include namespace boost { namespace accumulators { // The weight of a single sample BOOST_PARAMETER_KEYWORD(tag, weight) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(weight) }} // namespace boost::accumulators === modified file 'boost/includes/boost/accumulators/framework/parameters/weights.hpp' --- boost/includes/boost/accumulators/framework/parameters/weights.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/framework/parameters/weights.hpp 2014-05-08 16:23:59 +0000 @@ -9,12 +9,14 @@ #define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 #include +#include namespace boost { namespace accumulators { // The weight accumulator BOOST_PARAMETER_KEYWORD(tag, weights) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(weights) }} // namespace boost::accumulators === modified file 'boost/includes/boost/accumulators/numeric/functional.hpp' --- boost/includes/boost/accumulators/numeric/functional.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/numeric/functional.hpp 2014-05-08 16:23:59 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -166,6 +167,7 @@ { \ op::Name const &Name = boost::detail::pod_singleton::instance; \ } \ + BOOST_ACCUMULATORS_IGNORE_GLOBAL(Name) \ /**/ /// INTERNAL ONLY @@ -243,14 +245,14 @@ }; template - struct average_base + struct fdiv_base : functional::divides {}; // partial specialization that promotes the arguments to double for // integral division. template - struct average_base >::type> + struct fdiv_base >::type> : functional::divides {}; @@ -346,8 +348,15 @@ {}; template + struct fdiv + : fdiv_base + {}; + + /// INTERNAL ONLY + /// For back-compat only. Use fdiv. + template struct average - : average_base + : fdiv {}; template @@ -386,8 +395,13 @@ : boost::detail::function2, functional::tag<_2> > > {}; + struct fdiv + : boost::detail::function2, functional::tag<_2> > > + {}; + + /// INTERNAL ONLY struct average - : boost::detail::function2, functional::tag<_2> > > + : boost::detail::function2, functional::tag<_2> > > {}; struct as_min @@ -411,11 +425,21 @@ { op::min_assign const &min_assign = boost::detail::pod_singleton::instance; op::max_assign const &max_assign = boost::detail::pod_singleton::instance; - op::average const &average = boost::detail::pod_singleton::instance; + op::fdiv const &fdiv = boost::detail::pod_singleton::instance; + op::fdiv const &average = boost::detail::pod_singleton::instance; ///< INTERNAL ONLY op::as_min const &as_min = boost::detail::pod_singleton::instance; op::as_max const &as_max = boost::detail::pod_singleton::instance; op::as_zero const &as_zero = boost::detail::pod_singleton::instance; op::as_one const &as_one = boost::detail::pod_singleton::instance; + + BOOST_ACCUMULATORS_IGNORE_GLOBAL(min_assign) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(max_assign) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(fdiv) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(average) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_min) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_max) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_zero) + BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_one) } /////////////////////////////////////////////////////////////////////////////// === modified file 'boost/includes/boost/accumulators/numeric/functional/valarray.hpp' --- boost/includes/boost/accumulators/numeric/functional/valarray.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/numeric/functional/valarray.hpp 2014-05-08 16:23:59 +0000 @@ -234,9 +234,9 @@ } }; - // partial specialization of numeric::average<> for std::valarray. + // partial specialization of numeric::fdiv<> for std::valarray. template - struct average + struct fdiv : mpl::if_< are_integral , divides === modified file 'boost/includes/boost/accumulators/numeric/functional/vector.hpp' --- boost/includes/boost/accumulators/numeric/functional/vector.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/numeric/functional/vector.hpp 2014-05-08 16:23:59 +0000 @@ -231,7 +231,7 @@ // partial specialization for std::vector. template - struct average + struct fdiv : mpl::if_< are_integral , divides === modified file 'boost/includes/boost/accumulators/numeric/functional_fwd.hpp' --- boost/includes/boost/accumulators/numeric/functional_fwd.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/numeric/functional_fwd.hpp 2014-05-08 16:23:59 +0000 @@ -141,7 +141,7 @@ template struct max_assign_base; template - struct average_base; + struct fdiv_base; template struct as_min_base; template @@ -158,7 +158,7 @@ template::type, typename RightTag = typename tag::type> struct max_assign; template::type, typename RightTag = typename tag::type> - struct average; + struct fdiv; template::type> struct as_min; template::type> @@ -175,7 +175,7 @@ struct promote; struct min_assign; struct max_assign; - struct average; + struct fdiv; struct as_min; struct as_max; struct as_zero; @@ -186,7 +186,7 @@ { extern op::min_assign const &min_assign; extern op::max_assign const &max_assign; - extern op::average const &average; + extern op::fdiv const &fdiv; extern op::as_min const &as_min; extern op::as_max const &as_max; extern op::as_zero const &as_zero; === modified file 'boost/includes/boost/accumulators/statistics/covariance.hpp' --- boost/includes/boost/accumulators/statistics/covariance.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/covariance.hpp 2014-05-08 16:23:59 +0000 @@ -122,8 +122,8 @@ struct covariance_impl : accumulator_base { - typedef typename numeric::functional::average::result_type sample_type; - typedef typename numeric::functional::average::result_type variate_type; + typedef typename numeric::functional::fdiv::result_type sample_type; + typedef typename numeric::functional::fdiv::result_type variate_type; // for boost::result_of typedef typename numeric::functional::outer_product::result_type result_type; @@ -131,8 +131,8 @@ covariance_impl(Args const &args) : cov_( numeric::outer_product( - numeric::average(args[sample | Sample()], (std::size_t)1) - , numeric::average(args[parameter::keyword::get() | VariateType()], (std::size_t)1) + numeric::fdiv(args[sample | Sample()], (std::size_t)1) + , numeric::fdiv(args[parameter::keyword::get() | VariateType()], (std::size_t)1) ) ) { === modified file 'boost/includes/boost/accumulators/statistics/density.hpp' --- boost/includes/boost/accumulators/statistics/density.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/density.hpp 2014-05-08 16:23:59 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,9 @@ BOOST_PARAMETER_NESTED_KEYWORD(tag, density_cache_size, cache_size) BOOST_PARAMETER_NESTED_KEYWORD(tag, density_num_bins, num_bins) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(density_cache_size) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(density_num_bins) + namespace impl { /////////////////////////////////////////////////////////////////////////////// @@ -57,7 +61,7 @@ struct density_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef std::vector array_type; // for boost::result_of @@ -73,8 +77,8 @@ , histogram( num_bins + 2 , std::make_pair( - numeric::average(args[sample | Sample()],(std::size_t)1) - , numeric::average(args[sample | Sample()],(std::size_t)1) + numeric::fdiv(args[sample | Sample()],(std::size_t)1) + , numeric::fdiv(args[sample | Sample()],(std::size_t)1) ) ) , is_dirty(true) @@ -99,9 +103,9 @@ // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). if (cnt == this->cache_size) { - float_type minimum = numeric::average((min)(args), (std::size_t)1); - float_type maximum = numeric::average((max)(args), (std::size_t)1); - float_type bin_size = numeric::average(maximum - minimum, this->num_bins ); + float_type minimum = numeric::fdiv((min)(args), (std::size_t)1); + float_type maximum = numeric::fdiv((max)(args), (std::size_t)1); + float_type bin_size = numeric::fdiv(maximum - minimum, this->num_bins ); // determine bin positions (their lower bounds) for (std::size_t i = 0; i < this->num_bins + 2; ++i) @@ -173,7 +177,7 @@ for (std::size_t i = 0; i < this->num_bins + 2; ++i) { - this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::average(this->samples_in_bin[i], count(args))); + this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::fdiv(this->samples_in_bin[i], count(args))); } } // returns a range of pairs === modified file 'boost/includes/boost/accumulators/statistics/error_of_mean.hpp' --- boost/includes/boost/accumulators/statistics/error_of_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/error_of_mean.hpp 2014-05-08 16:23:59 +0000 @@ -29,7 +29,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; error_of_mean_impl(dont_care) {} @@ -38,7 +38,7 @@ { using namespace std; extractor const variance = {}; - return sqrt(numeric::average(variance(args), count(args) - 1)); + return sqrt(numeric::fdiv(variance(args), count(args) - 1)); } }; === modified file 'boost/includes/boost/accumulators/statistics/extended_p_square.hpp' --- boost/includes/boost/accumulators/statistics/extended_p_square.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/extended_p_square.hpp 2014-05-08 16:23:59 +0000 @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,6 +34,8 @@ // BOOST_PARAMETER_NESTED_KEYWORD(tag, extended_p_square_probabilities, probabilities) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_probabilities) + namespace impl { /////////////////////////////////////////////////////////////////////////////// @@ -55,9 +57,9 @@ K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49, Number 4 (October), 1986, p. 159-164. - The extended \f$ P^2 \f$ algorithm generalizess the \f$ P^2 \f$ algorithm of + The extended \f$ P^2 \f$ algorithm generalizes the \f$ P^2 \f$ algorithm of - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -67,7 +69,7 @@ struct extended_p_square_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector array_type; // for boost::result_of typedef iterator_range< @@ -256,7 +258,7 @@ typedef accumulators::impl::extended_p_square_impl impl; #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::extended_p_square::probabilities named paramter + /// tag::extended_p_square::probabilities named parameter static boost::parameter::keyword const probabilities; #endif }; === modified file 'boost/includes/boost/accumulators/statistics/extended_p_square_quantile.hpp' --- boost/includes/boost/accumulators/statistics/extended_p_square_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/extended_p_square_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -57,7 +57,7 @@ struct extended_p_square_quantile_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector array_type; typedef iterator_range< detail::lvalue_index_iterator< @@ -137,7 +137,7 @@ float_type h1 = *iter_heights; float_type h0 = *(iter_heights - 1); - float_type a = numeric::average(h1 - h0, p1 - p0); + float_type a = numeric::fdiv(h1 - h0, p1 - p0); float_type b = h1 - p1 * a; res = a * this->probability + b; @@ -169,12 +169,12 @@ h2 = *iter_heights; } - float_type hp21 = numeric::average(h2 - h1, p2 - p1); - float_type hp10 = numeric::average(h1 - h0, p1 - p0); - float_type p21 = numeric::average(p2 * p2 - p1 * p1, p2 - p1); - float_type p10 = numeric::average(p1 * p1 - p0 * p0, p1 - p0); + float_type hp21 = numeric::fdiv(h2 - h1, p2 - p1); + float_type hp10 = numeric::fdiv(h1 - h0, p1 - p0); + float_type p21 = numeric::fdiv(p2 * p2 - p1 * p1, p2 - p1); + float_type p10 = numeric::fdiv(p1 * p1 - p0 * p0, p1 - p0); - float_type a = numeric::average(hp21 - hp10, p21 - p10); + float_type a = numeric::fdiv(hp21 - hp10, p21 - p10); float_type b = hp21 - a * p21; float_type c = h2 - a * p2 * p2 - b * p2; === modified file 'boost/includes/boost/accumulators/statistics/kurtosis.hpp' --- boost/includes/boost/accumulators/statistics/kurtosis.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/kurtosis.hpp 2014-05-08 16:23:59 +0000 @@ -47,14 +47,14 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; kurtosis_impl(dont_care) {} template result_type result(Args const &args) const { - return numeric::average( + return numeric::fdiv( accumulators::moment<4>(args) - 4. * accumulators::moment<3>(args) * mean(args) + 6. * accumulators::moment<2>(args) * mean(args) * mean(args) === modified file 'boost/includes/boost/accumulators/statistics/mean.hpp' --- boost/includes/boost/accumulators/statistics/mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/mean.hpp 2014-05-08 16:23:59 +0000 @@ -31,7 +31,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; mean_impl(dont_care) {} @@ -39,7 +39,7 @@ result_type result(Args const &args) const { extractor sum; - return numeric::average(sum(args), count(args)); + return numeric::fdiv(sum(args), count(args)); } }; @@ -48,11 +48,11 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template immediate_mean_impl(Args const &args) - : mean(numeric::average(args[sample | Sample()], numeric::one::value)) + : mean(numeric::fdiv(args[sample | Sample()], numeric::one::value)) { } @@ -60,7 +60,7 @@ void operator ()(Args const &args) { std::size_t cnt = count(args); - this->mean = numeric::average( + this->mean = numeric::fdiv( (this->mean * (cnt - 1)) + args[parameter::keyword::get()] , cnt ); === modified file 'boost/includes/boost/accumulators/statistics/median.hpp' --- boost/includes/boost/accumulators/statistics/median.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/median.hpp 2014-05-08 16:23:59 +0000 @@ -39,7 +39,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; median_impl(dont_care) {} @@ -63,7 +63,7 @@ struct with_density_median_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef iterator_range range_type; // for boost::result_of @@ -71,7 +71,7 @@ template with_density_median_impl(Args const &args) - : sum(numeric::average(args[sample | Sample()], (std::size_t)1)) + : sum(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) , is_dirty(true) { } @@ -98,7 +98,7 @@ ++it; } --it; - float_type over = numeric::average(this->sum - 0.5 * cnt, it->second * cnt); + float_type over = numeric::fdiv(this->sum - 0.5 * cnt, it->second * cnt); this->median = it->first * over + (it + 1)->first * (1. - over); } @@ -125,7 +125,7 @@ struct with_p_square_cumulative_distribution_median_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef iterator_range range_type; // for boost::result_of @@ -154,7 +154,7 @@ { ++it; } - float_type over = numeric::average(it->second - 0.5, it->second - (it - 1)->second); + float_type over = numeric::fdiv(it->second - 0.5, it->second - (it - 1)->second); this->median = it->first * over + (it + 1)->first * ( 1. - over ); } === modified file 'boost/includes/boost/accumulators/statistics/moment.hpp' --- boost/includes/boost/accumulators/statistics/moment.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/moment.hpp 2014-05-08 16:23:59 +0000 @@ -55,7 +55,7 @@ { BOOST_MPL_ASSERT_RELATION(N::value, >, 0); // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template moment_impl(Args const &args) @@ -72,7 +72,7 @@ template result_type result(Args const &args) const { - return numeric::average(this->sum, count(args)); + return numeric::fdiv(this->sum, count(args)); } private: === modified file 'boost/includes/boost/accumulators/statistics/p_square_cumul_dist.hpp' --- boost/includes/boost/accumulators/statistics/p_square_cumul_dist.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/p_square_cumul_dist.hpp 2014-05-08 16:23:59 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,8 @@ // BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution_num_cells) + namespace impl { /////////////////////////////////////////////////////////////////////////////// @@ -41,7 +44,7 @@ For further details, see - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -51,7 +54,7 @@ struct p_square_cumulative_distribution_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector array_type; typedef std::vector > histogram_type; // for boost::result_of @@ -73,7 +76,7 @@ { this->actual_positions[i] = i + 1.; this->desired_positions[i] = i + 1.; - this->positions_increments[i] = numeric::average(i, b); + this->positions_increments[i] = numeric::fdiv(i, b); } } @@ -195,7 +198,7 @@ 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)); + this->histogram[i] = std::make_pair(this->heights[i], numeric::fdiv(this->actual_positions[i], cnt)); } } //return histogram; === modified file 'boost/includes/boost/accumulators/statistics/p_square_quantile.hpp' --- boost/includes/boost/accumulators/statistics/p_square_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/p_square_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -44,7 +44,7 @@ For further details, see - R. Jain and I. Chlamtac, The P^2 algorithmus fordynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -54,7 +54,7 @@ struct p_square_quantile_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef array array_type; // for boost::result_of typedef float_type result_type; @@ -69,7 +69,7 @@ { for(std::size_t i = 0; i < 5; ++i) { - this->actual_positions[i] = i + 1; + this->actual_positions[i] = i + 1.; } this->desired_positions[0] = 1.; @@ -105,7 +105,7 @@ { std::size_t sample_cell = 1; // k - // find cell k such that heights[k-1] <= args[sample] < heights[k] and ajust extreme values + // 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]; === modified file 'boost/includes/boost/accumulators/statistics/parameters/quantile_probability.hpp' --- boost/includes/boost/accumulators/statistics/parameters/quantile_probability.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/parameters/quantile_probability.hpp 2014-05-08 16:23:59 +0000 @@ -9,12 +9,15 @@ #define BOOST_ACCUMULATORS_STATISTICS_PARAMETERS_QUANTILE_PROBABILITY_HPP_EAN_03_11_2005 #include +#include namespace boost { namespace accumulators { BOOST_PARAMETER_KEYWORD(tag, quantile_probability) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(quantile_probability) + }} // namespace boost::accumulators #endif === modified file 'boost/includes/boost/accumulators/statistics/peaks_over_threshold.hpp' --- boost/includes/boost/accumulators/statistics/peaks_over_threshold.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/peaks_over_threshold.hpp 2014-05-08 16:23:59 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,9 @@ BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_value, threshold_value) BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_probability, threshold_probability) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(pot_threshold_value) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(pot_threshold_probability) + namespace impl { /////////////////////////////////////////////////////////////////////////////// @@ -121,7 +125,7 @@ struct peaks_over_threshold_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef boost::tuple result_type; // for left tail fitting, mirror the extreme values @@ -130,8 +134,8 @@ template peaks_over_threshold_impl(Args const &args) : Nu_(0) - , mu_(sign::value * numeric::average(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1)) + , mu_(sign::value * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) + , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) , threshold_(sign::value * args[pot_threshold_value]) , fit_parameters_(boost::make_tuple(0., 0., 0.)) , is_dirty_(true) @@ -160,13 +164,13 @@ std::size_t cnt = count(args); - this->mu_ = sign::value * numeric::average(this->mu_, this->Nu_); - this->sigma2_ = numeric::average(this->sigma2_, this->Nu_); + this->mu_ = sign::value * numeric::fdiv(this->mu_, this->Nu_); + this->sigma2_ = numeric::fdiv(this->sigma2_, this->Nu_); this->sigma2_ -= this->mu_ * this->mu_; - float_type threshold_probability = numeric::average(cnt - this->Nu_, cnt); + float_type threshold_probability = numeric::fdiv(cnt - this->Nu_, cnt); - float_type tmp = numeric::average(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); + float_type tmp = numeric::fdiv(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); float_type xi_hat = 0.5 * ( 1. - tmp ); float_type beta_hat = 0.5 * ( this->mu_ - this->threshold_ ) * ( 1. + tmp ); float_type beta_bar = beta_hat * std::pow(1. - threshold_probability, xi_hat); @@ -201,7 +205,7 @@ struct peaks_over_threshold_prob_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef boost::tuple result_type; // for left tail fitting, mirror the extreme values @@ -209,8 +213,8 @@ template peaks_over_threshold_prob_impl(Args const &args) - : mu_(sign::value * numeric::average(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1)) + : mu_(sign::value * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) + , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) , threshold_probability_(args[pot_threshold_probability]) , fit_parameters_(boost::make_tuple(0., 0., 0.)) , is_dirty_(true) @@ -268,14 +272,14 @@ sigma2_ += *(tail(args).begin() + i) * (*(tail(args).begin() + i)); } - this->mu_ = sign::value * numeric::average(this->mu_, n); - this->sigma2_ = numeric::average(this->sigma2_, n); + this->mu_ = sign::value * numeric::fdiv(this->mu_, n); + this->sigma2_ = numeric::fdiv(this->sigma2_, n); this->sigma2_ -= this->mu_ * this->mu_; if (is_same::value) this->threshold_probability_ = 1. - this->threshold_probability_; - float_type tmp = numeric::average(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); + float_type tmp = numeric::fdiv(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); float_type xi_hat = 0.5 * ( 1. - tmp ); float_type beta_hat = 0.5 * ( this->mu_ - u ) * ( 1. + tmp ); float_type beta_bar = beta_hat * std::pow(1. - threshold_probability_, xi_hat); === modified file 'boost/includes/boost/accumulators/statistics/pot_quantile.hpp' --- boost/includes/boost/accumulators/statistics/pot_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/pot_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -49,7 +49,7 @@ struct pot_quantile_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef float_type result_type; === modified file 'boost/includes/boost/accumulators/statistics/pot_tail_mean.hpp' --- boost/includes/boost/accumulators/statistics/pot_tail_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/pot_tail_mean.hpp 2014-05-08 16:23:59 +0000 @@ -52,7 +52,7 @@ struct pot_tail_mean_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef float_type result_type; === modified file 'boost/includes/boost/accumulators/statistics/rolling_mean.hpp' --- boost/includes/boost/accumulators/statistics/rolling_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/rolling_mean.hpp 2014-05-08 16:23:59 +0000 @@ -31,7 +31,7 @@ struct rolling_mean_impl : accumulator_base { - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; rolling_mean_impl(dont_care) {} @@ -39,7 +39,7 @@ template result_type result(Args const &args) const { - return numeric::average(rolling_sum(args), rolling_count(args)); + return numeric::fdiv(rolling_sum(args), rolling_count(args)); } }; === modified file 'boost/includes/boost/accumulators/statistics/rolling_window.hpp' --- boost/includes/boost/accumulators/statistics/rolling_window.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/rolling_window.hpp 2014-05-08 16:23:59 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,8 @@ // tag::rolling_window::size named parameter BOOST_PARAMETER_NESTED_KEYWORD(tag, rolling_window_size, window_size) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_window_size) + namespace impl { /////////////////////////////////////////////////////////////////////////////// === modified file 'boost/includes/boost/accumulators/statistics/skewness.hpp' --- boost/includes/boost/accumulators/statistics/skewness.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/skewness.hpp 2014-05-08 16:23:59 +0000 @@ -31,7 +31,7 @@ @brief Skewness estimation The skewness of a sample distribution is defined as the ratio of the 3rd central moment and the \f$ 3/2 \f$-th power - of the 2nd central moment (the variance) of the sampless 3. The skewness can also be expressed by the simple moments: + of the 2nd central moment (the variance) of the samples 3. The skewness can also be expressed by the simple moments: \f[ \hat{g}_1 = @@ -48,7 +48,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; skewness_impl(dont_care) { @@ -57,7 +57,7 @@ template result_type result(Args const &args) const { - return numeric::average( + return numeric::fdiv( accumulators::moment<3>(args) - 3. * accumulators::moment<2>(args) * mean(args) + 2. * mean(args) * mean(args) * mean(args) === modified file 'boost/includes/boost/accumulators/statistics/tail.hpp' --- boost/includes/boost/accumulators/statistics/tail.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/tail.hpp 2014-05-08 16:23:59 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,9 @@ BOOST_PARAMETER_NESTED_KEYWORD(tag, right_tail_cache_size, cache_size) BOOST_PARAMETER_NESTED_KEYWORD(tag, left_tail_cache_size, cache_size) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(right_tail_cache_size) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(left_tail_cache_size) + namespace detail { /////////////////////////////////////////////////////////////////////////////// === modified file 'boost/includes/boost/accumulators/statistics/tail_mean.hpp' --- boost/includes/boost/accumulators/statistics/tail_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/tail_mean.hpp 2014-05-08 16:23:59 +0000 @@ -62,7 +62,7 @@ struct coherent_tail_mean_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef float_type result_type; @@ -82,10 +82,10 @@ extractor > const some_non_coherent_tail_mean = {}; return some_non_coherent_tail_mean(args) - + numeric::average(quantile(args), n) + + numeric::fdiv(quantile(args), n) * ( ( is_same::value ) ? args[quantile_probability] : 1. - args[quantile_probability] - - numeric::average(n, count(args)) + - numeric::fdiv(n, count(args)) ); } }; @@ -117,7 +117,7 @@ struct non_coherent_tail_mean_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef float_type result_type; @@ -136,7 +136,7 @@ // If n is in a valid range, return result, otherwise return NaN or throw exception if (n <= static_cast(tail(args).size())) - return numeric::average( + return numeric::fdiv( std::accumulate( tail(args).begin() , tail(args).begin() + n === modified file 'boost/includes/boost/accumulators/statistics/tail_quantile.hpp' --- boost/includes/boost/accumulators/statistics/tail_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/tail_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -46,7 +46,7 @@ @brief Tail quantile estimation based on order statistics (for both left and right tails) The estimation of a tail quantile \f$\hat{q}\f$ with level \f$\alpha\f$ based on order statistics requires the - chaching of at least the \f$\lceil n\alpha\rceil\f$ smallest or the \f$\lceil n(1-\alpha)\rceil\f$ largest samples, + caching of at least the \f$\lceil n\alpha\rceil\f$ smallest or the \f$\lceil n(1-\alpha)\rceil\f$ largest samples, \f$n\f$ being the total number of samples. The largest of the \f$\lceil n\alpha\rceil\f$ smallest samples or the smallest of the \f$\lceil n(1-\alpha)\rceil\f$ largest samples provides an estimate for the quantile: === modified file 'boost/includes/boost/accumulators/statistics/tail_variate_means.hpp' --- boost/includes/boost/accumulators/statistics/tail_variate_means.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/tail_variate_means.hpp 2014-05-08 16:23:59 +0000 @@ -79,7 +79,7 @@ struct tail_variate_means_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector array_type; // for boost::result_of typedef iterator_range result_type; === modified file 'boost/includes/boost/accumulators/statistics/variance.hpp' --- boost/includes/boost/accumulators/statistics/variance.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/variance.hpp 2014-05-08 16:23:59 +0000 @@ -42,7 +42,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; lazy_variance_impl(dont_care) {} @@ -85,11 +85,11 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template variance_impl(Args const &args) - : variance(numeric::average(args[sample | Sample()], numeric::one::value)) + : variance(numeric::fdiv(args[sample | Sample()], numeric::one::value)) { } @@ -103,8 +103,8 @@ extractor mean; result_type tmp = args[parameter::keyword::get()] - mean(args); this->variance = - numeric::average(this->variance * (cnt - 1), cnt) - + numeric::average(tmp * tmp, cnt - 1); + numeric::fdiv(this->variance * (cnt - 1), cnt) + + numeric::fdiv(tmp * tmp, cnt - 1); } } === modified file 'boost/includes/boost/accumulators/statistics/variates/covariate.hpp' --- boost/includes/boost/accumulators/statistics/variates/covariate.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/variates/covariate.hpp 2014-05-08 16:23:59 +0000 @@ -9,6 +9,7 @@ #define BOOST_ACCUMULATORS_STATISTICS_VARIATES_COVARIATE_HPP_EAN_03_11_2005 #include +#include namespace boost { namespace accumulators { @@ -16,6 +17,9 @@ BOOST_PARAMETER_KEYWORD(tag, covariate1) BOOST_PARAMETER_KEYWORD(tag, covariate2) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariate1) +BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariate2) + }} // namespace boost::accumulators #endif === modified file 'boost/includes/boost/accumulators/statistics/weighted_covariance.hpp' --- boost/includes/boost/accumulators/statistics/weighted_covariance.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_covariance.hpp 2014-05-08 16:23:59 +0000 @@ -57,8 +57,8 @@ struct weighted_covariance_impl : accumulator_base { - typedef typename numeric::functional::multiplies::result_type>::result_type weighted_sample_type; - typedef typename numeric::functional::multiplies::result_type>::result_type weighted_variate_type; + typedef typename numeric::functional::multiplies::result_type>::result_type weighted_sample_type; + typedef typename numeric::functional::multiplies::result_type>::result_type weighted_variate_type; // for boost::result_of typedef typename numeric::functional::outer_product::result_type result_type; @@ -66,9 +66,9 @@ weighted_covariance_impl(Args const &args) : cov_( numeric::outer_product( - numeric::average(args[sample | Sample()], (std::size_t)1) + numeric::fdiv(args[sample | Sample()], (std::size_t)1) * numeric::one::value - , numeric::average(args[parameter::keyword::get() | VariateType()], (std::size_t)1) + , numeric::fdiv(args[parameter::keyword::get() | VariateType()], (std::size_t)1) * numeric::one::value ) ) === modified file 'boost/includes/boost/accumulators/statistics/weighted_density.hpp' --- boost/includes/boost/accumulators/statistics/weighted_density.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_density.hpp 2014-05-08 16:23:59 +0000 @@ -50,7 +50,7 @@ struct weighted_density_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef std::vector array_type; // for boost::result_of @@ -66,8 +66,8 @@ , histogram( num_bins + 2 , std::make_pair( - numeric::average(args[sample | Sample()],(std::size_t)1) - , numeric::average(args[sample | Sample()],(std::size_t)1) + numeric::fdiv(args[sample | Sample()],(std::size_t)1) + , numeric::fdiv(args[sample | Sample()],(std::size_t)1) ) ) , is_dirty(true) @@ -92,9 +92,9 @@ // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). if (cnt == this->cache_size) { - float_type minimum = numeric::average((min)(args),(std::size_t)1); - float_type maximum = numeric::average((max)(args),(std::size_t)1); - float_type bin_size = numeric::average(maximum - minimum, this->num_bins); + float_type minimum = numeric::fdiv((min)(args),(std::size_t)1); + float_type maximum = numeric::fdiv((max)(args),(std::size_t)1); + float_type bin_size = numeric::fdiv(maximum - minimum, this->num_bins); // determine bin positions (their lower bounds) for (std::size_t i = 0; i < this->num_bins + 2; ++i) @@ -163,7 +163,7 @@ for (std::size_t i = 0; i < this->num_bins + 2; ++i) { - this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::average(this->samples_in_bin[i], sum_of_weights(args))); + this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::fdiv(this->samples_in_bin[i], sum_of_weights(args))); } } === modified file 'boost/includes/boost/accumulators/statistics/weighted_extended_p_square.hpp' --- boost/includes/boost/accumulators/statistics/weighted_extended_p_square.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_extended_p_square.hpp 2014-05-08 16:23:59 +0000 @@ -54,9 +54,9 @@ K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49, Number 4 (October), 1986, p. 159-164. - The extended \f$ P^2 \f$ algorithm generalizess the \f$ P^2 \f$ algorithm of + The extended \f$ P^2 \f$ algorithm generalizes the \f$ P^2 \f$ algorithm of - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -67,7 +67,7 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector array_type; // for boost::result_of typedef iterator_range< === modified file 'boost/includes/boost/accumulators/statistics/weighted_kurtosis.hpp' --- boost/includes/boost/accumulators/statistics/weighted_kurtosis.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_kurtosis.hpp 2014-05-08 16:23:59 +0000 @@ -52,7 +52,7 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; weighted_kurtosis_impl(dont_care) { @@ -61,7 +61,7 @@ template result_type result(Args const &args) const { - return numeric::average( + return numeric::fdiv( accumulators::weighted_moment<4>(args) - 4. * accumulators::weighted_moment<3>(args) * weighted_mean(args) + 6. * accumulators::weighted_moment<2>(args) * weighted_mean(args) * weighted_mean(args) === modified file 'boost/includes/boost/accumulators/statistics/weighted_mean.hpp' --- boost/includes/boost/accumulators/statistics/weighted_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_mean.hpp 2014-05-08 16:23:59 +0000 @@ -36,7 +36,7 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; weighted_mean_impl(dont_care) {} @@ -53,7 +53,7 @@ extractor const some_weighted_sum = {}; - return numeric::average(some_weighted_sum(args), sum_of_weights(args)); + return numeric::fdiv(some_weighted_sum(args), sum_of_weights(args)); } }; @@ -66,12 +66,12 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template immediate_weighted_mean_impl(Args const &args) : mean( - numeric::average( + numeric::fdiv( args[parameter::keyword::get() | Sample()] * numeric::one::value , numeric::one::value @@ -89,7 +89,7 @@ Weight w_sum = sum_of_weights(args); Weight w = args[weight]; weighted_sample const &s = args[parameter::keyword::get()] * w; - this->mean = numeric::average(this->mean * (w_sum - w) + s, w_sum); + this->mean = numeric::fdiv(this->mean * (w_sum - w) + s, w_sum); } result_type result(dont_care) const === modified file 'boost/includes/boost/accumulators/statistics/weighted_median.hpp' --- boost/includes/boost/accumulators/statistics/weighted_median.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_median.hpp 2014-05-08 16:23:59 +0000 @@ -40,7 +40,7 @@ : accumulator_base { // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; weighted_median_impl(dont_care) {} @@ -65,7 +65,7 @@ struct with_density_weighted_median_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef iterator_range range_type; // for boost::result_of @@ -73,7 +73,7 @@ template with_density_weighted_median_impl(Args const &args) - : sum(numeric::average(args[sample | Sample()], (std::size_t)1)) + : sum(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) , is_dirty(true) { } @@ -99,7 +99,7 @@ ++it; } --it; - float_type over = numeric::average(this->sum - 0.5 * cnt, it->second * cnt); + float_type over = numeric::fdiv(this->sum - 0.5 * cnt, it->second * cnt); this->median = it->first * over + (it + 1)->first * ( 1. - over ); } @@ -127,7 +127,7 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef iterator_range range_type; // for boost::result_of @@ -156,7 +156,7 @@ { ++it; } - float_type over = numeric::average(it->second - 0.5, it->second - (it - 1)->second); + float_type over = numeric::fdiv(it->second - 0.5, it->second - (it - 1)->second); this->median = it->first * over + (it + 1)->first * ( 1. - over ); } === modified file 'boost/includes/boost/accumulators/statistics/weighted_moment.hpp' --- boost/includes/boost/accumulators/statistics/weighted_moment.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_moment.hpp 2014-05-08 16:23:59 +0000 @@ -40,7 +40,7 @@ BOOST_MPL_ASSERT_RELATION(N::value, >, 0); typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template weighted_moment_impl(Args const &args) @@ -57,7 +57,7 @@ template result_type result(Args const &args) const { - return numeric::average(this->sum, sum_of_weights(args)); + return numeric::fdiv(this->sum, sum_of_weights(args)); } private: === modified file 'boost/includes/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp' --- boost/includes/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp 2014-05-08 16:23:59 +0000 @@ -42,7 +42,7 @@ For further details, see - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -53,7 +53,7 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef std::vector > histogram_type; typedef std::vector array_type; // for boost::result_of @@ -153,7 +153,7 @@ 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); + + numeric::fdiv((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); } // adjust heights of markers 2 to num_cells if necessary @@ -214,7 +214,7 @@ 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))); + this->histogram[i] = std::make_pair(this->heights[i], numeric::fdiv(this->actual_positions[i], sum_of_weights(args))); } } === modified file 'boost/includes/boost/accumulators/statistics/weighted_p_square_quantile.hpp' --- boost/includes/boost/accumulators/statistics/weighted_p_square_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_p_square_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -44,7 +44,7 @@ For further details, see - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. @@ -55,7 +55,7 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; typedef array array_type; // for boost::result_of typedef float_type result_type; @@ -80,7 +80,7 @@ this->heights[cnt - 1] = args[sample]; // In this initialization phase, actual_positions stores the weights of the - // inital samples that are needed at the end of the initialization phase to + // initial samples that are needed at the end of the initialization phase to // compute the correct initial positions of the markers. this->actual_positions[cnt - 1] = args[weight]; === modified file 'boost/includes/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp' --- boost/includes/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp 2014-05-08 16:23:59 +0000 @@ -56,16 +56,16 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef boost::tuple result_type; template weighted_peaks_over_threshold_impl(Args const &args) : sign_((is_same::value) ? -1 : 1) - , mu_(sign_ * numeric::average(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1)) - , w_sum_(numeric::average(args[weight | Weight()], (std::size_t)1)) + , mu_(sign_ * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) + , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) + , w_sum_(numeric::fdiv(args[weight | Weight()], (std::size_t)1)) , threshold_(sign_ * args[pot_threshold_value]) , fit_parameters_(boost::make_tuple(0., 0., 0.)) , is_dirty_(true) @@ -92,13 +92,13 @@ { this->is_dirty_ = false; - this->mu_ = this->sign_ * numeric::average(this->mu_, this->w_sum_); - this->sigma2_ = numeric::average(this->sigma2_, this->w_sum_); + this->mu_ = this->sign_ * numeric::fdiv(this->mu_, this->w_sum_); + this->sigma2_ = numeric::fdiv(this->sigma2_, this->w_sum_); this->sigma2_ -= this->mu_ * this->mu_; - float_type threshold_probability = numeric::average(sum_of_weights(args) - this->w_sum_, sum_of_weights(args)); + float_type threshold_probability = numeric::fdiv(sum_of_weights(args) - this->w_sum_, sum_of_weights(args)); - float_type tmp = numeric::average(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); + float_type tmp = numeric::fdiv(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); float_type xi_hat = 0.5 * ( 1. - tmp ); float_type beta_hat = 0.5 * ( this->mu_ - this->threshold_ ) * ( 1. + tmp ); float_type beta_bar = beta_hat * std::pow(1. - threshold_probability, xi_hat); @@ -135,15 +135,15 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef boost::tuple result_type; template weighted_peaks_over_threshold_prob_impl(Args const &args) : sign_((is_same::value) ? -1 : 1) - , mu_(sign_ * numeric::average(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1)) + , mu_(sign_ * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) + , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) , threshold_probability_(args[pot_threshold_probability]) , fit_parameters_(boost::make_tuple(0., 0., 0.)) , is_dirty_(true) @@ -200,14 +200,14 @@ float_type u = *(tail(args).begin() + n - 1) * this->sign_; - this->mu_ = this->sign_ * numeric::average(this->mu_, sum); - this->sigma2_ = numeric::average(this->sigma2_, sum); + this->mu_ = this->sign_ * numeric::fdiv(this->mu_, sum); + this->sigma2_ = numeric::fdiv(this->sigma2_, sum); this->sigma2_ -= this->mu_ * this->mu_; if (is_same::value) this->threshold_probability_ = 1. - this->threshold_probability_; - float_type tmp = numeric::average(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); + float_type tmp = numeric::fdiv(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); float_type xi_hat = 0.5 * ( 1. - tmp ); float_type beta_hat = 0.5 * ( this->mu_ - u ) * ( 1. + tmp ); float_type beta_bar = beta_hat * std::pow(1. - threshold_probability_, xi_hat); === modified file 'boost/includes/boost/accumulators/statistics/weighted_skewness.hpp' --- boost/includes/boost/accumulators/statistics/weighted_skewness.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_skewness.hpp 2014-05-08 16:23:59 +0000 @@ -51,14 +51,14 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; weighted_skewness_impl(dont_care) {} template result_type result(Args const &args) const { - return numeric::average( + return numeric::fdiv( accumulators::weighted_moment<3>(args) - 3. * accumulators::weighted_moment<2>(args) * weighted_mean(args) + 2. * weighted_mean(args) * weighted_mean(args) * weighted_mean(args) === modified file 'boost/includes/boost/accumulators/statistics/weighted_tail_mean.hpp' --- boost/includes/boost/accumulators/statistics/weighted_tail_mean.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_tail_mean.hpp 2014-05-08 16:23:59 +0000 @@ -82,9 +82,9 @@ : accumulator_base { typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; non_coherent_weighted_tail_mean_impl(dont_care) {} @@ -120,7 +120,7 @@ } } - return numeric::average( + return numeric::fdiv( std::inner_product( tail(args).begin() , tail(args).begin() + n === modified file 'boost/includes/boost/accumulators/statistics/weighted_tail_quantile.hpp' --- boost/includes/boost/accumulators/statistics/weighted_tail_quantile.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_tail_quantile.hpp 2014-05-08 16:23:59 +0000 @@ -66,7 +66,7 @@ struct weighted_tail_quantile_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; + typedef typename numeric::functional::fdiv::result_type float_type; // for boost::result_of typedef Sample result_type; === modified file 'boost/includes/boost/accumulators/statistics/weighted_tail_variate_means.hpp' --- boost/includes/boost/accumulators/statistics/weighted_tail_variate_means.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_tail_variate_means.hpp 2014-05-08 16:23:59 +0000 @@ -37,7 +37,7 @@ namespace boost { // for _BinaryOperatrion2 in std::inner_product below - // mutliplies two values and promotes the result to double + // multiplies two values and promotes the result to double namespace numeric { namespace functional { /////////////////////////////////////////////////////////////////////////////// @@ -107,8 +107,8 @@ struct weighted_tail_variate_means_impl : accumulator_base { - typedef typename numeric::functional::average::result_type float_type; - typedef typename numeric::functional::average::result_type, Weight>::result_type array_type; + typedef typename numeric::functional::fdiv::result_type float_type; + typedef typename numeric::functional::fdiv::result_type, Weight>::result_type array_type; // for boost::result_of typedef iterator_range result_type; === modified file 'boost/includes/boost/accumulators/statistics/weighted_variance.hpp' --- boost/includes/boost/accumulators/statistics/weighted_variance.hpp 2013-08-07 21:38:50 +0000 +++ boost/includes/boost/accumulators/statistics/weighted_variance.hpp 2014-05-08 16:23:59 +0000 @@ -41,7 +41,7 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; lazy_weighted_variance_impl(dont_care) {} @@ -64,7 +64,7 @@ ,\quad n\ge2,\quad\hat{\sigma}_0^2 = 0. \f] where \f$\bar{w}_n\f$ is the sum of the \f$n\f$ weights \f$w_i\f$ and \f$\hat{\mu}_n\f$ - the estimate of the mean of the weighted smaples. Note that the sample variance is not defined for + the estimate of the mean of the weighted samples. Note that the sample variance is not defined for \f$n <= 1\f$. */ template @@ -73,11 +73,11 @@ { typedef typename numeric::functional::multiplies::result_type weighted_sample; // for boost::result_of - typedef typename numeric::functional::average::result_type result_type; + typedef typename numeric::functional::fdiv::result_type result_type; template weighted_variance_impl(Args const &args) - : weighted_variance(numeric::average(args[sample | Sample()], numeric::one::value)) + : weighted_variance(numeric::fdiv(args[sample | Sample()], numeric::one::value)) { } @@ -93,8 +93,8 @@ result_type tmp = args[parameter::keyword::get()] - some_mean(args); this->weighted_variance = - numeric::average(this->weighted_variance * (sum_of_weights(args) - args[weight]), sum_of_weights(args)) - + numeric::average(tmp * tmp * args[weight], sum_of_weights(args) - args[weight] ); + numeric::fdiv(this->weighted_variance * (sum_of_weights(args) - args[weight]), sum_of_weights(args)) + + numeric::fdiv(tmp * tmp * args[weight], sum_of_weights(args) - args[weight] ); } } === modified file 'boost/includes/boost/algorithm/cxx11/copy_if.hpp' --- boost/includes/boost/algorithm/cxx11/copy_if.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/cxx11/copy_if.hpp 2014-05-08 16:23:59 +0000 @@ -63,7 +63,7 @@ /// \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 +/// \return The updated input and output iterators /// /// \param first The start of the input sequence /// \param last One past the end of the input sequence @@ -71,25 +71,26 @@ /// \param p A predicate for testing the elements of the range /// template -OutputIterator copy_while ( InputIterator first, InputIterator last, - OutputIterator result, Predicate p ) +std::pair +copy_while ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { for ( ; first != last && p(*first); ++first ) *result++ = *first; - return result; + return std::make_pair(first, 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 +/// \return The updated input and output iterators /// /// \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 ) +std::pair::type, OutputIterator> +copy_while ( const Range &r, OutputIterator result, Predicate p ) { return boost::algorithm::copy_while (boost::begin (r), boost::end(r), result, p); } @@ -106,11 +107,12 @@ /// \param p A predicate for testing the elements of the range /// template -OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +std::pair +copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { for ( ; first != last && !p(*first); ++first ) *result++ = *first; - return result; + return std::make_pair(first, result); } /// \fn copy_until ( const Range &r, OutputIterator result, Predicate p ) @@ -123,7 +125,8 @@ /// \param p A predicate for testing the elements of the range /// template -OutputIterator copy_until ( const Range &r, OutputIterator result, Predicate p ) +std::pair::type, OutputIterator> +copy_until ( const Range &r, OutputIterator result, Predicate p ) { return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p); } === modified file 'boost/includes/boost/algorithm/cxx11/is_permutation.hpp' --- boost/includes/boost/algorithm/cxx11/is_permutation.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/cxx11/is_permutation.hpp 2014-05-08 16:23:59 +0000 @@ -25,10 +25,6 @@ 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 @@ -38,18 +34,82 @@ template bool operator () ( const T1 &t1 ) const { return p_ ( *it_, t1 ); } private: - Predicate &p_; + Predicate p_; Iterator it_; }; + +// Preconditions: +// 1. The sequences are the same length +// 2. Any common elements on the front have been removed (not necessary for correctness, just for performance) + template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate > + bool is_permutation_inner ( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate p ) { + // 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 ) { + 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; + } + + template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> + bool is_permutation_tag ( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate p, + std::forward_iterator_tag, std::forward_iterator_tag ) { + + // Skip the common prefix (if any) + while ( first1 != last1 && first2 != last2 && p ( *first1, *first2 )) { + ++first1; + ++first2; + } + if ( first1 != last1 && first2 != last2 ) + return boost::algorithm::detail::is_permutation_inner ( first1, last1, first2, last2, + std::equal_to::value_type> ()); + return first1 == last1 && first2 == last2; + } + + template + bool is_permutation_tag ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, + RandomAccessIterator2 first2, RandomAccessIterator2 last2, + BinaryPredicate p, + std::random_access_iterator_tag, std::random_access_iterator_tag ) { + // Cheap check + if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 )) + return false; + // Skip the common prefix (if any) + while ( first1 != last1 && first2 != last2 && p ( *first1, *first2 )) { + ++first1; + ++first2; + } + + if ( first1 != last1 && first2 != last2 ) + return is_permutation_inner (first1, last1, first2, last2, p); + return first1 == last1 && first2 == last2; + } + } /// \endcond +#if __cplusplus >= 201103L +// Use the C++11 versions of is_permutation if it is available +using std::is_permutation; // Section 25.2.12 +#else /// \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 first1 The start of the input sequence +/// \param last1 One past the end of the input sequence /// \param first2 The start of the second sequence /// \param p The predicate to compare elements with /// @@ -69,19 +129,7 @@ // 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 boost::algorithm::detail::is_permutation_inner ( first1, last1, first2, last2, p ); } return true; @@ -90,23 +138,84 @@ /// \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 first1 The start of the input sequence +/// \param last2 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 ) +bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, 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> ()); +// Skip the common prefix (if any) + std::pair eq = std::mismatch (first1, last1, first2 ); + first1 = eq.first; + first2 = eq.second; + if ( first1 != last1 ) { + // Create last2 + ForwardIterator2 last2 = first2; + std::advance ( last2, std::distance (first1, last1)); + return boost::algorithm::detail::is_permutation_inner ( first1, last1, first2, last2, + std::equal_to::value_type> ()); + } + return true; } #endif +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, +/// ForwardIterator2 first2, ForwardIterator2 last2 ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first1 The start of the input sequence +/// \param last2 One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \param last1 One past the end 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 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 ) +{ +// 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::detail::is_permutation_tag ( + first1, last1, first2, last2, + std::equal_to::value_type> (), + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, +/// ForwardIterator2 first2, ForwardIterator2 last2, +/// BinaryPredicate p ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first1 The start of the input sequence +/// \param last1 One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \param last2 One past the end of the second sequence +/// \param pred 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, ForwardIterator2 last2, + BinaryPredicate pred ) +{ + return boost::algorithm::detail::is_permutation_tag ( + first1, last1, first2, last2, pred, + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + + + /// \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 /// === added directory 'boost/includes/boost/algorithm/cxx14' === added file 'boost/includes/boost/algorithm/cxx14/equal.hpp' --- boost/includes/boost/algorithm/cxx14/equal.hpp 1970-01-01 00:00:00 +0000 +++ boost/includes/boost/algorithm/cxx14/equal.hpp 2014-05-08 16:23:59 +0000 @@ -0,0 +1,97 @@ +/* + 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 equal.hpp +/// \brief Test ranges to if they are equal +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_EQUAL_HPP +#define BOOST_ALGORITHM_EQUAL_HPP + +#include // for std::equal +#include // for std::equal_to + +namespace boost { namespace algorithm { + +namespace detail { + + template + struct eq : public std::binary_function { + bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} + }; + + template + bool equal ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, + RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred, + std::random_access_iterator_tag, std::random_access_iterator_tag ) + { + // Random-access iterators let is check the sizes in constant time + if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 )) + return false; + // If we know that the sequences are the same size, the original version is fine + return std::equal ( first1, last1, first2, pred ); + } + + template + bool equal ( InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred, + std::input_iterator_tag, std::input_iterator_tag ) + { + for (; first1 != last1 && first2 != last2; ++first1, ++first2 ) + if ( !pred(*first1, *first2 )) + return false; + + return first1 == last1 && first2 == last2; + } +} + +/// \fn equal ( InputIterator1 first1, InputIterator1 last1, +/// InputIterator2 first2, InputIterator2 last2, +/// BinaryPredicate pred ) +/// \return true if all elements in the two ranges are equal +/// +/// \param first1 The start of the first range. +/// \param last1 One past the end of the first range. +/// \param first2 The start of the second range. +/// \param last2 One past the end of the second range. +/// \param pred A predicate for comparing the elements of the ranges +template +bool equal ( InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred ) +{ + return boost::algorithm::detail::equal ( + first1, last1, first2, last2, pred, + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + +/// \fn equal ( InputIterator1 first1, InputIterator1 last1, +/// InputIterator2 first2, InputIterator2 last2 ) +/// \return true if all elements in the two ranges are equal +/// +/// \param first1 The start of the first range. +/// \param last1 One past the end of the first range. +/// \param first2 The start of the second range. +/// \param last2 One past the end of the second range. +template +bool equal ( InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 ) +{ + return boost::algorithm::detail::equal ( + first1, last1, first2, last2, + boost::algorithm::detail::eq< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type> (), + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + +// There are already range-based versions of these. + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_EQUAL_HPP === added file 'boost/includes/boost/algorithm/cxx14/is_permutation.hpp' --- boost/includes/boost/algorithm/cxx14/is_permutation.hpp 1970-01-01 00:00:00 +0000 +++ boost/includes/boost/algorithm/cxx14/is_permutation.hpp 2014-05-08 16:23:59 +0000 @@ -0,0 +1,130 @@ +/* + Copyright (c) Marshall Clow 2013 + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file equal.hpp +/// \brief Determines if one +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IS_PERMUTATION_HPP +#define BOOST_ALGORITHM_IS_PERMUTATION_HPP + +#include +#include // for std::equal_to + +namespace boost { namespace algorithm { + +namespace detail { + + template + struct is_perm_eq : public std::binary_function { + bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} + }; + + + template + bool is_permutation ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, + RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred, + std::random_access_iterator_tag, std::random_access_iterator_tag ) + { + // Random-access iterators let is check the sizes in constant time + if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 )) + return false; + // If we know that the sequences are the same size, the original version is fine + return std::is_permutation ( first1, last1, first2, pred ); + } + + + template + bool is_permutation ( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred, + std::forward_iterator_tag, std::forward_iterator_tag ) + { + + // Look for common prefix + for (; first1 != last1 && first2 != last2; ++first1, ++first2) + if (!pred(*first1, *first2)) + goto not_done; + // We've reached the end of one of the sequences without a mismatch. + return first1 == last1 && first2 == last2; + not_done: + + // Check and make sure that we have the same # of elements left + typedef typename std::iterator_traits::difference_type diff1_t; + diff1_t len1 = _VSTD::distance(first1, last1); + typedef typename std::iterator_traits::difference_type diff2_t; + diff2_t len2 = _VSTD::distance(first2, last2); + if (len1 != len2) + return false; + + // For each element in [f1, l1) see if there are the + // same number of equal elements in [f2, l2) + for ( ForwardIterator1 i = first1; i != last1; ++i ) + { + // Have we already counted this value? + ForwardIterator1 j; + for ( j = first1; j != i; ++j ) + if (pred(*j, *i)) + break; + if ( j == i ) // didn't find it... + { + // Count number of *i in [f2, l2) + diff1_t c2 = 0; + for ( ForwardIterator2 iter2 = first2; iter2 != last2; ++iter2 ) + if (pred(*i, *iter2)) + ++c2; + if (c2 == 0) + return false; + + // Count number of *i in [i, l1) + diff1_t c1 = 0; + for (_ForwardIterator1 iter1 = i; iter1 != last1; ++iter1 ) + if (pred(*i, *iter1)) + ++c1; + if (c1 != c2) + return false; + } + } + return true; + } + +} + + +template +bool is_permutation ( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred ) +{ + return boost::algorithm::detail::is_permutation ( + first1, last1, first2, last2, pred, + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + +template +bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 ) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type value1_t; + typedef typename iterator_traits<_ForwardIterator2>::value_type value2_t; + return boost::algorithm::detail::is_permutation ( + first1, last1, first2, last2, + boost::algorithm::detail::is_perm_eq< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type> (), + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); +} + +// There are already range-based versions of these. + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_IS_PERMUTATION_HPP === added file 'boost/includes/boost/algorithm/cxx14/mismatch.hpp' --- boost/includes/boost/algorithm/cxx14/mismatch.hpp 1970-01-01 00:00:00 +0000 +++ boost/includes/boost/algorithm/cxx14/mismatch.hpp 2014-05-08 16:23:59 +0000 @@ -0,0 +1,65 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt) +*/ + +/// \file mismatch.hpp +/// \brief Find the first mismatched element in a sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_MISMATCH_HPP +#define BOOST_ALGORITHM_MISMATCH_HPP + +#include // for std::mismatch +#include // for std::pair + +namespace boost { namespace algorithm { + +/// \fn mismatch ( InputIterator1 first1, InputIterator1 last1, +/// InputIterator2 first2, InputIterator2 last2, +/// BinaryPredicate pred ) +/// \return a pair of iterators pointing to the first elements in the sequence that do not match +/// +/// \param first1 The start of the first range. +/// \param last1 One past the end of the first range. +/// \param first2 The start of the second range. +/// \param last2 One past the end of the second range. +/// \param pred A predicate for comparing the elements of the ranges +template +std::pair mismatch ( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + BinaryPredicate pred ) +{ + for (; first1 != last1 && first2 != last2; ++first1, ++first2) + if ( !pred ( *first1, *first2 )) + break; + return std::pair(first1, first2); +} + +/// \fn mismatch ( InputIterator1 first1, InputIterator1 last1, +/// InputIterator2 first2, InputIterator2 last2 ) +/// \return a pair of iterators pointing to the first elements in the sequence that do not match +/// +/// \param first1 The start of the first range. +/// \param last1 One past the end of the first range. +/// \param first2 The start of the second range. +/// \param last2 One past the end of the second range. +template +std::pair mismatch ( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 ) +{ + for (; first1 != last1 && first2 != last2; ++first1, ++first2) + if ( *first1 != *first2 ) + break; + return std::pair(first1, first2); +} + +// There are already range-based versions of these. + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_MISMATCH_HPP === added file 'boost/includes/boost/algorithm/gather.hpp' --- boost/includes/boost/algorithm/gather.hpp 1970-01-01 00:00:00 +0000 +++ boost/includes/boost/algorithm/gather.hpp 2014-05-08 16:23:59 +0000 @@ -0,0 +1,123 @@ +/* + Copyright 2008 Adobe Systems Incorporated + + Distributed under the 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: + January 2008 mtc Version for Adobe Source Library + January 2013 mtc Version for Boost.Algorithm + +*/ + +/**************************************************************************************************/ + +/*! +\author Marshall Clow +\date January 2008 +*/ + +#ifndef BOOST_ALGORITHM_GATHER_HPP +#define BOOST_ALGORITHM_GATHER_HPP + +#include // for std::stable_partition +#include + +#include // for boost::bind +#include // for boost::begin(range) +#include // for boost::end(range) + + +/**************************************************************************************************/ +/*! + \defgroup gather gather + \ingroup mutating_algorithm + + \c gather() takes a collection of elements defined by a pair of iterators and moves + the ones satisfying a predicate to them to a position (called the pivot) within + the sequence. The algorithm is stable. The result is a pair of iterators that + contains the items that satisfy the predicate. + + Given an sequence containing: +
+    0 1 2 3 4 5 6 7 8 9
+    
+ + a call to gather ( arr, arr + 10, arr + 4, IsEven ()) will result in: + +
+    1 3 0 2 4 6 8 5 7 9
+        |---|-----|
+      first |  second
+          pivot
+    
+ + + The problem is broken down into two basic steps, namely, moving the items before the pivot + and then moving the items from the pivot to the end. These "moves" are done with calls to + stable_partition. + + \par Storage Requirements: + + The algorithm uses stable_partition, which will attempt to allocate temporary memory, + but will work in-situ if there is none available. + + \par Time Complexity: + + If there is sufficient memory available, the run time is linear in N. + If there is not any memory available, then the run time is O(N log N). +*/ + +/**************************************************************************************************/ + +namespace boost { namespace algorithm { + +/**************************************************************************************************/ + +/*! + \ingroup gather + \brief iterator-based gather implementation +*/ + +template < + typename BidirectionalIterator, // Iter models BidirectionalIterator + typename Pred> // Pred models UnaryPredicate +std::pair gather + ( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred ) +{ +// The first call partitions everything up to (but not including) the pivot element, +// while the second call partitions the rest of the sequence. + return std::make_pair ( + std::stable_partition ( first, pivot, !boost::bind ( pred, _1 )), + std::stable_partition ( pivot, last, boost::bind ( pred, _1 ))); +} + +/**************************************************************************************************/ + +/*! + \ingroup gather + \brief range-based gather implementation +*/ + +template < + typename BidirectionalRange, // + typename Pred> // Pred models UnaryPredicate +std::pair< + typename boost::range_iterator::type, + typename boost::range_iterator::type> +gather ( + const BidirectionalRange &range, + typename boost::range_iterator::type pivot, + Pred pred ) +{ + return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred ); +} + +/**************************************************************************************************/ + +}} // namespace + +/**************************************************************************************************/ + +#endif + === modified file 'boost/includes/boost/algorithm/hex.hpp' --- boost/includes/boost/algorithm/hex.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/hex.hpp 2014-05-08 16:23:59 +0000 @@ -10,12 +10,6 @@ /* 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 @@ -42,11 +36,11 @@ /*! \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 @@ -69,18 +63,16 @@ 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 + template + unsigned char hex_char_to_int ( T val ) { + char c = static_cast ( val ); + unsigned retval = 0; + if ( c >= '0' && c <= '9' ) retval = c - '0'; + else if ( c >= 'A' && c <= 'F' ) retval = c - 'A' + 10; + else if ( c >= 'a' && c <= 'f' ) retval = c - 'a' + 10; + else BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c)); + return retval; } - } // My own iterator_traits class. // It is here so that I can "reach inside" some kinds of output iterators @@ -134,7 +126,7 @@ 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)); + res = ( 16 * res ) + hex_char_to_int (*first); } *out = res; === modified file 'boost/includes/boost/algorithm/string/concept.hpp' --- boost/includes/boost/algorithm/string/concept.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/concept.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_CONCEPT_HPP #include -#include +#include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/find_format.hpp' --- boost/includes/boost/algorithm/string/detail/find_format.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/find_format.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_FIND_FORMAT_DETAIL_HPP #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/find_format_all.hpp' --- boost/includes/boost/algorithm/string/detail/find_format_all.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/find_format_all.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/find_format_store.hpp' --- boost/includes/boost/algorithm/string/detail/find_format_store.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/find_format_store.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP #include -#include +#include namespace boost { namespace algorithm { === modified file 'boost/includes/boost/algorithm/string/detail/find_iterator.hpp' --- boost/includes/boost/algorithm/string/detail/find_iterator.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/find_iterator.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/finder.hpp' --- boost/includes/boost/algorithm/string/detail/finder.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/finder.hpp 2014-05-08 16:23:59 +0000 @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -142,7 +142,6 @@ ForwardIteratorT End, std::forward_iterator_tag ) const { - typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; first_finder_type first_finder( @@ -263,7 +262,6 @@ ForwardIteratorT End, unsigned int N) const { - typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; // Sanity check @@ -298,7 +296,6 @@ ForwardIteratorT End, unsigned int N) const { - typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; // Sanity check @@ -362,7 +359,6 @@ unsigned int N, std::random_access_iterator_tag ) { - typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; if ( (End<=Begin) || ( static_cast(End-Begin) < N ) ) @@ -436,7 +432,6 @@ unsigned int N, std::random_access_iterator_tag ) { - typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; if ( (End<=Begin) || ( static_cast(End-Begin) < N ) ) === modified file 'boost/includes/boost/algorithm/string/detail/finder_regex.hpp' --- boost/includes/boost/algorithm/string/detail/finder_regex.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/finder_regex.hpp 2014-05-08 16:23:59 +0000 @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/formatter.hpp' --- boost/includes/boost/algorithm/string/detail/formatter.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/formatter.hpp 2014-05-08 16:23:59 +0000 @@ -12,7 +12,7 @@ #define BOOST_STRING_FORMATTER_DETAIL_HPP -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/detail/util.hpp' --- boost/includes/boost/algorithm/string/detail/util.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/detail/util.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include #include -#include +#include namespace boost { namespace algorithm { === modified file 'boost/includes/boost/algorithm/string/erase.hpp' --- boost/includes/boost/algorithm/string/erase.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/erase.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/find.hpp' --- boost/includes/boost/algorithm/string/find.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/find.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/find_format.hpp' --- boost/includes/boost/algorithm/string/find_format.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/find_format.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/find_iterator.hpp' --- boost/includes/boost/algorithm/string/find_iterator.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/find_iterator.hpp 2014-05-08 16:23:59 +0000 @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -132,10 +132,7 @@ // increment void increment() { - 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); + m_Match=this->do_find(m_Match.end(),m_End); } // comparison === modified file 'boost/includes/boost/algorithm/string/finder.hpp' --- boost/includes/boost/algorithm/string/finder.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/finder.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/formatter.hpp' --- boost/includes/boost/algorithm/string/formatter.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/formatter.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include === modified file 'boost/includes/boost/algorithm/string/iter_find.hpp' --- boost/includes/boost/algorithm/string/iter_find.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/iter_find.hpp 2014-05-08 16:23:59 +0000 @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/predicate.hpp' --- boost/includes/boost/algorithm/string/predicate.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/predicate.hpp 2014-05-08 16:23:59 +0000 @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include === modified file 'boost/includes/boost/algorithm/string/regex.hpp' --- boost/includes/boost/algorithm/string/regex.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/regex.hpp 2014-05-08 16:23:59 +0000 @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/replace.hpp' --- boost/includes/boost/algorithm/string/replace.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/replace.hpp 2014-05-08 16:23:59 +0000 @@ -13,7 +13,7 @@ #include -#include +#include #include #include #include === modified file 'boost/includes/boost/algorithm/string/trim.hpp' --- boost/includes/boost/algorithm/string/trim.hpp 2013-08-07 21:38:52 +0000 +++ boost/includes/boost/algorithm/string/trim.hpp 2014-05-08 16:23:59 +0000 @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include === modified file 'boost/includes/boost/any.hpp' --- boost/includes/boost/any.hpp 2010-08-08 16:26:41 +0000 +++ boost/includes/boost/any.hpp 2014-05-08 16:23:39 +0000 @@ -3,21 +3,31 @@ #ifndef BOOST_ANY_INCLUDED #define BOOST_ANY_INCLUDED +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + // what: variant type boost::any // who: contributed by Kevlin Henney, // with features contributed and bugs found by -// Ed Brey, Mark Rodgers, Peter Dimov, and James Curran -// when: July 2001 -// where: tested with BCC 5.5, MSVC 6.0, and g++ 2.95 +// Antony Polukhin, Ed Brey, Mark Rodgers, +// Peter Dimov, and James Curran +// when: July 2001, April 2013 - May 2013 #include #include #include "boost/config.hpp" #include +#include +#include #include +#include #include #include +#include +#include +#include // See boost/python/type_id.hpp // TODO: add BOOST_TYPEID_COMPARE_BY_NAME to config.hpp @@ -30,20 +40,25 @@ #include # endif +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4172) // Mistakenly warns: returning address of local variable or temporary +#endif + namespace boost { class any { public: // structors - any() + any() BOOST_NOEXCEPT : content(0) { } template any(const ValueType & value) - : content(new holder(value)) + : content(new holder::type>(value)) { } @@ -52,19 +67,39 @@ { } - ~any() +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + // Move constructor + any(any&& other) BOOST_NOEXCEPT + : content(other.content) + { + other.content = 0; + } + + // Perfect forwarding of ValueType + template + any(ValueType&& value + , typename boost::disable_if >::type* = 0 // disable if value has type `any&` + , typename boost::disable_if >::type* = 0) // disable if value has type `const ValueType&&` + : content(new holder< typename decay::type >(static_cast(value))) + { + } +#endif + + ~any() BOOST_NOEXCEPT { delete content; } public: // modifiers - any & swap(any & rhs) + any & swap(any & rhs) BOOST_NOEXCEPT { std::swap(content, rhs.content); return *this; } + +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template any & operator=(const ValueType & rhs) { @@ -74,18 +109,47 @@ any & operator=(any rhs) { + any(rhs).swap(*this); + return *this; + } + +#else + any & operator=(const any& rhs) + { + any(rhs).swap(*this); + return *this; + } + + // move assignement + any & operator=(any&& rhs) BOOST_NOEXCEPT + { rhs.swap(*this); - return *this; - } + any().swap(rhs); + return *this; + } + + // Perfect forwarding of ValueType + template + any & operator=(ValueType&& rhs) + { + any(static_cast(rhs)).swap(*this); + return *this; + } +#endif public: // queries - bool empty() const + bool empty() const BOOST_NOEXCEPT { return !content; } - const std::type_info & type() const + void clear() BOOST_NOEXCEPT + { + any().swap(*this); + } + + const std::type_info & type() const BOOST_NOEXCEPT { return content ? content->type() : typeid(void); } @@ -106,7 +170,7 @@ public: // queries - virtual const std::type_info & type() const = 0; + virtual const std::type_info & type() const BOOST_NOEXCEPT = 0; virtual placeholder * clone() const = 0; @@ -122,9 +186,15 @@ { } +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + holder(ValueType&& value) + : held(static_cast< ValueType&& >(value)) + { + } +#endif public: // queries - virtual const std::type_info & type() const + virtual const std::type_info & type() const BOOST_NOEXCEPT { return typeid(ValueType); } @@ -147,10 +217,10 @@ private: // representation template - friend ValueType * any_cast(any *); + friend ValueType * any_cast(any *) BOOST_NOEXCEPT; template - friend ValueType * unsafe_any_cast(any *); + friend ValueType * unsafe_any_cast(any *) BOOST_NOEXCEPT; #else @@ -161,11 +231,16 @@ placeholder * content; }; + + inline void swap(any & lhs, any & rhs) BOOST_NOEXCEPT + { + lhs.swap(rhs); + } - class bad_any_cast : public std::bad_cast + class BOOST_SYMBOL_VISIBLE bad_any_cast : public std::bad_cast { public: - virtual const char * what() const throw() + virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW { return "boost::bad_any_cast: " "failed conversion using boost::any_cast"; @@ -173,7 +248,7 @@ }; template - ValueType * any_cast(any * operand) + ValueType * any_cast(any * operand) BOOST_NOEXCEPT { return operand && #ifdef BOOST_AUX_ANY_TYPE_ID_NAME @@ -186,7 +261,7 @@ } template - inline const ValueType * any_cast(const any * operand) + inline const ValueType * any_cast(const any * operand) BOOST_NOEXCEPT { return any_cast(const_cast(operand)); } @@ -209,7 +284,18 @@ nonref * result = any_cast(&operand); if(!result) boost::throw_exception(bad_any_cast()); - return *result; + + // Attempt to avoid construction of a temporary object in cases when + // `ValueType` is not a reference. Example: + // `static_cast(*result);` + // which is equal to `std::string(*result);` + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_reference, + ValueType, + BOOST_DEDUCED_TYPENAME boost::add_reference::type + >::type ref_type; + + return static_cast(*result); } template @@ -226,19 +312,33 @@ return any_cast(const_cast(operand)); } +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template + inline ValueType&& any_cast(any&& operand) + { + BOOST_STATIC_ASSERT_MSG( + boost::is_rvalue_reference::value + || boost::is_const< typename boost::remove_reference::type >::value, + "boost::any_cast shall not be used for getting nonconst references to temporary objects" + ); + return any_cast(operand); + } +#endif + + // Note: The "unsafe" versions of any_cast are not part of the // public interface and may be removed at any time. They are // required where we know what type is stored in the any and can't // use typeid() comparison, e.g., when our types may travel across // different shared libraries. template - inline ValueType * unsafe_any_cast(any * operand) + inline ValueType * unsafe_any_cast(any * operand) BOOST_NOEXCEPT { return &static_cast *>(operand->content)->held; } template - inline const ValueType * unsafe_any_cast(const any * operand) + inline const ValueType * unsafe_any_cast(const any * operand) BOOST_NOEXCEPT { return unsafe_any_cast(const_cast(operand)); } @@ -250,4 +350,8 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + #endif === modified file 'boost/includes/boost/asio.hpp' --- boost/includes/boost/asio.hpp 2013-08-07 21:36:53 +0000 +++ boost/includes/boost/asio.hpp 2014-05-08 16:23:39 +0000 @@ -2,7 +2,7 @@ // asio.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -17,6 +17,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include #include #include #include @@ -40,12 +41,20 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include +#include +#include #include +#include #include +#include #include #include #include === added file 'boost/includes/boost/asio/async_result.hpp' --- boost/includes/boost/asio/async_result.hpp 1970-01-01 00:00:00 +0000 +++ boost/includes/boost/asio/async_result.hpp 2014-05-08 16:23:59 +0000 @@ -0,0 +1,96 @@ +// +// async_result.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2013 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_ASYNC_RESULT_HPP +#define BOOST_ASIO_ASYNC_RESULT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include + +#include + +namespace boost { +namespace asio { + +/// An interface for customising the behaviour of an initiating function. +/** + * This template may be specialised for user-defined handler types. + */ +template +class async_result +{ +public: + /// The return type of the initiating function. + typedef void type; + + /// Construct an async result from a given handler. + /** + * When using a specalised async_result, the constructor has an opportunity + * to initialise some state associated with the handler, which is then + * returned from the initiating function. + */ + explicit async_result(Handler&) + { + } + + /// Obtain the value to be returned from the initiating function. + type get() + { + } +}; + +namespace detail { + +// Helper template to deduce the true type of a handler, capture a local copy +// of the handler, and then create an async_result for the handler. +template +struct async_result_init +{ + explicit async_result_init(BOOST_ASIO_MOVE_ARG(Handler) orig_handler) + : handler(BOOST_ASIO_MOVE_CAST(Handler)(orig_handler)), + result(handler) + { + } + + typename handler_type::type handler; + async_result::type> result; +}; + +template +struct async_result_type_helper +{ + typedef typename async_result< + typename handler_type::type + >::type type; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#if defined(GENERATING_DOCUMENTATION) +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + void_or_deduced +#elif defined(_MSC_VER) && (_MSC_VER < 1500) +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + typename ::boost::asio::detail::async_result_type_helper::type +#else +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + typename ::boost::asio::async_result< \ + typename ::boost::asio::handler_type::type>::type +#endif + +#endif // BOOST_ASIO_ASYNC_RESULT_HPP === modified file 'boost/includes/boost/asio/basic_datagram_socket.hpp' --- boost/includes/boost/asio/basic_datagram_socket.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_datagram_socket.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_datagram_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -166,6 +167,50 @@ BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)); return *this; } + + /// Move-construct a basic_datagram_socket from a socket of another protocol + /// type. + /** + * This constructor moves a datagram socket from one object to another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + template + basic_datagram_socket( + basic_datagram_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_datagram_socket< + Protocol1, DatagramSocketService1>)(other)) + { + } + + /// Move-assign a basic_datagram_socket from a socket of another protocol + /// type. + /** + * This assignment operator moves a datagram socket from one object to + * another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_datagram_socket>::type& operator=( + basic_datagram_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_datagram_socket< + Protocol1, DatagramSocketService1>)(other)); + return *this; + } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Send some data on a connected socket. @@ -290,22 +335,23 @@ * std::vector. */ template - void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send(this->get_implementation(), + return this->get_service().async_send(this->get_implementation(), buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send on a connected socket. /** - * This function is used to send data on the datagram socket. The function - * call will block until the data has been sent successfully or an error - * occurs. + * This function is used to asynchronously send data on the datagram socket. + * The function call always returns immediately. * * @param buffers One or more data buffers to be sent on the socket. Although * the buffers object may be copied as necessary, ownership of the underlying @@ -331,7 +377,9 @@ * socket. */ template - void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -339,7 +387,7 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send(this->get_implementation(), + return this->get_service().async_send(this->get_implementation(), buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } @@ -469,7 +517,9 @@ * std::vector. */ template - void async_send_to(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -477,8 +527,9 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send_to(this->get_implementation(), buffers, - destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, 0, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -509,7 +560,9 @@ * boost::asio::io_service::post(). */ template - void async_send_to(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -517,8 +570,9 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send_to(this->get_implementation(), buffers, - destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -647,14 +701,16 @@ * std::vector. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), + return this->get_service().async_receive(this->get_implementation(), buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } @@ -687,7 +743,9 @@ * datagram socket. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -695,7 +753,7 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), + return this->get_service().async_receive(this->get_implementation(), buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } @@ -819,13 +877,15 @@ * To receive into a single data buffer use the @ref buffer function as * follows: * @code socket.async_receive_from( - * boost::asio::buffer(data, size), 0, sender_endpoint, handler); @endcode + * boost::asio::buffer(data, size), sender_endpoint, handler); @endcode * See the @ref buffer documentation for information on receiving into * multiple buffers in one go, and how to use it with arrays, boost::array or * std::vector. */ template - void async_receive_from(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -833,8 +893,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive_from(this->get_implementation(), buffers, - sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -867,7 +928,9 @@ * boost::asio::io_service::post(). */ template - void async_receive_from(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -875,8 +938,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive_from(this->get_implementation(), buffers, - sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_deadline_timer.hpp' --- boost/includes/boost/asio/basic_deadline_timer.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_deadline_timer.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -16,6 +16,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include + +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ + || defined(GENERATING_DOCUMENTATION) + #include #include #include @@ -492,13 +496,15 @@ * boost::asio::io_service::post(). */ template - void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, + void (boost::system::error_code)) + async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WaitHandler. BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - this->service.async_wait(this->implementation, + return this->service.async_wait(this->implementation, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); } }; @@ -508,4 +514,7 @@ #include +#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) + // || defined(GENERATING_DOCUMENTATION) + #endif // BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP === modified file 'boost/includes/boost/asio/basic_io_object.hpp' --- boost/includes/boost/asio/basic_io_object.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_io_object.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_io_object.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) === modified file 'boost/includes/boost/asio/basic_raw_socket.hpp' --- boost/includes/boost/asio/basic_raw_socket.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_raw_socket.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_raw_socket.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -165,6 +166,46 @@ BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)); return *this; } + + /// Move-construct a basic_raw_socket from a socket of another protocol type. + /** + * This constructor moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + template + basic_raw_socket(basic_raw_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_raw_socket< + Protocol1, RawSocketService1>)(other)) + { + } + + /// Move-assign a basic_raw_socket from a socket of another protocol type. + /** + * This assignment operator moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_raw_socket>::type& operator=( + basic_raw_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_raw_socket< + Protocol1, RawSocketService1>)(other)); + return *this; + } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Send some data on a connected socket. @@ -285,14 +326,16 @@ * std::vector. */ template - void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send(this->get_implementation(), + return this->get_service().async_send(this->get_implementation(), buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } @@ -325,7 +368,9 @@ * socket. */ template - void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -333,7 +378,7 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send(this->get_implementation(), + return this->get_service().async_send(this->get_implementation(), buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } @@ -463,7 +508,9 @@ * std::vector. */ template - void async_send_to(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -471,8 +518,8 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send_to(this->get_implementation(), buffers, - destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + return this->get_service().async_send_to(this->get_implementation(), + buffers, destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -503,7 +550,9 @@ * boost::asio::io_service::post(). */ template - void async_send_to(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -511,8 +560,9 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send_to(this->get_implementation(), buffers, - destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -641,14 +691,16 @@ * std::vector. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), + return this->get_service().async_receive(this->get_implementation(), buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } @@ -681,7 +733,9 @@ * raw socket. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -689,7 +743,7 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), + return this->get_service().async_receive(this->get_implementation(), buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } @@ -819,7 +873,9 @@ * std::vector. */ template - void async_receive_from(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -827,8 +883,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive_from(this->get_implementation(), buffers, - sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -861,7 +918,9 @@ * boost::asio::io_service::post(). */ template - void async_receive_from(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -869,8 +928,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive_from(this->get_implementation(), buffers, - sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_seq_packet_socket.hpp' --- boost/includes/boost/asio/basic_seq_packet_socket.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_seq_packet_socket.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_seq_packet_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -171,6 +171,51 @@ BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)); return *this; } + + /// Move-construct a basic_seq_packet_socket from a socket of another protocol + /// type. + /** + * This constructor moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + template + basic_seq_packet_socket( + basic_seq_packet_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket< + Protocol1, SeqPacketSocketService1>)(other)) + { + } + + /// Move-assign a basic_seq_packet_socket from a socket of another protocol + /// type. + /** + * This assignment operator moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_seq_packet_socket>::type& operator=( + basic_seq_packet_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket< + Protocol1, SeqPacketSocketService1>)(other)); + return *this; + } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Send some data on the socket. @@ -267,7 +312,9 @@ * std::vector. */ template - void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { @@ -275,7 +322,7 @@ // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_send(this->get_implementation(), + return this->get_service().async_send(this->get_implementation(), buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } @@ -437,7 +484,9 @@ * std::vector. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, socket_base::message_flags& out_flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { @@ -445,8 +494,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), buffers, - 0, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive( + this->get_implementation(), buffers, 0, out_flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -492,7 +542,9 @@ * std::vector. */ template - void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, socket_base::message_flags in_flags, socket_base::message_flags& out_flags, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) @@ -501,8 +553,9 @@ // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_receive(this->get_implementation(), buffers, - in_flags, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + return this->get_service().async_receive( + this->get_implementation(), buffers, in_flags, out_flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_serial_port.hpp' --- boost/includes/boost/asio/basic_serial_port.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_serial_port.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_serial_port.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -559,14 +559,16 @@ * std::vector. */ template - void async_write_some(const ConstBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (boost::system::error_code, std::size_t)) + async_write_some(const ConstBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - this->get_service().async_write_some(this->get_implementation(), + return this->get_service().async_write_some(this->get_implementation(), buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } @@ -670,14 +672,16 @@ * std::vector. */ template - void async_read_some(const MutableBufferSequence& buffers, + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (boost::system::error_code, std::size_t)) + async_read_some(const MutableBufferSequence& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - this->get_service().async_read_some(this->get_implementation(), + return this->get_service().async_read_some(this->get_implementation(), buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_signal_set.hpp' --- boost/includes/boost/asio/basic_signal_set.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_signal_set.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_signal_set.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -365,13 +365,15 @@ * boost::asio::io_service::post(). */ template - void async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) + BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, + void (boost::system::error_code, int)) + async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a SignalHandler. BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; - this->service.async_wait(this->implementation, + return this->service.async_wait(this->implementation, BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_socket.hpp' --- boost/includes/boost/asio/basic_socket.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_socket.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_socket.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -16,9 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include +#include #include #include #include +#include #include #include @@ -173,6 +175,51 @@ BOOST_ASIO_MOVE_CAST(basic_socket)(other)); return *this; } + + // All sockets have access to each other's implementations. + template + friend class basic_socket; + + /// Move-construct a basic_socket from a socket of another protocol type. + /** + * This constructor moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + basic_socket(basic_socket&& other, + typename enable_if::value>::type* = 0) + : basic_io_object(other.get_io_service()) + { + this->get_service().template converting_move_construct( + this->get_implementation(), other.get_implementation()); + } + + /// Move-assign a basic_socket from a socket of another protocol type. + /** + * This assignment operator moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_socket>::type& operator=( + basic_socket&& other) + { + basic_socket tmp(BOOST_ASIO_MOVE_CAST2(basic_socket< + Protocol1, SocketService1>)(other)); + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket)(tmp)); + return *this; + } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get a reference to the lowest layer. @@ -395,7 +442,7 @@ * CancelIoEx function is always used. This function does not have the * problems described above. */ -#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) \ +#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \ && !defined(BOOST_ASIO_ENABLE_CANCELIO) __declspec(deprecated("By default, this function always fails with " @@ -443,7 +490,7 @@ * CancelIoEx function is always used. This function does not have the * problems described above. */ -#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) \ +#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \ && !defined(BOOST_ASIO_ENABLE_CANCELIO) __declspec(deprecated("By default, this function always fails with " @@ -698,7 +745,9 @@ * @endcode */ template - void async_connect(const endpoint_type& peer_endpoint, + BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler, + void (boost::system::error_code)) + async_connect(const endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { // If you get an error on the following line it means that your handler does @@ -711,14 +760,21 @@ const protocol_type protocol = peer_endpoint.protocol(); if (this->get_service().open(this->get_implementation(), protocol, ec)) { + detail::async_result_init< + ConnectHandler, void (boost::system::error_code)> init( + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); + this->get_io_service().post( boost::asio::detail::bind_handler( - BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), ec)); - return; + BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE( + ConnectHandler, void (boost::system::error_code)))( + init.handler), ec)); + + return init.result.get(); } } - this->get_service().async_connect(this->get_implementation(), + return this->get_service().async_connect(this->get_implementation(), peer_endpoint, BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } === modified file 'boost/includes/boost/asio/basic_socket_acceptor.hpp' --- boost/includes/boost/asio/basic_socket_acceptor.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_socket_acceptor.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_socket_acceptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -211,6 +212,54 @@ BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)); return *this; } + + // All socket acceptors have access to each other's implementations. + template + friend class basic_socket_acceptor; + + /// Move-construct a basic_socket_acceptor from an acceptor of another + /// protocol type. + /** + * This constructor moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + basic_socket_acceptor( + basic_socket_acceptor&& other, + typename enable_if::value>::type* = 0) + : basic_io_object(other.get_io_service()) + { + this->get_service().template converting_move_construct( + this->get_implementation(), other.get_implementation()); + } + + /// Move-assign a basic_socket_acceptor from an acceptor of another protocol + /// type. + /** + * This assignment operator moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_socket_acceptor>::type& operator=( + basic_socket_acceptor&& other) + { + basic_socket_acceptor tmp(BOOST_ASIO_MOVE_CAST2(basic_socket_acceptor< + Protocol1, SocketAcceptorService1>)(other)); + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(tmp)); + return *this; + } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Open the acceptor using the specified protocol. @@ -316,8 +365,9 @@ * @par Example * @code * boost::asio::ip::tcp::acceptor acceptor(io_service); - * acceptor.open(boost::asio::ip::tcp::v4()); - * acceptor.bind(boost::asio::ip::tcp::endpoint(12345)); + * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); + * acceptor.open(endpoint.protocol()); + * acceptor.bind(endpoint); * @endcode */ void bind(const endpoint_type& endpoint) @@ -340,9 +390,10 @@ * @par Example * @code * boost::asio::ip::tcp::acceptor acceptor(io_service); - * acceptor.open(boost::asio::ip::tcp::v4()); + * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); + * acceptor.open(endpoint.protocol()); * boost::system::error_code ec; - * acceptor.bind(boost::asio::ip::tcp::endpoint(12345), ec); + * acceptor.bind(endpoint, ec); * if (ec) * { * // An error occurred. @@ -871,11 +922,13 @@ * acceptor.accept(socket); * @endcode */ - template - void accept(basic_socket& peer) + template + void accept(basic_socket& peer, + typename enable_if::value>::type* = 0) { boost::system::error_code ec; - this->get_service().accept(this->get_implementation(), peer, 0, ec); + this->get_service().accept(this->get_implementation(), + peer, static_cast(0), ec); boost::asio::detail::throw_error(ec, "accept"); } @@ -902,12 +955,14 @@ * } * @endcode */ - template + template boost::system::error_code accept( - basic_socket& peer, - boost::system::error_code& ec) + basic_socket& peer, + boost::system::error_code& ec, + typename enable_if::value>::type* = 0) { - return this->get_service().accept(this->get_implementation(), peer, 0, ec); + return this->get_service().accept(this->get_implementation(), + peer, static_cast(0), ec); } /// Start an asynchronous accept. @@ -948,16 +1003,20 @@ * acceptor.async_accept(socket, accept_handler); * @endcode */ - template - void async_accept(basic_socket& peer, - BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) + template + BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, + void (boost::system::error_code)) + async_accept(basic_socket& peer, + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, + typename enable_if::value>::type* = 0) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a AcceptHandler. BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; - this->get_service().async_accept(this->get_implementation(), - peer, 0, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); + return this->get_service().async_accept(this->get_implementation(), + peer, static_cast(0), + BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } /// Accept a new connection and obtain the endpoint of the peer @@ -1057,14 +1116,16 @@ * boost::asio::io_service::post(). */ template - void async_accept(basic_socket& peer, + BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, + void (boost::system::error_code)) + async_accept(basic_socket& peer, endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a AcceptHandler. BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; - this->get_service().async_accept(this->get_implementation(), peer, + return this->get_service().async_accept(this->get_implementation(), peer, &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } }; === modified file 'boost/includes/boost/asio/basic_socket_iostream.hpp' --- boost/includes/boost/asio/basic_socket_iostream.hpp 2013-08-07 21:38:58 +0000 +++ boost/includes/boost/asio/basic_socket_iostream.hpp 2014-05-08 16:23:59 +0000 @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2013 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) @@ -17,44 +17,40 @@ #include -#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_ASIO_NO_IOSTREAM) -#include +#include +#include #include #include #if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -# include -# include -# include -# include - -# if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) -# define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 -# endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) +# include // A macro that should expand to: // template // explicit basic_socket_iostream(T1 x1, ..., Tn xn) -// : basic_iostream(&this->boost::base_from_member< -// basic_socket_streambuf >::member) +// : std::basic_iostream( +// &this->detail::socket_iostream_base< +// Protocol, StreamSocketService, Time, +// TimeTraits, TimerService>::streambuf_) // { // if (rdbuf()->connect(x1, ..., xn) == 0) // this->setstate(std::ios_base::failbit); // } // This macro should only persist within this file. -# define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \ - template \ - explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ - : std::basic_iostream(&this->boost::base_from_member< \ - basic_socket_streambuf >::member) \ +# define BOOST_ASIO_PRIVATE_CTR_DEF(n) \ + template \ + explicit basic_socket_iostream(BOOST_ASIO_VARIADIC_PARAMS(n)) \ + : std::basic_iostream( \ + &this->detail::socket_iostream_base< \ + Protocol, StreamSocketService, Time, \ + TimeTraits, TimerService>::streambuf_) \ { \ this->setf(std::ios_base::unitbuf); \ - if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ + if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ /**/ @@ -68,11 +64,11 @@ // } // This macro should only persist within this file. -# define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \ - template \ - void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ +# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ + template \ + void connect(BOOST_ASIO_VARIADIC_PARAMS(n)) \ { \ - if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ + if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ /**/ @@ -83,34 +79,69 @@ namespace boost { namespace asio { +namespace detail { + +// A separate base class is used to ensure that the streambuf is initialised +// prior to the basic_socket_iostream's basic_iostream base class. +template +class socket_iostream_base +{ +protected: + basic_socket_streambuf streambuf_; +}; + +} /// Iostream interface for a socket. template , +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ + || defined(GENERATING_DOCUMENTATION) typename Time = boost::posix_time::ptime, typename TimeTraits = boost::asio::time_traits