From 09edfb7114493ebff95d6581bb2ab01ea596f005 Mon Sep 17 00:00:00 2001 From: rolljee Date: Mon, 6 Jan 2025 17:56:31 +0100 Subject: [PATCH 1/2] feat: Update boost & deps --- include/boost/array.hpp | 94 +- include/boost/assert/source_location.hpp | 11 +- include/boost/bind/detail/requires_cxx11.hpp | 22 - include/boost/bind/mem_fn.hpp | 427 +- include/boost/bind/mem_fn_cc.hpp | 103 - include/boost/bind/mem_fn_template.hpp | 1047 ----- include/boost/bind/mem_fn_vw.hpp | 130 - include/boost/config/assert_cxx03.hpp | 2 +- include/boost/config/assert_cxx11.hpp | 5 +- include/boost/config/assert_cxx14.hpp | 2 +- include/boost/config/assert_cxx17.hpp | 5 +- include/boost/config/assert_cxx20.hpp | 2 +- include/boost/config/assert_cxx23.hpp | 41 + include/boost/config/compiler/borland.hpp | 3 + include/boost/config/compiler/clang.hpp | 4 + .../boost/config/compiler/clang_version.hpp | 10 +- include/boost/config/compiler/codegear.hpp | 4 + include/boost/config/compiler/common_edg.hpp | 4 +- include/boost/config/compiler/digitalmars.hpp | 3 + include/boost/config/compiler/gcc.hpp | 3 + include/boost/config/compiler/gcc_xml.hpp | 5 +- include/boost/config/compiler/hp_acc.hpp | 4 + include/boost/config/compiler/metrowerks.hpp | 3 + include/boost/config/compiler/mpw.hpp | 3 + include/boost/config/compiler/nvcc.hpp | 3 + include/boost/config/compiler/pathscale.hpp | 3 + include/boost/config/compiler/sunpro_cc.hpp | 3 + include/boost/config/compiler/vacpp.hpp | 3 + include/boost/config/compiler/visualc.hpp | 7 + include/boost/config/compiler/xlcpp.hpp | 4 + include/boost/config/compiler/xlcpp_zos.hpp | 1 + include/boost/config/detail/cxx_composite.hpp | 17 +- include/boost/config/detail/suffix.hpp | 40 + include/boost/container/allocator_traits.hpp | 217 +- include/boost/container/container_fwd.hpp | 20 +- include/boost/container/detail/addressof.hpp | 33 + .../container/detail/advanced_insert_int.hpp | 129 +- .../boost/container/detail/alloc_helpers.hpp | 12 +- .../container/detail/allocation_type.hpp | 14 +- .../boost/container/detail/config_begin.hpp | 1 + .../container/detail/construct_in_place.hpp | 36 +- .../boost/container/detail/copy_move_algo.hpp | 81 +- include/boost/container/detail/destroyers.hpp | 96 +- include/boost/container/detail/is_pair.hpp | 91 + include/boost/container/detail/iterators.hpp | 341 +- include/boost/container/detail/mpl.hpp | 8 +- .../boost/container/detail/next_capacity.hpp | 14 +- include/boost/container/detail/value_init.hpp | 6 +- .../boost/container/detail/version_type.hpp | 8 +- include/boost/container/detail/workaround.hpp | 57 +- include/boost/container/new_allocator.hpp | 22 +- include/boost/container/options.hpp | 72 +- include/boost/container/vector.hpp | 694 ++-- .../container_hash/detail/hash_integral.hpp | 146 + .../boost/container_hash/detail/hash_mix.hpp | 12 +- .../container_hash/detail/hash_range.hpp | 170 +- .../container_hash/detail/hash_tuple_like.hpp | 104 +- include/boost/container_hash/detail/mulx.hpp | 40 +- .../container_hash/detail/requires_cxx11.hpp | 22 - include/boost/container_hash/hash.hpp | 151 +- .../container_hash/is_contiguous_range.hpp | 48 +- .../container_hash/is_described_class.hpp | 9 +- include/boost/container_hash/is_range.hpp | 49 +- .../boost/container_hash/is_tuple_like.hpp | 14 +- .../container_hash/is_unordered_range.hpp | 13 +- include/boost/core/checked_delete.hpp | 9 + include/boost/core/invoke_swap.hpp | 93 + include/boost/core/swap.hpp | 89 - include/boost/detail/basic_pointerbuf.hpp | 10 +- include/boost/detail/lcast_precision.hpp | 150 +- include/boost/exception/exception.hpp | 2 +- include/boost/function.hpp | 68 +- include/boost/function/detail/epilogue.hpp | 39 - .../function/detail/function_iterate.hpp | 16 - .../function/detail/gen_maybe_include.pl | 39 - .../boost/function/detail/maybe_include.hpp | 369 -- include/boost/function/detail/prologue.hpp | 27 - .../boost/function/detail/requires_cxx11.hpp | 22 - include/boost/function/function0.hpp | 12 - include/boost/function/function1.hpp | 12 - include/boost/function/function10.hpp | 12 - include/boost/function/function2.hpp | 12 - include/boost/function/function3.hpp | 12 - include/boost/function/function4.hpp | 12 - include/boost/function/function5.hpp | 12 - include/boost/function/function6.hpp | 12 - include/boost/function/function7.hpp | 12 - include/boost/function/function8.hpp | 12 - include/boost/function/function9.hpp | 12 - include/boost/function/function_base.hpp | 233 +- include/boost/function/function_fwd.hpp | 77 +- include/boost/function/function_template.hpp | 856 ++-- include/boost/geometry/algorithms/append.hpp | 19 +- include/boost/geometry/algorithms/area.hpp | 36 +- include/boost/geometry/algorithms/assign.hpp | 19 +- .../boost/geometry/algorithms/centroid.hpp | 27 +- include/boost/geometry/algorithms/clear.hpp | 11 +- include/boost/geometry/algorithms/convert.hpp | 59 +- include/boost/geometry/algorithms/correct.hpp | 12 +- .../geometry/algorithms/correct_closure.hpp | 6 +- .../detail/assign_indexed_point.hpp | 7 +- .../algorithms/detail/assign_values.hpp | 31 +- .../detail/buffer/buffer_inserter.hpp | 102 +- .../detail/buffer/buffer_policies.hpp | 21 +- .../buffer/buffered_piece_collection.hpp | 215 +- .../detail/buffer/get_piece_turns.hpp | 19 +- .../detail/buffer/implementation.hpp | 21 +- .../detail/buffer/line_line_intersection.hpp | 2 +- .../algorithms/detail/buffer/piece_border.hpp | 1 + .../buffer/turn_in_original_visitor.hpp | 3 +- .../centroid/translating_transformer.hpp | 13 +- .../closest_feature/geometry_to_range.hpp | 10 +- .../detail/closest_feature/point_to_range.hpp | 1 - .../detail/closest_feature/range_to_range.hpp | 6 +- .../linear_or_areal_to_areal.hpp | 10 +- .../closest_points/linear_to_linear.hpp | 6 +- .../closest_points/multipoint_to_geometry.hpp | 6 +- .../closest_points/point_to_geometry.hpp | 2 +- .../closest_points/segment_to_segment.hpp | 6 +- .../detail/closest_points/utilities.hpp | 4 +- .../detail/convert_indexed_to_indexed.hpp | 6 +- .../detail/convert_point_to_point.hpp | 4 +- .../detail/convex_hull/graham_andrew.hpp | 2 + .../detail/convex_hull/interface.hpp | 10 +- .../detail/covered_by/implementation.hpp | 2 +- .../detail/disjoint/linear_areal.hpp | 11 +- .../detail/disjoint/linear_linear.hpp | 21 +- .../detail/disjoint/linear_segment_or_box.hpp | 4 +- .../detail/disjoint/multipoint_geometry.hpp | 18 +- .../detail/disjoint/segment_box.hpp | 7 +- .../detail/distance/geometry_collection.hpp | 2 + .../distance/geometry_to_segment_or_box.hpp | 59 +- .../algorithms/detail/distance/interface.hpp | 2 +- .../detail/distance/linear_to_linear.hpp | 4 +- .../detail/distance/point_to_geometry.hpp | 4 +- .../detail/distance/segment_to_box.hpp | 57 +- .../detail/distance/segment_to_segment.hpp | 33 +- .../detail/distance/strategy_utils.hpp | 8 +- .../algorithms/detail/envelope/initialize.hpp | 7 +- .../detail/envelope/range_of_boxes.hpp | 4 +- .../algorithms/detail/envelope/segment.hpp | 2 +- .../detail/equals/collect_vectors.hpp | 11 +- .../algorithms/detail/equals/interface.hpp | 8 +- .../algorithms/detail/extreme_points.hpp | 6 +- .../algorithms/detail/for_each_range.hpp | 1 - .../algorithms/detail/get_max_size.hpp | 69 - .../detail/has_self_intersections.hpp | 23 +- .../detail/intersection/areal_areal.hpp | 39 +- .../detail/intersection/box_box.hpp | 2 +- .../box_box_implementation.hpp} | 31 +- .../algorithms/detail/intersection/gc.hpp | 16 +- .../detail/intersection/interface.hpp | 29 +- .../algorithms/detail/intersection/multi.hpp | 29 +- .../detail/intersects/implementation.hpp | 9 +- .../is_simple/debug_print_boundary_points.hpp | 5 +- .../algorithms/detail/is_simple/linear.hpp | 32 +- .../detail/is_simple/multipoint.hpp | 2 +- .../detail/is_valid/has_valid_self_turns.hpp | 29 +- .../detail/is_valid/multipolygon.hpp | 7 +- .../algorithms/detail/is_valid/pointlike.hpp | 31 +- .../algorithms/detail/is_valid/polygon.hpp | 64 +- .../algorithms/detail/is_valid/ring.hpp | 5 +- .../algorithms/detail/is_valid/segment.hpp | 2 +- .../overlay/append_no_dups_or_spikes.hpp | 143 +- .../detail/overlay/approximately_equals.hpp | 25 + .../detail/overlay/assign_parents.hpp | 36 +- .../detail/overlay/backtrack_check_si.hpp | 12 +- .../detail/overlay/check_enrich.hpp | 11 +- .../detail/overlay/clip_linestring.hpp | 12 +- .../detail/overlay/cluster_exits.hpp | 232 -- .../detail/overlay/cluster_info.hpp | 8 +- .../detail/overlay/colocate_clusters.hpp | 12 +- .../detail/overlay/copy_segment_point.hpp | 2 +- .../detail/overlay/copy_segments.hpp | 38 +- .../overlay/discard_duplicate_turns.hpp | 174 +- .../overlay/enrich_intersection_points.hpp | 202 +- .../algorithms/detail/overlay/follow.hpp | 35 +- .../detail/overlay/follow_linear_linear.hpp | 15 +- .../detail/overlay/get_clusters.hpp | 76 +- .../detail/overlay/get_distance_measure.hpp | 4 +- .../overlay/get_intersection_points.hpp | 23 +- .../detail/overlay/get_turn_info.hpp | 401 +- .../overlay/get_turn_info_for_endpoint.hpp | 7 +- .../detail/overlay/get_turn_info_helpers.hpp | 273 +- .../detail/overlay/get_turn_info_la.hpp | 332 +- .../detail/overlay/get_turn_info_ll.hpp | 113 +- .../algorithms/detail/overlay/get_turns.hpp | 182 +- .../detail/overlay/handle_colocations.hpp | 57 +- .../detail/overlay/handle_self_turns.hpp | 2 +- .../overlay/inconsistent_turns_exception.hpp | 5 +- .../detail/overlay/intersection_insert.hpp | 176 +- .../detail/overlay/less_by_segment_ratio.hpp | 10 +- .../detail/overlay/linear_linear.hpp | 23 +- .../algorithms/detail/overlay/overlay.hpp | 76 +- .../detail/overlay/pointlike_areal.hpp | 9 +- .../detail/overlay/pointlike_linear.hpp | 15 +- .../detail/overlay/pointlike_pointlike.hpp | 35 +- .../detail/overlay/range_in_geometry.hpp | 1 - .../detail/overlay/self_turn_points.hpp | 49 +- .../detail/overlay/sort_by_side.hpp | 138 +- .../algorithms/detail/overlay/traversal.hpp | 282 +- .../detail/overlay/traversal_ring_creator.hpp | 82 +- .../overlay/traversal_switch_detector.hpp | 58 +- .../algorithms/detail/overlay/traverse.hpp | 16 +- .../detail/point_is_spike_or_equal.hpp | 86 +- .../algorithms/detail/recalculate.hpp | 232 -- .../algorithms/detail/relate/areal_areal.hpp | 4 +- .../detail/relate/boundary_checker.hpp | 3 +- .../algorithms/detail/relate/box_areal.hpp | 6 +- .../detail/relate/follow_helpers.hpp | 18 +- .../algorithms/detail/relate/linear_areal.hpp | 95 +- .../detail/relate/multi_point_geometry.hpp | 25 +- .../algorithms/detail/relate/point_point.hpp | 9 +- .../algorithms/detail/relate/result.hpp | 11 +- .../detail/relate/topology_check.hpp | 1 + .../algorithms/detail/relate/turns.hpp | 45 +- .../detail/sections/range_by_section.hpp | 1 - .../detail/sections/section_functions.hpp | 39 +- .../detail/sections/sectionalize.hpp | 118 +- .../algorithms/detail/single_geometry.hpp | 7 +- .../geometry/algorithms/detail/sub_range.hpp | 10 +- .../detail/touches/implementation.hpp | 12 +- .../algorithms/detail/touches/interface.hpp | 8 +- .../algorithms/detail/tupled_output.hpp | 27 +- .../algorithms/detail/within/multi_point.hpp | 29 +- .../boost/geometry/algorithms/difference.hpp | 49 +- .../algorithms/discrete_frechet_distance.hpp | 29 +- .../discrete_hausdorff_distance.hpp | 80 +- .../algorithms/dispatch/closest_points.hpp | 12 +- .../geometry/algorithms/dispatch/disjoint.hpp | 12 +- .../geometry/algorithms/dispatch/distance.hpp | 12 +- .../boost/geometry/algorithms/for_each.hpp | 4 +- .../boost/geometry/algorithms/is_convex.hpp | 1 + include/boost/geometry/algorithms/length.hpp | 3 +- .../geometry/algorithms/line_interpolate.hpp | 15 +- .../geometry/algorithms/num_geometries.hpp | 7 +- .../boost/geometry/algorithms/num_points.hpp | 5 +- .../geometry/algorithms/point_on_surface.hpp | 6 +- .../geometry/algorithms/remove_spikes.hpp | 20 +- .../boost/geometry/algorithms/simplify.hpp | 32 +- .../geometry/algorithms/sym_difference.hpp | 70 +- .../boost/geometry/algorithms/transform.hpp | 47 +- include/boost/geometry/algorithms/union.hpp | 93 +- .../boost/geometry/arithmetic/determinant.hpp | 4 +- .../arithmetic/infinite_line_functions.hpp | 2 +- include/boost/geometry/core/access.hpp | 139 +- include/boost/geometry/core/closure.hpp | 35 +- include/boost/geometry/core/config.hpp | 22 +- .../geometry/core/coordinate_dimension.hpp | 12 +- .../boost/geometry/core/coordinate_system.hpp | 13 +- .../boost/geometry/core/coordinate_type.hpp | 35 +- include/boost/geometry/core/cs.hpp | 27 +- include/boost/geometry/core/exception.hpp | 8 +- include/boost/geometry/core/geometry_id.hpp | 7 + include/boost/geometry/core/point_order.hpp | 24 +- include/boost/geometry/core/point_type.hpp | 13 +- .../geometry/core/primary_single_tag.hpp | 55 + include/boost/geometry/core/radian_access.hpp | 11 +- include/boost/geometry/core/radius.hpp | 111 +- .../boost/geometry/core/reverse_dispatch.hpp | 5 +- include/boost/geometry/core/ring_type.hpp | 15 +- include/boost/geometry/core/tag.hpp | 12 +- include/boost/geometry/core/tag_cast.hpp | 13 +- include/boost/geometry/core/tags.hpp | 3 + .../geometry/core/topological_dimension.hpp | 7 + .../geometry/formulas/andoyer_inverse.hpp | 15 +- .../boost/geometry/formulas/area_formulas.hpp | 42 +- .../formulas/differential_quantities.hpp | 10 +- .../boost/geometry/formulas/karney_direct.hpp | 8 +- .../geometry/formulas/karney_inverse.hpp | 77 +- .../boost/geometry/formulas/thomas_direct.hpp | 19 +- .../geometry/formulas/thomas_inverse.hpp | 15 +- .../geometry/formulas/vincenty_direct.hpp | 12 +- .../geometry/formulas/vincenty_inverse.hpp | 15 +- .../geometries/concepts/box_concept.hpp | 7 +- .../concepts/linestring_concept.hpp | 4 +- .../geometries/concepts/polygon_concept.hpp | 8 +- .../geometries/concepts/ring_concept.hpp | 4 +- .../geometries/concepts/segment_concept.hpp | 6 +- .../geometry/geometries/helper_geometry.hpp | 8 +- .../index/detail/algorithms/bounds.hpp | 12 +- .../algorithms/intersection_content.hpp | 9 +- .../detail/algorithms/path_intersection.hpp | 11 +- .../geometry/index/detail/bounded_view.hpp | 2 +- .../geometry/index/detail/rtree/node/node.hpp | 15 +- .../detail/rtree/node/variant_dynamic.hpp | 4 +- .../detail/rtree/node/variant_static.hpp | 8 +- .../index/detail/rtree/pack_create.hpp | 11 +- .../index/detail/rtree/visitors/insert.hpp | 25 +- .../boost/geometry/index/detail/utilities.hpp | 4 +- .../boost/geometry/index/detail/varray.hpp | 2 - include/boost/geometry/index/equal_to.hpp | 4 + include/boost/geometry/index/rtree.hpp | 31 +- include/boost/geometry/io/dsv/write.hpp | 11 +- include/boost/geometry/io/svg/svg_mapper.hpp | 8 +- include/boost/geometry/io/wkt/read.hpp | 16 +- include/boost/geometry/io/wkt/write.hpp | 17 +- .../is_valid/failing_reason_policy.hpp | 7 +- .../geometry/policies/relate/direction.hpp | 8 + .../policies/relate/intersection_points.hpp | 16 + .../policies/relate/intersection_policy.hpp | 13 + .../robustness/get_rescale_policy.hpp | 415 -- .../policies/robustness/no_rescale_policy.hpp | 55 - .../policies/robustness/rescale_policy.hpp | 83 - .../robustness/rescale_policy_tags.hpp | 43 - .../policies/robustness/robust_point_type.hpp | 30 - .../policies/robustness/robust_type.hpp | 72 - .../policies/robustness/segment_ratio.hpp | 20 +- .../robustness/segment_ratio_type.hpp | 54 - .../agnostic/point_in_box_by_side.hpp | 2 +- .../strategies/agnostic/point_in_point.hpp | 2 +- .../agnostic/point_in_poly_winding.hpp | 13 +- .../strategies/cartesian/buffer_end_round.hpp | 2 +- .../strategies/cartesian/centroid_average.hpp | 7 +- .../cartesian/centroid_bashein_detmer.hpp | 18 +- .../cartesian/centroid_weighted_length.hpp | 6 +- .../geometry/strategies/cartesian/densify.hpp | 7 +- .../cartesian/disjoint_segment_box.hpp | 22 +- .../cartesian/distance_projected_point_ax.hpp | 315 -- .../cartesian/distance_pythagoras.hpp | 11 +- .../cartesian/distance_pythagoras_box_box.hpp | 18 +- .../distance_pythagoras_point_box.hpp | 14 +- .../strategies/cartesian/intersection.hpp | 184 +- .../strategies/cartesian/line_interpolate.hpp | 7 +- .../point_in_poly_crossings_multiply.hpp | 2 - .../cartesian/point_in_poly_franklin.hpp | 2 - .../cartesian/side_rounded_input.hpp | 2 +- .../cartesian/turn_in_ring_winding.hpp | 15 - .../strategies/comparable_distance_result.hpp | 4 +- include/boost/geometry/strategies/compare.hpp | 4 +- .../strategies/concepts/within_concept.hpp | 6 +- .../boost/geometry/strategies/convex_hull.hpp | 2 +- .../strategies/convex_hull/cartesian.hpp | 2 +- .../boost/geometry/strategies/covered_by.hpp | 24 +- .../boost/geometry/strategies/disjoint.hpp | 12 +- .../boost/geometry/strategies/distance.hpp | 4 +- .../geometry/strategies/distance_result.hpp | 4 +- .../geographic/buffer_end_round.hpp | 2 +- .../geographic/disjoint_segment_box.hpp | 2 - .../distance_cross_track_box_box.hpp | 12 +- .../distance_cross_track_point_box.hpp | 6 +- .../strategies/geographic/intersection.hpp | 12 +- .../strategies/intersection_result.hpp | 17 +- .../strategies/intersection_strategies.hpp | 22 +- .../boost/geometry/strategies/normalize.hpp | 21 +- .../boost/geometry/strategies/side_info.hpp | 8 +- .../spherical/closest_points_pt_seg.hpp | 30 +- .../spherical/disjoint_segment_box.hpp | 12 +- .../distance_cross_track_box_box.hpp | 18 +- .../distance_cross_track_point_box.hpp | 12 +- .../spherical/distance_haversine.hpp | 16 +- .../spherical/distance_segment_box.hpp | 5 +- .../strategies/spherical/intersection.hpp | 12 +- .../spherical/point_in_poly_winding.hpp | 13 +- .../strategies/spherical/point_order.hpp | 5 +- .../boost/geometry/strategies/strategies.hpp | 1 - .../strategies/strategy_transform.hpp | 5 +- .../strategies/transform/map_transformer.hpp | 6 +- .../transform/matrix_transformers.hpp | 17 +- include/boost/geometry/strategies/within.hpp | 28 +- include/boost/geometry/strategy/relate.hpp | 11 +- .../spherical/envelope_multipoint.hpp | 4 +- .../strategy/spherical/envelope_point.hpp | 2 +- .../strategy/spherical/envelope_range.hpp | 2 + .../strategy/spherical/envelope_segment.hpp | 12 +- .../strategy/spherical/expand_box.hpp | 2 + .../strategy/spherical/expand_point.hpp | 13 +- include/boost/geometry/util/bounds.hpp | 28 + .../geometry/util/for_each_with_index.hpp | 49 - .../is_inverse_spheroidal_coordinates.hpp | 16 +- include/boost/geometry/util/math.hpp | 10 +- include/boost/geometry/util/numeric_cast.hpp | 45 + include/boost/geometry/util/precise_math.hpp | 12 +- .../boost/geometry/util/series_expansion.hpp | 1 + include/boost/geometry/util/type_traits.hpp | 112 +- .../boost/geometry/util/type_traits_std.hpp | 16 +- .../detail/boundary_view/implementation.hpp | 1 + .../boost/geometry/views/enumerate_view.hpp | 159 + include/boost/integer/common_factor_rt.hpp | 16 +- include/boost/intrusive/detail/algorithm.hpp | 16 +- include/boost/intrusive/detail/iterator.hpp | 24 +- include/boost/intrusive/detail/mpl.hpp | 6 + include/boost/intrusive/detail/workaround.hpp | 43 +- include/boost/intrusive/pack_options.hpp | 6 +- include/boost/lexical_cast.hpp | 39 +- .../boost/lexical_cast/bad_lexical_cast.hpp | 20 +- .../boost/lexical_cast/detail/buffer_view.hpp | 59 + .../lexical_cast/detail/converter_lexical.hpp | 244 +- .../detail/converter_lexical_streams.hpp | 1251 +++--- .../lexical_cast/detail/converter_numeric.hpp | 164 +- include/boost/lexical_cast/detail/inf_nan.hpp | 59 +- .../lexical_cast/detail/is_character.hpp | 51 +- .../detail/lcast_basic_unlockedbuf.hpp | 73 + .../detail/lcast_char_constants.hpp | 2 +- .../detail/lcast_unsigned_converters.hpp | 39 +- .../boost/lexical_cast/detail/widest_char.hpp | 16 +- .../lexical_cast/try_lexical_convert.hpp | 183 +- include/boost/math/ccmath/abs.hpp | 18 +- include/boost/math/ccmath/detail/config.hpp | 52 + include/boost/math/ccmath/isinf.hpp | 24 +- include/boost/math/ccmath/isnan.hpp | 14 +- include/boost/math/ccmath/ldexp.hpp | 10 +- include/boost/math/constants/constants.hpp | 58 +- .../boost/math/cstdfloat/cstdfloat_cmath.hpp | 116 +- .../math/cstdfloat/cstdfloat_iostream.hpp | 97 +- .../boost/math/cstdfloat/cstdfloat_limits.hpp | 2 +- .../boost/math/policies/error_handling.hpp | 379 +- include/boost/math/policies/policy.hpp | 211 +- .../boost/math/special_functions/acosh.hpp | 4 +- .../boost/math/special_functions/asinh.hpp | 4 +- .../boost/math/special_functions/atanh.hpp | 22 +- .../math/special_functions/bernoulli.hpp | 4 +- include/boost/math/special_functions/cbrt.hpp | 52 +- .../boost/math/special_functions/cos_pi.hpp | 50 +- .../detail/bernoulli_details.hpp | 16 +- .../math/special_functions/detail/erf_inv.hpp | 210 +- .../special_functions/detail/fp_traits.hpp | 75 +- .../special_functions/detail/gamma_inva.hpp | 28 +- .../detail/igamma_inverse.hpp | 65 +- .../special_functions/detail/igamma_large.hpp | 122 +- .../special_functions/detail/lgamma_small.hpp | 37 +- .../special_functions/detail/polygamma.hpp | 4 +- .../special_functions/detail/round_fwd.hpp | 49 +- .../detail/unchecked_factorial.hpp | 216 +- .../boost/math/special_functions/digamma.hpp | 152 +- include/boost/math/special_functions/erf.hpp | 302 +- .../boost/math/special_functions/expm1.hpp | 98 +- .../math/special_functions/factorials.hpp | 31 +- .../math/special_functions/fpclassify.hpp | 165 +- .../boost/math/special_functions/gamma.hpp | 803 ++-- .../boost/math/special_functions/hypot.hpp | 20 +- .../boost/math/special_functions/lanczos.hpp | 687 ++-- .../boost/math/special_functions/log1p.hpp | 77 +- .../boost/math/special_functions/math_fwd.hpp | 687 ++-- include/boost/math/special_functions/next.hpp | 58 +- include/boost/math/special_functions/pow.hpp | 23 +- .../boost/math/special_functions/powm1.hpp | 64 +- include/boost/math/special_functions/sign.hpp | 75 +- .../boost/math/special_functions/sin_pi.hpp | 66 +- .../boost/math/special_functions/sqrt1pm1.hpp | 5 +- .../boost/math/special_functions/trigamma.hpp | 103 +- .../boost/math/special_functions/trunc.hpp | 179 +- include/boost/math/special_functions/zeta.hpp | 4 +- include/boost/math/tools/array.hpp | 41 + include/boost/math/tools/assert.hpp | 17 +- include/boost/math/tools/atomic.hpp | 4 +- include/boost/math/tools/big_constant.hpp | 18 +- include/boost/math/tools/complex.hpp | 41 +- include/boost/math/tools/config.hpp | 433 ++- .../boost/math/tools/convert_from_string.hpp | 11 + include/boost/math/tools/cstdint.hpp | 107 + .../tools/detail/polynomial_horner1_10.hpp | 22 +- .../tools/detail/polynomial_horner1_11.hpp | 24 +- .../tools/detail/polynomial_horner1_12.hpp | 26 +- .../tools/detail/polynomial_horner1_13.hpp | 28 +- .../tools/detail/polynomial_horner1_14.hpp | 30 +- .../tools/detail/polynomial_horner1_15.hpp | 32 +- .../tools/detail/polynomial_horner1_16.hpp | 34 +- .../tools/detail/polynomial_horner1_17.hpp | 36 +- .../tools/detail/polynomial_horner1_18.hpp | 38 +- .../tools/detail/polynomial_horner1_19.hpp | 40 +- .../tools/detail/polynomial_horner1_2.hpp | 6 +- .../tools/detail/polynomial_horner1_20.hpp | 42 +- .../tools/detail/polynomial_horner1_3.hpp | 8 +- .../tools/detail/polynomial_horner1_4.hpp | 10 +- .../tools/detail/polynomial_horner1_5.hpp | 12 +- .../tools/detail/polynomial_horner1_6.hpp | 14 +- .../tools/detail/polynomial_horner1_7.hpp | 16 +- .../tools/detail/polynomial_horner1_8.hpp | 18 +- .../tools/detail/polynomial_horner1_9.hpp | 20 +- .../tools/detail/polynomial_horner2_10.hpp | 22 +- .../tools/detail/polynomial_horner2_11.hpp | 24 +- .../tools/detail/polynomial_horner2_12.hpp | 26 +- .../tools/detail/polynomial_horner2_13.hpp | 28 +- .../tools/detail/polynomial_horner2_14.hpp | 30 +- .../tools/detail/polynomial_horner2_15.hpp | 32 +- .../tools/detail/polynomial_horner2_16.hpp | 34 +- .../tools/detail/polynomial_horner2_17.hpp | 36 +- .../tools/detail/polynomial_horner2_18.hpp | 38 +- .../tools/detail/polynomial_horner2_19.hpp | 40 +- .../tools/detail/polynomial_horner2_2.hpp | 10 +- .../tools/detail/polynomial_horner2_20.hpp | 42 +- .../tools/detail/polynomial_horner2_3.hpp | 10 +- .../tools/detail/polynomial_horner2_4.hpp | 10 +- .../tools/detail/polynomial_horner2_5.hpp | 12 +- .../tools/detail/polynomial_horner2_6.hpp | 14 +- .../tools/detail/polynomial_horner2_7.hpp | 16 +- .../tools/detail/polynomial_horner2_8.hpp | 18 +- .../tools/detail/polynomial_horner2_9.hpp | 20 +- .../tools/detail/polynomial_horner3_10.hpp | 22 +- .../tools/detail/polynomial_horner3_11.hpp | 24 +- .../tools/detail/polynomial_horner3_12.hpp | 26 +- .../tools/detail/polynomial_horner3_13.hpp | 28 +- .../tools/detail/polynomial_horner3_14.hpp | 30 +- .../tools/detail/polynomial_horner3_15.hpp | 32 +- .../tools/detail/polynomial_horner3_16.hpp | 34 +- .../tools/detail/polynomial_horner3_17.hpp | 36 +- .../tools/detail/polynomial_horner3_18.hpp | 38 +- .../tools/detail/polynomial_horner3_19.hpp | 40 +- .../tools/detail/polynomial_horner3_2.hpp | 10 +- .../tools/detail/polynomial_horner3_20.hpp | 42 +- .../tools/detail/polynomial_horner3_3.hpp | 10 +- .../tools/detail/polynomial_horner3_4.hpp | 10 +- .../tools/detail/polynomial_horner3_5.hpp | 12 +- .../tools/detail/polynomial_horner3_6.hpp | 14 +- .../tools/detail/polynomial_horner3_7.hpp | 16 +- .../tools/detail/polynomial_horner3_8.hpp | 18 +- .../tools/detail/polynomial_horner3_9.hpp | 20 +- .../math/tools/detail/rational_horner1_10.hpp | 40 +- .../math/tools/detail/rational_horner1_11.hpp | 44 +- .../math/tools/detail/rational_horner1_12.hpp | 48 +- .../math/tools/detail/rational_horner1_13.hpp | 52 +- .../math/tools/detail/rational_horner1_14.hpp | 56 +- .../math/tools/detail/rational_horner1_15.hpp | 60 +- .../math/tools/detail/rational_horner1_16.hpp | 64 +- .../math/tools/detail/rational_horner1_17.hpp | 68 +- .../math/tools/detail/rational_horner1_18.hpp | 72 +- .../math/tools/detail/rational_horner1_19.hpp | 76 +- .../math/tools/detail/rational_horner1_2.hpp | 8 +- .../math/tools/detail/rational_horner1_20.hpp | 80 +- .../math/tools/detail/rational_horner1_3.hpp | 12 +- .../math/tools/detail/rational_horner1_4.hpp | 16 +- .../math/tools/detail/rational_horner1_5.hpp | 20 +- .../math/tools/detail/rational_horner1_6.hpp | 24 +- .../math/tools/detail/rational_horner1_7.hpp | 28 +- .../math/tools/detail/rational_horner1_8.hpp | 32 +- .../math/tools/detail/rational_horner1_9.hpp | 36 +- .../math/tools/detail/rational_horner2_10.hpp | 34 +- .../math/tools/detail/rational_horner2_11.hpp | 38 +- .../math/tools/detail/rational_horner2_12.hpp | 42 +- .../math/tools/detail/rational_horner2_13.hpp | 46 +- .../math/tools/detail/rational_horner2_14.hpp | 50 +- .../math/tools/detail/rational_horner2_15.hpp | 54 +- .../math/tools/detail/rational_horner2_16.hpp | 58 +- .../math/tools/detail/rational_horner2_17.hpp | 62 +- .../math/tools/detail/rational_horner2_18.hpp | 66 +- .../math/tools/detail/rational_horner2_19.hpp | 70 +- .../math/tools/detail/rational_horner2_2.hpp | 10 +- .../math/tools/detail/rational_horner2_20.hpp | 74 +- .../math/tools/detail/rational_horner2_3.hpp | 10 +- .../math/tools/detail/rational_horner2_4.hpp | 10 +- .../math/tools/detail/rational_horner2_5.hpp | 14 +- .../math/tools/detail/rational_horner2_6.hpp | 18 +- .../math/tools/detail/rational_horner2_7.hpp | 22 +- .../math/tools/detail/rational_horner2_8.hpp | 26 +- .../math/tools/detail/rational_horner2_9.hpp | 30 +- .../math/tools/detail/rational_horner3_10.hpp | 34 +- .../math/tools/detail/rational_horner3_11.hpp | 38 +- .../math/tools/detail/rational_horner3_12.hpp | 42 +- .../math/tools/detail/rational_horner3_13.hpp | 46 +- .../math/tools/detail/rational_horner3_14.hpp | 50 +- .../math/tools/detail/rational_horner3_15.hpp | 54 +- .../math/tools/detail/rational_horner3_16.hpp | 58 +- .../math/tools/detail/rational_horner3_17.hpp | 62 +- .../math/tools/detail/rational_horner3_18.hpp | 66 +- .../math/tools/detail/rational_horner3_19.hpp | 70 +- .../math/tools/detail/rational_horner3_2.hpp | 10 +- .../math/tools/detail/rational_horner3_20.hpp | 74 +- .../math/tools/detail/rational_horner3_3.hpp | 10 +- .../math/tools/detail/rational_horner3_4.hpp | 10 +- .../math/tools/detail/rational_horner3_5.hpp | 14 +- .../math/tools/detail/rational_horner3_6.hpp | 18 +- .../math/tools/detail/rational_horner3_7.hpp | 22 +- .../math/tools/detail/rational_horner3_8.hpp | 26 +- .../math/tools/detail/rational_horner3_9.hpp | 30 +- include/boost/math/tools/fraction.hpp | 147 +- .../math/tools/is_constant_evaluated.hpp | 8 +- include/boost/math/tools/is_detected.hpp | 6 +- include/boost/math/tools/mp.hpp | 58 +- include/boost/math/tools/numeric_limits.hpp | 888 +++++ include/boost/math/tools/precision.hpp | 173 +- include/boost/math/tools/promotion.hpp | 314 +- include/boost/math/tools/rational.hpp | 87 +- include/boost/math/tools/roots.hpp | 138 +- include/boost/math/tools/series.hpp | 71 +- include/boost/math/tools/throw_exception.hpp | 23 +- include/boost/math/tools/toms748_solve.hpp | 102 +- include/boost/math/tools/tuple.hpp | 67 +- include/boost/math/tools/type_traits.hpp | 494 +++ include/boost/move/adl_move_swap.hpp | 12 +- include/boost/move/algo/adaptive_merge.hpp | 1 + .../move/algo/detail/adaptive_sort_merge.hpp | 24 +- include/boost/move/algo/detail/basic_op.hpp | 20 +- include/boost/move/algo/detail/heap_sort.hpp | 2 +- include/boost/move/algo/detail/merge.hpp | 30 +- include/boost/move/algo/predicate.hpp | 20 +- include/boost/move/core.hpp | 2 +- include/boost/move/detail/config_begin.hpp | 1 - .../move/detail/iterator_to_raw_pointer.hpp | 6 +- include/boost/move/detail/launder.hpp | 53 + include/boost/move/detail/meta_utils.hpp | 25 +- include/boost/move/detail/meta_utils_core.hpp | 15 + include/boost/move/detail/move_helpers.hpp | 48 +- include/boost/move/detail/placement_new.hpp | 2 + .../boost/move/detail/reverse_iterator.hpp | 56 +- include/boost/move/detail/std_ns_begin.hpp | 14 +- include/boost/move/detail/std_ns_end.hpp | 3 + include/boost/move/detail/to_raw_pointer.hpp | 2 +- include/boost/move/detail/type_traits.hpp | 94 +- include/boost/move/detail/workaround.hpp | 14 +- include/boost/move/iterator.hpp | 44 +- include/boost/move/utility.hpp | 150 - include/boost/mp11/algorithm.hpp | 59 + include/boost/mp11/bind.hpp | 9 + include/boost/mp11/detail/mp_count.hpp | 8 +- include/boost/mp11/detail/mp_fold.hpp | 4 +- include/boost/mp11/integer_sequence.hpp | 9 + include/boost/mp11/integral.hpp | 9 + include/boost/mp11/list.hpp | 9 + include/boost/mp11/version.hpp | 2 +- include/boost/mpl/aux_/integral_wrapper.hpp | 3 +- .../boost/multiprecision/cpp_bin_float.hpp | 105 +- include/boost/multiprecision/cpp_int.hpp | 16 +- .../boost/multiprecision/cpp_int/bitwise.hpp | 4 +- .../boost/multiprecision/cpp_int/divide.hpp | 52 +- .../boost/multiprecision/cpp_int/limits.hpp | 14 + include/boost/multiprecision/cpp_int/misc.hpp | 9 +- .../multiprecision/detail/default_ops.hpp | 53 +- .../multiprecision/detail/functions/trunc.hpp | 12 +- .../boost/multiprecision/detail/min_max.hpp | 24 +- .../multiprecision/detail/number_base.hpp | 21 +- include/boost/multiprecision/number.hpp | 19 +- .../traits/std_integer_traits.hpp | 5 + include/boost/predef/make.h | 4 + .../boost/preprocessor/variadic/has_opt.hpp | 2 + include/boost/qvm/assert.hpp | 3 +- include/boost/qvm/config.hpp | 7 +- include/boost/qvm/deduce_mat.hpp | 3 +- include/boost/qvm/deduce_scalar.hpp | 3 +- include/boost/qvm/deduce_vec.hpp | 3 +- include/boost/qvm/detail/cofactor_impl.hpp | 3 +- include/boost/qvm/detail/determinant_impl.hpp | 3 +- include/boost/qvm/detail/mat_assign.hpp | 3 +- include/boost/qvm/detail/remove_const.hpp | 3 +- include/boost/qvm/detail/transp_impl.hpp | 3 +- include/boost/qvm/detail/vec_assign.hpp | 3 +- include/boost/qvm/enable_if.hpp | 3 +- include/boost/qvm/error.hpp | 3 +- include/boost/qvm/gen/mat_assign2.hpp | 6 +- include/boost/qvm/gen/mat_assign3.hpp | 6 +- include/boost/qvm/gen/mat_assign4.hpp | 6 +- include/boost/qvm/gen/mat_operations2.hpp | 6 +- include/boost/qvm/gen/mat_operations3.hpp | 6 +- include/boost/qvm/gen/mat_operations4.hpp | 6 +- include/boost/qvm/gen/vec_assign2.hpp | 6 +- include/boost/qvm/gen/vec_assign3.hpp | 6 +- include/boost/qvm/gen/vec_assign4.hpp | 6 +- include/boost/qvm/gen/vec_mat_operations2.hpp | 6 +- include/boost/qvm/gen/vec_mat_operations3.hpp | 6 +- include/boost/qvm/gen/vec_mat_operations4.hpp | 6 +- include/boost/qvm/is_scalar.hpp | 5 +- include/boost/qvm/map_mat_mat.hpp | 3 +- include/boost/qvm/map_mat_vec.hpp | 3 +- include/boost/qvm/mat.hpp | 3 +- include/boost/qvm/mat_access.hpp | 3 +- include/boost/qvm/mat_operations.hpp | 9 +- include/boost/qvm/mat_operations2.hpp | 3 +- include/boost/qvm/mat_operations3.hpp | 3 +- include/boost/qvm/mat_operations4.hpp | 3 +- include/boost/qvm/mat_traits.hpp | 3 +- include/boost/qvm/mat_traits_array.hpp | 3 +- include/boost/qvm/math.hpp | 3 +- include/boost/qvm/quat_traits.hpp | 7 +- include/boost/qvm/scalar_traits.hpp | 3 +- include/boost/qvm/static_assert.hpp | 3 +- include/boost/qvm/throw_exception.hpp | 3 +- include/boost/qvm/to_string.hpp | 45 + include/boost/qvm/vec.hpp | 3 +- include/boost/qvm/vec_access.hpp | 3 +- include/boost/qvm/vec_mat_operations.hpp | 3 +- include/boost/qvm/vec_mat_operations2.hpp | 3 +- include/boost/qvm/vec_mat_operations3.hpp | 3 +- include/boost/qvm/vec_mat_operations4.hpp | 3 +- include/boost/qvm/vec_traits.hpp | 7 +- include/boost/ref.hpp | 17 - include/boost/serialization/force_include.hpp | 2 +- include/boost/serialization/nvp.hpp | 2 +- include/boost/serialization/serialization.hpp | 2 +- include/boost/serialization/split_free.hpp | 4 +- include/boost/serialization/split_member.hpp | 2 +- .../boost/serialization/strong_typedef.hpp | 2 +- include/boost/serialization/tracking.hpp | 2 +- include/boost/serialization/traits.hpp | 4 +- include/boost/serialization/version.hpp | 2 +- include/boost/tuple/detail/tuple_basic.hpp | 6 +- include/boost/tuple/tuple.hpp | 2 +- include/boost/type_index.hpp | 28 +- include/boost/type_index/ctti_type_index.hpp | 67 +- .../detail/compile_time_type_info.hpp | 134 +- .../type_index/detail/ctti_register_class.hpp | 14 +- .../type_index/detail/stl_register_class.hpp | 12 +- include/boost/type_index/stl_type_index.hpp | 96 +- .../boost/type_index/type_index_facade.hpp | 79 +- .../boost/type_traits/composite_traits.hpp | 29 - include/boost/type_traits/has_left_shift.hpp | 49 - include/boost/type_traits/has_right_shift.hpp | 49 - .../boost/type_traits/is_floating_point.hpp | 22 + include/boost/type_traits/make_signed.hpp | 137 - include/boost/utility/swap.hpp | 17 - .../variant/detail/apply_visitor_binary.hpp | 97 +- .../variant/detail/apply_visitor_delayed.hpp | 30 +- .../variant/detail/apply_visitor_unary.hpp | 34 +- include/boost/variant/detail/config.hpp | 20 +- .../boost/variant/detail/element_index.hpp | 2 +- .../boost/variant/detail/forced_return.hpp | 2 +- .../boost/variant/detail/has_result_type.hpp | 2 +- include/boost/variant/detail/hash_variant.hpp | 2 +- include/boost/variant/detail/initializer.hpp | 89 +- .../variant/detail/make_variant_list.hpp | 37 +- include/boost/variant/detail/move.hpp | 10 +- include/boost/variant/detail/std_hash.hpp | 2 +- .../boost/variant/detail/substitute_fwd.hpp | 15 - include/boost/variant/detail/variant_io.hpp | 26 +- .../boost/variant/detail/visitation_impl.hpp | 18 +- include/boost/variant/get.hpp | 2 +- .../boost/variant/recursive_wrapper_fwd.hpp | 2 +- include/boost/variant/variant.hpp | 158 +- include/boost/variant/variant_fwd.hpp | 156 +- include/boost/version.hpp | 4 +- package-lock.json | 3450 +++++++++-------- package.json | 14 +- 721 files changed, 18386 insertions(+), 19055 deletions(-) delete mode 100644 include/boost/bind/detail/requires_cxx11.hpp delete mode 100644 include/boost/bind/mem_fn_cc.hpp delete mode 100644 include/boost/bind/mem_fn_template.hpp delete mode 100644 include/boost/bind/mem_fn_vw.hpp create mode 100644 include/boost/config/assert_cxx23.hpp create mode 100644 include/boost/container/detail/addressof.hpp create mode 100644 include/boost/container/detail/is_pair.hpp create mode 100644 include/boost/container_hash/detail/hash_integral.hpp delete mode 100644 include/boost/container_hash/detail/requires_cxx11.hpp create mode 100644 include/boost/core/invoke_swap.hpp delete mode 100644 include/boost/core/swap.hpp delete mode 100644 include/boost/function/detail/epilogue.hpp delete mode 100644 include/boost/function/detail/function_iterate.hpp delete mode 100644 include/boost/function/detail/gen_maybe_include.pl delete mode 100644 include/boost/function/detail/maybe_include.hpp delete mode 100644 include/boost/function/detail/prologue.hpp delete mode 100644 include/boost/function/detail/requires_cxx11.hpp delete mode 100644 include/boost/function/function0.hpp delete mode 100644 include/boost/function/function1.hpp delete mode 100644 include/boost/function/function10.hpp delete mode 100644 include/boost/function/function2.hpp delete mode 100644 include/boost/function/function3.hpp delete mode 100644 include/boost/function/function4.hpp delete mode 100644 include/boost/function/function5.hpp delete mode 100644 include/boost/function/function6.hpp delete mode 100644 include/boost/function/function7.hpp delete mode 100644 include/boost/function/function8.hpp delete mode 100644 include/boost/function/function9.hpp delete mode 100644 include/boost/geometry/algorithms/detail/get_max_size.hpp rename include/boost/geometry/algorithms/detail/{overlay/intersection_box_box.hpp => intersection/box_box_implementation.hpp} (63%) delete mode 100644 include/boost/geometry/algorithms/detail/overlay/cluster_exits.hpp delete mode 100644 include/boost/geometry/algorithms/detail/recalculate.hpp create mode 100644 include/boost/geometry/core/primary_single_tag.hpp delete mode 100644 include/boost/geometry/policies/robustness/get_rescale_policy.hpp delete mode 100644 include/boost/geometry/policies/robustness/no_rescale_policy.hpp delete mode 100644 include/boost/geometry/policies/robustness/rescale_policy.hpp delete mode 100644 include/boost/geometry/policies/robustness/rescale_policy_tags.hpp delete mode 100644 include/boost/geometry/policies/robustness/robust_point_type.hpp delete mode 100644 include/boost/geometry/policies/robustness/robust_type.hpp delete mode 100644 include/boost/geometry/policies/robustness/segment_ratio_type.hpp delete mode 100644 include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp create mode 100644 include/boost/geometry/util/bounds.hpp delete mode 100644 include/boost/geometry/util/for_each_with_index.hpp create mode 100644 include/boost/geometry/util/numeric_cast.hpp create mode 100644 include/boost/geometry/views/enumerate_view.hpp create mode 100644 include/boost/lexical_cast/detail/buffer_view.hpp create mode 100644 include/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp create mode 100644 include/boost/math/ccmath/detail/config.hpp create mode 100644 include/boost/math/tools/array.hpp create mode 100644 include/boost/math/tools/cstdint.hpp create mode 100644 include/boost/math/tools/numeric_limits.hpp create mode 100644 include/boost/math/tools/type_traits.hpp create mode 100644 include/boost/move/detail/launder.hpp delete mode 100644 include/boost/move/utility.hpp create mode 100644 include/boost/qvm/to_string.hpp delete mode 100644 include/boost/ref.hpp delete mode 100644 include/boost/type_traits/composite_traits.hpp delete mode 100644 include/boost/type_traits/has_left_shift.hpp delete mode 100644 include/boost/type_traits/has_right_shift.hpp delete mode 100644 include/boost/type_traits/make_signed.hpp delete mode 100644 include/boost/utility/swap.hpp diff --git a/include/boost/array.hpp b/include/boost/array.hpp index f047063d..02bd76db 100644 --- a/include/boost/array.hpp +++ b/include/boost/array.hpp @@ -33,18 +33,18 @@ #include -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -# pragma warning(push) +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(push) # pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe -# pragma warning(disable:4510) // boost::array' : default constructor could not be generated -# pragma warning(disable:4610) // warning C4610: class 'boost::array' can never be instantiated - user defined constructor required +# pragma warning(disable:4510) // boost::array' : default constructor could not be generated +# pragma warning(disable:4610) // warning C4610: class 'boost::array' can never be instantiated - user defined constructor required #endif #include #include #include #include -#include +#include #include #include @@ -75,7 +75,7 @@ namespace boost { iterator begin() { return elems; } const_iterator begin() const { return elems; } const_iterator cbegin() const { return elems; } - + iterator end() { return elems+N; } const_iterator end() const { return elems+N; } const_iterator cend() const { return elems+N; } @@ -84,9 +84,9 @@ namespace boost { #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) - typedef std::reverse_iterator reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; #else @@ -112,39 +112,39 @@ namespace boost { } // operator[] - reference operator[](size_type i) - { - return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; + reference operator[](size_type i) + { + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; } - - /*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const - { - return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; + + /*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const + { + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; } // at() with range check reference at(size_type i) { return rangecheck(i), elems[i]; } /*BOOST_CONSTEXPR*/ const_reference at(size_type i) const { return rangecheck(i), elems[i]; } - + // front() and back() - reference front() - { - return elems[0]; + reference front() + { + return elems[0]; } - - BOOST_CONSTEXPR const_reference front() const + + BOOST_CONSTEXPR const_reference front() const { return elems[0]; } - - reference back() - { - return elems[N-1]; + + reference back() + { + return elems[N-1]; } - - BOOST_CONSTEXPR const_reference back() const - { - return elems[N-1]; + + BOOST_CONSTEXPR const_reference back() const + { + return elems[N-1]; } // size is constant @@ -156,7 +156,7 @@ namespace boost { // swap (note: linear complexity) void swap (array& y) { for (size_type i = 0; i < N; ++i) - boost::swap(elems[i],y.elems[i]); + boost::core::invoke_swap(elems[i],y.elems[i]); } // direct access to data (read-only) @@ -213,9 +213,9 @@ namespace boost { #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) - typedef std::reverse_iterator reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; #else @@ -301,7 +301,7 @@ namespace boost { // assign one value to all elements void assign (const T& value) { fill ( value ); } void fill (const T& ) {} - + // check range (may be private because it is static) static reference failed_rangecheck () { std::out_of_range e("attempt to access element of an empty array"); @@ -353,16 +353,16 @@ namespace boost { #if defined(__SUNPRO_CC) // Trac ticket #4757; the Sun Solaris compiler can't handle // syntax like 'T(&get_c_array(boost::array& arg))[N]' -// -// We can't just use this for all compilers, because the -// borland compilers can't handle this form. +// +// We can't just use this for all compilers, because the +// borland compilers can't handle this form. namespace detail { template struct c_array { typedef T type[N]; }; } - + // Specific for boost::array: simply returns its elems data member. template typename detail::c_array::type& get_c_array(boost::array& arg) @@ -383,7 +383,7 @@ namespace boost { { return arg.elems; } - + // Const version. template const T(&get_c_array(const boost::array& arg))[N] @@ -391,7 +391,7 @@ namespace boost { return arg.elems; } #endif - + #if 0 // Overload for std::array, assuming that std::array will have // explicit conversion functions as discussed at the WG21 meeting @@ -401,7 +401,7 @@ namespace boost { { return static_cast(arg); } - + // Const version. template const T(&get_c_array(const std::array& arg))[N] @@ -423,7 +423,7 @@ namespace boost { BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" ); return arr[Idx]; } - + template const T &get(const boost::array &arr) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" ); @@ -440,7 +440,7 @@ namespace std { BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" ); return arr[Idx]; } - + template const T &get(const boost::array &arr) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" ); @@ -449,8 +449,8 @@ namespace std { } #endif -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -# pragma warning(pop) -#endif +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(pop) +#endif #endif /*BOOST_ARRAY_HPP*/ diff --git a/include/boost/assert/source_location.hpp b/include/boost/assert/source_location.hpp index 09770f7d..c6eae325 100644 --- a/include/boost/assert/source_location.hpp +++ b/include/boost/assert/source_location.hpp @@ -7,9 +7,7 @@ // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt -#include #include -#include #include #include #include @@ -146,6 +144,10 @@ template std::basic_ostream & operator<<( std::basic_ost # define BOOST_CURRENT_LOCATION ::boost::source_location() +#elif defined(BOOST_MSVC) && BOOST_MSVC >= 1935 + +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCSIG(), __builtin_COLUMN()) + #elif defined(BOOST_MSVC) && BOOST_MSVC >= 1926 // std::source_location::current() is available in -std:c++20, but fails with consteval errors before 19.31, and doesn't produce @@ -172,9 +174,12 @@ template std::basic_ostream & operator<<( std::basic_ost # define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION(), __builtin_COLUMN()) -#elif defined(BOOST_GCC) && BOOST_GCC >= 70000 +#elif defined(BOOST_GCC) && BOOST_GCC >= 80000 // The built-ins are available in 4.8+, but are not constant expressions until 7 +// In addition, reproducible builds require -ffile-prefix-map, which is GCC 8 +// https://github.com/boostorg/assert/issues/38 + # define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION()) #elif defined(BOOST_GCC) && BOOST_GCC >= 50000 diff --git a/include/boost/bind/detail/requires_cxx11.hpp b/include/boost/bind/detail/requires_cxx11.hpp deleted file mode 100644 index a104d067..00000000 --- a/include/boost/bind/detail/requires_cxx11.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef BOOST_BIND_DETAIL_REQUIRES_CXX11_HPP_INCLUDED -#define BOOST_BIND_DETAIL_REQUIRES_CXX11_HPP_INCLUDED - -// Copyright 2023 Peter Dimov -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ - defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_DECLTYPE) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) - -BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Bind 1.82 and will be removed in Boost.Bind 1.84. Please open an issue in https://github.com/boostorg/bind if you want it retained.") - -#endif - -#endif // #ifndef BOOST_BIND_DETAIL_REQUIRES_CXX11_HPP_INCLUDED diff --git a/include/boost/bind/mem_fn.hpp b/include/boost/bind/mem_fn.hpp index 1078e7c5..5cfbb99e 100644 --- a/include/boost/bind/mem_fn.hpp +++ b/include/boost/bind/mem_fn.hpp @@ -8,318 +8,162 @@ #endif // -// mem_fn.hpp - a generalization of std::mem_fun[_ref] +// mem_fn.hpp - a generalization of std::mem_fun[_ref] // -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2003-2005 Peter Dimov +// Copyright 2001-2005, 2024 Peter Dimov +// Copyright 2001 David Abrahams // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. // -#include #include #include #include +#include namespace boost { -#if defined(BOOST_NO_VOID_RETURNS) - -#define BOOST_MEM_FN_CLASS_F , class F -#define BOOST_MEM_FN_TYPEDEF(X) - -namespace _mfi // mem_fun_impl +namespace _mfi { -template struct mf +template struct remove_cvref: std::remove_cv< typename std::remove_reference::type > { +}; -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf - -template<> struct mf +template class mf { +public: -#define BOOST_MEM_FN_RETURN - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF_F - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_NAME2(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif + typedef R result_type; -#ifdef BOOST_MEM_FN_ENABLE_STDCALL +private: -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall + Pm pm_; -#include +public: -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC + mf( Pm pm ): pm_( pm ) {} -#endif + template::type, + class En = typename std::enable_if< + std::is_same::value || std::is_base_of::value + >::type + > -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + R operator()( U&& u, A... a ) const + { + return (std::forward( u ).*pm_)( std::forward( a )... ); + } -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall + template::type, + class E1 = void, + class En = typename std::enable_if< + !(std::is_same::value || std::is_base_of::value) + >::type + > -#include + R operator()( U&& u, A... a ) const + { + return (get_pointer( std::forward( u ) )->*pm_)( std::forward( a )... ); + } -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC + bool operator==( mf const & rhs ) const + { + return pm_ == rhs.pm_; + } -#endif + bool operator!=( mf const & rhs ) const + { + return pm_ != rhs.pm_; + } +}; } // namespace _mfi -#else // #ifdef BOOST_NO_VOID_RETURNS - -#define BOOST_MEM_FN_CLASS_F -#define BOOST_MEM_FN_TYPEDEF(X) typedef X; +// -namespace _mfi +template +auto mem_fn( R (T::*pmf) (A...) ) -> _mfi::mf { + return pmf; +} -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -} // namespace _mfi - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF - -#endif // #ifdef BOOST_NO_VOID_RETURNS +template +auto mem_fn( R (T::*pmf) (A...) const ) -> _mfi::mf +{ + return pmf; +} -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC -#define BOOST_MEM_FN_NOEXCEPT +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) -#include +template +auto mem_fn( R (T::*pmf) (A...) noexcept ) -> _mfi::mf +{ + return pmf; +} -#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) -# undef BOOST_MEM_FN_NOEXCEPT -# define BOOST_MEM_FN_NOEXCEPT noexcept -# include -#endif +template +auto mem_fn( R (T::*pmf) (A...) const noexcept ) -> _mfi::mf +{ + return pmf; +} -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NOEXCEPT +#endif // #if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) #if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl -#define BOOST_MEM_FN_NOEXCEPT +template +auto mem_fn( R (__cdecl T::*pmf) (A...) ) -> _mfi::mf +{ + return pmf; +} -#include +template +auto mem_fn( R (__cdecl T::*pmf) (A...) const ) -> _mfi::mf +{ + return pmf; +} -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NOEXCEPT - -#endif +#endif // #if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall -#define BOOST_MEM_FN_NOEXCEPT - -#include +template +auto mem_fn( R (__stdcall T::*pmf) (A...) ) -> _mfi::mf +{ + return pmf; +} -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NOEXCEPT +template +auto mem_fn( R (__stdcall T::*pmf) (A...) const ) -> _mfi::mf +{ + return pmf; +} -#endif +#endif // #if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall -#define BOOST_MEM_FN_NOEXCEPT - -#include +template +auto mem_fn( R (__fastcall T::*pmf) (A...) ) -> _mfi::mf +{ + return pmf; +} -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NOEXCEPT +template +auto mem_fn( R (__fastcall T::*pmf) (A...) const ) -> _mfi::mf +{ + return pmf; +} -#endif +#endif // #if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) // data member support @@ -334,69 +178,74 @@ template class dm typedef T const * argument_type; private: - - typedef R (T::*F); - F f_; - template R const & call(U & u, T const *) const - { - return (u.*f_); - } - - template R const & call(U & u, void const *) const - { - return (get_pointer(u)->*f_); - } + typedef R (T::*Pm); + Pm pm_; public: - - explicit dm(F f): f_(f) {} - R & operator()(T * p) const - { - return (p->*f_); - } + dm( Pm pm ): pm_( pm ) {} - R const & operator()(T const * p) const + template::type, + class En = typename std::enable_if< + std::is_same::value || std::is_base_of::value + >::type + > + + auto operator()( U&& u ) const -> decltype( std::forward( u ).*pm_ ) { - return (p->*f_); + return std::forward( u ).*pm_; } - template R const & operator()(U const & u) const + template::type, + class E1 = void, + class En = typename std::enable_if< + !(std::is_same::value || std::is_base_of::value) + >::type + > + + auto operator()( U&& u ) const -> decltype( get_pointer( std::forward( u ) )->*pm_ ) { - return call(u, &u); + return get_pointer( std::forward( u ) )->*pm_; } -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1910) - R & operator()(T & t) const + template + R& operator()( U* u ) const { - return (t.*f_); + return u->*pm_; } - R const & operator()(T const & t) const + template + R const& operator()( U const* u ) const { - return (t.*f_); + return u->*pm_; } #endif - bool operator==(dm const & rhs) const + bool operator==( dm const & rhs ) const { - return f_ == rhs.f_; + return pm_ == rhs.pm_; } - bool operator!=(dm const & rhs) const + bool operator!=( dm const & rhs ) const { - return f_ != rhs.f_; + return pm_ != rhs.pm_; } }; } // namespace _mfi -template _mfi::dm mem_fn(R T::*f) +template::value >::type +> +_mfi::dm mem_fn( R T::*pm ) { - return _mfi::dm(f); + return pm; } } // namespace boost diff --git a/include/boost/bind/mem_fn_cc.hpp b/include/boost/bind/mem_fn_cc.hpp deleted file mode 100644 index 03e38300..00000000 --- a/include/boost/bind/mem_fn_cc.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// bind/mem_fn_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -template _mfi::BOOST_MEM_FN_NAME(mf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf0)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf0)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf1)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf1)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf2)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf2)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf3)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf3)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf4)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf4)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf5)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf5)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf6)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf6)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf7)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf7)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(mf8)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const BOOST_MEM_FN_NOEXCEPT) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf8)(f); -} diff --git a/include/boost/bind/mem_fn_template.hpp b/include/boost/bind/mem_fn_template.hpp deleted file mode 100644 index b26d585d..00000000 --- a/include/boost/bind/mem_fn_template.hpp +++ /dev/null @@ -1,1047 +0,0 @@ -// -// bind/mem_fn_template.hpp -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS -#endif - -// mf0 - -template class BOOST_MEM_FN_NAME(mf0) -{ -public: - - typedef R result_type; - typedef T * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) - F f_; - - template R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} - - R operator()(T * p) const - { - BOOST_MEM_FN_RETURN (p->*f_)(); - } - - template R operator()(U & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - -#endif - - R operator()(T & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf0 - -template class BOOST_MEM_FN_NAME(cmf0) -{ -public: - - typedef R result_type; - typedef T const * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) - F f_; - - template R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} - - template R operator()(U const & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - - R operator()(T const & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf1 - -template class BOOST_MEM_FN_NAME(mf1) -{ -public: - - typedef R result_type; - typedef T * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) - F f_; - - template R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} - - R operator()(T * p, A1 a1) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1); - } - - template R operator()(U & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - -#endif - - R operator()(T & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf1 - -template class BOOST_MEM_FN_NAME(cmf1) -{ -public: - - typedef R result_type; - typedef T const * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) - F f_; - - template R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - - R operator()(T const & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf2 - -template class BOOST_MEM_FN_NAME(mf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); - } - - template R operator()(U & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf2 - -template class BOOST_MEM_FN_NAME(cmf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - - R operator()(T const & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf3 - -template class BOOST_MEM_FN_NAME(mf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf3 - -template class BOOST_MEM_FN_NAME(cmf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf4 - -template class BOOST_MEM_FN_NAME(mf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf4 - -template class BOOST_MEM_FN_NAME(cmf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf5 - -template class BOOST_MEM_FN_NAME(mf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf5 - -template class BOOST_MEM_FN_NAME(cmf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf6 - -template class BOOST_MEM_FN_NAME(mf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf6 - -template class BOOST_MEM_FN_NAME(cmf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf7 - -template class BOOST_MEM_FN_NAME(mf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf7 - -template class BOOST_MEM_FN_NAME(cmf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf8 - -template class BOOST_MEM_FN_NAME(mf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf8 - -template class BOOST_MEM_FN_NAME(cmf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} - - R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/include/boost/bind/mem_fn_vw.hpp b/include/boost/bind/mem_fn_vw.hpp deleted file mode 100644 index f3fc58db..00000000 --- a/include/boost/bind/mem_fn_vw.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// bind/mem_fn_vw.hpp - void return helper wrappers -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -template struct BOOST_MEM_FN_NAME(mf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (); - explicit BOOST_MEM_FN_NAME(mf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0) -{ - typedef R (BOOST_MEM_FN_CC T::*F) () const; - explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1); - explicit BOOST_MEM_FN_NAME(mf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; - explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); - explicit BOOST_MEM_FN_NAME(mf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; - explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); - explicit BOOST_MEM_FN_NAME(mf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; - explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); - explicit BOOST_MEM_FN_NAME(mf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; - explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); - explicit BOOST_MEM_FN_NAME(mf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; - explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); - explicit BOOST_MEM_FN_NAME(mf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; - explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); - explicit BOOST_MEM_FN_NAME(mf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; - explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); - explicit BOOST_MEM_FN_NAME(mf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; - explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)(f) {} -}; - diff --git a/include/boost/config/assert_cxx03.hpp b/include/boost/config/assert_cxx03.hpp index 03360a93..c914aa86 100644 --- a/include/boost/config/assert_cxx03.hpp +++ b/include/boost/config/assert_cxx03.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the diff --git a/include/boost/config/assert_cxx11.hpp b/include/boost/config/assert_cxx11.hpp index b029a274..addd06ad 100644 --- a/include/boost/config/assert_cxx11.hpp +++ b/include/boost/config/assert_cxx11.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the @@ -18,6 +18,9 @@ #ifdef BOOST_NO_CXX11_ALIGNAS # error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ALIGNAS." #endif +#ifdef BOOST_NO_CXX11_ALIGNOF +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ALIGNOF." +#endif #ifdef BOOST_NO_CXX11_ALLOCATOR # error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ALLOCATOR." #endif diff --git a/include/boost/config/assert_cxx14.hpp b/include/boost/config/assert_cxx14.hpp index 1d3132a1..061aba3f 100644 --- a/include/boost/config/assert_cxx14.hpp +++ b/include/boost/config/assert_cxx14.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the diff --git a/include/boost/config/assert_cxx17.hpp b/include/boost/config/assert_cxx17.hpp index cd41be61..e2402515 100644 --- a/include/boost/config/assert_cxx17.hpp +++ b/include/boost/config/assert_cxx17.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the @@ -12,6 +12,9 @@ #include #include +#ifdef BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS." +#endif #ifdef BOOST_NO_CXX17_DEDUCTION_GUIDES # error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_DEDUCTION_GUIDES." #endif diff --git a/include/boost/config/assert_cxx20.hpp b/include/boost/config/assert_cxx20.hpp index c1482778..71a74154 100644 --- a/include/boost/config/assert_cxx20.hpp +++ b/include/boost/config/assert_cxx20.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the diff --git a/include/boost/config/assert_cxx23.hpp b/include/boost/config/assert_cxx23.hpp new file mode 100644 index 00000000..feb44573 --- /dev/null +++ b/include/boost/config/assert_cxx23.hpp @@ -0,0 +1,41 @@ +// This file was automatically generated on Fri Oct 13 19:09:38 2023 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX23_HDR_EXPECTED +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_EXPECTED." +#endif +#ifdef BOOST_NO_CXX23_HDR_FLAT_MAP +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_FLAT_MAP." +#endif +#ifdef BOOST_NO_CXX23_HDR_FLAT_SET +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_FLAT_SET." +#endif +#ifdef BOOST_NO_CXX23_HDR_GENERATOR +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_GENERATOR." +#endif +#ifdef BOOST_NO_CXX23_HDR_MDSPAN +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_MDSPAN." +#endif +#ifdef BOOST_NO_CXX23_HDR_PRINT +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_PRINT." +#endif +#ifdef BOOST_NO_CXX23_HDR_SPANSTREAM +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_SPANSTREAM." +#endif +#ifdef BOOST_NO_CXX23_HDR_STACKTRACE +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_STACKTRACE." +#endif +#ifdef BOOST_NO_CXX23_HDR_STDFLOAT +# error "Your compiler appears not to be fully C++23 compliant. Detected via defect macro BOOST_NO_CXX23_HDR_STDFLOAT." +#endif diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 567636c5..51d51886 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -245,6 +245,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index 1eeed315..f9a5050b 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -321,6 +321,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if (__clang_major__ < 4) || (__cplusplus < 201406L) /* non-standard value that is greater than 201402, which is reported by clang 4.0.0 for C++1z */ +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif + #if __cplusplus < 201103L #define BOOST_NO_CXX11_SFINAE_EXPR #endif diff --git a/include/boost/config/compiler/clang_version.hpp b/include/boost/config/compiler/clang_version.hpp index 70c5507c..a61de13d 100644 --- a/include/boost/config/compiler/clang_version.hpp +++ b/include/boost/config/compiler/clang_version.hpp @@ -2,7 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt) -#if !defined(__APPLE__) +#if !defined(__apple_build_version__) # define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__ % 100) @@ -11,7 +11,13 @@ // https://en.wikipedia.org/wiki/Xcode#Toolchain_versions -# if BOOST_CLANG_REPORTED_VERSION >= 140000 +# if BOOST_CLANG_REPORTED_VERSION >= 150000 +# define BOOST_CLANG_VERSION 160000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 140003 +# define BOOST_CLANG_VERSION 150000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 140000 # define BOOST_CLANG_VERSION 140000 # elif BOOST_CLANG_REPORTED_VERSION >= 130100 diff --git a/include/boost/config/compiler/codegear.hpp b/include/boost/config/compiler/codegear.hpp index 4d3f42ae..49f934c0 100644 --- a/include/boost/config/compiler/codegear.hpp +++ b/include/boost/config/compiler/codegear.hpp @@ -316,6 +316,10 @@ # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif + // // TR1 macros: // diff --git a/include/boost/config/compiler/common_edg.hpp b/include/boost/config/compiler/common_edg.hpp index dc049893..0d59ae0e 100644 --- a/include/boost/config/compiler/common_edg.hpp +++ b/include/boost/config/compiler/common_edg.hpp @@ -171,10 +171,12 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif - #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #ifdef c_plusplus // EDG has "long long" in non-strict mode diff --git a/include/boost/config/compiler/digitalmars.hpp b/include/boost/config/compiler/digitalmars.hpp index bb56ff6c..4fa347ab 100644 --- a/include/boost/config/compiler/digitalmars.hpp +++ b/include/boost/config/compiler/digitalmars.hpp @@ -130,6 +130,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #if (__DMC__ <= 0x840) #error "Compiler not supported or configured - please reconfigure" diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index 2f1fe550..fc05a918 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -319,6 +319,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if (__GNUC__ < 7) || (__cplusplus < 201703L) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #if __GNUC__ >= 7 # define BOOST_FALLTHROUGH __attribute__((fallthrough)) diff --git a/include/boost/config/compiler/gcc_xml.hpp b/include/boost/config/compiler/gcc_xml.hpp index 75cac44e..e23b14d0 100644 --- a/include/boost/config/compiler/gcc_xml.hpp +++ b/include/boost/config/compiler/gcc_xml.hpp @@ -108,7 +108,8 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ - - diff --git a/include/boost/config/compiler/hp_acc.hpp b/include/boost/config/compiler/hp_acc.hpp index 25636324..42e35e55 100644 --- a/include/boost/config/compiler/hp_acc.hpp +++ b/include/boost/config/compiler/hp_acc.hpp @@ -137,6 +137,10 @@ #define BOOST_NO_CXX11_VARIADIC_MACROS #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif + #endif // diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index 448ab67b..c38efb32 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -173,6 +173,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/include/boost/config/compiler/mpw.hpp b/include/boost/config/compiler/mpw.hpp index 8433f371..3adb6122 100644 --- a/include/boost/config/compiler/mpw.hpp +++ b/include/boost/config/compiler/mpw.hpp @@ -122,6 +122,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif // // versions check: diff --git a/include/boost/config/compiler/nvcc.hpp b/include/boost/config/compiler/nvcc.hpp index 419dd724..147f75db 100644 --- a/include/boost/config/compiler/nvcc.hpp +++ b/include/boost/config/compiler/nvcc.hpp @@ -57,5 +57,8 @@ # define BOOST_NO_CXX11_NOEXCEPT #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS #endif +#endif diff --git a/include/boost/config/compiler/pathscale.hpp b/include/boost/config/compiler/pathscale.hpp index 5348cf7f..59ab9b00 100644 --- a/include/boost/config/compiler/pathscale.hpp +++ b/include/boost/config/compiler/pathscale.hpp @@ -135,4 +135,7 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif #endif diff --git a/include/boost/config/compiler/sunpro_cc.hpp b/include/boost/config/compiler/sunpro_cc.hpp index 490dc76d..334b604b 100644 --- a/include/boost/config/compiler/sunpro_cc.hpp +++ b/include/boost/config/compiler/sunpro_cc.hpp @@ -194,6 +194,9 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif // Turn on threading support for Solaris 12. // Ticket #11972 diff --git a/include/boost/config/compiler/vacpp.hpp b/include/boost/config/compiler/vacpp.hpp index 9cfa1adf..3794d360 100644 --- a/include/boost/config/compiler/vacpp.hpp +++ b/include/boost/config/compiler/vacpp.hpp @@ -184,3 +184,6 @@ #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) # define BOOST_NO_CXX17_IF_CONSTEXPR #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index ae631219..ce0fc15e 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -263,6 +263,9 @@ #define BOOST_NO_CXX17_INLINE_VARIABLES #define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if (_MSC_VER < 1914) || (_MSVC_LANG < 201703) +#define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif // // Things that don't work in clr mode: @@ -305,6 +308,10 @@ # define BOOST_CXX_VERSION 201402L #endif +#if BOOST_CXX_VERSION >= 201703L +# define BOOST_ATTRIBUTE_UNUSED [[maybe_unused]] +#endif + #ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The diff --git a/include/boost/config/compiler/xlcpp.hpp b/include/boost/config/compiler/xlcpp.hpp index 99b8b245..4a4477d9 100644 --- a/include/boost/config/compiler/xlcpp.hpp +++ b/include/boost/config/compiler/xlcpp.hpp @@ -265,6 +265,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606) +# define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS +#endif + #if !__has_feature(cxx_thread_local) # define BOOST_NO_CXX11_THREAD_LOCAL #endif diff --git a/include/boost/config/compiler/xlcpp_zos.hpp b/include/boost/config/compiler/xlcpp_zos.hpp index 9a177f1b..0b288a88 100644 --- a/include/boost/config/compiler/xlcpp_zos.hpp +++ b/include/boost/config/compiler/xlcpp_zos.hpp @@ -157,6 +157,7 @@ #define BOOST_NO_CXX17_INLINE_VARIABLES #define BOOST_NO_CXX17_FOLD_EXPRESSIONS #define BOOST_NO_CXX17_IF_CONSTEXPR +#define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS // ------------------------------------- diff --git a/include/boost/config/detail/cxx_composite.hpp b/include/boost/config/detail/cxx_composite.hpp index a243d41f..acd8e849 100644 --- a/include/boost/config/detail/cxx_composite.hpp +++ b/include/boost/config/detail/cxx_composite.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jun 5 16:50:18 2022 +// This file was automatically generated on Fri Oct 13 19:09:38 2023 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-21. // Use, modification and distribution are subject to the @@ -81,6 +81,7 @@ #if defined(BOOST_NO_CXX03)\ || defined(BOOST_NO_CXX11_ADDRESSOF)\ || defined(BOOST_NO_CXX11_ALIGNAS)\ + || defined(BOOST_NO_CXX11_ALIGNOF)\ || defined(BOOST_NO_CXX11_ALLOCATOR)\ || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)\ || defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS)\ @@ -163,6 +164,7 @@ #endif #if defined(BOOST_NO_CXX14)\ + || defined(BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS)\ || defined(BOOST_NO_CXX17_DEDUCTION_GUIDES)\ || defined(BOOST_NO_CXX17_FOLD_EXPRESSIONS)\ || defined(BOOST_NO_CXX17_HDR_ANY)\ @@ -201,3 +203,16 @@ # define BOOST_NO_CXX20 #endif +#if defined(BOOST_NO_CXX20)\ + || defined(BOOST_NO_CXX23_HDR_EXPECTED)\ + || defined(BOOST_NO_CXX23_HDR_FLAT_MAP)\ + || defined(BOOST_NO_CXX23_HDR_FLAT_SET)\ + || defined(BOOST_NO_CXX23_HDR_GENERATOR)\ + || defined(BOOST_NO_CXX23_HDR_MDSPAN)\ + || defined(BOOST_NO_CXX23_HDR_PRINT)\ + || defined(BOOST_NO_CXX23_HDR_SPANSTREAM)\ + || defined(BOOST_NO_CXX23_HDR_STACKTRACE)\ + || defined(BOOST_NO_CXX23_HDR_STDFLOAT) +# define BOOST_NO_CXX23 +#endif + diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index b28d46f1..2650510f 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -1257,6 +1257,46 @@ namespace std{ using ::type_info; } #endif #endif +#if (!defined(__has_include) || (BOOST_CXX_VERSION < 202003L)) +# define BOOST_NO_CXX23_HDR_EXPECTED +# define BOOST_NO_CXX23_HDR_FLAT_MAP +# define BOOST_NO_CXX23_HDR_FLAT_SET +# define BOOST_NO_CXX23_HDR_GENERATOR +# define BOOST_NO_CXX23_HDR_MDSPAN +# define BOOST_NO_CXX23_HDR_PRINT +# define BOOST_NO_CXX23_HDR_SPANSTREAM +# define BOOST_NO_CXX23_HDR_STACKTRACE +# define BOOST_NO_CXX23_HDR_STDFLOAT +#else +#if (!__has_include() || !defined(__cpp_lib_expected) || (__cpp_lib_expected < 202211L)) && !defined(BOOST_NO_CXX23_HDR_EXPECTED) +# define BOOST_NO_CXX23_HDR_EXPECTED +#endif +#if (!__has_include() || !defined(__cpp_lib_flat_map) || (__cpp_lib_flat_map < 202207L)) && !defined(BOOST_NO_CXX23_HDR_FLAT_MAP) +# define BOOST_NO_CXX23_HDR_FLAT_MAP +#endif +#if (!__has_include() || !defined(__cpp_lib_flat_set) || (__cpp_lib_flat_set < 202207L)) && !defined(BOOST_NO_CXX23_HDR_FLAT_SET) +# define BOOST_NO_CXX23_HDR_FLAT_SET +#endif +#if (!__has_include() || !defined(__cpp_lib_generator) || (__cpp_lib_generator < 202207L)) && !defined(BOOST_NO_CXX23_HDR_GENERATOR) +# define BOOST_NO_CXX23_HDR_GENERATOR +#endif +#if (!__has_include() || !defined(__cpp_lib_mdspan) || (__cpp_lib_mdspan < 202207L)) && !defined(BOOST_NO_CXX23_HDR_MDSPAN) +# define BOOST_NO_CXX23_HDR_MDSPAN +#endif +#if (!__has_include() || !defined(__cpp_lib_print) || (__cpp_lib_print < 202207L)) && !defined(BOOST_NO_CXX23_HDR_PRINT) +# define BOOST_NO_CXX23_HDR_PRINT +#endif +#if (!__has_include() || !defined(__cpp_lib_spanstream) || (__cpp_lib_spanstream < 202106L)) && !defined(BOOST_NO_CXX23_HDR_SPANSTREAM) +# define BOOST_NO_CXX23_HDR_SPANSTREAM +#endif +#if (!__has_include() || !defined(__cpp_lib_stacktrace) || (__cpp_lib_stacktrace < 202011L)) && !defined(BOOST_NO_CXX23_HDR_STACKTRACE) +# define BOOST_NO_CXX23_HDR_STACKTRACE +#endif +#if !__has_include() && !defined(BOOST_NO_CXX23_HDR_STDFLOAT) +# define BOOST_NO_CXX23_HDR_STDFLOAT +#endif +#endif + #if defined(__cplusplus) && defined(__has_include) #if !__has_include() # define BOOST_NO_CXX20_HDR_VERSION diff --git a/include/boost/container/allocator_traits.hpp b/include/boost/container/allocator_traits.hpp index f5f73efa..dd5bf0e4 100644 --- a/include/boost/container/allocator_traits.hpp +++ b/include/boost/container/allocator_traits.hpp @@ -32,6 +32,8 @@ #include #include //is_empty #include +#include +#include #ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP #include #endif @@ -44,14 +46,13 @@ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include #endif -// other boost -#include #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-result" +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate @@ -75,7 +76,7 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 #include -#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) #pragma GCC diagnostic pop #endif @@ -83,6 +84,144 @@ namespace boost { namespace container { +namespace dtl { + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template +BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...args) +{ + ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); +} + +template < class Pair, class KeyType, class ... Args> +typename dtl::enable_if< dtl::is_pair, void >::type +construct_type + (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) +{ + construct_type(dtl::addressof(p->first), ::boost::forward(k)); + BOOST_CONTAINER_TRY{ + construct_type(dtl::addressof(p->second), ::boost::forward(args)...); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename Pair::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +#else + +#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ(N) \ +template\ +BOOST_CONTAINER_FORCEINLINE \ + typename dtl::disable_if_c::value, void >::type \ +construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ +{\ + ::new((void*)p, boost_container_new_t()) T( BOOST_MOVE_FWD##N );\ +}\ +// +BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ) +#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ + +#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE(N) \ +template < class Pair, class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\ +typename dtl::enable_if< dtl::is_pair, void >::type construct_type\ + (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ +{\ + construct_type(dtl::addressof(p->first), ::boost::forward(k));\ + BOOST_CONTAINER_TRY{\ + construct_type(dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ + BOOST_CONTAINER_CATCH(...) {\ + typedef typename Pair::first_type first_type;\ + dtl::addressof(p->first)->~first_type();\ + BOOST_CONTAINER_RETHROW\ + }\ + BOOST_CONTAINER_CATCH_END\ +}\ +// +BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE) +#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE + +#endif + +template +inline +typename dtl::enable_if, void >::type +construct_type(T* p) +{ + dtl::construct_type(dtl::addressof(p->first)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + + +template +inline +typename dtl::enable_if_c + < dtl::is_pair::value + , void >::type +construct_type(T* p, U &u) +{ + dtl::construct_type(dtl::addressof(p->first), u.first); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), u.second); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +template +inline +typename dtl::enable_if_c + < dtl::is_pair::type>::value && + !boost::move_detail::is_reference::value //This is needed for MSVC10 and ambiguous overloads + , void >::type +construct_type(T* p, BOOST_RV_REF(U) u) +{ + dtl::construct_type(dtl::addressof(p->first), ::boost::move(u.first)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), ::boost::move(u.second)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +template +inline +typename dtl::enable_if, void >::type +construct_type(T* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) +{ + dtl::construct_type(dtl::addressof(p->first), ::boost::forward(x)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), ::boost::forward(y)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +} //namespace dtl #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -102,19 +241,19 @@ namespace dtl { //supporting rvalue references template struct is_std_allocator -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; template struct is_std_allocator< std::allocator > -{ static const bool value = true; }; +{ BOOST_STATIC_CONSTEXPR bool value = true; }; template struct is_std_allocator< small_vector_allocator, Options > > -{ static const bool value = true; }; +{ BOOST_STATIC_CONSTEXPR bool value = true; }; template struct is_not_std_allocator -{ static const bool value = !is_std_allocator::value; }; +{ BOOST_STATIC_CONSTEXPR bool value = !is_std_allocator::value; }; BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer) @@ -298,18 +437,18 @@ struct allocator_traits //! Returns: a.allocate(n) //! - BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n) + inline static pointer allocate(Allocator &a, size_type n) { return a.allocate(n); } //! Returns: a.deallocate(p, n) //! //! Throws: Nothing - BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n) + inline static void deallocate(Allocator &a, pointer p, size_type n) { a.deallocate(p, n); } //! Effects: calls a.allocate(n, p) if that call is well-formed; //! otherwise, invokes a.allocate(n) - BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p) + inline static pointer allocate(Allocator &a, size_type n, const_void_pointer p) { const bool value = boost::container::dtl:: has_member_function_callable_with_allocate @@ -321,7 +460,7 @@ struct allocator_traits //! Effects: calls a.destroy(p) if that call is well-formed; //! otherwise, invokes p->~T(). template - BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW + inline static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW { typedef T* destroy_pointer; const bool value = boost::container::dtl:: @@ -333,7 +472,7 @@ struct allocator_traits //! Returns: a.max_size() if that expression is well-formed; otherwise, //! numeric_limits::max(). - BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + inline static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { const bool value = allocator_traits_detail::has_max_size::value; dtl::bool_ flag; @@ -342,7 +481,7 @@ struct allocator_traits //! Returns: a.select_on_container_copy_construction() if that expression is well-formed; //! otherwise, a. - BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator, + inline static BOOST_CONTAINER_DOC1ST(Allocator, typename dtl::if_c < allocator_traits_detail::has_select_on_container_copy_construction::value BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) @@ -358,9 +497,9 @@ struct allocator_traits //! Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; //! otherwise, invokes `placement new` (static_cast(p)) T(std::forward(args)...) template - BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) + inline static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) { - static const bool value = ::boost::move_detail::and_ + BOOST_STATIC_CONSTEXPR bool value = ::boost::move_detail::and_ < dtl::is_not_std_allocator , boost::container::dtl::has_member_function_callable_with_construct < Allocator, T*, Args... > @@ -372,7 +511,7 @@ struct allocator_traits //! Returns: a.storage_is_unpropagable(p) if is_partially_propagable::value is true; otherwise, //! false. - BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW + inline static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW { dtl::bool_ flag; return allocator_traits::priv_storage_is_unpropagable(flag, a, p); @@ -380,7 +519,7 @@ struct allocator_traits //! Returns: true if is_always_equal::value == true, otherwise, //! a == b. - BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW + inline static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW { dtl::bool_ flag; return allocator_traits::priv_equal(flag, a, b); @@ -388,48 +527,48 @@ struct allocator_traits #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) private: - BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::true_type, Allocator &a, size_type n, const_void_pointer p) + inline static pointer priv_allocate(dtl::true_type, Allocator &a, size_type n, const_void_pointer p) { return a.allocate(n, p); } - BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer) + inline static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer) { return a.allocate(n); } template - BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW + inline static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW { a.destroy(p); } template - BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW + inline static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW { p->~T(); (void)p; } - BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + inline static size_type priv_max_size(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a.max_size(); } - BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline static size_type priv_max_size(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(value_type); } - BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(dtl::true_type, const Allocator &a) + inline static Allocator priv_select_on_container_copy_construction(dtl::true_type, const Allocator &a) { return a.select_on_container_copy_construction(); } - BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + inline static const Allocator &priv_select_on_container_copy_construction(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a; } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) + inline static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) { a.construct( p, ::boost::forward(args)...); } template - BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) - { ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); } + inline static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) + { dtl::construct_type(p, ::boost::forward(args)...); } #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) public: #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \ template\ - BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + inline static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - static const bool value = ::boost::move_detail::and_ \ + BOOST_STATIC_CONSTEXPR bool value = ::boost::move_detail::and_ \ < dtl::is_not_std_allocator \ , boost::container::dtl::has_member_function_callable_with_construct \ < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \ @@ -447,12 +586,12 @@ struct allocator_traits ///////////////////////////////// #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ template\ - BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + inline static void priv_construct(dtl::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\ \ template\ - BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ + inline static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { dtl::construct_type(p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ // BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL @@ -460,19 +599,19 @@ struct allocator_traits #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) + inline static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) { ::new((void*)p, boost_container_new_t()) T; } - BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::true_type, const Allocator &a, pointer p) + inline static bool priv_storage_is_unpropagable(dtl::true_type, const Allocator &a, pointer p) { return a.storage_is_unpropagable(p); } - BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::false_type, const Allocator &, pointer) + inline static bool priv_storage_is_unpropagable(dtl::false_type, const Allocator &, pointer) { return false; } - BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::true_type, const Allocator &, const Allocator &) + inline static bool priv_equal(dtl::true_type, const Allocator &, const Allocator &) { return true; } - BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::false_type, const Allocator &a, const Allocator &b) + inline static bool priv_equal(dtl::false_type, const Allocator &a, const Allocator &b) { return a == b; } #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/include/boost/container/container_fwd.hpp b/include/boost/container/container_fwd.hpp index 9e82fdef..2525b7d2 100644 --- a/include/boost/container/container_fwd.hpp +++ b/include/boost/container/container_fwd.hpp @@ -15,6 +15,8 @@ # include #endif +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -277,10 +279,10 @@ class basic_string; typedef basic_string string; typedef basic_string wstring; -static const std::size_t ADP_nodes_per_block = 256u; -static const std::size_t ADP_max_free_blocks = 2u; -static const std::size_t ADP_overhead_percent = 1u; -static const std::size_t ADP_only_alignment = 0u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_nodes_per_block = 256u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_max_free_blocks = 2u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_overhead_percent = 1u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_only_alignment = 0u; template < class T , std::size_t NodesPerBlock = ADP_nodes_per_block @@ -295,7 +297,7 @@ template < class T , unsigned int AllocationDisableMask = 0> class allocator; -static const std::size_t NodeAlloc_nodes_per_block = 256u; +BOOST_STATIC_CONSTEXPR std::size_t NodeAlloc_nodes_per_block = 256u; template < class T @@ -332,7 +334,7 @@ struct ordered_range_t //! Value used to tag that the input range is //! guaranteed to be ordered -static const ordered_range_t ordered_range = ordered_range_t(); +BOOST_CONTAINER_CONSTANT_VAR ordered_range_t ordered_range = ordered_range_t(); //! Type used to tag that the input range is //! guaranteed to be ordered and unique @@ -342,7 +344,7 @@ struct ordered_unique_range_t //! Value used to tag that the input range is //! guaranteed to be ordered and unique -static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); +BOOST_CONTAINER_CONSTANT_VAR ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); //! Type used to tag that the inserted values //! should be default initialized @@ -351,7 +353,7 @@ struct default_init_t //! Value used to tag that the inserted values //! should be default initialized -static const default_init_t default_init = default_init_t(); +BOOST_CONTAINER_CONSTANT_VAR default_init_t default_init = default_init_t(); #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //! Type used to tag that the inserted values @@ -361,7 +363,7 @@ struct value_init_t //! Value used to tag that the inserted values //! should be value initialized -static const value_init_t value_init = value_init_t(); +BOOST_CONTAINER_CONSTANT_VAR value_init_t value_init = value_init_t(); namespace container_detail_really_deep_namespace { diff --git a/include/boost/container/detail/addressof.hpp b/include/boost/container/detail/addressof.hpp new file mode 100644 index 00000000..00679b8f --- /dev/null +++ b/include/boost/container/detail/addressof.hpp @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP +#define BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include + +namespace boost { +namespace container { +namespace dtl { + +using boost::move_detail::addressof; + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index 0238805d..e16082a7 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -39,6 +39,7 @@ #include #include +#include // other #include @@ -49,19 +50,19 @@ struct move_insert_range_proxy { typedef typename allocator_traits::value_type value_type; - BOOST_CONTAINER_FORCEINLINE explicit move_insert_range_proxy(FwdIt first) + inline explicit move_insert_range_proxy(FwdIt first) : first_(first) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) { this->first_ = ::boost::container::uninitialized_move_alloc_n_source (a, this->first_, n, p); } template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) + inline void copy_n_and_update(Allocator &, Iterator p, std::size_t n) { this->first_ = ::boost::container::move_n_source(this->first_, n, p); } @@ -75,18 +76,18 @@ struct insert_range_proxy { typedef typename allocator_traits::value_type value_type; - BOOST_CONTAINER_FORCEINLINE explicit insert_range_proxy(FwdIt first) + inline explicit insert_range_proxy(FwdIt first) : first_(first) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) { this->first_ = ::boost::container::uninitialized_copy_alloc_n_source(a, this->first_, n, p); } template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) + inline void copy_n_and_update(Allocator &, Iterator p, std::size_t n) { this->first_ = ::boost::container::copy_n_source(this->first_, n, p); } @@ -100,16 +101,16 @@ struct insert_n_copies_proxy { typedef typename allocator_traits::value_type value_type; - BOOST_CONTAINER_FORCEINLINE explicit insert_n_copies_proxy(const value_type &v) + inline explicit insert_n_copies_proxy(const value_type &v) : v_(v) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const { boost::container::uninitialized_fill_alloc_n(a, v_, n, p); } template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + inline void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const { while (n){ --n; @@ -129,7 +130,7 @@ struct insert_value_initialized_n_proxy typedef typename dtl::aligned_storage::value>::type storage_t; template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const { boost::container::uninitialized_value_init_alloc_n(a, n, p); } template @@ -138,8 +139,8 @@ struct insert_value_initialized_n_proxy while (n){ --n; storage_t v; - alloc_traits::construct(a, move_detail::force_ptr(&v)); - value_type *vp = move_detail::force_ptr(&v); + alloc_traits::construct(a, (value_type*)&v); + value_type *vp = move_detail::launder_cast(&v); value_destructor on_exit(a, *vp); (void)on_exit; *p = ::boost::move(*vp); ++p; @@ -155,7 +156,7 @@ struct insert_default_initialized_n_proxy typedef typename dtl::aligned_storage::value>::type storage_t; template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const { boost::container::uninitialized_default_init_alloc_n(a, n, p); } template @@ -165,8 +166,8 @@ struct insert_default_initialized_n_proxy while (n){ --n; typename dtl::aligned_storage::value>::type v; - alloc_traits::construct(a, move_detail::force_ptr(&v), default_init); - value_type *vp = move_detail::force_ptr(&v); + alloc_traits::construct(a, (value_type*)&v, default_init); + value_type *vp = move_detail::launder_cast(&v); value_destructor on_exit(a, *vp); (void)on_exit; *p = ::boost::move(*vp); ++p; @@ -181,21 +182,21 @@ struct insert_copy_proxy typedef boost::container::allocator_traits alloc_traits; typedef typename alloc_traits::value_type value_type; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_copy_proxy(const value_type &v) + inline explicit insert_copy_proxy(const value_type &v) : v_(v) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const { BOOST_ASSERT(n == 1); (void)n; alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), v_); } template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + inline void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const { BOOST_ASSERT(n == 1); (void)n; *p = v_; @@ -211,21 +212,21 @@ struct insert_move_proxy typedef boost::container::allocator_traits alloc_traits; typedef typename alloc_traits::value_type value_type; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_move_proxy(value_type &v) + inline explicit insert_move_proxy(value_type &v) : v_(v) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const { BOOST_ASSERT(n == 1); (void)n; alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) ); } template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + inline void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const { BOOST_ASSERT(n == 1); (void)n; *p = ::boost::move(v_); @@ -235,13 +236,13 @@ struct insert_move_proxy }; template -BOOST_CONTAINER_FORCEINLINE insert_move_proxy get_insert_value_proxy(BOOST_RV_REF(typename boost::container::iterator_traits::value_type) v) +inline insert_move_proxy get_insert_value_proxy(BOOST_RV_REF(typename boost::container::iterator_traits::value_type) v) { return insert_move_proxy(v); } template -BOOST_CONTAINER_FORCEINLINE insert_copy_proxy get_insert_value_proxy(const typename boost::container::iterator_traits::value_type &v) +inline insert_copy_proxy get_insert_value_proxy(const typename boost::container::iterator_traits::value_type &v) { return insert_copy_proxy(v); } @@ -264,19 +265,19 @@ struct insert_nonmovable_emplace_proxy typedef typename alloc_traits::value_type value_type; typedef typename build_number_seq::type index_tuple_t; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_nonmovable_emplace_proxy(BOOST_FWD_REF(Args)... args) + inline explicit insert_nonmovable_emplace_proxy(BOOST_FWD_REF(Args)... args) : args_(args...) {} template - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) { this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); } private: template - BOOST_CONTAINER_FORCEINLINE void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) + inline void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) { BOOST_ASSERT(n == 1); (void)n; alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward(get(this->args_))... ); @@ -295,25 +296,25 @@ struct insert_emplace_proxy typedef typename base_t::value_type value_type; typedef typename base_t::index_tuple_t index_tuple_t; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(BOOST_FWD_REF(Args)... args) + inline explicit insert_emplace_proxy(BOOST_FWD_REF(Args)... args) : base_t(::boost::forward(args)...) {} template - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + inline void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) { this->priv_copy_some_and_update(a, index_tuple_t(), p, n); } private: template - BOOST_CONTAINER_FORCEINLINE void priv_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) + inline void priv_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) { BOOST_ASSERT(n ==1); (void)n; typename dtl::aligned_storage::value>::type v; - alloc_traits::construct(a, move_detail::force_ptr(&v), ::boost::forward(get(this->args_))...); - value_type *vp = move_detail::force_ptr(&v); + alloc_traits::construct(a, (value_type*)&v, ::boost::forward(get(this->args_))...); + value_type *vp = move_detail::launder_cast(&v); BOOST_CONTAINER_TRY{ *p = ::boost::move(*vp); } @@ -331,9 +332,9 @@ template struct insert_emplace_proxy::value_type> : public insert_move_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(typename boost::container::allocator_traits::value_type &&v) + inline explicit insert_emplace_proxy(typename boost::container::allocator_traits::value_type &&v) : insert_move_proxy(v) {} }; @@ -348,9 +349,9 @@ struct insert_emplace_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -359,9 +360,9 @@ template struct insert_emplace_proxy::value_type &> : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -372,9 +373,9 @@ struct insert_emplace_proxy : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -396,20 +397,20 @@ struct insert_nonmovable_emplace_proxy##N\ typedef boost::container::allocator_traits alloc_traits;\ typedef typename alloc_traits::value_type value_type;\ \ - static const bool single_value = true;\ + BOOST_STATIC_CONSTEXPR bool single_value = true;\ \ - BOOST_CONTAINER_FORCEINLINE explicit insert_nonmovable_emplace_proxy##N(BOOST_MOVE_UREF##N)\ + inline explicit insert_nonmovable_emplace_proxy##N(BOOST_MOVE_UREF##N)\ BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N {}\ \ template\ - BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ + inline void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ {\ BOOST_ASSERT(n == 1); (void)n;\ alloc_traits::construct(a, boost::movelib::iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ }\ \ template\ - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator, std::size_t)\ + inline void copy_n_and_update(Allocator &, Iterator, std::size_t)\ { BOOST_ASSERT(false); }\ \ protected:\ @@ -425,18 +426,18 @@ struct insert_emplace_proxy_arg##N\ typedef typename base_t::value_type value_type;\ typedef boost::container::allocator_traits alloc_traits;\ \ - static const bool single_value = true;\ + BOOST_STATIC_CONSTEXPR bool single_value = true;\ \ - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg##N(BOOST_MOVE_UREF##N)\ + inline explicit insert_emplace_proxy_arg##N(BOOST_MOVE_UREF##N)\ : base_t(BOOST_MOVE_FWD##N){}\ \ template\ - BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ + inline void copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ {\ BOOST_ASSERT(n == 1); (void)n;\ typename dtl::aligned_storage::value>::type v;\ - alloc_traits::construct(a, move_detail::force_ptr(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ - value_type *vp = move_detail::force_ptr(&v);\ + alloc_traits::construct(a, (value_type*)&v BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ + value_type *vp = move_detail::launder_cast(&v);\ BOOST_CONTAINER_TRY{\ *p = ::boost::move(*vp);\ }\ @@ -459,9 +460,9 @@ template struct insert_emplace_proxy_arg1::value_type> > : public insert_move_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &v) : insert_move_proxy(v) {} }; @@ -470,9 +471,9 @@ template struct insert_emplace_proxy_arg1::value_type> : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -484,9 +485,9 @@ template struct insert_emplace_proxy_arg1::value_type> : public insert_move_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &&v) + inline explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &&v) : insert_move_proxy(v) {} }; @@ -500,9 +501,9 @@ struct insert_emplace_proxy_arg1 : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -511,9 +512,9 @@ template struct insert_emplace_proxy_arg1::value_type &> : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; @@ -524,9 +525,9 @@ struct insert_emplace_proxy_arg1 : public insert_copy_proxy { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; - BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) : insert_copy_proxy(v) {} }; diff --git a/include/boost/container/detail/alloc_helpers.hpp b/include/boost/container/detail/alloc_helpers.hpp index 5ca2ca72..57c59e46 100644 --- a/include/boost/container/detail/alloc_helpers.hpp +++ b/include/boost/container/detail/alloc_helpers.hpp @@ -27,30 +27,30 @@ namespace container { namespace dtl { template -BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) +inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { boost::adl_move_swap(l, r); } template -BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) +inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) { l = r; } template -BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) +inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { l = ::boost::move(r); } } //namespace dtl { diff --git a/include/boost/container/detail/allocation_type.hpp b/include/boost/container/detail/allocation_type.hpp index 1e8aa673..5f0d4b62 100644 --- a/include/boost/container/detail/allocation_type.hpp +++ b/include/boost/container/detail/allocation_type.hpp @@ -42,13 +42,13 @@ enum allocation_type_v typedef unsigned int allocation_type; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -static const allocation_type allocate_new = (allocation_type)allocate_new_v; -static const allocation_type expand_fwd = (allocation_type)expand_fwd_v; -static const allocation_type expand_bwd = (allocation_type)expand_bwd_v; -static const allocation_type shrink_in_place = (allocation_type)shrink_in_place_v; -static const allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v; -static const allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v; -static const allocation_type zero_memory = (allocation_type)zero_memory_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type allocate_new = (allocation_type)allocate_new_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type expand_fwd = (allocation_type)expand_fwd_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type expand_bwd = (allocation_type)expand_bwd_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type shrink_in_place = (allocation_type)shrink_in_place_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type zero_memory = (allocation_type)zero_memory_v; } //namespace container { } //namespace boost { diff --git a/include/boost/container/detail/config_begin.hpp b/include/boost/container/detail/config_begin.hpp index e1075d1d..d459a066 100644 --- a/include/boost/container/detail/config_begin.hpp +++ b/include/boost/container/detail/config_begin.hpp @@ -41,6 +41,7 @@ #pragma warning (disable : 4671) // the copy constructor is inaccessible #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4702) // unreachable code #pragma warning (disable : 4706) // assignment within conditional expression #pragma warning (disable : 4710) // function not inlined #pragma warning (disable : 4714) // "function": marked as __forceinline not inlined diff --git a/include/boost/container/detail/construct_in_place.hpp b/include/boost/container/detail/construct_in_place.hpp index d824d814..bfdf05c2 100644 --- a/include/boost/container/detail/construct_in_place.hpp +++ b/include/boost/container/detail/construct_in_place.hpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace boost { namespace container { @@ -62,9 +63,42 @@ BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, empla //Assignment +template +BOOST_CONTAINER_FORCEINLINE + typename dtl::disable_if_c + < dtl::is_pair::type>::value + && dtl::is_pair::type>::value + , void>::type +assign_in_place_ref(T &t, BOOST_FWD_REF(U) u) +{ t = ::boost::forward(u); } + +template +BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_c + < dtl::is_pair::type>::value + && dtl::is_pair::type>::value + , void>::type +assign_in_place_ref(T &t, const U &u) +{ + assign_in_place_ref(t.first, u.first); + assign_in_place_ref(t.second, u.second); +} + +template +BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_c + < dtl::is_pair::type>::value + && dtl::is_pair::type>::value + , void>::type +assign_in_place_ref(T &t, BOOST_RV_REF(U) u) +{ + assign_in_place_ref(t.first, ::boost::move(u.first)); + assign_in_place_ref(t.second, ::boost::move(u.second)); +} + template BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) -{ *dest = *source; } +{ assign_in_place_ref(*dest, *source); } template BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator) diff --git a/include/boost/container/detail/copy_move_algo.hpp b/include/boost/container/detail/copy_move_algo.hpp index 8729b307..7c7d216f 100644 --- a/include/boost/container/detail/copy_move_algo.hpp +++ b/include/boost/container/detail/copy_move_algo.hpp @@ -46,7 +46,12 @@ # endif //GCC 8 seems a bit confused about array access error with static_vector //when out of bound exceptions are being thrown. -# if defined(BOOST_GCC) && (BOOST_GCC >= 80000) && (BOOST_GCC < 80200) +# if defined(BOOST_GCC) && ((BOOST_GCC >= 80000) && (BOOST_GCC < 80200)) +# pragma GCC diagnostic ignored "-Wstringop-overflow" +# endif +//GCC 12 seems a bit confused about array access error with small_vector +# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) +# pragma GCC diagnostic ignored "-Wstringop-overread" # pragma GCC diagnostic ignored "-Wstringop-overflow" # endif # pragma GCC diagnostic ignored "-Warray-bounds" @@ -59,7 +64,7 @@ namespace dtl { template struct are_elements_contiguous { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; ///////////////////////// @@ -69,7 +74,7 @@ struct are_elements_contiguous template struct are_elements_contiguous { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; ///////////////////////// @@ -110,7 +115,7 @@ namespace dtl { template struct are_elements_contiguous > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; @@ -121,7 +126,7 @@ struct are_elements_contiguous template struct are_elements_contiguous< ::boost::interprocess::offset_ptr > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template @@ -180,20 +185,20 @@ struct has_single_value template static two test(int, ...); template static char test(int, const wrapper*); public: - static const bool value = sizeof(test(0, 0)) == 1; + BOOST_STATIC_CONSTEXPR bool value = sizeof(test(0, 0)) == 1; void dummy() {} }; template::value> struct is_single_value_proxy_impl { - static const bool value = InsertionProxy::single_value; + BOOST_STATIC_CONSTEXPR bool value = InsertionProxy::single_value; }; template struct is_single_value_proxy_impl { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template @@ -214,7 +219,7 @@ struct disable_if_single_value_proxy template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW +inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iter_value::type value_type; typedef typename boost::container::iterator_traits::difference_type r_difference_type; @@ -232,7 +237,7 @@ BOOST_CONTAINER_FORCEINLINE F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE F memmove_n(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW +inline F memmove_n(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iter_value::type value_type; typedef typename boost::container::iterator_traits::difference_type r_difference_type; @@ -250,7 +255,7 @@ BOOST_CONTAINER_FORCEINLINE F memmove_n(I f, std::size_t n, F r) BOOST_NOEXCEPT_ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE I memmove_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW +inline I memmove_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { if(BOOST_LIKELY(n != 0)){ typedef typename boost::container::iter_value::type value_type; @@ -267,7 +272,7 @@ BOOST_CONTAINER_FORCEINLINE I memmove_n_source(I f, std::size_t n, F r) BOOST_NO template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE I memmove_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW +inline I memmove_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iter_value::type value_type; typedef typename boost::container::iterator_traits::difference_type i_difference_type; @@ -288,7 +293,7 @@ template struct is_memzero_initializable { typedef typename ::boost::container::iterator_traits::value_type value_type; - static const bool value = are_elements_contiguous::value && + BOOST_STATIC_CONSTEXPR bool value = are_elements_contiguous::value && ( dtl::is_integral::value || dtl::is_enum::value #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) || dtl::is_pointer::value @@ -367,7 +372,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove(f, l, r); } @@ -413,7 +418,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n(f, n, r); } @@ -459,7 +464,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n_source(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source(f, n, r); } @@ -504,7 +509,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove(f, l, r); } @@ -550,7 +555,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n(f, n, r); } @@ -595,7 +600,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n_source(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source(f, n, r); } @@ -639,7 +644,7 @@ inline typename dtl::disable_if_memzero_initializable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memzero_initializable::type +inline typename dtl::enable_if_memzero_initializable::type uninitialized_value_init_alloc_n(Allocator &, std::size_t n, F r) { typedef typename boost::container::iterator_traits::value_type value_type; @@ -812,7 +817,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n(f, n, r); } @@ -840,7 +845,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source(f, n, r); } @@ -867,7 +872,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source_dest(f, n, r); } @@ -922,7 +927,7 @@ template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n(f, n, r); } @@ -949,7 +954,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iter_value::type value_type; @@ -985,7 +990,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source_dest(f, n, r); } @@ -1013,18 +1018,18 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::memmove_n_source(f, n, r); } template // F models ForwardIterator -BOOST_CONTAINER_FORCEINLINE F move_forward_overlapping(F f, F l, F r) +inline F move_forward_overlapping(F f, F l, F r) { return (f != r) ? (move)(f, l, r) : l; } template // B models BidirIterator -BOOST_CONTAINER_FORCEINLINE B move_backward_overlapping(B f, B l, B rl) +inline B move_backward_overlapping(B f, B l, B rl) { return (l != rl) ? (move_backward)(f, l, rl) : f; } @@ -1054,7 +1059,7 @@ template // U models unsigned integral constant -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_trivially_destructible::type +inline typename dtl::enable_if_trivially_destructible::type destroy_alloc_n(Allocator &, I, U) {} @@ -1079,7 +1084,7 @@ inline typename dtl::disable_if_trivially_destructible::type template // I models InputIterator -BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_trivially_destructible::type +inline typename dtl::enable_if_trivially_destructible::type destroy_alloc(Allocator &, I, I) {} @@ -1106,7 +1111,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable::type boost::container::destroy_alloc_n(a, large_range_f, std::size_t(n_j - n_i)); } -static const std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes +BOOST_CONTAINER_CONSTANT_VAR std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes template -BOOST_CONTAINER_FORCEINLINE void expand_forward_and_insert_alloc +inline void expand_forward_and_insert_alloc ( Allocator& a , F pos , F last @@ -1491,8 +1496,8 @@ void expand_backward_forward_and_insert_alloc_move_backward { typedef std::size_t size_type; typedef typename allocator_traits::value_type value_type; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; - static const bool trivial_dctr = dtl::is_trivially_destructible::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible::value; typedef typename dtl::if_c -BOOST_CONTAINER_FORCEINLINE void expand_backward_forward_and_insert_alloc_move_forward +inline void expand_backward_forward_and_insert_alloc_move_forward ( B const old_start , std::size_t const old_size , B const new_start @@ -1791,8 +1796,8 @@ BOOST_CONTAINER_FORCEINLINE void expand_backward_forward_and_insert_alloc_move_f { typedef std::size_t size_type; typedef typename allocator_traits::value_type value_type; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; - static const bool trivial_dctr = dtl::is_trivially_destructible::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible::value; typedef typename dtl::if_c AllocTraits; typedef Ptr pointer; - BOOST_CONTAINER_FORCEINLINE null_scoped_destructor_n(Ptr, Allocator&, std::size_t) + inline null_scoped_destructor_n(Ptr, Allocator&, std::size_t) {} - BOOST_CONTAINER_FORCEINLINE void increment_size(std::size_t) + inline void increment_size(std::size_t) {} - BOOST_CONTAINER_FORCEINLINE void increment_size_backwards(std::size_t) + inline void increment_size_backwards(std::size_t) {} - BOOST_CONTAINER_FORCEINLINE void set_size(std::size_t ) + inline void set_size(std::size_t ) {} - BOOST_CONTAINER_FORCEINLINE void shrink_forward(std::size_t) + inline void shrink_forward(std::size_t) {} - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() {} }; @@ -254,20 +254,20 @@ struct scoped_destructor_range typedef typename AllocTraits::pointer pointer; typedef typename AllocTraits::value_type value_type; - BOOST_CONTAINER_FORCEINLINE scoped_destructor_range(pointer p, pointer e, Allocator& a) + inline scoped_destructor_range(pointer p, pointer e, Allocator& a) : m_p(p), m_e(e), m_a(a) {} - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() { m_p = pointer(); m_e = pointer(); } - BOOST_CONTAINER_FORCEINLINE void set_end(pointer e) + inline void set_end(pointer e) { m_e = e; } - BOOST_CONTAINER_FORCEINLINE void set_begin(pointer b) + inline void set_begin(pointer b) { m_p = b; } - BOOST_CONTAINER_FORCEINLINE void set_range(pointer b, pointer e) + inline void set_range(pointer b, pointer e) { m_p = b; m_e = e; } ~scoped_destructor_range() @@ -293,19 +293,19 @@ struct null_scoped_destructor_range typedef boost::container::allocator_traits AllocTraits; typedef typename AllocTraits::pointer pointer; - BOOST_CONTAINER_FORCEINLINE null_scoped_destructor_range(pointer, pointer, Allocator&) + inline null_scoped_destructor_range(pointer, pointer, Allocator&) {} - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() {} - BOOST_CONTAINER_FORCEINLINE void set_end(pointer) + inline void set_end(pointer) {} - BOOST_CONTAINER_FORCEINLINE void set_begin(pointer) + inline void set_begin(pointer) {} - BOOST_CONTAINER_FORCEINLINE void set_range(pointer, pointer) + inline void set_range(pointer, pointer) {} }; @@ -316,24 +316,24 @@ class scoped_destructor typedef boost::container::allocator_traits AllocTraits; public: typedef typename Allocator::value_type value_type; - BOOST_CONTAINER_FORCEINLINE scoped_destructor(Allocator &a, value_type *pv) + inline scoped_destructor(Allocator &a, value_type *pv) : pv_(pv), a_(a) {} - BOOST_CONTAINER_FORCEINLINE ~scoped_destructor() + inline ~scoped_destructor() { if(pv_){ AllocTraits::destroy(a_, pv_); } } - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() { pv_ = 0; } - BOOST_CONTAINER_FORCEINLINE void set(value_type *ptr) { pv_ = ptr; } + inline void set(value_type *ptr) { pv_ = ptr; } - BOOST_CONTAINER_FORCEINLINE value_type *get() const { return pv_; } + inline value_type *get() const { return pv_; } private: value_type *pv_; @@ -346,18 +346,18 @@ class null_scoped_destructor typedef boost::container::allocator_traits AllocTraits; public: typedef typename Allocator::value_type value_type; - BOOST_CONTAINER_FORCEINLINE null_scoped_destructor(Allocator &, value_type *) + inline null_scoped_destructor(Allocator &, value_type *) {} - BOOST_CONTAINER_FORCEINLINE ~null_scoped_destructor() + inline ~null_scoped_destructor() {} - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() {} - BOOST_CONTAINER_FORCEINLINE void set(value_type *) { } + inline void set(value_type *) { } - BOOST_CONTAINER_FORCEINLINE value_type *get() const { return 0; } + inline value_type *get() const { return 0; } }; @@ -368,11 +368,11 @@ class value_destructor typedef boost::container::allocator_traits AllocTraits; public: typedef Value value_type; - BOOST_CONTAINER_FORCEINLINE value_destructor(Allocator &a, value_type &rv) + inline value_destructor(Allocator &a, value_type &rv) : rv_(rv), a_(a) {} - BOOST_CONTAINER_FORCEINLINE ~value_destructor() + inline ~value_destructor() { AllocTraits::destroy(a_, &rv_); } @@ -396,18 +396,18 @@ class allocator_node_destroyer Allocator & a_; private: - BOOST_CONTAINER_FORCEINLINE void priv_deallocate(const pointer &p, version_1) + inline void priv_deallocate(const pointer &p, version_1) { AllocTraits::deallocate(a_,p, 1); } - BOOST_CONTAINER_FORCEINLINE void priv_deallocate(const pointer &p, version_2) + inline void priv_deallocate(const pointer &p, version_2) { a_.deallocate_one(p); } public: - BOOST_CONTAINER_FORCEINLINE explicit allocator_node_destroyer(Allocator &a) + inline explicit allocator_node_destroyer(Allocator &a) : a_(a) {} - BOOST_CONTAINER_FORCEINLINE void operator()(const pointer &p) + inline void operator()(const pointer &p) { boost::movelib::to_raw_pointer(p)->destructor(a_); this->priv_deallocate(p, alloc_version()); @@ -420,24 +420,24 @@ class scoped_node_destructor typedef boost::container::allocator_traits AllocTraits; public: typedef typename Allocator::value_type value_type; - BOOST_CONTAINER_FORCEINLINE scoped_node_destructor(Allocator &a, value_type *pv) + inline scoped_node_destructor(Allocator &a, value_type *pv) : pv_(pv), a_(a) {} - BOOST_CONTAINER_FORCEINLINE ~scoped_node_destructor() + inline ~scoped_node_destructor() { if(pv_){ pv_->destructor(a_); } } - BOOST_CONTAINER_FORCEINLINE void release() + inline void release() { pv_ = 0; } - BOOST_CONTAINER_FORCEINLINE void set(value_type *ptr) { pv_ = ptr; } + inline void set(value_type *ptr) { pv_ = ptr; } - BOOST_CONTAINER_FORCEINLINE value_type *get() const { return pv_; } + inline value_type *get() const { return pv_; } private: value_type *pv_; @@ -457,11 +457,11 @@ class allocator_node_destroyer_and_chain_builder multiallocation_chain &c_; public: - BOOST_CONTAINER_FORCEINLINE allocator_node_destroyer_and_chain_builder(Allocator &a, multiallocation_chain &c) + inline allocator_node_destroyer_and_chain_builder(Allocator &a, multiallocation_chain &c) : a_(a), c_(c) {} - BOOST_CONTAINER_FORCEINLINE void operator()(const typename Allocator::pointer &p) + inline void operator()(const typename Allocator::pointer &p) { boost::movelib::to_raw_pointer(p)->destructor(a_); c_.push_back(p); @@ -480,14 +480,14 @@ class allocator_multialloc_chain_node_deallocator multiallocation_chain c_; public: - BOOST_CONTAINER_FORCEINLINE allocator_multialloc_chain_node_deallocator(Allocator &a) + inline allocator_multialloc_chain_node_deallocator(Allocator &a) : a_(a), c_() {} - BOOST_CONTAINER_FORCEINLINE chain_builder get_chain_builder() + inline chain_builder get_chain_builder() { return chain_builder(a_, c_); } - BOOST_CONTAINER_FORCEINLINE ~allocator_multialloc_chain_node_deallocator() + inline ~allocator_multialloc_chain_node_deallocator() { a_.deallocate_individual(c_); } diff --git a/include/boost/container/detail/is_pair.hpp b/include/boost/container/detail/is_pair.hpp new file mode 100644 index 00000000..ddb63b68 --- /dev/null +++ b/include/boost/container/detail/is_pair.hpp @@ -0,0 +1,91 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_IS_PAIR_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_IS_PAIR_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +#if defined(BOOST_MSVC) && (_CPPLIB_VER == 520) +//MSVC 2010 tuple marker +namespace std { namespace tr1 { struct _Nil; }} +#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 540) +//MSVC 2012 tuple marker +namespace std { struct _Nil; } +#endif + +namespace boost { +namespace tuples { + +struct null_type; + +template < + class T0, class T1, class T2, + class T3, class T4, class T5, + class T6, class T7, class T8, + class T9> +class tuple; + +} //namespace tuples { +} //namespace boost { + +namespace boost { +namespace container { + +struct try_emplace_t{}; + +namespace dtl { + +template +struct pair; + +template +struct is_pair +{ + BOOST_STATIC_CONSTEXPR bool value = false; +}; + +template +struct is_pair< pair > +{ + BOOST_STATIC_CONSTEXPR bool value = true; +}; + +template +struct is_pair< std::pair > +{ + BOOST_STATIC_CONSTEXPR bool value = true; +}; + +template +struct is_not_pair +{ + BOOST_STATIC_CONSTEXPR bool value = !is_pair::value; +}; + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#include + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_IS_PAIR_HPP diff --git a/include/boost/container/detail/iterators.hpp b/include/boost/container/detail/iterators.hpp index c503916a..82daac46 100644 --- a/include/boost/container/detail/iterators.hpp +++ b/include/boost/container/detail/iterators.hpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -49,125 +48,125 @@ class constant_iterator typedef constant_iterator this_type; public: - BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, std::size_t range_size) + inline explicit constant_iterator(const T &ref, std::size_t range_size) : m_ptr(&ref), m_num(range_size){} //Constructors - BOOST_CONTAINER_FORCEINLINE constant_iterator() + inline constant_iterator() : m_ptr(0), m_num(0){} - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator++() + inline constant_iterator& operator++() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator++(int) + inline constant_iterator operator++(int) { constant_iterator result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator--() + inline constant_iterator& operator--() { decrement(); return *this; } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator--(int) + inline constant_iterator operator--(int) { constant_iterator result (*this); decrement(); return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator== (const constant_iterator& i, const constant_iterator& i2) { return i.equal(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator!= (const constant_iterator& i, const constant_iterator& i2) { return !(i == i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator< (const constant_iterator& i, const constant_iterator& i2) { return i.less(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator> (const constant_iterator& i, const constant_iterator& i2) { return i2 < i; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator<= (const constant_iterator& i, const constant_iterator& i2) { return !(i > i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const constant_iterator& i, const constant_iterator& i2) + inline friend bool operator>= (const constant_iterator& i, const constant_iterator& i2) { return !(i < i2); } - BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const constant_iterator& i, const constant_iterator& i2) + inline friend std::ptrdiff_t operator- (const constant_iterator& i, const constant_iterator& i2) { return i2.distance_to(i); } //Arithmetic signed - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(std::ptrdiff_t off) + inline constant_iterator& operator+=(std::ptrdiff_t off) { this->advance(off); return *this; } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(std::ptrdiff_t off) const + inline constant_iterator operator+(std::ptrdiff_t off) const { constant_iterator other(*this); other.advance(off); return other; } - BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(std::ptrdiff_t off, const constant_iterator& right) + inline friend constant_iterator operator+(std::ptrdiff_t off, const constant_iterator& right) { return right + off; } - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(std::ptrdiff_t off) + inline constant_iterator& operator-=(std::ptrdiff_t off) { this->advance(-off); return *this; } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(std::ptrdiff_t off) const + inline constant_iterator operator-(std::ptrdiff_t off) const { return *this + (-off); } - BOOST_CONTAINER_FORCEINLINE const T& operator[] (std::ptrdiff_t ) const + inline const T& operator[] (std::ptrdiff_t ) const { return dereference(); } - BOOST_CONTAINER_FORCEINLINE const T& operator*() const + inline const T& operator*() const { return dereference(); } - BOOST_CONTAINER_FORCEINLINE const T* operator->() const + inline const T* operator->() const { return &(dereference()); } //Arithmetic unsigned - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(std::size_t off) + inline constant_iterator& operator+=(std::size_t off) { return *this += std::ptrdiff_t(off); } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(std::size_t off) const + inline constant_iterator operator+(std::size_t off) const { return *this + std::ptrdiff_t(off); } - BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(std::size_t off, const constant_iterator& right) + inline friend constant_iterator operator+(std::size_t off, const constant_iterator& right) { return std::ptrdiff_t(off) + right; } - BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(std::size_t off) + inline constant_iterator& operator-=(std::size_t off) { return *this -= std::ptrdiff_t(off); } - BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(std::size_t off) const + inline constant_iterator operator-(std::size_t off) const { return *this - std::ptrdiff_t(off); } - BOOST_CONTAINER_FORCEINLINE const T& operator[] (std::size_t off) const + inline const T& operator[] (std::size_t off) const { return (*this)[std::ptrdiff_t(off)]; } private: const T * m_ptr; std::size_t m_num; - BOOST_CONTAINER_FORCEINLINE void increment() + inline void increment() { --m_num; } - BOOST_CONTAINER_FORCEINLINE void decrement() + inline void decrement() { ++m_num; } - BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const + inline bool equal(const this_type &other) const { return m_num == other.m_num; } - BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const + inline bool less(const this_type &other) const { return other.m_num < m_num; } - BOOST_CONTAINER_FORCEINLINE const T & dereference() const + inline const T & dereference() const { return *m_ptr; } - BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n) + inline void advance(std::ptrdiff_t n) { m_num = std::size_t(std::ptrdiff_t(m_num) - n); } - BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const + inline std::ptrdiff_t distance_to(const this_type &other)const { return std::ptrdiff_t(m_num - other.m_num); } }; @@ -179,72 +178,72 @@ class value_init_construct_iterator typedef value_init_construct_iterator this_type; public: - BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(std::size_t range_size) + inline explicit value_init_construct_iterator(std::size_t range_size) : m_num(range_size){} //Constructors - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator() + inline value_init_construct_iterator() : m_num(0){} - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator++() + inline value_init_construct_iterator& operator++() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator++(int) + inline value_init_construct_iterator operator++(int) { value_init_construct_iterator result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator--() + inline value_init_construct_iterator& operator--() { decrement(); return *this; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator--(int) + inline value_init_construct_iterator operator--(int) { value_init_construct_iterator result (*this); decrement(); return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i.equal(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i == i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i.less(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i2 < i; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i > i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i < i2); } - BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + inline friend std::ptrdiff_t operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i2.distance_to(i); } //Arithmetic - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(std::ptrdiff_t off) + inline value_init_construct_iterator& operator+=(std::ptrdiff_t off) { this->advance(off); return *this; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(std::ptrdiff_t off) const + inline value_init_construct_iterator operator+(std::ptrdiff_t off) const { value_init_construct_iterator other(*this); other.advance(off); return other; } - BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(std::ptrdiff_t off, const value_init_construct_iterator& right) + inline friend value_init_construct_iterator operator+(std::ptrdiff_t off, const value_init_construct_iterator& right) { return right + off; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(std::ptrdiff_t off) + inline value_init_construct_iterator& operator-=(std::ptrdiff_t off) { this->advance(-off); return *this; } - BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(std::ptrdiff_t off) const + inline value_init_construct_iterator operator-(std::ptrdiff_t off) const { return *this + (-off); } //This pseudo-iterator's dereference operations have no sense since value is not @@ -257,28 +256,28 @@ class value_init_construct_iterator private: std::size_t m_num; - BOOST_CONTAINER_FORCEINLINE void increment() + inline void increment() { --m_num; } - BOOST_CONTAINER_FORCEINLINE void decrement() + inline void decrement() { ++m_num; } - BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const + inline bool equal(const this_type &other) const { return m_num == other.m_num; } - BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const + inline bool less(const this_type &other) const { return other.m_num < m_num; } - BOOST_CONTAINER_FORCEINLINE const T & dereference() const + inline const T & dereference() const { static T dummy; return dummy; } - BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n) + inline void advance(std::ptrdiff_t n) { m_num = std::size_t(std::ptrdiff_t(m_num) - n); } - BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const + inline std::ptrdiff_t distance_to(const this_type &other)const { return std::ptrdiff_t(m_num - other.m_num); } }; @@ -290,72 +289,72 @@ class default_init_construct_iterator typedef default_init_construct_iterator this_type; public: - BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(std::size_t range_size) + inline explicit default_init_construct_iterator(std::size_t range_size) : m_num(range_size){} //Constructors - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator() + inline default_init_construct_iterator() : m_num(0){} - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator++() + inline default_init_construct_iterator& operator++() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator++(int) + inline default_init_construct_iterator operator++(int) { default_init_construct_iterator result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator--() + inline default_init_construct_iterator& operator--() { decrement(); return *this; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator--(int) + inline default_init_construct_iterator operator--(int) { default_init_construct_iterator result (*this); decrement(); return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i.equal(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i == i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i.less(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i2 < i; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i > i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i < i2); } - BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + inline friend std::ptrdiff_t operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i2.distance_to(i); } //Arithmetic - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(std::ptrdiff_t off) + inline default_init_construct_iterator& operator+=(std::ptrdiff_t off) { this->advance(off); return *this; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(std::ptrdiff_t off) const + inline default_init_construct_iterator operator+(std::ptrdiff_t off) const { default_init_construct_iterator other(*this); other.advance(off); return other; } - BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(std::ptrdiff_t off, const default_init_construct_iterator& right) + inline friend default_init_construct_iterator operator+(std::ptrdiff_t off, const default_init_construct_iterator& right) { return right + off; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(std::ptrdiff_t off) + inline default_init_construct_iterator& operator-=(std::ptrdiff_t off) { this->advance(-off); return *this; } - BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(std::ptrdiff_t off) const + inline default_init_construct_iterator operator-(std::ptrdiff_t off) const { return *this + (-off); } //This pseudo-iterator's dereference operations have no sense since value is not @@ -368,28 +367,28 @@ class default_init_construct_iterator private: std::size_t m_num; - BOOST_CONTAINER_FORCEINLINE void increment() + inline void increment() { --m_num; } - BOOST_CONTAINER_FORCEINLINE void decrement() + inline void decrement() { ++m_num; } - BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const + inline bool equal(const this_type &other) const { return m_num == other.m_num; } - BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const + inline bool less(const this_type &other) const { return other.m_num < m_num; } - BOOST_CONTAINER_FORCEINLINE const T & dereference() const + inline const T & dereference() const { static T dummy; return dummy; } - BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n) + inline void advance(std::ptrdiff_t n) { m_num = std::size_t(std::ptrdiff_t(m_num) - n); } - BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other) const + inline std::ptrdiff_t distance_to(const this_type &other) const { return std::ptrdiff_t(m_num - other.m_num); } }; @@ -401,106 +400,106 @@ class repeat_iterator { typedef repeat_iterator this_type; public: - BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, std::size_t range_size) + inline explicit repeat_iterator(T &ref, std::size_t range_size) : m_ptr(&ref), m_num(range_size){} //Constructors - BOOST_CONTAINER_FORCEINLINE repeat_iterator() + inline repeat_iterator() : m_ptr(0), m_num(0){} - BOOST_CONTAINER_FORCEINLINE this_type& operator++() + inline this_type& operator++() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator++(int) + inline this_type operator++(int) { this_type result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE this_type& operator--() + inline this_type& operator--() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator--(int) + inline this_type operator--(int) { this_type result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2) + inline friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2) + inline friend bool operator!= (const this_type& i, const this_type& i2) { return !(i == i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2) + inline friend bool operator< (const this_type& i, const this_type& i2) { return i.less(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2) + inline friend bool operator> (const this_type& i, const this_type& i2) { return i2 < i; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2) + inline friend bool operator<= (const this_type& i, const this_type& i2) { return !(i > i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2) + inline friend bool operator>= (const this_type& i, const this_type& i2) { return !(i < i2); } - BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const this_type& i, const this_type& i2) + inline friend std::ptrdiff_t operator- (const this_type& i, const this_type& i2) { return i2.distance_to(i); } //Arithmetic - BOOST_CONTAINER_FORCEINLINE this_type& operator+=(std::ptrdiff_t off) + inline this_type& operator+=(std::ptrdiff_t off) { this->advance(off); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator+(std::ptrdiff_t off) const + inline this_type operator+(std::ptrdiff_t off) const { this_type other(*this); other.advance(off); return other; } - BOOST_CONTAINER_FORCEINLINE friend this_type operator+(std::ptrdiff_t off, const this_type& right) + inline friend this_type operator+(std::ptrdiff_t off, const this_type& right) { return right + off; } - BOOST_CONTAINER_FORCEINLINE this_type& operator-=(std::ptrdiff_t off) + inline this_type& operator-=(std::ptrdiff_t off) { this->advance(-off); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator-(std::ptrdiff_t off) const + inline this_type operator-(std::ptrdiff_t off) const { return *this + (-off); } - BOOST_CONTAINER_FORCEINLINE T& operator*() const + inline T& operator*() const { return dereference(); } - BOOST_CONTAINER_FORCEINLINE T& operator[] (std::ptrdiff_t ) const + inline T& operator[] (std::ptrdiff_t ) const { return dereference(); } - BOOST_CONTAINER_FORCEINLINE T *operator->() const + inline T *operator->() const { return &(dereference()); } private: T * m_ptr; std::size_t m_num; - BOOST_CONTAINER_FORCEINLINE void increment() + inline void increment() { --m_num; } - BOOST_CONTAINER_FORCEINLINE void decrement() + inline void decrement() { ++m_num; } - BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const + inline bool equal(const this_type &other) const { return m_num == other.m_num; } - BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const + inline bool less(const this_type &other) const { return other.m_num < m_num; } - BOOST_CONTAINER_FORCEINLINE T & dereference() const + inline T & dereference() const { return *m_ptr; } - BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n) + inline void advance(std::ptrdiff_t n) { m_num = std::size_t(std::ptrdiff_t(m_num - n)); } - BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const + inline std::ptrdiff_t distance_to(const this_type &other)const { return std::ptrdiff_t(m_num - other.m_num); } }; @@ -513,71 +512,71 @@ class emplace_iterator public: typedef std::ptrdiff_t difference_type; - BOOST_CONTAINER_FORCEINLINE explicit emplace_iterator(EmplaceFunctor&e) + inline explicit emplace_iterator(EmplaceFunctor&e) : m_num(1), m_pe(&e){} - BOOST_CONTAINER_FORCEINLINE emplace_iterator() + inline emplace_iterator() : m_num(0), m_pe(0){} - BOOST_CONTAINER_FORCEINLINE this_type& operator++() + inline this_type& operator++() { increment(); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator++(int) + inline this_type operator++(int) { this_type result (*this); increment(); return result; } - BOOST_CONTAINER_FORCEINLINE this_type& operator--() + inline this_type& operator--() { decrement(); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator--(int) + inline this_type operator--(int) { this_type result (*this); decrement(); return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2) + inline friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2) + inline friend bool operator!= (const this_type& i, const this_type& i2) { return !(i == i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2) + inline friend bool operator< (const this_type& i, const this_type& i2) { return i.less(i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2) + inline friend bool operator> (const this_type& i, const this_type& i2) { return i2 < i; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2) + inline friend bool operator<= (const this_type& i, const this_type& i2) { return !(i > i2); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2) + inline friend bool operator>= (const this_type& i, const this_type& i2) { return !(i < i2); } - BOOST_CONTAINER_FORCEINLINE friend difference_type operator- (const this_type& i, const this_type& i2) + inline friend difference_type operator- (const this_type& i, const this_type& i2) { return i2.distance_to(i); } //Arithmetic - BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off) + inline this_type& operator+=(difference_type off) { this->advance(off); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator+(difference_type off) const + inline this_type operator+(difference_type off) const { this_type other(*this); other.advance(off); return other; } - BOOST_CONTAINER_FORCEINLINE friend this_type operator+(difference_type off, const this_type& right) + inline friend this_type operator+(difference_type off, const this_type& right) { return right + off; } - BOOST_CONTAINER_FORCEINLINE this_type& operator-=(difference_type off) + inline this_type& operator-=(difference_type off) { this->advance(-off); return *this; } - BOOST_CONTAINER_FORCEINLINE this_type operator-(difference_type off) const + inline this_type operator-(difference_type off) const { return *this + (-off); } private: @@ -590,39 +589,39 @@ class emplace_iterator public: template - BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* ptr) + inline void construct_in_place(Allocator &a, T* ptr) { (*m_pe)(a, ptr); } template - BOOST_CONTAINER_FORCEINLINE void assign_in_place(DestIt dest) + inline void assign_in_place(DestIt dest) { (*m_pe)(dest); } private: std::size_t m_num; EmplaceFunctor * m_pe; - BOOST_CONTAINER_FORCEINLINE void increment() + inline void increment() { --m_num; } - BOOST_CONTAINER_FORCEINLINE void decrement() + inline void decrement() { ++m_num; } - BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const + inline bool equal(const this_type &other) const { return m_num == other.m_num; } - BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const + inline bool less(const this_type &other) const { return other.m_num < m_num; } - BOOST_CONTAINER_FORCEINLINE const T & dereference() const + inline const T & dereference() const { static T dummy; return dummy; } - BOOST_CONTAINER_FORCEINLINE void advance(difference_type n) + inline void advance(difference_type n) { m_num -= n; } - BOOST_CONTAINER_FORCEINLINE difference_type distance_to(const this_type &other)const + inline difference_type distance_to(const this_type &other)const { return difference_type(m_num - other.m_num); } }; @@ -633,28 +632,28 @@ struct emplace_functor { typedef typename dtl::build_number_seq::type index_tuple_t; - BOOST_CONTAINER_FORCEINLINE emplace_functor(BOOST_FWD_REF(Args)... args) + inline emplace_functor(BOOST_FWD_REF(Args)... args) : args_(args...) {} template - BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr) + inline void operator()(Allocator &a, T *ptr) { emplace_functor::inplace_impl(a, ptr, index_tuple_t()); } template - BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest) + inline void operator()(DestIt dest) { emplace_functor::inplace_impl(dest, index_tuple_t()); } private: template - BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const dtl::index_tuple&) + inline void inplace_impl(Allocator &a, T* ptr, const dtl::index_tuple&) { allocator_traits::construct (a, ptr, ::boost::forward(dtl::get(args_))...); } template - BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const dtl::index_tuple&) + inline void inplace_impl(DestIt dest, const dtl::index_tuple&) { typedef typename boost::container::iterator_traits::value_type value_type; value_type && tmp= value_type(::boost::forward(dtl::get(args_))...); @@ -680,15 +679,15 @@ struct emplace_functor_type; BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ struct emplace_functor##N\ {\ - BOOST_CONTAINER_FORCEINLINE explicit emplace_functor##N( BOOST_MOVE_UREF##N )\ + inline explicit emplace_functor##N( BOOST_MOVE_UREF##N )\ BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\ \ template\ - BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr)\ + inline void operator()(Allocator &a, T *ptr)\ { allocator_traits::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N); }\ \ template\ - BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest)\ + inline void operator()(DestIt dest)\ {\ typedef typename boost::container::iterator_traits::value_type value_type;\ BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init tmp) ;\ @@ -724,50 +723,50 @@ struct has_iterator_category template static two test(int, ...); - static const bool value = (1 == sizeof(test(0, 0))); + BOOST_STATIC_CONSTEXPR bool value = (1 == sizeof(test(0, 0))); }; template::value > struct is_input_iterator { - static const bool value = is_same::value; + BOOST_STATIC_CONSTEXPR bool value = is_same::value; }; template struct is_input_iterator { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template struct is_not_input_iterator { - static const bool value = !is_input_iterator::value; + BOOST_STATIC_CONSTEXPR bool value = !is_input_iterator::value; }; template::value > struct is_forward_iterator { - static const bool value = is_same::value; + BOOST_STATIC_CONSTEXPR bool value = is_same::value; }; template struct is_forward_iterator { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template::value > struct is_bidirectional_iterator { - static const bool value = is_same::value; + BOOST_STATIC_CONSTEXPR bool value = is_same::value; }; template struct is_bidirectional_iterator { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template @@ -836,62 +835,62 @@ class iterator_from_iiterator typedef typename types_t::iterator_category iterator_category; typedef typename types_t::value_type value_type; - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator() + inline iterator_from_iiterator() : m_iit() {} - BOOST_CONTAINER_FORCEINLINE explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW + inline explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW : m_iit(iit) {} - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW : m_iit(other.get()) {} - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW : m_iit(other.get()) {} - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator=(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator& operator=(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW { m_iit = other.get(); return *this; } - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW { ++this->m_iit; return *this; } - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW { iterator_from_iiterator result (*this); ++this->m_iit; return result; } - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW { //If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist - BOOST_STATIC_ASSERT((is_bidirectional_iterator::value)); + BOOST_CONTAINER_STATIC_ASSERT((is_bidirectional_iterator::value)); --this->m_iit; return *this; } - BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW + inline iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { iterator_from_iiterator result (*this); --this->m_iit; return result; } - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW + inline friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_iit == r.m_iit; } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW + inline friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_iit != r.m_iit; } - BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW + inline reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_iit->get_data(); } - BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW + inline pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return ::boost::intrusive::pointer_traits::pointer_to(this->operator*()); } - BOOST_CONTAINER_FORCEINLINE const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW + inline const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_iit; } private: diff --git a/include/boost/container/detail/mpl.hpp b/include/boost/container/detail/mpl.hpp index ffae180c..7662e4cc 100644 --- a/include/boost/container/detail/mpl.hpp +++ b/include/boost/container/detail/mpl.hpp @@ -84,13 +84,13 @@ struct void_t { typedef void type; }; template struct is_transparent_base { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template struct is_transparent_base::type> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template @@ -112,7 +112,7 @@ template using variadic_void_t = void; template struct is_allocator { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template @@ -123,7 +123,7 @@ struct is_allocator < Allocator, variadic_void_t< typename Allocator::value_type , decltype(ctad_declval().allocate(size_t{})) >> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template diff --git a/include/boost/container/detail/next_capacity.hpp b/include/boost/container/detail/next_capacity.hpp index 9777b147..76bf0a0e 100644 --- a/include/boost/container/detail/next_capacity.hpp +++ b/include/boost/container/detail/next_capacity.hpp @@ -26,8 +26,6 @@ // container/detail #include -#include - namespace boost { namespace container { namespace dtl { @@ -35,10 +33,10 @@ namespace dtl { template struct grow_factor_ratio { - BOOST_STATIC_ASSERT(Numerator > Denominator); - BOOST_STATIC_ASSERT(Numerator < 100); - BOOST_STATIC_ASSERT(Denominator < 100); - BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator)); + BOOST_CONTAINER_STATIC_ASSERT(Numerator > Denominator); + BOOST_CONTAINER_STATIC_ASSERT(Numerator < 100); + BOOST_CONTAINER_STATIC_ASSERT(Denominator < 100); + BOOST_CONTAINER_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator)); template SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const @@ -80,11 +78,11 @@ struct growth_factor_100 {}; template -BOOST_CONTAINER_FORCEINLINE void clamp_by_stored_size_type(SizeType &, SizeType) +inline void clamp_by_stored_size_type(SizeType &, SizeType) {} template -BOOST_CONTAINER_FORCEINLINE void clamp_by_stored_size_type(SizeType &s, SomeStoredSizeType) +inline void clamp_by_stored_size_type(SizeType &s, SomeStoredSizeType) { if (s >= SomeStoredSizeType(-1) ) s = SomeStoredSizeType(-1); diff --git a/include/boost/container/detail/value_init.hpp b/include/boost/container/detail/value_init.hpp index 35b0aa11..08a1f841 100644 --- a/include/boost/container/detail/value_init.hpp +++ b/include/boost/container/detail/value_init.hpp @@ -31,13 +31,13 @@ namespace dtl { template struct value_init { - value_init() + BOOST_CONTAINER_FORCEINLINE value_init() : m_t() {} - operator T &() { return m_t; } + BOOST_CONTAINER_FORCEINLINE operator T &() { return m_t; } - T &get() { return m_t; } + BOOST_CONTAINER_FORCEINLINE T &get() { return m_t; } T m_t; }; diff --git a/include/boost/container/detail/version_type.hpp b/include/boost/container/detail/version_type.hpp index 389606a5..e02244ac 100644 --- a/include/boost/container/detail/version_type.hpp +++ b/include/boost/container/detail/version_type.hpp @@ -57,20 +57,20 @@ struct has_version template static two test(...); template static char test(const typename U::version*); public: - static const bool value = sizeof(test(0)) == 1; + BOOST_STATIC_CONSTEXPR bool value = sizeof(test(0)) == 1; void dummy(){} }; template ::value> struct version { - static const unsigned value = 1; + BOOST_STATIC_CONSTEXPR unsigned value = 1; }; template struct version { - static const unsigned value = extract_version::type::value; + BOOST_STATIC_CONSTEXPR unsigned value = extract_version::type::value; }; } //namespace impl @@ -83,7 +83,7 @@ struct version template struct is_version { - static const bool value = + BOOST_STATIC_CONSTEXPR bool value = is_same< typename version::type, integral_constant >::value; }; diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp index 64daa0c1..055cf24d 100644 --- a/include/boost/container/detail/workaround.hpp +++ b/include/boost/container/detail/workaround.hpp @@ -101,8 +101,11 @@ #elif defined(BOOST_MSVC) && (_MSC_VER <= 1900 || defined(_DEBUG)) //"__forceinline" and MSVC seems to have some bugs in old versions and in debug mode #define BOOST_CONTAINER_FORCEINLINE inline -#elif defined(BOOST_GCC) && ((__GNUC__ <= 5) || defined(__MINGW32__)) +#elif defined(BOOST_CLANG) || (defined(BOOST_GCC) && ((__GNUC__ <= 5) || defined(__MINGW32__))) //Older GCCs and MinGw have problems with forceinline + //Clang can have code bloat issues with forceinline, see + //https://lists.boost.org/boost-users/2023/04/91445.php and + //https://github.com/llvm/llvm-project/issues/62202 #define BOOST_CONTAINER_FORCEINLINE inline #else #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE @@ -187,4 +190,56 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&) # define BOOST_CONTAINER_CATCH_END } #endif +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_CONTAINER_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__) +# else +# define BOOST_CONTAINER_STATIC_ASSERT( B ) static_assert(B, #B) +# endif +#else +namespace boost { + namespace container { + namespace dtl { + + template + struct STATIC_ASSERTION_FAILURE; + + template<> + struct STATIC_ASSERTION_FAILURE {}; + + template struct static_assert_test {}; + + } + } +} + +#define BOOST_CONTAINER_STATIC_ASSERT(B) \ + typedef ::boost::container::dtl::static_assert_test<\ + (unsigned)sizeof(::boost::container::dtl::STATIC_ASSERTION_FAILURE)>\ + BOOST_JOIN(boost_container_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED + +#endif + +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_CONTAINER_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) +# else +# define BOOST_CONTAINER_STATIC_ASSERT_MSG( B, Msg ) static_assert( B, Msg ) +# endif +#else +# define BOOST_CONTAINER_STATIC_ASSERT_MSG( B, Msg ) BOOST_CONTAINER_STATIC_ASSERT( B ) +#endif + +#if !defined(BOOST_NO_CXX17_INLINE_VARIABLES) +# define BOOST_CONTAINER_CONSTANT_VAR BOOST_INLINE_CONSTEXPR +#else +# define BOOST_CONTAINER_CONSTANT_VAR static BOOST_CONSTEXPR_OR_CONST +#endif + +#if defined(__GNUC__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600) +#define BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED +#elif defined(__clang__) +#define BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED +#endif + #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/include/boost/container/new_allocator.hpp b/include/boost/container/new_allocator.hpp index 82c42a95..1dadb2b7 100644 --- a/include/boost/container/new_allocator.hpp +++ b/include/boost/container/new_allocator.hpp @@ -33,7 +33,7 @@ namespace container { template struct new_allocator_bool -{ static const bool value = Value; }; +{ BOOST_STATIC_CONSTEXPR bool value = Value; }; template class new_allocator; @@ -129,25 +129,23 @@ class new_allocator //!Default constructor //!Never throws - new_allocator() BOOST_NOEXCEPT_OR_NOTHROW + inline new_allocator() BOOST_NOEXCEPT_OR_NOTHROW {} //!Constructor from other new_allocator. //!Never throws - new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} //!Copy assignment operator from other new_allocator. //!Never throws - new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { - return *this; - } + inline new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + { return *this; } //!Constructor from related new_allocator. //!Never throws template - new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} //!Allocates memory for an array of count elements. @@ -174,22 +172,22 @@ class new_allocator //!Returns the maximum number of elements that could be allocated. //!Never throws - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + inline size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return std::size_t(-1)/(2*sizeof(T)); } //!Swaps two allocators, does nothing //!because this new_allocator is stateless - friend void swap(new_allocator &, new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline friend void swap(new_allocator &, new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} //!An new_allocator always compares to true, as memory allocated with one //!instance can be deallocated by another instance - friend bool operator==(const new_allocator &, const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline friend bool operator==(const new_allocator &, const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return true; } //!An new_allocator always compares to false, as memory allocated with one //!instance can be deallocated by another instance - friend bool operator!=(const new_allocator &, const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + inline friend bool operator!=(const new_allocator &, const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return false; } }; diff --git a/include/boost/container/options.hpp b/include/boost/container/options.hpp index c58ff82a..13b168f1 100644 --- a/include/boost/container/options.hpp +++ b/include/boost/container/options.hpp @@ -23,8 +23,8 @@ #include #include +#include #include -#include namespace boost { namespace container { @@ -52,8 +52,8 @@ enum tree_type_enum template struct tree_opt { - static const boost::container::tree_type_enum tree_type = TreeType; - static const bool optimize_size = OptimizeSize; + BOOST_STATIC_CONSTEXPR boost::container::tree_type_enum tree_type = TreeType; + BOOST_STATIC_CONSTEXPR bool optimize_size = OptimizeSize; }; typedef tree_opt tree_assoc_defaults; @@ -116,10 +116,10 @@ using tree_assoc_options_t = typename boost::container::tree_assoc_options struct hash_opt { - static const bool store_hash = StoreHash; - static const bool cache_begin = CacheBegin; - static const bool linear_buckets = LinearBuckets; - static const bool fastmod_buckets = FastmodBuckets; + BOOST_STATIC_CONSTEXPR bool store_hash = StoreHash; + BOOST_STATIC_CONSTEXPR bool cache_begin = CacheBegin; + BOOST_STATIC_CONSTEXPR bool linear_buckets = LinearBuckets; + BOOST_STATIC_CONSTEXPR bool fastmod_buckets = FastmodBuckets; }; typedef hash_opt hash_assoc_defaults; @@ -203,13 +203,13 @@ struct default_if_void template struct default_if_zero { - static const std::size_t value = N; + BOOST_STATIC_CONSTEXPR std::size_t value = N; }; template struct default_if_zero<0u, DefaultN> { - static const std::size_t value = DefaultN; + BOOST_STATIC_CONSTEXPR std::size_t value = DefaultN; }; @@ -289,8 +289,8 @@ BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_fa //! //!If the maximum capacity() to be used is limited, a user can try to use 8-bit, 16-bit //!(e.g. in 32-bit machines), or 32-bit size types (e.g. in a 64 bit machine) to see if some -//!memory can be saved for empty vectors. This could potentially performance benefits due to better -//!cache usage. +//!memory can be saved, specially for empty containers. This could potentially improve performance +//!due to better cache usage. //! //!Note that alignment requirements can disallow theoretical space savings. Example: //!\c vector holds a pointer and two size types (for size and capacity), in a 32 bit machine @@ -301,7 +301,7 @@ BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_fa //!Measure the size of the resulting container and do not assume a smaller \c stored_size //!will always lead to a smaller sizeof(container). //! -//!If a user tries to insert more elements than representable by \c stored_size, vector +//!If a user tries to insert more elements than representable by \c stored_size, the container //!will throw a length_error. //! //!If this option is not specified, `allocator_traits::size_type` (usually std::size_t) will @@ -337,7 +337,6 @@ struct vector_options //! Helper alias metafunction to combine options into a single type to be used //! by \c boost::container::vector. -//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size template using vector_options_t = typename boost::container::vector_options::type; @@ -360,20 +359,23 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(inplace_alignment, std::size_t, Alignment, inpla #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) -template +template struct small_vector_opt { - typedef GrowthType growth_factor_type; - static const std::size_t inplace_alignment = InplaceAlignment; + typedef GrowthType growth_factor_type; + BOOST_STATIC_CONSTEXPR std::size_t inplace_alignment = InplaceAlignment; + typedef StoredSizeType stored_size_type; }; -typedef small_vector_opt small_vector_null_opt; +typedef small_vector_opt small_vector_null_opt; #endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Helper metafunction to combine options into a single type to be used //! by \c boost::container::small_vector. -//! Supported options are: \c boost::container::growth_factor and \c boost::container::inplace_alignment +//! Supported options are: \c boost::container::growth_factor, +//! \c boost::container::inplace_alignment and +//! \c boost::container::stored_size. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) template #else @@ -391,7 +393,9 @@ struct small_vector_options #endif >::type packed_options; typedef small_vector_opt< typename packed_options::growth_factor_type - , packed_options::inplace_alignment> implementation_defined; + , packed_options::inplace_alignment + , typename packed_options::stored_size_type + > implementation_defined; /// @endcond typedef implementation_defined type; }; @@ -400,7 +404,6 @@ struct small_vector_options //! Helper alias metafunction to combine options into a single type to be used //! by \c boost::container::small_vector. -//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size template using small_vector_options_t = typename boost::container::small_vector_options::type; @@ -427,20 +430,22 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(throw_on_overflow, bool, ThrowOnOverflow, throw_ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) -template +template struct static_vector_opt { - static const bool throw_on_overflow = ThrowOnOverflow; - static const std::size_t inplace_alignment = InplaceAlignment; + BOOST_STATIC_CONSTEXPR bool throw_on_overflow = ThrowOnOverflow; + BOOST_STATIC_CONSTEXPR std::size_t inplace_alignment = InplaceAlignment; + typedef StoredSizeType stored_size_type; }; -typedef static_vector_opt static_vector_null_opt; +typedef static_vector_opt static_vector_null_opt; #endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Helper metafunction to combine options into a single type to be used //! by \c boost::container::static_vector. -//! Supported options are: \c boost::container::throw_on_overflow and \c boost::container::inplace_alignment +//! Supported options are: \c boost::container::throw_on_overflow, \c boost::container::inplace_alignment +//! and \c boost::container::stored_size. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) template #else @@ -458,7 +463,9 @@ struct static_vector_options #endif >::type packed_options; typedef static_vector_opt< packed_options::throw_on_overflow - , packed_options::inplace_alignment> implementation_defined; + , packed_options::inplace_alignment + , typename packed_options::stored_size_type + > implementation_defined; /// @endcond typedef implementation_defined type; }; @@ -467,7 +474,6 @@ struct static_vector_options //! Helper alias metafunction to combine options into a single type to be used //! by \c boost::container::static_vector. -//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size template using static_vector_options_t = typename boost::container::static_vector_options::type; @@ -515,7 +521,7 @@ template struct devector_opt : vector_opt { - static const std::size_t free_fraction = FreeFraction; + BOOST_STATIC_CONSTEXPR std::size_t free_fraction = FreeFraction; }; typedef devector_opt devector_null_opt; @@ -587,7 +593,6 @@ struct devector_options //! Helper alias metafunction to combine options into a single type to be used //! by \c boost::container::devector. -//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size template using devector_options_t = typename boost::container::devector_options::type; @@ -606,9 +611,9 @@ using devector_options_t = typename boost::container::devector_options struct deque_opt { - static const std::size_t block_bytes = BlockBytes; - static const std::size_t block_size = BlockSize; - BOOST_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time"); + BOOST_STATIC_CONSTEXPR std::size_t block_bytes = BlockBytes; + BOOST_STATIC_CONSTEXPR std::size_t block_size = BlockSize; + BOOST_CONTAINER_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time"); }; typedef deque_opt<0u, 0u> deque_null_opt; @@ -617,7 +622,7 @@ typedef deque_opt<0u, 0u> deque_null_opt; //! Helper metafunction to combine options into a single type to be used //! by \c boost::container::deque. -//! Supported options are: \c boost::container::block_bytes +//! Supported options are: \c boost::container::block_bytes and \c boost::container::block_size #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) template #else @@ -643,7 +648,6 @@ struct deque_options //! Helper alias metafunction to combine options into a single type to be used //! by \c boost::container::deque. -//! Supported options are: \c boost::container::block_bytes template using deque_options_t = typename boost::container::deque_options::type; diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index d5d2f1ea..aecb7dd2 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -51,6 +51,7 @@ #include #include #include +#include // move/detail #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include @@ -120,15 +121,15 @@ class vec_iterator , nat>::type nonconst_iterator; public: - BOOST_CONTAINER_FORCEINLINE + inline const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW { return m_ptr; } - BOOST_CONTAINER_FORCEINLINE + inline Pointer &get_ptr() BOOST_NOEXCEPT_OR_NOTHROW { return m_ptr; } - BOOST_CONTAINER_FORCEINLINE explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW + inline explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW : m_ptr(ptr) {} #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -136,93 +137,93 @@ class vec_iterator public: //Constructors - BOOST_CONTAINER_FORCEINLINE vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW : m_ptr() //Value initialization to achieve "null iterators" (N3644) {} - BOOST_CONTAINER_FORCEINLINE vec_iterator(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW : m_ptr(other.get_ptr()) {} - BOOST_CONTAINER_FORCEINLINE vec_iterator(const nonconst_iterator &other) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator(const nonconst_iterator &other) BOOST_NOEXCEPT_OR_NOTHROW : m_ptr(other.get_ptr()) {} - BOOST_CONTAINER_FORCEINLINE vec_iterator & operator=(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator & operator=(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW { m_ptr = other.get_ptr(); return *this; } //Pointer like operators - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); return *m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); return m_ptr[off]; } //Increment / Decrement - BOOST_CONTAINER_FORCEINLINE vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); ++m_ptr; return *this; } - BOOST_CONTAINER_FORCEINLINE vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); return vec_iterator(m_ptr++); } - BOOST_CONTAINER_FORCEINLINE vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); --m_ptr; return *this; } - BOOST_CONTAINER_FORCEINLINE vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!!m_ptr); return vec_iterator(m_ptr--); } //Arithmetic - BOOST_CONTAINER_FORCEINLINE vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(m_ptr || !off); m_ptr += off; return *this; } - BOOST_CONTAINER_FORCEINLINE vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + inline vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(m_ptr || !off); m_ptr -= off; return *this; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(x.m_ptr || !off); return vec_iterator(x.m_ptr+off); } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(right.m_ptr || !off); right.m_ptr += off; return right; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(left.m_ptr || !off); left.m_ptr -= off; return left; } //Difference - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW { return left.m_ptr - right.m_ptr; } //Comparison operators - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr == r.m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr != r.m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr < r.m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr <= r.m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr > r.m_ptr; } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_ptr >= r.m_ptr; } }; @@ -233,7 +234,7 @@ struct vector_insert_ordered_cursor typedef typename iterator_traits::value_type size_type; typedef typename iterator_traits::reference reference; - BOOST_CONTAINER_FORCEINLINE vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit) + inline vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit) : last_position_it(posit), last_value_it(valueit) {} @@ -247,10 +248,10 @@ struct vector_insert_ordered_cursor } } - BOOST_CONTAINER_FORCEINLINE size_type get_pos() const + inline size_type get_pos() const { return *last_position_it; } - BOOST_CONTAINER_FORCEINLINE reference get_val() + inline reference get_val() { return *last_value_it; } BiDirPosConstIt last_position_it; @@ -258,25 +259,25 @@ struct vector_insert_ordered_cursor }; template -BOOST_CONTAINER_FORCEINLINE const Pointer &vector_iterator_get_ptr(const vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW +inline const Pointer &vector_iterator_get_ptr(const vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW { return it.get_ptr(); } template -BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr(vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW +inline Pointer &get_ptr(vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW { return it.get_ptr(); } struct initial_capacity_t {}; struct vector_uninitialized_size_t {}; -static const vector_uninitialized_size_t vector_uninitialized_size = vector_uninitialized_size_t(); +BOOST_CONTAINER_CONSTANT_VAR vector_uninitialized_size_t vector_uninitialized_size = vector_uninitialized_size_t(); struct maybe_initial_capacity_t {}; template struct vector_value_traits_base { - static const bool trivial_dctr = dtl::is_trivially_destructible::value; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; }; template @@ -351,23 +352,23 @@ struct vector_alloc_holder public: - BOOST_CONTAINER_FORCEINLINE - static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) + template + inline static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc) { - (void)propagate_allocator; (void)p; (void)to_alloc; (void)from_alloc; + (void)p; (void)to_alloc; (void)from_alloc; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value || !allocator_traits_type::storage_is_unpropagable(from_alloc, p); return all_storage_propagable && - (propagate_allocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(from_alloc, to_alloc)); + (PropagateAllocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(from_alloc, to_alloc)); } - BOOST_CONTAINER_FORCEINLINE - static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p, bool const propagate_allocator) + template + inline static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p) { - (void)propagate_allocator; (void)l_p; (void)r_p; (void)l_a; (void)r_a; + (void)l_p; (void)r_p; (void)l_a; (void)r_a; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value || !(allocator_traits_type::storage_is_unpropagable(l_a, l_p) || allocator_traits_type::storage_is_unpropagable(r_a, r_p)); - return all_storage_propagable && (propagate_allocator || allocator_traits_type::equal(l_a, r_a)); + return all_storage_propagable && (PropagateAllocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(l_a, r_a)); } //Constructor, does not throw @@ -446,33 +447,33 @@ struct vector_alloc_holder holder.m_size = holder.m_capacity = 0; } - BOOST_CONTAINER_FORCEINLINE ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW + inline ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW { if(this->m_capacity){ this->deallocate(this->m_start, this->m_capacity); } } - BOOST_CONTAINER_FORCEINLINE void set_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void set_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(s); } - BOOST_CONTAINER_FORCEINLINE void dec_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void dec_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(this->m_size - s); } - BOOST_CONTAINER_FORCEINLINE void inc_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void inc_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(this->m_size + s); } - BOOST_CONTAINER_FORCEINLINE void set_stored_capacity(size_type c) BOOST_NOEXCEPT_OR_NOTHROW + inline void set_stored_capacity(size_type c) BOOST_NOEXCEPT_OR_NOTHROW { this->m_capacity = static_cast(c); } - BOOST_CONTAINER_FORCEINLINE pointer allocation_command(boost::container::allocation_type command, + inline pointer allocation_command(boost::container::allocation_type command, size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) { typedef typename dtl::version::type alloc_version; return this->priv_allocation_command(alloc_version(), command, limit_size, prefer_in_recvd_out_size, reuse); } - BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type n) + inline pointer allocate(size_type n) { const size_type max_alloc = allocator_traits_type::max_size(this->alloc()); const size_type max = max_alloc <= stored_size_type(-1) ? max_alloc : stored_size_type(-1); @@ -482,7 +483,7 @@ struct vector_alloc_holder return allocator_traits_type::allocate(this->alloc(), n); } - BOOST_CONTAINER_FORCEINLINE void deallocate(const pointer &p, size_type n) + inline void deallocate(const pointer &p, size_type n) { allocator_traits_type::deallocate(this->alloc(), p, n); } @@ -539,22 +540,22 @@ struct vector_alloc_holder x.m_size = x.m_capacity = 0; } - BOOST_CONTAINER_FORCEINLINE allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW + inline allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - BOOST_CONTAINER_FORCEINLINE const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW + inline const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - BOOST_CONTAINER_FORCEINLINE const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW + inline pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return m_start; } - BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + inline size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_capacity; } - BOOST_CONTAINER_FORCEINLINE void start(const pointer &p) BOOST_NOEXCEPT_OR_NOTHROW + inline void start(const pointer &p) BOOST_NOEXCEPT_OR_NOTHROW { m_start = p; } - BOOST_CONTAINER_FORCEINLINE void capacity(const size_type &c) BOOST_NOEXCEPT_OR_NOTHROW + inline void capacity(const size_type &c) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT( c <= stored_size_type(-1)); this->set_stored_capacity(c); } - static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow() + static inline void on_capacity_overflow() { } private: @@ -642,7 +643,7 @@ struct vector_alloc_holder template vector_alloc_holder(vector_uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) : allocator_type(boost::forward(a)) - , m_size(initial_size) //Size is initialized here... + , m_size(static_cast(initial_size)) //Size is initialized here... { //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor this->priv_first_allocation(initial_size); @@ -651,7 +652,7 @@ struct vector_alloc_holder //Constructor, does not throw vector_alloc_holder(vector_uninitialized_size_t, size_type initial_size) : allocator_type() - , m_size(initial_size) //Size is initialized here... + , m_size(static_cast(initial_size)) //Size is initialized here... { //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor this->priv_first_allocation(initial_size); @@ -680,26 +681,26 @@ struct vector_alloc_holder (this->alloc(), boost::movelib::to_raw_pointer(holder.start()), n, boost::movelib::to_raw_pointer(this->start())); } - static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow() + static inline void on_capacity_overflow() { allocator_type::on_capacity_overflow(); } - BOOST_CONTAINER_FORCEINLINE void set_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void set_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(s); } - BOOST_CONTAINER_FORCEINLINE void dec_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void dec_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(this->m_size - s); } - BOOST_CONTAINER_FORCEINLINE void inc_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW + inline void inc_stored_size(size_type s) BOOST_NOEXCEPT_OR_NOTHROW { this->m_size = static_cast(this->m_size + s); } - BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap) + inline void priv_first_allocation(size_type cap) { if(cap > allocator_type::internal_capacity){ on_capacity_overflow(); } } - BOOST_CONTAINER_FORCEINLINE void deep_swap(vector_alloc_holder &x) + inline void deep_swap(vector_alloc_holder &x) { this->priv_deep_swap(x); } template @@ -712,29 +713,29 @@ struct vector_alloc_holder this->priv_deep_swap(x); } - BOOST_CONTAINER_FORCEINLINE void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW + inline void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW { //Containers with version 0 allocators can't be moved without moving elements one by one on_capacity_overflow(); } - BOOST_CONTAINER_FORCEINLINE void steal_resources(vector_alloc_holder &) + inline void steal_resources(vector_alloc_holder &) { //Containers with version 0 allocators can't be moved without moving elements one by one on_capacity_overflow(); } - BOOST_CONTAINER_FORCEINLINE allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW + inline allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - BOOST_CONTAINER_FORCEINLINE const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW + inline const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - BOOST_CONTAINER_FORCEINLINE bool try_expand_fwd(size_type at_least) + inline bool try_expand_fwd(size_type at_least) { return !at_least; } - BOOST_CONTAINER_FORCEINLINE pointer start() const BOOST_NOEXCEPT_OR_NOTHROW + inline pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_type::internal_storage(); } - BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + inline size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_type::internal_capacity; } stored_size_type m_size; @@ -812,8 +813,11 @@ class vector typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; private: - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + //`allocator_type::value_type` must match container's `value type`. If this + //assertion fails, please review your allocator definition. + BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same::value)); + typedef typename boost::container:: allocator_traits::size_type alloc_size_type; typedef typename get_vector_opt::type options_type; @@ -822,7 +826,7 @@ class vector typedef value_less value_less_t; //If provided the stored_size option must specify a type that is equal or a type that is smaller. - BOOST_STATIC_ASSERT( (sizeof(stored_size_type) < sizeof(alloc_size_type) || + BOOST_CONTAINER_STATIC_ASSERT( (sizeof(stored_size_type) < sizeof(alloc_size_type) || dtl::is_same::value) ); typedef typename dtl::version::type alloc_version; @@ -837,14 +841,14 @@ class vector protected: - BOOST_CONTAINER_FORCEINLINE - static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) - { return alloc_holder_t::is_propagable_from(from_alloc, p, to_alloc, propagate_allocator); } + template + inline static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc) + { return alloc_holder_t::template is_propagable_from(from_alloc, p, to_alloc); } - BOOST_CONTAINER_FORCEINLINE - static bool are_swap_propagable( const allocator_type &l_a, pointer l_p - , const allocator_type &r_a, pointer r_p, bool const propagate_allocator) - { return alloc_holder_t::are_swap_propagable(l_a, l_p, r_a, r_p, propagate_allocator); } + template + inline static bool are_swap_propagable( const allocator_type &l_a, pointer l_p + , const allocator_type &r_a, pointer r_p) + { return alloc_holder_t::template are_swap_propagable(l_a, l_p, r_a, r_p); } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -855,23 +859,42 @@ class vector protected: - BOOST_CONTAINER_FORCEINLINE void steal_resources(vector &x) + inline void steal_resources(vector &x) { return this->m_holder.steal_resources(x.m_holder); } - BOOST_CONTAINER_FORCEINLINE void protected_set_size(size_type n) + inline void protected_set_size(size_type n) { this->m_holder.m_size = static_cast(n); } template - BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type cap, BOOST_FWD_REF(AllocFwd) a) + inline vector(initial_capacity_t, pointer initial_memory, size_type cap, BOOST_FWD_REF(AllocFwd) a) : m_holder(initial_capacity_t(), initial_memory, cap, ::boost::forward(a)) {} - BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type cap) + template + inline vector(initial_capacity_t, pointer initial_memory, size_type cap, BOOST_FWD_REF(AllocFwd) a, vector &x) + : m_holder(initial_capacity_t(), initial_memory, cap, ::boost::forward(a)) + { + allocator_type &this_al = this->get_stored_allocator(); + if (this->template is_propagable_from(x.get_stored_allocator(), x.data(), this_al)) { + this->steal_resources(x); + } + else { + const size_type sz = x.size(); + ::boost::container::uninitialized_move_alloc_n_source + ( this_al, x.priv_raw_begin(), sz + //Use launder to stop false positives from -Warray-bounds + , boost::move_detail::launder(this->priv_raw_begin())); + this->protected_set_size(sz); + x.clear(); + } + } + + inline vector(initial_capacity_t, pointer initial_memory, size_type cap) : m_holder(initial_capacity_t(), initial_memory, cap) {} template - BOOST_CONTAINER_FORCEINLINE vector(maybe_initial_capacity_t, pointer p, SizeType initial_capacity, BOOST_FWD_REF(AllocFwd) a) + inline vector(maybe_initial_capacity_t, pointer p, SizeType initial_capacity, BOOST_FWD_REF(AllocFwd) a) : m_holder(maybe_initial_capacity_t(), p, initial_capacity, ::boost::forward(a)) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS @@ -880,7 +903,7 @@ class vector } template - BOOST_CONTAINER_FORCEINLINE vector(maybe_initial_capacity_t, pointer p, SizeType initial_capacity) + inline vector(maybe_initial_capacity_t, pointer p, SizeType initial_capacity) : m_holder(maybe_initial_capacity_t(), p, initial_capacity) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS @@ -1094,7 +1117,7 @@ class vector //! Complexity: Constant. vector(BOOST_RV_REF(vector) x) BOOST_NOEXCEPT_OR_NOTHROW : m_holder(boost::move(x.m_holder)) - { BOOST_STATIC_ASSERT((!allocator_traits_type::is_partially_propagable::value)); } + { BOOST_CONTAINER_STATIC_ASSERT((!allocator_traits_type::is_partially_propagable::value)); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: Constructs a vector that will use a copy of allocator a @@ -1163,11 +1186,11 @@ class vector vector(BOOST_RV_REF(vector) x, const allocator_type &a) : m_holder( vector_uninitialized_size, a //In this allocator move constructor the allocator won't be propagated --v - , is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a, false) ? 0 : x.size() + , is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a) ? 0 : x.size() ) { //In this allocator move constructor the allocator won't be propagated ---v - if(is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a, false)){ + if(is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a)){ this->m_holder.steal_resources(x.m_holder); } else{ @@ -1202,7 +1225,7 @@ class vector //! Throws: If memory allocation throws or T's copy/move constructor/assignment throws. //! //! Complexity: Linear to the number of elements in x. - BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x) + inline vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x) { if (BOOST_LIKELY(&x != this)){ this->priv_copy_assign(x); @@ -1214,7 +1237,7 @@ class vector //! Effects: Make *this container contains elements from il. //! //! Complexity: Linear to the range [il.begin(), il.end()). - BOOST_CONTAINER_FORCEINLINE vector& operator=(std::initializer_list il) + inline vector& operator=(std::initializer_list il) { this->assign(il.begin(), il.end()); return *this; @@ -1232,7 +1255,7 @@ class vector //! Complexity: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. - BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_RV_REF(vector) x) + inline vector& operator=(BOOST_RV_REF(vector) x) BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) { @@ -1255,7 +1278,7 @@ class vector //! //! Note: Non-standard extension to support static_vector template - BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and + inline typename dtl::enable_if_and < vector& , dtl::is_version::type, 0> , dtl::is_different::type, allocator_type> @@ -1277,7 +1300,7 @@ class vector //! //! Note: Non-standard extension to support static_vector template - BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and + inline typename dtl::enable_if_and < vector& , dtl::is_version::type, 0> , dtl::is_different::type, allocator_type> @@ -1334,7 +1357,7 @@ class vector //! Throws: If memory allocation throws or //! T's constructor from dereferencing iniializer_list iterator throws. //! - BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list il) + inline void assign(std::initializer_list il) { this->assign(il.begin(), il.end()); } @@ -1405,7 +1428,7 @@ class vector //! T's copy/move constructor/assignment throws. //! //! Complexity: Linear to n. - BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const value_type& val) + inline void assign(size_type n, const value_type& val) { this->assign(cvalue_iterator(val, n), cvalue_iterator()); } //! Effects: Returns a copy of the internal allocator. @@ -1413,7 +1436,7 @@ class vector //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_holder.alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -1423,7 +1446,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->m_holder.alloc(); } @@ -1434,7 +1457,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_holder.alloc(); } @@ -1449,7 +1472,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->m_holder.start()); } //! Effects: Returns a const_iterator to the first element contained in the vector. @@ -1457,7 +1480,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->m_holder.start()); } //! Effects: Returns an iterator to the end of the vector. @@ -1465,7 +1488,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline iterator end() BOOST_NOEXCEPT_OR_NOTHROW { iterator it (this->m_holder.start()); it += difference_type(this->m_holder.m_size); @@ -1477,7 +1500,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -1486,7 +1509,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1495,7 +1518,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end @@ -1504,7 +1527,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1513,7 +1536,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the vector. @@ -1521,7 +1544,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->m_holder.start()); } //! Effects: Returns a const_iterator to the end of the vector. @@ -1529,7 +1552,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { const_iterator it (this->m_holder.start()); it += difference_type(this->m_holder.m_size); @@ -1542,7 +1565,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->end());} //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1551,7 +1574,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->begin()); } ////////////////////////////////////////////// @@ -1565,7 +1588,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return !this->m_holder.m_size; } //! Effects: Returns the number of the elements contained in the vector. @@ -1573,7 +1596,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_holder.m_size; } //! Effects: Returns the largest possible size of the vector. @@ -1581,7 +1604,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_traits_type::max_size(this->m_holder.alloc()); } //! Effects: Inserts or erases elements at the end such that @@ -1590,7 +1613,7 @@ class vector //! Throws: If memory allocation throws, or T's copy/move or value initialization throws. //! //! Complexity: Linear to the difference between size() and new_size. - BOOST_CONTAINER_FORCEINLINE void resize(size_type new_size) + inline void resize(size_type new_size) { this->priv_resize(new_size, value_init, alloc_version()); } //! Effects: Inserts or erases elements at the end such that @@ -1601,7 +1624,7 @@ class vector //! Complexity: Linear to the difference between size() and new_size. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE void resize(size_type new_size, default_init_t) + inline void resize(size_type new_size, default_init_t) { this->priv_resize(new_size, default_init, alloc_version()); } //! Effects: Inserts or erases elements at the end such that @@ -1610,7 +1633,7 @@ class vector //! Throws: If memory allocation throws, or T's copy/move constructor throws. //! //! Complexity: Linear to the difference between size() and new_size. - BOOST_CONTAINER_FORCEINLINE void resize(size_type new_size, const T& x) + inline void resize(size_type new_size, const T& x) { this->priv_resize(new_size, x, alloc_version()); } //! Effects: Number of elements for which memory has been allocated. @@ -1619,7 +1642,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_holder.capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -1628,7 +1651,7 @@ class vector //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. //! //! Throws: If memory allocation allocation throws or T's copy/move constructor throws. - BOOST_CONTAINER_FORCEINLINE void reserve(size_type new_cap) + inline void reserve(size_type new_cap) { if (this->capacity() < new_cap){ this->priv_move_to_new_buffer(new_cap, alloc_version()); @@ -1641,7 +1664,7 @@ class vector //! Throws: If memory allocation throws, or T's copy/move constructor throws. //! //! Complexity: Linear to size(). - BOOST_CONTAINER_FORCEINLINE void shrink_to_fit() + inline void shrink_to_fit() { this->priv_shrink_to_fit(alloc_version()); } ////////////////////////////////////////////// @@ -1658,7 +1681,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->m_holder.start(); @@ -1672,7 +1695,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->m_holder.start(); @@ -1686,7 +1709,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return this->m_holder.start()[difference_type(this->m_holder.m_size - 1u)]; @@ -1700,7 +1723,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return this->m_holder.start()[this->m_holder.m_size - 1]; @@ -1714,7 +1737,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->m_holder.m_size > n); return this->m_holder.start()[difference_type(n)]; @@ -1728,7 +1751,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->m_holder.m_size > n); @@ -1746,7 +1769,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->m_holder.m_size >= n); @@ -1764,7 +1787,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->m_holder.m_size >= n); @@ -1781,7 +1804,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { //Range check assert done in priv_index_of @@ -1798,7 +1821,7 @@ class vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { //Range check assert done in priv_index_of @@ -1813,7 +1836,7 @@ class vector //! Throws: range_error if n >= size() //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reference at(size_type n) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline reference at(size_type n) { this->priv_throw_if_out_of_range(n); return this->m_holder.start()[difference_type(n)]; @@ -1827,7 +1850,7 @@ class vector //! Throws: range_error if n >= size() //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reference at(size_type n) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const_reference at(size_type n) const { this->priv_throw_if_out_of_range(n); return this->m_holder.start()[n]; @@ -1845,7 +1868,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE T* data() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline T* data() BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_raw_begin(); } //! Returns: A pointer such that [data(),data() + size()) is a valid range. @@ -1854,7 +1877,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const T * data() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline const T * data() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_raw_begin(); } ////////////////////////////////////////////// @@ -1874,7 +1897,7 @@ class vector //! //! Complexity: Amortized constant time. template - BOOST_CONTAINER_FORCEINLINE reference emplace_back(BOOST_FWD_REF(Args)...args) + inline reference emplace_back(BOOST_FWD_REF(Args)...args) { T* const p = this->priv_raw_end(); if (BOOST_LIKELY(this->room_enough())){ @@ -1899,7 +1922,7 @@ class vector //! //! Note: Non-standard extension. template - BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_FWD_REF(Args)...args) + inline bool stable_emplace_back(BOOST_FWD_REF(Args)...args) { const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u)); if (BOOST_LIKELY(is_room_enough)){ @@ -1921,7 +1944,7 @@ class vector //! Complexity: If position is end(), amortized constant time //! Linear time otherwise. template - BOOST_CONTAINER_FORCEINLINE iterator emplace(const_iterator position, BOOST_FWD_REF(Args) ...args) + inline iterator emplace(const_iterator position, BOOST_FWD_REF(Args) ...args) { BOOST_ASSERT(this->priv_in_range_or_end(position)); //Just call more general insert(pos, size, value) and return iterator @@ -1934,7 +1957,7 @@ class vector #define BOOST_CONTAINER_VECTOR_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE reference emplace_back(BOOST_MOVE_UREF##N)\ + inline reference emplace_back(BOOST_MOVE_UREF##N)\ {\ T* const p = this->priv_raw_end();\ if (BOOST_LIKELY(this->room_enough())){\ @@ -1951,7 +1974,7 @@ class vector }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_MOVE_UREF##N)\ + inline bool stable_emplace_back(BOOST_MOVE_UREF##N)\ {\ const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u));\ if (BOOST_LIKELY(is_room_enough)){\ @@ -1963,7 +1986,7 @@ class vector }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace(const_iterator pos BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + inline iterator emplace(const_iterator pos BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ BOOST_ASSERT(this->priv_in_range_or_end(pos));\ typedef dtl::insert_emplace_proxy_arg##N proxy_t;\ @@ -2029,7 +2052,7 @@ class vector //! Throws: If memory allocation throws or T's copy/move constructor throws. //! //! Complexity: Linear to n. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, size_type n, const T& x) + inline iterator insert(const_iterator p, size_type n, const T& x) { BOOST_ASSERT(this->priv_in_range_or_end(p)); dtl::insert_n_copies_proxy proxy(x); @@ -2069,7 +2092,7 @@ class vector #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator pos, FwdIt first, FwdIt last + inline iterator insert(const_iterator pos, FwdIt first, FwdIt last , typename dtl::disable_if_or < void , dtl::is_convertible @@ -2106,7 +2129,7 @@ class vector //! a non-standard extension. #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator pos, size_type num, InIt first, InIt last) + inline iterator insert(const_iterator pos, size_type num, InIt first, InIt last) { BOOST_ASSERT(this->priv_in_range_or_end(pos)); BOOST_ASSERT(dtl::is_input_iterator::value || @@ -2125,7 +2148,7 @@ class vector //! Returns: an iterator to the first inserted element or position if first == last. //! //! Complexity: Linear to the range [il.begin(), il.end()). - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator position, std::initializer_list il) + inline iterator insert(const_iterator position, std::initializer_list il) { //Assertion done in insert() return this->insert(position, il.begin(), il.end()); @@ -2137,7 +2160,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant time. - BOOST_CONTAINER_FORCEINLINE void pop_back() BOOST_NOEXCEPT_OR_NOTHROW + inline void pop_back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); //Destroy last element @@ -2199,7 +2222,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE void swap(vector& x) + inline void swap(vector& x) BOOST_NOEXCEPT_IF( ((allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) && !dtl::is_version::value)) @@ -2217,7 +2240,7 @@ class vector //! //! Note: Non-standard extension to support static_vector template - BOOST_CONTAINER_FORCEINLINE void swap(vector & x + inline void swap(vector & x , typename dtl::enable_if_and < void , dtl::is_version::type, 0> @@ -2228,24 +2251,24 @@ class vector #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - //! Effects: Erases all the elements of the vector. + //! Effects: Erases all the elements of the vector. Leaves the capacity() of the vector unchanged. //! //! Throws: Nothing. //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW + inline void clear() BOOST_NOEXCEPT_OR_NOTHROW { this->priv_destroy_all(); } //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE friend bool operator==(const vector& x, const vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator==(const vector& x, const vector& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const vector& x, const vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator!=(const vector& x, const vector& y) { return !(x == y); } //! Effects: Returns true if x is less than y @@ -2257,25 +2280,25 @@ class vector //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE friend bool operator>(const vector& x, const vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator>(const vector& x, const vector& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const vector& x, const vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator<=(const vector& x, const vector& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const vector& x, const vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline friend bool operator>=(const vector& x, const vector& y) { return !(x < y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE friend void swap(vector& x, vector& y) + inline friend void swap(vector& x, vector& y) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) { x.swap(y); } @@ -2295,45 +2318,62 @@ class vector return cp >= new_cap || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(size_type(new_cap - cp))); } + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //Absolutely experimental. This function might change, disappear or simply crash! template - BOOST_CONTAINER_FORCEINLINE void insert_ordered_at(const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it) + inline void insert_ordered_at(const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it) { typedef vector_insert_ordered_cursor inserter_t; return this->priv_insert_ordered_at(element_count, inserter_t(last_position_it, last_value_it)); } template - BOOST_CONTAINER_FORCEINLINE void merge(InputIt first, InputIt last) + inline void merge(InputIt first, InputIt last) { this->merge(first, last, value_less_t()); } template - BOOST_CONTAINER_FORCEINLINE void merge(InputIt first, InputIt last, Compare comp) + inline + typename dtl::enable_if_c + < !dtl::is_input_iterator::value && + dtl::is_same::value_type>::value + , void>::type + merge(InputIt first, InputIt last, Compare comp) { size_type const s = this->size(); size_type const c = this->capacity(); size_type n = 0; size_type const free_cap = c - s; //If not input iterator and new elements don't fit in the remaining capacity, merge in new buffer - if(!dtl::is_input_iterator::value && - free_cap < (n = boost::container::iterator_udistance(first, last))){ + if(free_cap < (n = boost::container::iterator_udistance(first, last))){ this->priv_merge_in_new_buffer(first, n, comp, alloc_version()); } else{ - this->insert(this->cend(), first, last); - T *const raw_beg = this->priv_raw_begin(); - T *const raw_end = this->priv_raw_end(); - T *const raw_pos = raw_beg + s; - boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, free_cap - n); + this->priv_merge_generic(first, last, comp); } } + template + inline + typename dtl::enable_if_c + < dtl::is_input_iterator::value || + !dtl::is_same::value_type>::value + , void>::type + merge(InputIt first, InputIt last, Compare comp) + { + this->priv_merge_generic(first, last, comp); + } + template - BOOST_CONTAINER_FORCEINLINE void merge_unique(InputIt first, InputIt last) + inline void merge_unique(InputIt first, InputIt last) { this->merge_unique(first, last, value_less_t()); } template - BOOST_CONTAINER_FORCEINLINE void merge_unique(InputIt first, InputIt last, Compare comp) + inline + typename dtl::enable_if_c + < !dtl::is_input_iterator::value && + dtl::is_same::value_type>::value + , void>::type + merge_unique(InputIt first, InputIt last, Compare comp) { size_type const old_size = this->size(); this->priv_set_difference_back(first, last, comp); @@ -2343,7 +2383,42 @@ class vector boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, this->capacity() - this->size()); } + template + inline + typename dtl::enable_if_c + < dtl::is_input_iterator::value || + !dtl::is_same::value_type>::value + , void>::type + merge_unique(InputIt first, InputIt last, Compare comp) + { + iterator pos = this->insert(this->end(), first, last); + const iterator e = boost::movelib::inplace_set_unique_difference(pos, this->end(), this->begin(), pos, comp); + this->erase(e, this->end()); + boost::movelib::adaptive_merge( this->begin(), pos, e, comp + , this->priv_raw_end(), this->capacity() - this->size()); + } + + //Function for optimizations, not for users + T *unused_storage(size_type &sz) + { + sz = static_cast(this->capacity() - this->size()); + return this->priv_raw_end(); + } + + #endif + private: + template + inline void priv_merge_generic(InputIt first, InputIt last, Compare comp) + { + size_type const old_s = this->size(); + this->insert(this->cend(), first, last); + T* const raw_beg = this->priv_raw_begin(); + T* const raw_end = this->priv_raw_end(); + T* const raw_pos = raw_beg + old_s; + boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, this->capacity() - this->size()); + } + template void priv_insert_ordered_at(const size_type element_count, PositionValue position_value) { @@ -2436,7 +2511,7 @@ class vector } template - BOOST_CONTAINER_FORCEINLINE void priv_merge_in_new_buffer(FwdIt, size_type, Compare, version_0) + inline void priv_merge_in_new_buffer(FwdIt, size_type, Compare, version_0) { alloc_holder_t::on_capacity_overflow(); } @@ -2498,13 +2573,13 @@ class vector new_values_destroyer.release(); } - BOOST_CONTAINER_FORCEINLINE bool room_enough() const + inline bool room_enough() const { return this->m_holder.m_size != this->m_holder.capacity(); } - BOOST_CONTAINER_FORCEINLINE pointer back_ptr() const + inline pointer back_ptr() const { return this->m_holder.start() + difference_type(this->m_holder.m_size); } - BOOST_CONTAINER_FORCEINLINE size_type priv_index_of(pointer p) const + inline size_type priv_index_of(pointer p) const { BOOST_ASSERT(this->m_holder.start() <= p); BOOST_ASSERT(p <= (this->m_holder.start()+difference_type(this->size()))); @@ -2531,6 +2606,38 @@ class vector x.clear(); } + template + void priv_move_assign_steal_or_assign(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x, dtl::true_type /*data_can_be_always_stolen*/) + { + this->clear(); + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, this->m_holder.m_capacity); + this->m_holder.steal_resources(x.m_holder); + } + + template + void priv_move_assign_steal_or_assign(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x, dtl::false_type /*data_can_be_always_stolen*/) + { + const bool propagate_alloc = allocator_traits_type::propagate_on_container_move_assignment::value; + allocator_type& this_alloc = this->m_holder.alloc(); + allocator_type& x_alloc = x.m_holder.alloc(); + + //In this allocator move constructor the allocator might will be propagated, but to support small_vector-like + //types, we need to check the currently owned buffers to know if they are propagable. + const bool is_buffer_propagable_from_x = is_propagable_from(x_alloc, x.m_holder.start(), this_alloc); + + if (is_buffer_propagable_from_x) { + this->priv_move_assign_steal_or_assign(boost::move(x), dtl::true_type()); + } + //Else do a one by one move. Also, clear the source as users find confusing + //elements are still alive in the source container. + else { + this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin())) + , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end())) ); + x.clear(); + } + } + template void priv_move_assign(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x , typename dtl::disable_if_or @@ -2542,30 +2649,16 @@ class vector //for move assignment, no aliasing (&x != this) is assumed. //x.size() == 0 is allowed for buggy std libraries. BOOST_ASSERT(this != &x || x.size() == 0); - allocator_type &this_alloc = this->m_holder.alloc(); - allocator_type &x_alloc = x.m_holder.alloc(); + const bool alloc_is_always_equal = allocator_traits_type::is_always_equal::value; const bool propagate_alloc = allocator_traits_type::propagate_on_container_move_assignment::value; + const bool partially_propagable_alloc = allocator_traits_type::is_partially_propagable::value; + const bool data_can_be_always_be_stolen = alloc_is_always_equal || (propagate_alloc && !partially_propagable_alloc); - //In this allocator move constructor the allocator maybe will be propagated -----------------------v - const bool is_propagable_from_x = is_propagable_from(x_alloc, x.m_holder.start(), this_alloc, propagate_alloc); + this->priv_move_assign_steal_or_assign(boost::move(x), dtl::bool_()); - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(is_propagable_from_x){ - this->clear(); - if(BOOST_LIKELY(!!this->m_holder.m_start)) - this->m_holder.deallocate(this->m_holder.m_start, this->m_holder.m_capacity); - this->m_holder.steal_resources(x.m_holder); - } - //Else do a one by one move. Also, clear the source as users find confusing - //elements are still alive in the source container. - else{ - this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin())) - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end() )) - ); - x.clear(); - } //Move allocator if needed + allocator_type& this_alloc = this->m_holder.alloc(); + allocator_type& x_alloc = x.m_holder.alloc(); dtl::move_alloc(this_alloc, x_alloc, dtl::bool_()); } @@ -2607,62 +2700,131 @@ class vector } template //Template it to avoid it in explicit instantiations - BOOST_CONTAINER_FORCEINLINE void priv_swap(Vector &x, dtl::true_type) //version_0 + inline void priv_swap(Vector &x, dtl::true_type) //version_0 { this->m_holder.deep_swap(x.m_holder); } template //Template it to avoid it in explicit instantiations void priv_swap(Vector &x, dtl::false_type) //version_N { - const bool propagate_alloc = allocator_traits_type::propagate_on_container_swap::value; + BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || + allocator_traits_type::is_always_equal::value || + this->get_stored_allocator() == x.get_stored_allocator()); + + if (BOOST_UNLIKELY(&x == this)) { + return; + } + + //Just swap internals + this->m_holder.swap_resources(x.m_holder); + //And now swap the allocator + dtl::bool_ flag; + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), flag); + } + + protected: + template //Template it to avoid it in explicit instantiations + void prot_swap_small(Vector &x, std::size_t internal_capacity) //version_N + { if (BOOST_UNLIKELY(&x == this)){ return; } - else if(are_swap_propagable( this->get_stored_allocator(), this->m_holder.start() - , x.get_stored_allocator(), x.m_holder.start(), propagate_alloc)){ - //Just swap internals - this->m_holder.swap_resources(x.m_holder); + + const bool propagate_alloc = allocator_traits_type::propagate_on_container_swap::value; + if(are_swap_propagable + ( this->get_stored_allocator(), this->m_holder.start(), x.get_stored_allocator(), x.m_holder.start())){ + this->priv_swap(x, dtl::false_()); + return; } - else{ - //Else swap element by element... + + allocator_type &th_al = this->get_stored_allocator(); + allocator_type &ot_al = x.get_stored_allocator(); + + const bool is_this_data_propagable = is_propagable_from(th_al, this->data(), ot_al); + const bool is_that_data_propagable = is_propagable_from(ot_al, x.data(), th_al); + + if(internal_capacity && (is_this_data_propagable || is_that_data_propagable)) { + //steal memory from src to dst, but move elements from dst to src + vector& extmem = is_this_data_propagable ? *this : x; + vector& intmem = is_this_data_propagable ? x : *this; + + //Reset extmem to the internal storage and backup data + pointer const orig_extdata = extmem.data(); + const size_type orig_extmem_size = extmem.size(); + const size_type orig_extmem_cap = extmem.capacity(); + + //New safe state for extmem -> empty, internal storage + extmem.m_holder.m_start = extmem.get_stored_allocator().internal_storage(); + extmem.m_holder.set_stored_size(0u); + extmem.m_holder.set_stored_capacity(internal_capacity); + + { + //Deallocate on exception + typename value_traits::ArrayDeallocator new_buffer_deallocator(orig_extdata, extmem.get_stored_allocator(), orig_extmem_cap); + typename value_traits::ArrayDestructor new_values_destroyer(orig_extdata, extmem.get_stored_allocator(), orig_extmem_size); + + //Move internal memory data to the internal memory data of the target, this can throw + BOOST_ASSERT(extmem.capacity() >= intmem.size()); + ::boost::container::uninitialized_move_alloc_n + (intmem.get_stored_allocator(), intmem.priv_raw_begin(), intmem.size(), extmem.priv_raw_begin()); + + //Exception not thrown, commit new state + extmem.m_holder.set_stored_size(intmem.size()); + //Throwing part passed, disable rollback + new_buffer_deallocator.release(); + new_values_destroyer.release(); + } + + //Destroy moved elements from intmem + boost::container::destroy_alloc_n + ( intmem.get_stored_allocator(), intmem.priv_raw_begin() + , intmem.size()); + + //Adopt dynamic buffer + intmem.m_holder.m_start = orig_extdata; + intmem.m_holder.set_stored_size(orig_extmem_size); + intmem.m_holder.set_stored_capacity(orig_extmem_cap); + + //And now swap the allocator + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_()); + } + else { //swap element by element and insert rest bool const t_smaller = this->size() < x.size(); vector &sml = t_smaller ? *this : x; vector &big = t_smaller ? x : *this; - //For empty containers, maybe storage can be moved from the other (just like in the move constructor) - if(sml.empty() && is_propagable_from(big.get_stored_allocator(), big.data(), sml.get_allocator(), propagate_alloc)){ - if(BOOST_LIKELY(0u != sml.capacity())) - sml.m_holder.deallocate(sml.m_holder.m_start, sml.m_holder.m_capacity); - sml.steal_resources(big); - } - else { - //Else swap element by element... - size_type const common_elements = sml.size(); - for(size_type i = 0; i != common_elements; ++i){ - boost::adl_move_swap(sml[i], big[i]); - } - //... and move-insert the remaining range - sml.insert( sml.cend() - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.nth(common_elements))) - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.end())) - ); - //Destroy remaining elements - big.erase(big.nth(common_elements), big.cend()); + //swap element by element until common size + size_type const common_elements = sml.size(); + for(size_type i = 0; i != common_elements; ++i){ + boost::adl_move_swap(sml[i], big[i]); } + + //And now swap the allocator to be able to construct new elements in sml with the proper allocator + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_()); + + //move-insert the remaining range + T *const raw_big_nth = boost::movelib::iterator_to_raw_pointer(big.nth(common_elements)); + sml.insert(sml.cend() + , boost::make_move_iterator(raw_big_nth) + , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.end()))); + + //Destroy remaining, moved, elements with their original allocator + boost::container::destroy_alloc_n + ( sml.get_stored_allocator(), raw_big_nth + , std::size_t(big.m_holder.m_size - common_elements)); + big.m_holder.set_stored_size(common_elements); } - //And now swap the allocator - dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_()); } - - BOOST_CONTAINER_FORCEINLINE void priv_move_to_new_buffer(size_type, version_0) + private: + inline void priv_move_to_new_buffer(size_type, version_0) { alloc_holder_t::on_capacity_overflow(); } - BOOST_CONTAINER_FORCEINLINE dtl::insert_range_proxy > priv_dummy_empty_proxy() + inline dtl::insert_range_proxy > priv_dummy_empty_proxy() { return dtl::insert_range_proxy > (::boost::make_move_iterator((T *)0)); } - BOOST_CONTAINER_FORCEINLINE void priv_move_to_new_buffer(size_type new_cap, version_1) + inline void priv_move_to_new_buffer(size_type new_cap, version_1) { //There is not enough memory, allocate a new buffer //Pass the hint so that allocators can take advantage of this. @@ -2735,34 +2897,69 @@ class vector } template - BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) u) + inline iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) u) { return this->emplace(p, ::boost::forward(u)); } template - BOOST_CONTAINER_FORCEINLINE void priv_push_back(BOOST_FWD_REF(U) u) + inline void priv_push_back(BOOST_FWD_REF(U) u) { this->emplace_back(::boost::forward(u)); } //Overload to support compiler errors that instantiate too much - BOOST_CONTAINER_FORCEINLINE void priv_push_back(::boost::move_detail::nat) + inline void priv_push_back(::boost::move_detail::nat) {} - BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator, ::boost::move_detail::nat) + inline iterator priv_insert(const_iterator, ::boost::move_detail::nat) { return iterator(); } - BOOST_CONTAINER_FORCEINLINE dtl::insert_n_copies_proxy priv_resize_proxy(const T &x) + inline dtl::insert_n_copies_proxy priv_resize_proxy(const T &x) { return dtl::insert_n_copies_proxy(x); } - BOOST_CONTAINER_FORCEINLINE dtl::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) + inline dtl::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) { return dtl::insert_default_initialized_n_proxy(); } - BOOST_CONTAINER_FORCEINLINE dtl::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) + inline dtl::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) { return dtl::insert_value_initialized_n_proxy(); } - BOOST_CONTAINER_FORCEINLINE void priv_shrink_to_fit(version_0) BOOST_NOEXCEPT_OR_NOTHROW + protected: + void prot_shrink_to_fit_small(pointer const small_buffer, const size_type small_capacity) + { + const size_type cp = this->m_holder.capacity(); + if (cp && this->m_holder.m_start != small_buffer) { //Do something only if a dynamic buffer is used + const size_type sz = this->size(); + if (!sz) { + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, cp); + this->m_holder.m_start = small_buffer; + this->m_holder.set_stored_capacity(small_capacity); + } + else if(sz <= small_capacity) { + T *const oldbuf = boost::movelib::to_raw_pointer(this->m_holder.m_start); + ::boost::container::uninitialized_move_alloc_n + ( this->get_stored_allocator() + , oldbuf + , sz + , boost::movelib::to_raw_pointer(small_buffer) + ); + boost::container::destroy_alloc_n(this->get_stored_allocator(), oldbuf, sz); + + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, cp); + + this->m_holder.m_start = small_buffer; + this->m_holder.set_stored_capacity(small_capacity); + } + else if (sz < cp) { + this->priv_move_to_new_buffer(sz, alloc_version()); + } + } + } + + private: + inline void priv_shrink_to_fit(version_0) BOOST_NOEXCEPT_OR_NOTHROW {} void priv_shrink_to_fit(version_1) @@ -2807,12 +3004,19 @@ class vector } } + #ifdef _MSC_VER + #pragma warning (push) + #pragma warning(disable: 4702) //Disable unreachable code warning + #endif template - BOOST_CONTAINER_FORCEINLINE iterator priv_insert_forward_range_no_capacity + inline iterator priv_insert_forward_range_no_capacity (T * const, const size_type, const InsertionProxy , version_0) { return alloc_holder_t::on_capacity_overflow(), iterator(); } + #ifdef _MSC_VER + #pragma warning (pop) + #endif template BOOST_CONTAINER_NOINLINE iterator priv_insert_forward_range_no_capacity @@ -2879,7 +3083,7 @@ class vector } template - BOOST_CONTAINER_FORCEINLINE iterator priv_insert_forward_range + inline iterator priv_insert_forward_range (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy) { BOOST_ASSERT(this->m_holder.capacity() >= this->m_holder.m_size); @@ -3017,14 +3221,14 @@ class vector } private: - BOOST_CONTAINER_FORCEINLINE T *priv_raw_begin() const + inline T *priv_raw_begin() const { return boost::movelib::to_raw_pointer(m_holder.start()); } - BOOST_CONTAINER_FORCEINLINE T* priv_raw_end() const + inline T* priv_raw_end() const { return this->priv_raw_begin() + this->m_holder.m_size; } template //inline single-element version as it is significantly smaller - BOOST_CONTAINER_FORCEINLINE void priv_insert_forward_range_expand_forward + inline void priv_insert_forward_range_expand_forward (T* const raw_pos, const size_type, InsertionProxy insert_range_proxy, dtl::true_type) { BOOST_ASSERT(this->room_enough()); @@ -3051,7 +3255,7 @@ class vector } template - BOOST_CONTAINER_FORCEINLINE void priv_insert_forward_range_expand_forward + inline void priv_insert_forward_range_expand_forward (T* const raw_pos, const size_type n, InsertionProxy insert_range_proxy, dtl::false_type) { //There is enough memory @@ -3113,12 +3317,12 @@ class vector } } - BOOST_CONTAINER_FORCEINLINE bool priv_in_range(const_iterator pos) const + inline bool priv_in_range(const_iterator pos) const { return (this->begin() <= pos) && (pos < this->end()); } - BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const + inline bool priv_in_range_or_end(const_iterator pos) const { return (this->begin() <= pos) && (pos <= this->end()); } @@ -3161,8 +3365,8 @@ struct has_trivial_destructor_after_move::allocator_type allocator_type; typedef typename ::boost::container::allocator_traits::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move::value && - ::boost::has_trivial_destructor_after_move::value; + BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move::value && + ::boost::has_trivial_destructor_after_move::value; }; } @@ -3170,6 +3374,8 @@ struct has_trivial_destructor_after_move + BOOST_MOVE_STD_NS_BEG template @@ -3179,6 +3385,8 @@ struct pointer_traits< boost::container::vec_iterator > BOOST_MOVE_STD_NS_END +#include + #endif //BOOST_GNU_STDLIB #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container_hash/detail/hash_integral.hpp b/include/boost/container_hash/detail/hash_integral.hpp new file mode 100644 index 00000000..3b0be63f --- /dev/null +++ b/include/boost/container_hash/detail/hash_integral.hpp @@ -0,0 +1,146 @@ +// Copyright 2021-2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP +#define BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP + +#include +#include +#include +#include + +namespace boost +{ +namespace hash_detail +{ + +// libstdc++ doesn't provide support for __int128 in the standard traits + +template struct is_integral: public std::is_integral +{ +}; + +template struct is_unsigned: public std::is_unsigned +{ +}; + +template struct make_unsigned: public std::make_unsigned +{ +}; + +#if defined(__SIZEOF_INT128__) + +template<> struct is_integral<__int128_t>: public std::true_type +{ +}; + +template<> struct is_integral<__uint128_t>: public std::true_type +{ +}; + +template<> struct is_unsigned<__int128_t>: public std::false_type +{ +}; + +template<> struct is_unsigned<__uint128_t>: public std::true_type +{ +}; + +template<> struct make_unsigned<__int128_t> +{ + typedef __uint128_t type; +}; + +template<> struct make_unsigned<__uint128_t> +{ + typedef __uint128_t type; +}; + +#endif + +template sizeof(std::size_t)), + bool is_unsigned = is_unsigned::value, + std::size_t size_t_bits = sizeof(std::size_t) * CHAR_BIT, + std::size_t type_bits = sizeof(T) * CHAR_BIT> +struct hash_integral_impl; + +template struct hash_integral_impl +{ + static std::size_t fn( T v ) + { + return static_cast( v ); + } +}; + +template struct hash_integral_impl +{ + static std::size_t fn( T v ) + { + typedef typename make_unsigned::type U; + + if( v >= 0 ) + { + return hash_integral_impl::fn( static_cast( v ) ); + } + else + { + return ~hash_integral_impl::fn( static_cast( ~static_cast( v ) ) ); + } + } +}; + +template struct hash_integral_impl +{ + static std::size_t fn( T v ) + { + std::size_t seed = 0; + + seed = static_cast( v >> 32 ) + hash_detail::hash_mix( seed ); + seed = static_cast( v & 0xFFFFFFFF ) + hash_detail::hash_mix( seed ); + + return seed; + } +}; + +template struct hash_integral_impl +{ + static std::size_t fn( T v ) + { + std::size_t seed = 0; + + seed = static_cast( v >> 96 ) + hash_detail::hash_mix( seed ); + seed = static_cast( v >> 64 ) + hash_detail::hash_mix( seed ); + seed = static_cast( v >> 32 ) + hash_detail::hash_mix( seed ); + seed = static_cast( v ) + hash_detail::hash_mix( seed ); + + return seed; + } +}; + +template struct hash_integral_impl +{ + static std::size_t fn( T v ) + { + std::size_t seed = 0; + + seed = static_cast( v >> 64 ) + hash_detail::hash_mix( seed ); + seed = static_cast( v ) + hash_detail::hash_mix( seed ); + + return seed; + } +}; + +} // namespace hash_detail + +template +typename std::enable_if::value, std::size_t>::type + hash_value( T v ) +{ + return hash_detail::hash_integral_impl::fn( v ); +} + +} // namespace boost + +#endif // #ifndef BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP diff --git a/include/boost/container_hash/detail/hash_mix.hpp b/include/boost/container_hash/detail/hash_mix.hpp index 327da9e5..088dd75d 100644 --- a/include/boost/container_hash/detail/hash_mix.hpp +++ b/include/boost/container_hash/detail/hash_mix.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_HASH_DETAIL_HASH_MIX_HPP #define BOOST_HASH_DETAIL_HASH_MIX_HPP -#include +#include #include #include @@ -66,9 +66,9 @@ template struct hash_mix_impl; template<> struct hash_mix_impl<64> { - inline static boost::uint64_t fn( boost::uint64_t x ) + inline static std::uint64_t fn( std::uint64_t x ) { - boost::uint64_t const m = (boost::uint64_t(0xe9846af) << 32) + 0x9b1a615d; + std::uint64_t const m = 0xe9846af9b1a615d; x ^= x >> 32; x *= m; @@ -87,10 +87,10 @@ template<> struct hash_mix_impl<64> template<> struct hash_mix_impl<32> { - inline static boost::uint32_t fn( boost::uint32_t x ) + inline static std::uint32_t fn( std::uint32_t x ) { - boost::uint32_t const m1 = 0x21f0aaad; - boost::uint32_t const m2 = 0x735a2d97; + std::uint32_t const m1 = 0x21f0aaad; + std::uint32_t const m2 = 0x735a2d97; x ^= x >> 16; x *= m1; diff --git a/include/boost/container_hash/detail/hash_range.hpp b/include/boost/container_hash/detail/hash_range.hpp index 84ec97da..74bfe384 100644 --- a/include/boost/container_hash/detail/hash_range.hpp +++ b/include/boost/container_hash/detail/hash_range.hpp @@ -7,10 +7,8 @@ #include #include -#include -#include -#include -#include +#include +#include #include #include #include @@ -22,20 +20,20 @@ namespace boost namespace hash_detail { -template struct is_char_type: public boost::false_type {}; +template struct is_char_type: public std::false_type {}; #if CHAR_BIT == 8 -template<> struct is_char_type: public boost::true_type {}; -template<> struct is_char_type: public boost::true_type {}; -template<> struct is_char_type: public boost::true_type {}; +template<> struct is_char_type: public std::true_type {}; +template<> struct is_char_type: public std::true_type {}; +template<> struct is_char_type: public std::true_type {}; #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L -template<> struct is_char_type: public boost::true_type {}; +template<> struct is_char_type: public std::true_type {}; #endif #if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L -template<> struct is_char_type: public boost::true_type {}; +template<> struct is_char_type: public std::true_type {}; #endif #endif @@ -43,7 +41,7 @@ template<> struct is_char_type: public boost::true_type {}; // generic version template -inline typename boost::enable_if_< +inline typename std::enable_if< !is_char_type::value_type>::value, std::size_t >::type hash_range( std::size_t seed, It first, It last ) @@ -58,25 +56,25 @@ std::size_t >::type // specialized char[] version, 32 bit -template inline boost::uint32_t read32le( It p ) +template inline std::uint32_t read32le( It p ) { // clang 5+, gcc 5+ figure out this pattern and use a single mov on x86 // gcc on s390x and power BE even knows how to use load-reverse - boost::uint32_t w = - static_cast( static_cast( p[0] ) ) | - static_cast( static_cast( p[1] ) ) << 8 | - static_cast( static_cast( p[2] ) ) << 16 | - static_cast( static_cast( p[3] ) ) << 24; + std::uint32_t w = + static_cast( static_cast( p[0] ) ) | + static_cast( static_cast( p[1] ) ) << 8 | + static_cast( static_cast( p[2] ) ) << 16 | + static_cast( static_cast( p[3] ) ) << 24; return w; } #if defined(_MSC_VER) && !defined(__clang__) -template inline boost::uint32_t read32le( T* p ) +template inline std::uint32_t read32le( T* p ) { - boost::uint32_t w; + std::uint32_t w; std::memcpy( &w, p, 4 ); return w; @@ -84,15 +82,15 @@ template inline boost::uint32_t read32le( T* p ) #endif -inline boost::uint64_t mul32( boost::uint32_t x, boost::uint32_t y ) +inline std::uint64_t mul32( std::uint32_t x, std::uint32_t y ) { - return static_cast( x ) * y; + return static_cast( x ) * y; } template -inline typename boost::enable_if_< +inline typename std::enable_if< is_char_type::value_type>::value && - is_same::iterator_category, std::random_access_iterator_tag>::value && + std::is_same::iterator_category, std::random_access_iterator_tag>::value && std::numeric_limits::digits <= 32, std::size_t>::type hash_range( std::size_t seed, It first, It last ) @@ -100,17 +98,17 @@ std::size_t>::type It p = first; std::size_t n = static_cast( last - first ); - boost::uint32_t const q = 0x9e3779b9U; - boost::uint32_t const k = 0xe35e67b1U; // q * q + std::uint32_t const q = 0x9e3779b9U; + std::uint32_t const k = 0xe35e67b1U; // q * q - boost::uint64_t h = mul32( static_cast( seed ) + q, k ); - boost::uint32_t w = static_cast( h & 0xFFFFFFFF ); + std::uint64_t h = mul32( static_cast( seed ) + q, k ); + std::uint32_t w = static_cast( h & 0xFFFFFFFF ); h ^= n; while( n >= 4 ) { - boost::uint32_t v1 = read32le( p ); + std::uint32_t v1 = read32le( p ); w += q; h ^= mul32( v1 + w, k ); @@ -120,7 +118,7 @@ std::size_t>::type } { - boost::uint32_t v1 = 0; + std::uint32_t v1 = 0; if( n >= 1 ) { @@ -128,9 +126,9 @@ std::size_t>::type std::size_t const x2 = n >> 1; // 1: 0, 2: 1, 3: 1 v1 = - static_cast( static_cast( p[ static_cast( x1 ) ] ) ) << x1 * 8 | - static_cast( static_cast( p[ static_cast( x2 ) ] ) ) << x2 * 8 | - static_cast( static_cast( p[ 0 ] ) ); + static_cast( static_cast( p[ static_cast( x1 ) ] ) ) << x1 * 8 | + static_cast( static_cast( p[ static_cast( x2 ) ] ) ) << x2 * 8 | + static_cast( static_cast( p[ 0 ] ) ); } w += q; @@ -138,28 +136,28 @@ std::size_t>::type } w += q; - h ^= mul32( static_cast( h & 0xFFFFFFFF ) + w, static_cast( h >> 32 ) + w + k ); + h ^= mul32( static_cast( h & 0xFFFFFFFF ) + w, static_cast( h >> 32 ) + w + k ); - return static_cast( h & 0xFFFFFFFF ) ^ static_cast( h >> 32 ); + return static_cast( h & 0xFFFFFFFF ) ^ static_cast( h >> 32 ); } template -inline typename boost::enable_if_< +inline typename std::enable_if< is_char_type::value_type>::value && - !is_same::iterator_category, std::random_access_iterator_tag>::value && + !std::is_same::iterator_category, std::random_access_iterator_tag>::value && std::numeric_limits::digits <= 32, std::size_t>::type hash_range( std::size_t seed, It first, It last ) { std::size_t n = 0; - boost::uint32_t const q = 0x9e3779b9U; - boost::uint32_t const k = 0xe35e67b1U; // q * q + std::uint32_t const q = 0x9e3779b9U; + std::uint32_t const k = 0xe35e67b1U; // q * q - boost::uint64_t h = mul32( static_cast( seed ) + q, k ); - boost::uint32_t w = static_cast( h & 0xFFFFFFFF ); + std::uint64_t h = mul32( static_cast( seed ) + q, k ); + std::uint32_t w = static_cast( h & 0xFFFFFFFF ); - boost::uint32_t v1 = 0; + std::uint32_t v1 = 0; for( ;; ) { @@ -170,7 +168,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ); + v1 |= static_cast( static_cast( *first ) ); ++first; ++n; @@ -179,7 +177,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 8; + v1 |= static_cast( static_cast( *first ) ) << 8; ++first; ++n; @@ -188,7 +186,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 16; + v1 |= static_cast( static_cast( *first ) ) << 16; ++first; ++n; @@ -197,7 +195,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 24; + v1 |= static_cast( static_cast( *first ) ) << 24; ++first; ++n; @@ -211,33 +209,33 @@ std::size_t>::type h ^= mul32( v1 + w, k ); w += q; - h ^= mul32( static_cast( h & 0xFFFFFFFF ) + w, static_cast( h >> 32 ) + w + k ); + h ^= mul32( static_cast( h & 0xFFFFFFFF ) + w, static_cast( h >> 32 ) + w + k ); - return static_cast( h & 0xFFFFFFFF ) ^ static_cast( h >> 32 ); + return static_cast( h & 0xFFFFFFFF ) ^ static_cast( h >> 32 ); } // specialized char[] version, 64 bit -template inline boost::uint64_t read64le( It p ) +template inline std::uint64_t read64le( It p ) { - boost::uint64_t w = - static_cast( static_cast( p[0] ) ) | - static_cast( static_cast( p[1] ) ) << 8 | - static_cast( static_cast( p[2] ) ) << 16 | - static_cast( static_cast( p[3] ) ) << 24 | - static_cast( static_cast( p[4] ) ) << 32 | - static_cast( static_cast( p[5] ) ) << 40 | - static_cast( static_cast( p[6] ) ) << 48 | - static_cast( static_cast( p[7] ) ) << 56; + std::uint64_t w = + static_cast( static_cast( p[0] ) ) | + static_cast( static_cast( p[1] ) ) << 8 | + static_cast( static_cast( p[2] ) ) << 16 | + static_cast( static_cast( p[3] ) ) << 24 | + static_cast( static_cast( p[4] ) ) << 32 | + static_cast( static_cast( p[5] ) ) << 40 | + static_cast( static_cast( p[6] ) ) << 48 | + static_cast( static_cast( p[7] ) ) << 56; return w; } #if defined(_MSC_VER) && !defined(__clang__) -template inline boost::uint64_t read64le( T* p ) +template inline std::uint64_t read64le( T* p ) { - boost::uint64_t w; + std::uint64_t w; std::memcpy( &w, p, 8 ); return w; @@ -246,9 +244,9 @@ template inline boost::uint64_t read64le( T* p ) #endif template -inline typename boost::enable_if_< +inline typename std::enable_if< is_char_type::value_type>::value && - is_same::iterator_category, std::random_access_iterator_tag>::value && + std::is_same::iterator_category, std::random_access_iterator_tag>::value && (std::numeric_limits::digits > 32), std::size_t>::type hash_range( std::size_t seed, It first, It last ) @@ -256,15 +254,15 @@ std::size_t>::type It p = first; std::size_t n = static_cast( last - first ); - boost::uint64_t const q = static_cast( 0x9e3779b9 ) << 32 | 0x7f4a7c15; - boost::uint64_t const k = static_cast( 0xdf442d22 ) << 32 | 0xce4859b9; // q * q + std::uint64_t const q = 0x9e3779b97f4a7c15; + std::uint64_t const k = 0xdf442d22ce4859b9; // q * q - boost::uint64_t w = mulx( seed + q, k ); - boost::uint64_t h = w ^ n; + std::uint64_t w = mulx( seed + q, k ); + std::uint64_t h = w ^ n; while( n >= 8 ) { - boost::uint64_t v1 = read64le( p ); + std::uint64_t v1 = read64le( p ); w += q; h ^= mulx( v1 + w, k ); @@ -274,11 +272,11 @@ std::size_t>::type } { - boost::uint64_t v1 = 0; + std::uint64_t v1 = 0; if( n >= 4 ) { - v1 = static_cast( read32le( p + static_cast( n - 4 ) ) ) << ( n - 4 ) * 8 | read32le( p ); + v1 = static_cast( read32le( p + static_cast( n - 4 ) ) ) << ( n - 4 ) * 8 | read32le( p ); } else if( n >= 1 ) { @@ -286,9 +284,9 @@ std::size_t>::type std::size_t const x2 = n >> 1; // 1: 0, 2: 1, 3: 1 v1 = - static_cast( static_cast( p[ static_cast( x1 ) ] ) ) << x1 * 8 | - static_cast( static_cast( p[ static_cast( x2 ) ] ) ) << x2 * 8 | - static_cast( static_cast( p[ 0 ] ) ); + static_cast( static_cast( p[ static_cast( x1 ) ] ) ) << x1 * 8 | + static_cast( static_cast( p[ static_cast( x2 ) ] ) ) << x2 * 8 | + static_cast( static_cast( p[ 0 ] ) ); } w += q; @@ -299,22 +297,22 @@ std::size_t>::type } template -inline typename boost::enable_if_< +inline typename std::enable_if< is_char_type::value_type>::value && - !is_same::iterator_category, std::random_access_iterator_tag>::value && + !std::is_same::iterator_category, std::random_access_iterator_tag>::value && (std::numeric_limits::digits > 32), std::size_t>::type hash_range( std::size_t seed, It first, It last ) { std::size_t n = 0; - boost::uint64_t const q = static_cast( 0x9e3779b9 ) << 32 | 0x7f4a7c15; - boost::uint64_t const k = static_cast( 0xdf442d22 ) << 32 | 0xce4859b9; // q * q + std::uint64_t const q = 0x9e3779b97f4a7c15; + std::uint64_t const k = 0xdf442d22ce4859b9; // q * q - boost::uint64_t w = mulx( seed + q, k ); - boost::uint64_t h = w; + std::uint64_t w = mulx( seed + q, k ); + std::uint64_t h = w; - boost::uint64_t v1 = 0; + std::uint64_t v1 = 0; for( ;; ) { @@ -325,7 +323,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ); + v1 |= static_cast( static_cast( *first ) ); ++first; ++n; @@ -334,7 +332,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 8; + v1 |= static_cast( static_cast( *first ) ) << 8; ++first; ++n; @@ -343,7 +341,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 16; + v1 |= static_cast( static_cast( *first ) ) << 16; ++first; ++n; @@ -352,7 +350,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 24; + v1 |= static_cast( static_cast( *first ) ) << 24; ++first; ++n; @@ -361,7 +359,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 32; + v1 |= static_cast( static_cast( *first ) ) << 32; ++first; ++n; @@ -370,7 +368,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 40; + v1 |= static_cast( static_cast( *first ) ) << 40; ++first; ++n; @@ -379,7 +377,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 48; + v1 |= static_cast( static_cast( *first ) ) << 48; ++first; ++n; @@ -388,7 +386,7 @@ std::size_t>::type break; } - v1 |= static_cast( static_cast( *first ) ) << 56; + v1 |= static_cast( static_cast( *first ) ) << 56; ++first; ++n; diff --git a/include/boost/container_hash/detail/hash_tuple_like.hpp b/include/boost/container_hash/detail/hash_tuple_like.hpp index f9f5a5ba..c7f881c1 100644 --- a/include/boost/container_hash/detail/hash_tuple_like.hpp +++ b/include/boost/container_hash/detail/hash_tuple_like.hpp @@ -9,17 +9,8 @@ #include #include #include -#include -#include -#include - -#if defined(BOOST_NO_CXX11_HDR_TUPLE) - -// no support for tuple-likes - -#else - -#include +#include +#include namespace boost { @@ -28,14 +19,14 @@ namespace hash_detail template inline -typename boost::enable_if_<(I == std::tuple_size::value), void>::type +typename std::enable_if<(I == std::tuple_size::value), void>::type hash_combine_tuple_like( std::size_t&, T const& ) { } template inline -typename boost::enable_if_<(I < std::tuple_size::value), void>::type +typename std::enable_if<(I < std::tuple_size::value), void>::type hash_combine_tuple_like( std::size_t& seed, T const& v ) { using std::get; @@ -56,13 +47,9 @@ inline std::size_t hash_tuple_like( T const& v ) } // namespace hash_detail -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1800) - template inline -typename boost::enable_if_< +typename std::enable_if< container_hash::is_tuple_like::value && !container_hash::is_range::value, std::size_t>::type hash_value( T const& v ) @@ -70,87 +57,6 @@ std::size_t>::type return boost::hash_detail::hash_tuple_like( v ); } -#else - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -#endif - -#else - -inline std::size_t hash_value( std::tuple<> const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -template -inline std::size_t hash_value( std::tuple const& v ) -{ - return boost::hash_detail::hash_tuple_like( v ); -} - -#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - } // namespace boost -#endif // #if defined(BOOST_NO_CXX11_HDR_TUPLE) - #endif // #ifndef BOOST_HASH_DETAIL_HASH_TUPLE_LIKE_HPP diff --git a/include/boost/container_hash/detail/mulx.hpp b/include/boost/container_hash/detail/mulx.hpp index da6f21a2..a99a7dd3 100644 --- a/include/boost/container_hash/detail/mulx.hpp +++ b/include/boost/container_hash/detail/mulx.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_HASH_DETAIL_MULX_HPP #define BOOST_HASH_DETAIL_MULX_HPP -#include +#include #if defined(_MSC_VER) # include #endif @@ -17,55 +17,55 @@ namespace hash_detail #if defined(_MSC_VER) && defined(_M_X64) && !defined(__clang__) -__forceinline boost::uint64_t mulx( boost::uint64_t x, boost::uint64_t y ) +__forceinline std::uint64_t mulx( std::uint64_t x, std::uint64_t y ) { - boost::uint64_t r2; - boost::uint64_t r = _umul128( x, y, &r2 ); + std::uint64_t r2; + std::uint64_t r = _umul128( x, y, &r2 ); return r ^ r2; } #elif defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__) -__forceinline boost::uint64_t mulx( boost::uint64_t x, boost::uint64_t y ) +__forceinline std::uint64_t mulx( std::uint64_t x, std::uint64_t y ) { - boost::uint64_t r = x * y; - boost::uint64_t r2 = __umulh( x, y ); + std::uint64_t r = x * y; + std::uint64_t r2 = __umulh( x, y ); return r ^ r2; } #elif defined(__SIZEOF_INT128__) -inline boost::uint64_t mulx( boost::uint64_t x, boost::uint64_t y ) +inline std::uint64_t mulx( std::uint64_t x, std::uint64_t y ) { __uint128_t r = static_cast<__uint128_t>( x ) * y; - return static_cast( r ) ^ static_cast( r >> 64 ); + return static_cast( r ) ^ static_cast( r >> 64 ); } #else -inline boost::uint64_t mulx( boost::uint64_t x, boost::uint64_t y ) +inline std::uint64_t mulx( std::uint64_t x, std::uint64_t y ) { - boost::uint64_t x1 = static_cast( x ); - boost::uint64_t x2 = x >> 32; + std::uint64_t x1 = static_cast( x ); + std::uint64_t x2 = x >> 32; - boost::uint64_t y1 = static_cast( y ); - boost::uint64_t y2 = y >> 32; + std::uint64_t y1 = static_cast( y ); + std::uint64_t y2 = y >> 32; - boost::uint64_t r3 = x2 * y2; + std::uint64_t r3 = x2 * y2; - boost::uint64_t r2a = x1 * y2; + std::uint64_t r2a = x1 * y2; r3 += r2a >> 32; - boost::uint64_t r2b = x2 * y1; + std::uint64_t r2b = x2 * y1; r3 += r2b >> 32; - boost::uint64_t r1 = x1 * y1; + std::uint64_t r1 = x1 * y1; - boost::uint64_t r2 = (r1 >> 32) + static_cast( r2a ) + static_cast( r2b ); + std::uint64_t r2 = (r1 >> 32) + static_cast( r2a ) + static_cast( r2b ); - r1 = (r2 << 32) + static_cast( r1 ); + r1 = (r2 << 32) + static_cast( r1 ); r3 += r2 >> 32; return r1 ^ r3; diff --git a/include/boost/container_hash/detail/requires_cxx11.hpp b/include/boost/container_hash/detail/requires_cxx11.hpp deleted file mode 100644 index f123f927..00000000 --- a/include/boost/container_hash/detail/requires_cxx11.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef BOOST_HASH_DETAIL_REQUIRES_CXX11_HPP_INCLUDED -#define BOOST_HASH_DETAIL_REQUIRES_CXX11_HPP_INCLUDED - -// Copyright 2023 Peter Dimov -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ - defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_DECLTYPE) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_HDR_TUPLE) - -BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.ContainerHash 1.82 and will be removed in Boost.ContainerHash 1.84. Please open an issue in https://github.com/boostorg/container_hash if you want it retained.") - -#endif - -#endif // #ifndef BOOST_HASH_DETAIL_REQUIRES_CXX11_HPP_INCLUDED diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index 605644b3..8305a22c 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -11,27 +11,18 @@ #define BOOST_FUNCTIONAL_HASH_HASH_HPP #include -#include #include #include #include #include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include +#include +#include #if defined(BOOST_DESCRIBE_CXX14) # include @@ -77,95 +68,12 @@ namespace boost // // integral types - - namespace hash_detail - { - template sizeof(std::size_t)), - bool is_unsigned = boost::is_unsigned::value, - std::size_t size_t_bits = sizeof(std::size_t) * CHAR_BIT, - std::size_t type_bits = sizeof(T) * CHAR_BIT> - struct hash_integral_impl; - - template struct hash_integral_impl - { - static std::size_t fn( T v ) - { - return static_cast( v ); - } - }; - - template struct hash_integral_impl - { - static std::size_t fn( T v ) - { - typedef typename boost::make_unsigned::type U; - - if( v >= 0 ) - { - return hash_integral_impl::fn( static_cast( v ) ); - } - else - { - return ~hash_integral_impl::fn( static_cast( ~static_cast( v ) ) ); - } - } - }; - - template struct hash_integral_impl - { - static std::size_t fn( T v ) - { - std::size_t seed = 0; - - seed = static_cast( v >> 32 ) + hash_detail::hash_mix( seed ); - seed = static_cast( v & 0xFFFFFFFF ) + hash_detail::hash_mix( seed ); - - return seed; - } - }; - - template struct hash_integral_impl - { - static std::size_t fn( T v ) - { - std::size_t seed = 0; - - seed = static_cast( v >> 96 ) + hash_detail::hash_mix( seed ); - seed = static_cast( v >> 64 ) + hash_detail::hash_mix( seed ); - seed = static_cast( v >> 32 ) + hash_detail::hash_mix( seed ); - seed = static_cast( v ) + hash_detail::hash_mix( seed ); - - return seed; - } - }; - - template struct hash_integral_impl - { - static std::size_t fn( T v ) - { - std::size_t seed = 0; - - seed = static_cast( v >> 64 ) + hash_detail::hash_mix( seed ); - seed = static_cast( v ) + hash_detail::hash_mix( seed ); - - return seed; - } - }; - - } // namespace hash_detail - - template - typename boost::enable_if_::value, std::size_t>::type - hash_value( T v ) - { - return hash_detail::hash_integral_impl::fn( v ); - } + // in detail/hash_integral.hpp // enumeration types template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T v ) { // This should in principle return the equivalent of @@ -199,7 +107,7 @@ namespace boost { static std::size_t fn( T v ) { - boost::uint32_t w; + std::uint32_t w; std::memcpy( &w, &v, sizeof( v ) ); return w; @@ -211,7 +119,7 @@ namespace boost { static std::size_t fn( T v ) { - boost::uint64_t w; + std::uint64_t w; std::memcpy( &w, &v, sizeof( v ) ); return hash_value( w ); @@ -223,7 +131,7 @@ namespace boost { static std::size_t fn( T v ) { - boost::uint64_t w[ 2 ] = {}; + std::uint64_t w[ 2 ] = {}; std::memcpy( &w, &v, 80 / CHAR_BIT ); std::size_t seed = 0; @@ -240,7 +148,7 @@ namespace boost { static std::size_t fn( T v ) { - boost::uint64_t w[ 2 ] = {}; + std::uint64_t w[ 2 ] = {}; std::memcpy( &w, &v, 80 / CHAR_BIT ); std::size_t seed = 0; @@ -257,7 +165,7 @@ namespace boost { static std::size_t fn( T v ) { - boost::uint64_t w[ 2 ]; + std::uint64_t w[ 2 ]; std::memcpy( &w, &v, sizeof( v ) ); std::size_t seed = 0; @@ -280,7 +188,7 @@ namespace boost } // namespace hash_detail template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T v ) { return boost::hash_detail::hash_float_impl::fn( v + 0 ); @@ -291,7 +199,7 @@ namespace boost // `x + (x >> 3)` adjustment by Alberto Barbati and Dave Harris. template std::size_t hash_value( T* const& v ) { - boost::uintptr_t x = reinterpret_cast( v ); + std::uintptr_t x = reinterpret_cast( v ); return boost::hash_value( x + (x >> 3) ); } @@ -336,7 +244,7 @@ namespace boost // ranges (list, set, deque...) template - typename boost::enable_if_::value && !container_hash::is_contiguous_range::value && !container_hash::is_unordered_range::value, std::size_t>::type + typename std::enable_if::value && !container_hash::is_contiguous_range::value && !container_hash::is_unordered_range::value, std::size_t>::type hash_value( T const& v ) { return boost::hash_range( v.begin(), v.end() ); @@ -345,7 +253,7 @@ namespace boost // contiguous ranges (string, vector, array) template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T const& v ) { return boost::hash_range( v.data(), v.data() + v.size() ); @@ -354,7 +262,7 @@ namespace boost // unordered ranges (unordered_set, unordered_map) template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T const& v ) { return boost::hash_unordered_range( v.begin(), v.end() ); @@ -367,7 +275,7 @@ namespace boost // resolve ambiguity with unconstrained stdext::hash_value in :-/ template class L, class... T> - typename boost::enable_if_>::value && !container_hash::is_contiguous_range>::value && !container_hash::is_unordered_range>::value, std::size_t>::type + typename std::enable_if>::value && !container_hash::is_contiguous_range>::value && !container_hash::is_unordered_range>::value, std::size_t>::type hash_value( L const& v ) { return boost::hash_range( v.begin(), v.end() ); @@ -376,14 +284,14 @@ namespace boost // contiguous ranges (string, vector, array) template class L, class... T> - typename boost::enable_if_>::value, std::size_t>::type + typename std::enable_if>::value, std::size_t>::type hash_value( L const& v ) { return boost::hash_range( v.data(), v.data() + v.size() ); } template class L, class T, std::size_t N> - typename boost::enable_if_>::value, std::size_t>::type + typename std::enable_if>::value, std::size_t>::type hash_value( L const& v ) { return boost::hash_range( v.data(), v.data() + v.size() ); @@ -392,7 +300,7 @@ namespace boost // unordered ranges (unordered_set, unordered_map) template class L, class... T> - typename boost::enable_if_>::value, std::size_t>::type + typename std::enable_if>::value, std::size_t>::type hash_value( L const& v ) { return boost::hash_unordered_range( v.begin(), v.end() ); @@ -410,10 +318,10 @@ namespace boost #endif template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T const& v ) { - static_assert( !boost::is_union::value, "described unions are not supported" ); + static_assert( !std::is_union::value, "described unions are not supported" ); std::size_t r = 0; @@ -503,7 +411,7 @@ namespace boost #if !defined(BOOST_NO_CXX11_NULLPTR) template - typename boost::enable_if_::value, std::size_t>::type + typename std::enable_if::value, std::size_t>::type hash_value( T const& /*v*/ ) { return boost::hash_value( static_cast( nullptr ) ); @@ -520,7 +428,7 @@ namespace boost { if( !v ) { - // Arbitray value for empty optional. + // Arbitrary value for empty optional. return 0x12345678; } else @@ -654,20 +562,11 @@ namespace boost namespace unordered { template struct hash_is_avalanching; - template struct hash_is_avalanching< boost::hash< std::basic_string > >: boost::is_integral {}; - - // boost::is_integral is false, but should be true (https://github.com/boostorg/type_traits/issues/175) -#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L - template<> struct hash_is_avalanching< boost::hash< std::basic_string > >: boost::true_type {}; -#endif + template struct hash_is_avalanching< boost::hash< std::basic_string > >: std::is_integral {}; #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) - template struct hash_is_avalanching< boost::hash< std::basic_string_view > >: boost::is_integral {}; - -#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L - template<> struct hash_is_avalanching< boost::hash< std::basic_string_view > >: boost::true_type {}; -#endif + template struct hash_is_avalanching< boost::hash< std::basic_string_view > >: std::is_integral {}; #endif } // namespace unordered diff --git a/include/boost/container_hash/is_contiguous_range.hpp b/include/boost/container_hash/is_contiguous_range.hpp index 96043ccd..c18db6b2 100644 --- a/include/boost/container_hash/is_contiguous_range.hpp +++ b/include/boost/container_hash/is_contiguous_range.hpp @@ -5,17 +5,13 @@ #ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED #define BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED -#include #include -#include #include #include +#include -#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700) && !BOOST_WORKAROUND(BOOST_MSVC, < 1910) +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1910) -#include -#include -#include #include namespace boost @@ -24,11 +20,11 @@ namespace hash_detail { template - integral_constant< bool, is_same::value_type, T>::value && is_integral::value > + std::integral_constant< bool, std::is_same::value_type, T>::value && std::is_integral::value > is_contiguous_range_check( It first, It last, T const*, T const*, S ); -template decltype( is_contiguous_range_check( declval().begin(), declval().end(), declval().data(), declval().data() + declval().size(), declval().size() ) ) is_contiguous_range_( int ); -template false_type is_contiguous_range_( ... ); +template decltype( is_contiguous_range_check( std::declval().begin(), std::declval().end(), std::declval().data(), std::declval().data() + std::declval().size(), std::declval().size() ) ) is_contiguous_range_( int ); +template std::false_type is_contiguous_range_( ... ); template struct is_contiguous_range: decltype( hash_detail::is_contiguous_range_( 0 ) ) { @@ -39,54 +35,64 @@ template struct is_contiguous_range: decltype( hash_detail::is_contiguo namespace container_hash { -template struct is_contiguous_range: integral_constant< bool, is_range::value && hash_detail::is_contiguous_range::value > +template struct is_contiguous_range: std::integral_constant< bool, is_range::value && hash_detail::is_contiguous_range::value > { }; } // namespace container_hash } // namespace boost -#else // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) +#else // !BOOST_WORKAROUND(BOOST_MSVC, < 1910) #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_ARRAY) #include -#endif namespace boost { namespace container_hash { -template struct is_contiguous_range: false_type +template struct is_contiguous_range: std::false_type { }; -template struct is_contiguous_range< std::basic_string >: true_type +template struct is_contiguous_range< std::basic_string >: std::true_type { }; -template struct is_contiguous_range< std::basic_string const >: true_type +template struct is_contiguous_range< std::basic_string const >: std::true_type { }; -#if !defined(BOOST_NO_CXX11_HDR_ARRAY) +template struct is_contiguous_range< std::vector >: std::true_type +{ +}; + +template struct is_contiguous_range< std::vector const >: std::true_type +{ +}; -template struct is_contiguous_range< std::array >: true_type +template struct is_contiguous_range< std::vector >: std::false_type { }; -template struct is_contiguous_range< std::array const >: true_type +template struct is_contiguous_range< std::vector const >: std::false_type { }; -#endif +template struct is_contiguous_range< std::array >: std::true_type +{ +}; + +template struct is_contiguous_range< std::array const >: std::true_type +{ +}; } // namespace container_hash } // namespace boost -#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) +#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1910) #endif // #ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED diff --git a/include/boost/container_hash/is_described_class.hpp b/include/boost/container_hash/is_described_class.hpp index cd2e1db4..88f8ed37 100644 --- a/include/boost/container_hash/is_described_class.hpp +++ b/include/boost/container_hash/is_described_class.hpp @@ -5,10 +5,9 @@ #ifndef BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED #define BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED -#include -#include #include #include +#include namespace boost { @@ -17,16 +16,16 @@ namespace container_hash #if defined(BOOST_DESCRIBE_CXX11) -template struct is_described_class: boost::integral_constant struct is_described_class: std::integral_constant::value && describe::has_describe_members::value && - !boost::is_union::value> + !std::is_union::value> { }; #else -template struct is_described_class: boost::false_type +template struct is_described_class: std::false_type { }; diff --git a/include/boost/container_hash/is_range.hpp b/include/boost/container_hash/is_range.hpp index 2d3746cd..e6adbce5 100644 --- a/include/boost/container_hash/is_range.hpp +++ b/include/boost/container_hash/is_range.hpp @@ -5,29 +5,25 @@ #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED #define BOOST_HASH_IS_RANGE_HPP_INCLUDED -#include -#include -#include -#include -#include -#include -#include -#include #include +#include namespace boost { -#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700) namespace hash_detail { +template struct iterator_traits: std::iterator_traits {}; +template<> struct iterator_traits< void* > {}; +template<> struct iterator_traits< void const* > {}; + template - integral_constant< bool, !is_same::type, typename std::iterator_traits::value_type>::value > + std::integral_constant< bool, !std::is_same::type, typename iterator_traits::value_type>::value > is_range_check( It first, It last ); -template decltype( is_range_check( declval().begin(), declval().end() ) ) is_range_( int ); -template false_type is_range_( ... ); +template decltype( is_range_check( std::declval().begin(), std::declval().end() ) ) is_range_( int ); +template std::false_type is_range_( ... ); } // namespace hash_detail @@ -40,35 +36,6 @@ template struct is_range: decltype( hash_detail::is_range_( 0 ) ) } // namespace container_hash -#else - -namespace hash_detail -{ - -template struct is_range_: false_type -{ -}; - -template struct is_range_< T, integral_constant< bool, - is_same::value_type>::value && - is_integral::value - > >: true_type -{ -}; - -} // namespace hash_detail - -namespace container_hash -{ - -template struct is_range: hash_detail::is_range_ -{ -}; - -} // namespace container_hash - -#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) - } // namespace boost #endif // #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED diff --git a/include/boost/container_hash/is_tuple_like.hpp b/include/boost/container_hash/is_tuple_like.hpp index 8f57364e..bd34ee8c 100644 --- a/include/boost/container_hash/is_tuple_like.hpp +++ b/include/boost/container_hash/is_tuple_like.hpp @@ -5,9 +5,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include -#include +#include #include namespace boost @@ -15,24 +13,20 @@ namespace boost namespace hash_detail { -template struct is_tuple_like_: false_type +template struct is_tuple_like_: std::false_type { }; -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1800) - -template struct is_tuple_like_::value == std::tuple_size::value> >: true_type +template struct is_tuple_like_::value == std::tuple_size::value> >: std::true_type { }; -#endif - } // namespace hash_detail namespace container_hash { -template struct is_tuple_like: hash_detail::is_tuple_like_ +template struct is_tuple_like: hash_detail::is_tuple_like_< typename std::remove_cv::type > { }; diff --git a/include/boost/container_hash/is_unordered_range.hpp b/include/boost/container_hash/is_unordered_range.hpp index 11ee386c..5a81b7d5 100644 --- a/include/boost/container_hash/is_unordered_range.hpp +++ b/include/boost/container_hash/is_unordered_range.hpp @@ -6,21 +6,20 @@ #define BOOST_HASH_IS_UNORDERED_RANGE_HPP_INCLUDED #include -#include -#include +#include namespace boost { namespace hash_detail { -template struct has_hasher_: false_type +template struct has_hasher_: std::false_type { }; -template struct has_hasher_< T, integral_constant< bool, - is_same::value - > >: true_type +template struct has_hasher_< T, std::integral_constant< bool, + std::is_same::value + > >: std::true_type { }; @@ -29,7 +28,7 @@ template struct has_hasher_< T, integral_constant< bool, namespace container_hash { -template struct is_unordered_range: integral_constant< bool, is_range::value && hash_detail::has_hasher_::value > +template struct is_unordered_range: std::integral_constant< bool, is_range::value && hash_detail::has_hasher_::value > { }; diff --git a/include/boost/core/checked_delete.hpp b/include/boost/core/checked_delete.hpp index b74a43af..67f3c742 100644 --- a/include/boost/core/checked_delete.hpp +++ b/include/boost/core/checked_delete.hpp @@ -60,6 +60,10 @@ template inline void checked_array_delete(T * x) BOOST_NOEXCEPT delete [] x; } +// Block unintended ADL +namespace checked_deleters +{ + template struct checked_deleter { typedef void result_type; @@ -83,6 +87,11 @@ template struct checked_array_deleter } }; +} // namespace checked_deleters + +using checked_deleters::checked_deleter; +using checked_deleters::checked_array_deleter; + } // namespace boost #endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP diff --git a/include/boost/core/invoke_swap.hpp b/include/boost/core/invoke_swap.hpp new file mode 100644 index 00000000..80562895 --- /dev/null +++ b/include/boost/core/invoke_swap.hpp @@ -0,0 +1,93 @@ +// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker +// Copyright (C) 2023 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// For more information, see http://www.boost.org + +#ifndef BOOST_CORE_INVOKE_SWAP_HPP +#define BOOST_CORE_INVOKE_SWAP_HPP + +// Note: the implementation of this utility contains various workarounds: +// - invoke_swap_impl is put outside the boost namespace, to avoid infinite +// recursion (causing stack overflow) when swapping objects of a primitive +// type. +// - std::swap is imported with a using-directive, rather than +// a using-declaration, because some compilers (including MSVC 7.1, +// Borland 5.9.3, and Intel 8.1) don't do argument-dependent lookup +// when it has a using-declaration instead. +// - The main entry function is called invoke_swap rather than swap +// to avoid forming an infinite recursion when the arguments are not +// swappable. + +#include +#include +#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB) +#include // for std::swap (C++11) +#else +#include // for std::swap (C++98) +#endif +#include // for std::size_t + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(BOOST_GCC) && (BOOST_GCC < 40700) +// gcc 4.6 ICEs on noexcept specifications below +#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) +#else +#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x) +#endif + +namespace boost_swap_impl { + +// we can't use type_traits here + +template struct is_const { enum _vt { value = 0 }; }; +template struct is_const { enum _vt { value = 1 }; }; + +// Use std::swap if argument dependent lookup fails. +// We need to have this at namespace scope to be able to use unqualified swap() call +// in noexcept specification. +using namespace std; + +template +BOOST_GPU_ENABLED +inline void invoke_swap_impl(T& left, T& right) BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(swap(left, right))) +{ + swap(left, right); +} + +template +BOOST_GPU_ENABLED +inline void invoke_swap_impl(T (& left)[N], T (& right)[N]) + BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left[0], right[0]))) +{ + for (std::size_t i = 0; i < N; ++i) + { + ::boost_swap_impl::invoke_swap_impl(left[i], right[i]); + } +} + +} // namespace boost_swap_impl + +namespace boost { +namespace core { + +template +BOOST_GPU_ENABLED +inline typename enable_if_c< !::boost_swap_impl::is_const::value >::type +invoke_swap(T& left, T& right) + BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left, right))) +{ + ::boost_swap_impl::invoke_swap_impl(left, right); +} + +} // namespace core +} // namespace boost + +#undef BOOST_CORE_SWAP_NOEXCEPT_IF + +#endif // BOOST_CORE_INVOKE_SWAP_HPP diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp deleted file mode 100644 index 7add2fbf..00000000 --- a/include/boost/core/swap.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// For more information, see http://www.boost.org - - -#ifndef BOOST_CORE_SWAP_HPP -#define BOOST_CORE_SWAP_HPP - -// Note: the implementation of this utility contains various workarounds: -// - swap_impl is put outside the boost namespace, to avoid infinite -// recursion (causing stack overflow) when swapping objects of a primitive -// type. -// - std::swap is imported with a using-directive, rather than -// a using-declaration, because some compilers (including MSVC 7.1, -// Borland 5.9.3, and Intel 8.1) don't do argument-dependent lookup -// when it has a using-declaration instead. -// - boost::swap has two template arguments, instead of one, to -// avoid ambiguity when swapping objects of a Boost type that does -// not have its own boost::swap overload. - -#include -#include -#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB) -#include // for std::swap (C++11) -#else -#include // for std::swap (C++98) -#endif -#include // for std::size_t - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC < 40700) -// gcc 4.6 ICEs on noexcept specifications below -#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) -#else -#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x) -#endif - -namespace boost_swap_impl -{ - // we can't use type_traits here - - template struct is_const { enum _vt { value = 0 }; }; - template struct is_const { enum _vt { value = 1 }; }; - - // Use std::swap if argument dependent lookup fails. - // We need to have this at namespace scope to be able to use unqualified swap() call - // in noexcept specification. - using namespace std; - - template - BOOST_GPU_ENABLED - void swap_impl(T& left, T& right) BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(swap(left, right))) - { - swap(left, right); - } - - template - BOOST_GPU_ENABLED - void swap_impl(T (& left)[N], T (& right)[N]) - BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::swap_impl(left[0], right[0]))) - { - for (std::size_t i = 0; i < N; ++i) - { - ::boost_swap_impl::swap_impl(left[i], right[i]); - } - } -} - -namespace boost -{ - template - BOOST_GPU_ENABLED - typename enable_if_c< !boost_swap_impl::is_const::value && !boost_swap_impl::is_const::value >::type - swap(T1& left, T2& right) - BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::swap_impl(left, right))) - { - ::boost_swap_impl::swap_impl(left, right); - } -} - -#undef BOOST_CORE_SWAP_NOEXCEPT_IF - -#endif // BOOST_CORE_SWAP_HPP diff --git a/include/boost/detail/basic_pointerbuf.hpp b/include/boost/detail/basic_pointerbuf.hpp index a92a489f..07ea44f3 100644 --- a/include/boost/detail/basic_pointerbuf.hpp +++ b/include/boost/detail/basic_pointerbuf.hpp @@ -18,7 +18,8 @@ # pragma once #endif -#include "boost/config.hpp" +#include + #include namespace boost { namespace detail { @@ -42,13 +43,8 @@ class basic_pointerbuf : public BufferT { basic_pointerbuf() : base_type() { this_type::setbuf(0, 0); } const charT* getnext() { return this->gptr(); } -#ifndef BOOST_NO_USING_TEMPLATE using base_type::pptr; using base_type::pbase; -#else - charT* pptr() const { return base_type::pptr(); } - charT* pbase() const { return base_type::pbase(); } -#endif protected: // VC mistakenly assumes that `setbuf` and other functions are not referenced. @@ -76,7 +72,7 @@ template typename basic_pointerbuf::pos_type basic_pointerbuf::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) { - typedef typename boost::int_t::least cast_type; + typedef ::std::ios_base::seekdir cast_type; if(which & ::std::ios_base::out) return pos_type(off_type(-1)); diff --git a/include/boost/detail/lcast_precision.hpp b/include/boost/detail/lcast_precision.hpp index 84bf1222..e5551414 100644 --- a/include/boost/detail/lcast_precision.hpp +++ b/include/boost/detail/lcast_precision.hpp @@ -13,169 +13,67 @@ #include #include -#include - -#ifndef BOOST_NO_IS_ABSTRACT -// Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL -#include -#include -#endif - -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC<1310)) - -#define BOOST_LCAST_NO_COMPILE_TIME_PRECISION -#endif - -#ifdef BOOST_LCAST_NO_COMPILE_TIME_PRECISION -#include -#else -#include -#endif namespace boost { namespace detail { -class lcast_abstract_stub {}; - -#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION // Calculate an argument to pass to std::ios_base::precision from -// lexical_cast. See alternative implementation for broken standard -// libraries in lcast_get_precision below. Keep them in sync, please. +// lexical_cast. template struct lcast_precision { -#ifdef BOOST_NO_IS_ABSTRACT - typedef std::numeric_limits limits; // No fix for SF:1358600. -#else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_abstract::value - , std::numeric_limits - , std::numeric_limits - >::type limits; -#endif - - BOOST_STATIC_CONSTANT(bool, use_default_precision = + using limits = std::numeric_limits; + + static constexpr bool use_default_precision = !limits::is_specialized || limits::is_exact - ); + ; - BOOST_STATIC_CONSTANT(bool, is_specialized_bin = + static constexpr bool is_specialized_bin = !use_default_precision && limits::radix == 2 && limits::digits > 0 - ); + ; - BOOST_STATIC_CONSTANT(bool, is_specialized_dec = + static constexpr bool is_specialized_dec = !use_default_precision && limits::radix == 10 && limits::digits10 > 0 - ); + ; - BOOST_STATIC_CONSTANT(std::streamsize, streamsize_max = - boost::integer_traits::const_max - ); + static constexpr std::streamsize streamsize_max = + (std::numeric_limits::max)() + ; - BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U); + static constexpr unsigned int precision_dec = limits::digits10 + 1U; - BOOST_STATIC_ASSERT(!is_specialized_dec || + static_assert(!is_specialized_dec || precision_dec <= streamsize_max + 0UL - ); + , ""); - BOOST_STATIC_CONSTANT(unsigned long, precision_bin = + static constexpr unsigned long precision_bin = 2UL + limits::digits * 30103UL / 100000UL - ); + ; - BOOST_STATIC_ASSERT(!is_specialized_bin || + static_assert(!is_specialized_bin || (limits::digits + 0UL < ULONG_MAX / 30103UL && precision_bin > limits::digits10 + 0UL && precision_bin <= streamsize_max + 0UL) - ); + , ""); - BOOST_STATIC_CONSTANT(std::streamsize, value = + static constexpr std::streamsize value = is_specialized_bin ? precision_bin : is_specialized_dec ? precision_dec : 6 - ); + ; }; -#endif - -template -inline std::streamsize lcast_get_precision(T* = 0) -{ -#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION - return lcast_precision::value; -#else // Follow lcast_precision algorithm at run-time: - -#ifdef BOOST_NO_IS_ABSTRACT - typedef std::numeric_limits limits; // No fix for SF:1358600. -#else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_abstract::value - , std::numeric_limits - , std::numeric_limits - >::type limits; -#endif - - bool const use_default_precision = - !limits::is_specialized || limits::is_exact; - - if(!use_default_precision) - { // Includes all built-in floating-point types, float, double ... - // and UDT types for which digits (significand bits) is defined (not zero) - - bool const is_specialized_bin = - limits::radix == 2 && limits::digits > 0; - bool const is_specialized_dec = - limits::radix == 10 && limits::digits10 > 0; - std::streamsize const streamsize_max = - (boost::integer_traits::max)(); - (void)streamsize_max; - - if(is_specialized_bin) - { // Floating-point types with - // limits::digits defined by the specialization. - - unsigned long const digits = limits::digits; - unsigned long const precision = 2UL + digits * 30103UL / 100000UL; - // unsigned long is selected because it is at least 32-bits - // and thus ULONG_MAX / 30103UL is big enough for all types. - BOOST_ASSERT( - digits < ULONG_MAX / 30103UL && - precision > limits::digits10 + 0UL && - precision <= streamsize_max + 0UL - ); - return precision; - } - else if(is_specialized_dec) - { // Decimal Floating-point type, most likely a User Defined Type - // rather than a real floating-point hardware type. - unsigned int const precision = limits::digits10 + 1U; - BOOST_ASSERT(precision <= streamsize_max + 0UL); - return precision; - } - } - - // Integral type (for which precision has no effect) - // or type T for which limits is NOT specialized, - // so assume stream precision remains the default 6 decimal digits. - // Warning: if your User-defined Floating-point type T is NOT specialized, - // then you may lose accuracy by only using 6 decimal digits. - // To avoid this, you need to specialize T with either - // radix == 2 and digits == the number of significand bits, - // OR - // radix = 10 and digits10 == the number of decimal digits. - - return 6; -#endif -} template inline void lcast_set_precision(std::ios_base& stream, T*) { - stream.precision(lcast_get_precision()); + stream.precision(lcast_precision::value); } template inline void lcast_set_precision(std::ios_base& stream, Source*, Target*) { - std::streamsize const s = lcast_get_precision(static_cast(0)); - std::streamsize const t = lcast_get_precision(static_cast(0)); + std::streamsize const s = lcast_precision::value; + std::streamsize const t = lcast_precision::value; stream.precision(s > t ? s : t); } diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index ca8d8335..4ec18d7d 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -19,7 +19,7 @@ namespace boost { namespace exception_detail { using boost::shared_ptr; } } #endif #if !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#if __GNUC__*100+__GNUC_MINOR__>301 +#if defined(__GNUC__) && __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif #ifdef __clang__ diff --git a/include/boost/function.hpp b/include/boost/function.hpp index f6ee8820..6fd7388b 100644 --- a/include/boost/function.hpp +++ b/include/boost/function.hpp @@ -1,3 +1,6 @@ +#ifndef BOOST_FUNCTION_HPP_INCLUDED +#define BOOST_FUNCTION_HPP_INCLUDED + // Boost.Function library // Copyright Douglas Gregor 2001-2003. Use, modification and @@ -10,67 +13,6 @@ // William Kempf, Jesse Jones and Karl Nelson were all very helpful in the // design of this library. -#ifndef BOOST_FUNCTION_MAX_ARGS -# define BOOST_FUNCTION_MAX_ARGS 10 -#endif // BOOST_FUNCTION_MAX_ARGS - -#if !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) || (BOOST_FUNCTION_MAX_ARGS_DEFINED != BOOST_FUNCTION_MAX_ARGS) - -#if !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) -#define BOOST_FUNCTION_MAX_ARGS_DEFINED 0 -#endif - -#include // unary_function, binary_function - -#include -#include - -// Include the prologue here so that the use of file-level iteration -// in anything that may be included by function_template.hpp doesn't break -#include - -// Older Visual Age C++ version do not handle the file iteration well -#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800) -# if BOOST_FUNCTION_MAX_ARGS >= 0 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 1 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 2 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 3 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 4 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 5 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 6 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 7 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 8 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 9 -# include -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 10 -# include -# endif -#else -// What is the '3' for? -# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,)) -# include BOOST_PP_ITERATE() -# undef BOOST_PP_ITERATION_PARAMS_1 -#endif - -#include +#include -#endif // !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) || (BOOST_FUNCTION_MAX_ARGS_DEFINED != BOOST_FUNCTION_MAX_ARGS) +#endif // #ifndef BOOST_FUNCTION_HPP_INCLUDED diff --git a/include/boost/function/detail/epilogue.hpp b/include/boost/function/detail/epilogue.hpp deleted file mode 100644 index 908788bc..00000000 --- a/include/boost/function/detail/epilogue.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Boost.Function library - -#ifndef BOOST_FUNCTION_EPILOGUE_HPP -#define BOOST_FUNCTION_EPILOGUE_HPP - -// Copyright 2023 Peter Dimov -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -// Resolve C++20 issue with fn == bind(...) -// https://github.com/boostorg/function/issues/45 - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -namespace boost -{ - -namespace _bi -{ - -template class bind_t; - -} // namespace _bi - -template bool operator==( function const& f, _bi::bind_t const& b ) -{ - return f.contains( b ); -} - -template bool operator!=( function const& f, _bi::bind_t const& b ) -{ - return !f.contains( b ); -} - -} // namespace boost - -#endif // #if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -#endif // #ifndef BOOST_FUNCTION_EPILOGUE_HPP diff --git a/include/boost/function/detail/function_iterate.hpp b/include/boost/function/detail/function_iterate.hpp deleted file mode 100644 index 5370b36a..00000000 --- a/include/boost/function/detail/function_iterate.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org -#if !defined(BOOST_PP_IS_ITERATING) -# error Boost.Function - do not include this file! -#endif - -#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION() -#include -#undef BOOST_FUNCTION_NUM_ARGS - diff --git a/include/boost/function/detail/gen_maybe_include.pl b/include/boost/function/detail/gen_maybe_include.pl deleted file mode 100644 index bc409840..00000000 --- a/include/boost/function/detail/gen_maybe_include.pl +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl -w -# -# Boost.Function library -# -# Copyright (C) 2001-2003 Douglas Gregor (gregod@cs.rpi.edu) -# -# Permission to copy, use, sell and distribute this software is granted -# provided this copyright notice appears in all copies. -# Permission to modify the code and to distribute modified code is granted -# provided this copyright notice appears in all copies, and a notice -# that the code was modified is included with the copyright notice. -# -# This software is provided "as is" without express or implied warranty, -# and with no claim as to its suitability for any purpose. -# -# For more information, see http://www.boost.org -use English; - -$max_args = $ARGV[0]; - -open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp"); -for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) { - if ($on_arg == 0) { - print OUT "#if"; - } - else { - print OUT "#elif"; - } - print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n"; - print OUT "# undef BOOST_FUNCTION_MAX_ARGS_DEFINED\n"; - print OUT "# define BOOST_FUNCTION_MAX_ARGS_DEFINED $on_arg\n"; - print OUT "# ifndef BOOST_FUNCTION_$on_arg\n"; - print OUT "# define BOOST_FUNCTION_$on_arg\n"; - print OUT "# include \n"; - print OUT "# endif\n"; -} -print OUT "#else\n"; -print OUT "# error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n"; -print OUT "#endif\n"; diff --git a/include/boost/function/detail/maybe_include.hpp b/include/boost/function/detail/maybe_include.hpp deleted file mode 100644 index ec88905d..00000000 --- a/include/boost/function/detail/maybe_include.hpp +++ /dev/null @@ -1,369 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#if BOOST_FUNCTION_NUM_ARGS == 0 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 0 -# ifndef BOOST_FUNCTION_0 -# define BOOST_FUNCTION_0 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 1 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 1 -# ifndef BOOST_FUNCTION_1 -# define BOOST_FUNCTION_1 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 2 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 2 -# ifndef BOOST_FUNCTION_2 -# define BOOST_FUNCTION_2 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 3 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 3 -# ifndef BOOST_FUNCTION_3 -# define BOOST_FUNCTION_3 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 4 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 4 -# ifndef BOOST_FUNCTION_4 -# define BOOST_FUNCTION_4 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 5 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 5 -# ifndef BOOST_FUNCTION_5 -# define BOOST_FUNCTION_5 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 6 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 6 -# ifndef BOOST_FUNCTION_6 -# define BOOST_FUNCTION_6 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 7 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 7 -# ifndef BOOST_FUNCTION_7 -# define BOOST_FUNCTION_7 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 8 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 8 -# ifndef BOOST_FUNCTION_8 -# define BOOST_FUNCTION_8 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 9 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 9 -# ifndef BOOST_FUNCTION_9 -# define BOOST_FUNCTION_9 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 10 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 10 -# ifndef BOOST_FUNCTION_10 -# define BOOST_FUNCTION_10 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 11 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 11 -# ifndef BOOST_FUNCTION_11 -# define BOOST_FUNCTION_11 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 12 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 12 -# ifndef BOOST_FUNCTION_12 -# define BOOST_FUNCTION_12 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 13 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 13 -# ifndef BOOST_FUNCTION_13 -# define BOOST_FUNCTION_13 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 14 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 14 -# ifndef BOOST_FUNCTION_14 -# define BOOST_FUNCTION_14 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 15 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 15 -# ifndef BOOST_FUNCTION_15 -# define BOOST_FUNCTION_15 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 16 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 16 -# ifndef BOOST_FUNCTION_16 -# define BOOST_FUNCTION_16 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 17 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 17 -# ifndef BOOST_FUNCTION_17 -# define BOOST_FUNCTION_17 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 18 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 18 -# ifndef BOOST_FUNCTION_18 -# define BOOST_FUNCTION_18 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 19 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 19 -# ifndef BOOST_FUNCTION_19 -# define BOOST_FUNCTION_19 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 20 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 20 -# ifndef BOOST_FUNCTION_20 -# define BOOST_FUNCTION_20 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 21 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 21 -# ifndef BOOST_FUNCTION_21 -# define BOOST_FUNCTION_21 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 22 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 22 -# ifndef BOOST_FUNCTION_22 -# define BOOST_FUNCTION_22 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 23 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 23 -# ifndef BOOST_FUNCTION_23 -# define BOOST_FUNCTION_23 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 24 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 24 -# ifndef BOOST_FUNCTION_24 -# define BOOST_FUNCTION_24 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 25 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 25 -# ifndef BOOST_FUNCTION_25 -# define BOOST_FUNCTION_25 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 26 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 26 -# ifndef BOOST_FUNCTION_26 -# define BOOST_FUNCTION_26 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 27 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 27 -# ifndef BOOST_FUNCTION_27 -# define BOOST_FUNCTION_27 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 28 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 28 -# ifndef BOOST_FUNCTION_28 -# define BOOST_FUNCTION_28 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 29 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 29 -# ifndef BOOST_FUNCTION_29 -# define BOOST_FUNCTION_29 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 30 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 30 -# ifndef BOOST_FUNCTION_30 -# define BOOST_FUNCTION_30 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 31 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 31 -# ifndef BOOST_FUNCTION_31 -# define BOOST_FUNCTION_31 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 32 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 32 -# ifndef BOOST_FUNCTION_32 -# define BOOST_FUNCTION_32 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 33 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 33 -# ifndef BOOST_FUNCTION_33 -# define BOOST_FUNCTION_33 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 34 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 34 -# ifndef BOOST_FUNCTION_34 -# define BOOST_FUNCTION_34 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 35 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 35 -# ifndef BOOST_FUNCTION_35 -# define BOOST_FUNCTION_35 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 36 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 36 -# ifndef BOOST_FUNCTION_36 -# define BOOST_FUNCTION_36 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 37 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 37 -# ifndef BOOST_FUNCTION_37 -# define BOOST_FUNCTION_37 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 38 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 38 -# ifndef BOOST_FUNCTION_38 -# define BOOST_FUNCTION_38 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 39 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 39 -# ifndef BOOST_FUNCTION_39 -# define BOOST_FUNCTION_39 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 40 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 40 -# ifndef BOOST_FUNCTION_40 -# define BOOST_FUNCTION_40 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 41 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 41 -# ifndef BOOST_FUNCTION_41 -# define BOOST_FUNCTION_41 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 42 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 42 -# ifndef BOOST_FUNCTION_42 -# define BOOST_FUNCTION_42 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 43 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 43 -# ifndef BOOST_FUNCTION_43 -# define BOOST_FUNCTION_43 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 44 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 44 -# ifndef BOOST_FUNCTION_44 -# define BOOST_FUNCTION_44 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 45 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 45 -# ifndef BOOST_FUNCTION_45 -# define BOOST_FUNCTION_45 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 46 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 46 -# ifndef BOOST_FUNCTION_46 -# define BOOST_FUNCTION_46 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 47 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 47 -# ifndef BOOST_FUNCTION_47 -# define BOOST_FUNCTION_47 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 48 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 48 -# ifndef BOOST_FUNCTION_48 -# define BOOST_FUNCTION_48 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 49 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 49 -# ifndef BOOST_FUNCTION_49 -# define BOOST_FUNCTION_49 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 50 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 50 -# ifndef BOOST_FUNCTION_50 -# define BOOST_FUNCTION_50 -# include -# endif -#else -# error Cannot handle Boost.Function objects that accept more than 50 arguments! -#endif diff --git a/include/boost/function/detail/prologue.hpp b/include/boost/function/detail/prologue.hpp deleted file mode 100644 index 2edebe06..00000000 --- a/include/boost/function/detail/prologue.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_FUNCTION_PROLOGUE_HPP -#define BOOST_FUNCTION_PROLOGUE_HPP -# include -# include -# include -# include // unary_function, binary_function -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/include/boost/function/detail/requires_cxx11.hpp b/include/boost/function/detail/requires_cxx11.hpp deleted file mode 100644 index a2da96ca..00000000 --- a/include/boost/function/detail/requires_cxx11.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef BOOST_FUNCTION_DETAIL_REQUIRES_CXX11_HPP_INCLUDED -#define BOOST_FUNCTION_DETAIL_REQUIRES_CXX11_HPP_INCLUDED - -// Copyright 2023 Peter Dimov -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ - defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_DECLTYPE) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) - -BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Function 1.82 and will be removed in Boost.Function 1.84. Please open an issue in https://github.com/boostorg/function if you want it retained.") - -#endif - -#endif // #ifndef BOOST_FUNCTION_DETAIL_REQUIRES_CXX11_HPP_INCLUDED diff --git a/include/boost/function/function0.hpp b/include/boost/function/function0.hpp deleted file mode 100644 index 65a02e5f..00000000 --- a/include/boost/function/function0.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 0 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function1.hpp b/include/boost/function/function1.hpp deleted file mode 100644 index 90897151..00000000 --- a/include/boost/function/function1.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 1 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function10.hpp b/include/boost/function/function10.hpp deleted file mode 100644 index 65627248..00000000 --- a/include/boost/function/function10.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 10 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function2.hpp b/include/boost/function/function2.hpp deleted file mode 100644 index dc8bf975..00000000 --- a/include/boost/function/function2.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 2 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function3.hpp b/include/boost/function/function3.hpp deleted file mode 100644 index 19d1a49d..00000000 --- a/include/boost/function/function3.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 3 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function4.hpp b/include/boost/function/function4.hpp deleted file mode 100644 index f3349e2d..00000000 --- a/include/boost/function/function4.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 4 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function5.hpp b/include/boost/function/function5.hpp deleted file mode 100644 index a1305eb5..00000000 --- a/include/boost/function/function5.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 5 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function6.hpp b/include/boost/function/function6.hpp deleted file mode 100644 index 1f609149..00000000 --- a/include/boost/function/function6.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 6 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function7.hpp b/include/boost/function/function7.hpp deleted file mode 100644 index 68542ed4..00000000 --- a/include/boost/function/function7.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 7 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function8.hpp b/include/boost/function/function8.hpp deleted file mode 100644 index cf2c3766..00000000 --- a/include/boost/function/function8.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 8 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function9.hpp b/include/boost/function/function9.hpp deleted file mode 100644 index 590e0883..00000000 --- a/include/boost/function/function9.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 9 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 5693e11e..ca15b7b7 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -15,16 +15,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -32,6 +22,7 @@ #include #include #include +#include #if defined(BOOST_MSVC) # pragma warning( push ) @@ -39,16 +30,11 @@ # pragma warning( disable : 4127 ) // "conditional expression is constant" #endif -#if defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_TARGET_FIX(x) x -#else -# define BOOST_FUNCTION_TARGET_FIX(x) -#endif // __ICL etc +// retained because used in a test +#define BOOST_FUNCTION_TARGET_FIX(x) -# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ - typename ::boost::enable_if_< \ - !(::boost::is_integral::value), \ - Type>::type +#define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ + typename std::enable_if< !std::is_integral::value, Type>::type namespace boost { namespace detail { @@ -115,30 +101,6 @@ namespace boost { mutable char data[sizeof(function_buffer_members)]; }; - /** - * The unusable class is a placeholder for unused function arguments - * It is also completely unusable except that it constructable from - * anything. This helps compilers without partial specialization to - * handle Boost.Function objects returning void. - */ - struct unusable - { - unusable() {} - template unusable(const T&) {} - }; - - /* Determine the return type. This supports compilers that do not support - * void returns or partial specialization by silently changing the return - * type to "unusable". - */ - template struct function_return_type { typedef T type; }; - - template<> - struct function_return_type - { - typedef unusable type; - }; - // The operation type to perform on the given functor/function pointer enum functor_manager_operation_type { clone_functor_tag, @@ -157,15 +119,15 @@ namespace boost { template class get_function_tag { - typedef typename conditional<(is_pointer::value), + typedef typename std::conditional::value, function_ptr_tag, function_obj_tag>::type ptr_or_obj_tag; - typedef typename conditional<(is_member_pointer::value), + typedef typename std::conditional::value, member_ptr_tag, ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - typedef typename conditional<(is_reference_wrapper::value), + typedef typename std::conditional::value, function_obj_ref_tag, ptr_or_obj_or_mem_tag>::type or_ref_tag; @@ -230,8 +192,8 @@ namespace boost { BOOST_STATIC_CONSTANT (bool, value = ((sizeof(F) <= sizeof(function_buffer) && - (alignment_of::value - % alignment_of::value == 0)))); + (std::alignment_of::value + % std::alignment_of::value == 0)))); }; template @@ -288,16 +250,15 @@ namespace boost { manage_small(const function_buffer& in_buffer, function_buffer& out_buffer, functor_manager_operation_type op) { - if (op == clone_functor_tag || op == move_functor_tag) { + if (op == clone_functor_tag) { const functor_type* in_functor = reinterpret_cast(in_buffer.data); new (reinterpret_cast(out_buffer.data)) functor_type(*in_functor); - if (op == move_functor_tag) { + } else if (op == move_functor_tag) { functor_type* f = reinterpret_cast(in_buffer.data); - (void)f; // suppress warning about the value of f not being used (MSVC) + new (reinterpret_cast(out_buffer.data)) functor_type(std::move(*f)); f->~Functor(); - } } else if (op == destroy_functor_tag) { // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. functor_type* f = reinterpret_cast(out_buffer.data); @@ -333,7 +294,7 @@ namespace boost { // Function objects that fit in the small-object buffer. static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, true_type) + functor_manager_operation_type op, std::true_type) { functor_manager_common::manage_small(in_buffer,out_buffer,op); } @@ -341,7 +302,7 @@ namespace boost { // Function objects that require heap allocation static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, false_type) + functor_manager_operation_type op, std::false_type) { if (op == clone_functor_tag) { // Clone the functor @@ -382,7 +343,7 @@ namespace boost { functor_manager_operation_type op, function_obj_tag) { manager(in_buffer, out_buffer, op, - integral_constant::value)>()); + std::integral_constant::value)>()); } // For member pointers, we use the small-object optimization buffer. @@ -390,7 +351,7 @@ namespace boost { manager(const function_buffer& in_buffer, function_buffer& out_buffer, functor_manager_operation_type op, member_ptr_tag) { - manager(in_buffer, out_buffer, op, true_type()); + manager(in_buffer, out_buffer, op, std::true_type()); } public: @@ -428,7 +389,7 @@ namespace boost { // Function objects that fit in the small-object buffer. static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, true_type) + functor_manager_operation_type op, std::true_type) { functor_manager_common::manage_small(in_buffer,out_buffer,op); } @@ -436,17 +397,12 @@ namespace boost { // Function objects that require heap allocation static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, false_type) + functor_manager_operation_type op, std::false_type) { typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif if (op == clone_functor_tag) { // Clone the functor @@ -456,11 +412,7 @@ namespace boost { static_cast(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast(*f)); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, *f); -#else std::allocator_traits::construct(wrapper_allocator, copy, *f); -#endif // Get back to the original pointer type functor_wrapper_type* new_f = static_cast(copy); @@ -473,11 +425,7 @@ namespace boost { functor_wrapper_type* victim = static_cast(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast(*victim)); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.destroy(victim); -#else std::allocator_traits::destroy(wrapper_allocator, victim); -#endif wrapper_allocator.deallocate(victim,1); out_buffer.members.obj_ptr = 0; } else if (op == check_functor_type_tag) { @@ -500,7 +448,7 @@ namespace boost { functor_manager_operation_type op, function_obj_tag) { manager(in_buffer, out_buffer, op, - integral_constant::value)>()); + std::integral_constant::value)>()); } public: @@ -524,65 +472,6 @@ namespace boost { // A type that is only used for comparisons against zero struct useless_clear_type {}; -#ifdef BOOST_NO_SFINAE - // These routines perform comparisons between a Boost.Function - // object and an arbitrary function object (when the last - // parameter is false_type) or against zero (when the - // last parameter is true_type). They are only necessary - // for compilers that don't support SFINAE. - template - bool - compare_equal(const Function& f, const Functor&, int, true_type) - { return f.empty(); } - - template - bool - compare_not_equal(const Function& f, const Functor&, int, - true_type) - { return !f.empty(); } - - template - bool - compare_equal(const Function& f, const Functor& g, long, - false_type) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - - template - bool - compare_equal(const Function& f, const reference_wrapper& g, - int, false_type) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - - template - bool - compare_not_equal(const Function& f, const Functor& g, long, - false_type) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - - template - bool - compare_not_equal(const Function& f, - const reference_wrapper& g, int, - false_type) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } -#endif // BOOST_NO_SFINAE - /** * Stores the "manager" portion of the vtable for a * boost::function object. @@ -628,8 +517,8 @@ class function_base detail::function::function_buffer type_result; type_result.members.type.type = &BOOST_CORE_TYPEID(Functor); - type_result.members.type.const_qualified = is_const::value; - type_result.members.type.volatile_qualified = is_volatile::value; + type_result.members.type.const_qualified = std::is_const::value; + type_result.members.type.volatile_qualified = std::is_volatile::value; get_vtable()->manager(functor, type_result, detail::function::check_functor_type_tag); return static_cast(type_result.members.obj_ptr); @@ -643,7 +532,7 @@ class function_base detail::function::function_buffer type_result; type_result.members.type.type = &BOOST_CORE_TYPEID(Functor); type_result.members.type.const_qualified = true; - type_result.members.type.volatile_qualified = is_volatile::value; + type_result.members.type.volatile_qualified = std::is_volatile::value; get_vtable()->manager(functor, type_result, detail::function::check_functor_type_tag); // GCC 2.95.3 gets the CV qualifiers wrong here, so we @@ -652,7 +541,8 @@ class function_base } template - bool contains(const F& f) const + typename std::enable_if< !std::is_function::value, bool >::type + contains(const F& f) const { if (const F* fp = this->template target()) { @@ -662,28 +552,18 @@ class function_base } } -#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 - // GCC 3.3 and newer cannot copy with the global operator==, due to - // problems with instantiation of function return types before it - // has been verified that the argument types match up. - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g) const - { - if (const Functor* fp = target()) - return function_equal(*fp, g); - else return false; - } - - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g) const + template + typename std::enable_if< std::is_function::value, bool >::type + contains(Fn& f) const { - if (const Functor* fp = target()) - return !function_equal(*fp, g); - else return true; + typedef Fn* F; + if (const F* fp = this->template target()) + { + return function_equal(*fp, &f); + } else { + return false; + } } -#endif public: // should be protected, but GCC 2.95.3 will fail to allow access detail::function::vtable_base* get_vtable() const { @@ -716,7 +596,6 @@ class BOOST_SYMBOL_VISIBLE bad_function_call : public std::runtime_error # pragma clang diagnostic pop #endif -#ifndef BOOST_NO_SFINAE inline bool operator==(const function_base& f, detail::function::useless_clear_type*) { @@ -740,43 +619,10 @@ inline bool operator!=(detail::function::useless_clear_type*, { return !f.empty(); } -#endif - -#ifdef BOOST_NO_SFINAE -// Comparisons between boost::function objects and arbitrary function objects -template - inline bool operator==(const function_base& f, Functor g) - { - typedef integral_constant::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator==(Functor g, const function_base& f) - { - typedef integral_constant::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(const function_base& f, Functor g) - { - typedef integral_constant::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(Functor g, const function_base& f) - { - typedef integral_constant::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } -#else -# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) // Comparisons between boost::function objects and arbitrary function -// objects. GCC 3.3 and before has an obnoxious bug that prevents this -// from working. +// objects. + template BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) operator==(const function_base& f, Functor g) @@ -812,7 +658,6 @@ template return !function_equal(g, *fp); else return true; } -# endif template BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) @@ -850,8 +695,6 @@ template else return true; } -#endif // Compiler supporting SFINAE - namespace detail { namespace function { inline bool has_empty_target(const function_base* f) diff --git a/include/boost/function/function_fwd.hpp b/include/boost/function/function_fwd.hpp index e79b5048..fccfecc2 100644 --- a/include/boost/function/function_fwd.hpp +++ b/include/boost/function/function_fwd.hpp @@ -10,24 +10,9 @@ #define BOOST_FUNCTION_FWD_HPP #include -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// Work around a compiler bug. -// boost::python::objects::function has to be seen by the compiler before the -// boost::function class template. -namespace boost { namespace python { namespace objects { - class function; -}}} -#endif - -#if defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) -# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX -#endif - namespace boost { class bad_function_call; -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) // Preferred syntax template class function; @@ -36,34 +21,44 @@ namespace boost { { f1.swap(f2); } -#endif // have partial specialization // Portable syntax - template class function0; - template class function1; - template class function2; - template class function3; - template - class function4; - template - class function5; - template - class function6; - template - class function7; - template - class function8; - template - class function9; - template - class function10; + template class function_n; + + template using function0 = function_n; + template using function1 = function_n; + template using function2 = function_n; + template using function3 = function_n; + template using function4 = function_n; + template using function5 = function_n; + template using function6 = function_n; + template using function7 = function_n; + template using function8 = function_n; + template using function9 = function_n; + + template using function10 = function_n; + template using function11 = function_n; + template using function12 = function_n; + template using function13 = function_n; + template using function14 = function_n; + template using function15 = function_n; + template using function16 = function_n; + template using function17 = function_n; + template using function18 = function_n; + template using function19 = function_n; + + template using function20 = function_n; + template using function21 = function_n; + template using function22 = function_n; + template using function23 = function_n; + template using function24 = function_n; + template using function25 = function_n; + template using function26 = function_n; + template using function27 = function_n; + template using function28 = function_n; + template using function29 = function_n; + + template using function30 = function_n; } #endif diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 23814464..ac4a5b24 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -1,3 +1,6 @@ +#ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED +#define BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED + // Boost.Function library // Copyright Douglas Gregor 2001-2006 @@ -8,125 +11,64 @@ // For more information, see http://www.boost.org -// Note: this header is a header template and must NOT have multiple-inclusion -// protection. -#include +#include #include +#include +#include +#include +#include +#include +#include #if defined(BOOST_MSVC) # pragma warning( push ) # pragma warning( disable : 4127 ) // "conditional expression is constant" #endif -#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) - -#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) - -#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) - -#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) - -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES -# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) -#else -# define BOOST_FUNCTION_ARG(J,I,D) static_cast(BOOST_PP_CAT(a,I)) -# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY) -#endif - -#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ - typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); - -#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) - -// Comma if nonzero number of arguments -#if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA -#else -# define BOOST_FUNCTION_COMMA , -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - -// Class names used in this version of the code -#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_INVOKER \ - BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_REF_INVOKER \ - BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ - BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_MEMBER_INVOKER \ - BOOST_JOIN(function_mem_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \ - BOOST_JOIN(function_void_mem_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ - BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ - BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_MEMBER_INVOKER \ - BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_INVOKER \ - BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) - -#ifndef BOOST_NO_VOID_RETURNS -# define BOOST_FUNCTION_VOID_RETURN_TYPE void -# define BOOST_FUNCTION_RETURN(X) X -#else -# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable -# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () -#endif - namespace boost { namespace detail { namespace function { template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_FUNCTION_INVOKER + struct function_invoker { - static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static R invoke(function_buffer& function_ptr, + T... a) { FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); - return f(BOOST_FUNCTION_ARGS); + return f(static_cast(a)...); } }; template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER + struct void_function_invoker { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static void + invoke(function_buffer& function_ptr, + T... a) { FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); - BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); + f(static_cast(a)...); } }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER + struct function_obj_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static R invoke(function_buffer& function_obj_ptr, + T... a) { FunctionObj* f; @@ -134,20 +76,20 @@ namespace boost { f = reinterpret_cast(function_obj_ptr.data); else f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); + return (*f)(static_cast(a)...); } }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER + struct void_function_obj_invoker { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static void + invoke(function_buffer& function_obj_ptr, + T... a) { FunctionObj* f; @@ -155,194 +97,190 @@ namespace boost { f = reinterpret_cast(function_obj_ptr.data); else f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + (*f)(static_cast(a)...); } }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_FUNCTION_REF_INVOKER + struct function_ref_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static R invoke(function_buffer& function_obj_ptr, + T... a) { FunctionObj* f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); + return (*f)(static_cast(a)...); } }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER + struct void_function_ref_invoker { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static void + invoke(function_buffer& function_obj_ptr, + T... a) { FunctionObj* f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + (*f)(static_cast(a)...); } }; -#if BOOST_FUNCTION_NUM_ARGS > 0 /* Handle invocation of member pointers. */ template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_MEMBER_INVOKER + struct member_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static R invoke(function_buffer& function_obj_ptr, + T... a) { MemberPtr* f = reinterpret_cast(function_obj_ptr.data); - return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS); + return boost::mem_fn(*f)(static_cast(a)...); } }; template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_VOID_MEMBER_INVOKER + struct void_member_invoker { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static void + invoke(function_buffer& function_obj_ptr, + T... a) { MemberPtr* f = reinterpret_cast(function_obj_ptr.data); - BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS)); + boost::mem_fn(*f)(static_cast(a)...); } }; -#endif template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_GET_FUNCTION_INVOKER + struct get_function_invoker { - typedef typename conditional<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_INVOKER< + typedef typename std::conditional::value, + void_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >, - BOOST_FUNCTION_FUNCTION_INVOKER< + function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... > >::type type; }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER + struct get_function_obj_invoker { - typedef typename conditional<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< + typedef typename std::conditional::value, + void_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >, - BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< + function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... > >::type type; }; template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER + struct get_function_ref_invoker { - typedef typename conditional<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< + typedef typename std::conditional::value, + void_function_ref_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >, - BOOST_FUNCTION_FUNCTION_REF_INVOKER< + function_ref_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... > >::type type; }; -#if BOOST_FUNCTION_NUM_ARGS > 0 /* Retrieve the appropriate invoker for a member pointer. */ template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - struct BOOST_FUNCTION_GET_MEMBER_INVOKER + struct get_member_invoker { - typedef typename conditional<(is_void::value), - BOOST_FUNCTION_VOID_MEMBER_INVOKER< + typedef typename std::conditional::value, + void_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >, - BOOST_FUNCTION_MEMBER_INVOKER< + member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... > >::type type; }; -#endif /* Given the tag returned by get_function_tag, retrieve the actual invoker that will be used for the given function object. - Each specialization contains an "apply" nested class template + Each specialization contains an "apply_" nested class template that accepts the function object, return type, function - argument types, and allocator. The resulting "apply" class + argument types, and allocator. The resulting "apply_" class contains two typedefs, "invoker_type" and "manager_type", which correspond to the invoker and manager types. */ template - struct BOOST_FUNCTION_GET_INVOKER { }; + struct get_invoker { }; /* Retrieve the invoker for a function pointer. */ template<> - struct BOOST_FUNCTION_GET_INVOKER + struct get_invoker { template - struct apply + typename R, typename... T> + struct apply_ { - typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + typedef typename get_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -350,13 +288,13 @@ namespace boost { }; template + typename R, typename... T> struct apply_a { - typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + typedef typename get_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -364,19 +302,18 @@ namespace boost { }; }; -#if BOOST_FUNCTION_NUM_ARGS > 0 /* Retrieve the invoker for a member pointer. */ template<> - struct BOOST_FUNCTION_GET_INVOKER + struct get_invoker { template - struct apply + typename R, typename... T> + struct apply_ { - typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + typedef typename get_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -384,33 +321,32 @@ namespace boost { }; template + typename R, typename... T> struct apply_a { - typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + typedef typename get_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; typedef functor_manager manager_type; }; }; -#endif /* Retrieve the invoker for a function object. */ template<> - struct BOOST_FUNCTION_GET_INVOKER + struct get_invoker { template - struct apply + typename R, typename... T> + struct apply_ { - typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + typedef typename get_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -418,13 +354,13 @@ namespace boost { }; template + typename R, typename... T> struct apply_a { - typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + typedef typename get_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -434,16 +370,16 @@ namespace boost { /* Retrieve the invoker for a reference to a function object. */ template<> - struct BOOST_FUNCTION_GET_INVOKER + struct get_invoker { template - struct apply + typename R, typename... T> + struct apply_ { - typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typedef typename get_function_ref_invoker< typename RefWrapper::type, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -451,13 +387,13 @@ namespace boost { }; template + typename R, typename... T> struct apply_a { - typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typedef typename get_function_ref_invoker< typename RefWrapper::type, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + R, + T... >::type invoker_type; @@ -473,30 +409,26 @@ namespace boost { * members. It therefore cannot have any constructors, * destructors, base classes, etc. */ - template - struct BOOST_FUNCTION_VTABLE + template + struct basic_vtable { -#ifndef BOOST_NO_VOID_RETURNS typedef R result_type; -#else - typedef typename function_return_type::type result_type; -#endif // BOOST_NO_VOID_RETURNS typedef result_type (*invoker_type)(function_buffer& - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); + , + T...); template bool assign_to(F f, function_buffer& functor) const { typedef typename get_function_tag::type tag; - return assign_to(f, functor, tag()); + return assign_to(std::move(f), functor, tag()); } template bool assign_to_a(F f, function_buffer& functor, Allocator a) const { typedef typename get_function_tag::type tag; - return assign_to_a(f, functor, a, tag()); + return assign_to_a(std::move(f), functor, a, tag()); } void clear(function_buffer& functor) const @@ -521,8 +453,6 @@ namespace boost { { this->clear(functor); if (f) { - // should be a reinterpret cast, but some compilers insist - // on giving cv-qualifiers to free functions functor.members.func_ptr = reinterpret_cast(f); return true; } else { @@ -533,11 +463,10 @@ namespace boost { bool assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const { - return assign_to(f,functor,function_ptr_tag()); + return assign_to(std::move(f),functor,function_ptr_tag()); } // Member pointers -#if BOOST_FUNCTION_NUM_ARGS > 0 template bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const { @@ -564,50 +493,42 @@ namespace boost { return false; } } -#endif // BOOST_FUNCTION_NUM_ARGS > 0 // Function objects // Assign to a function object using the small object optimization template void - assign_functor(FunctionObj f, function_buffer& functor, true_type) const + assign_functor(FunctionObj f, function_buffer& functor, std::true_type) const { - new (reinterpret_cast(functor.data)) FunctionObj(f); + new (reinterpret_cast(functor.data)) FunctionObj(std::move(f)); } template void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, true_type) const + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, std::true_type) const { - assign_functor(f,functor,true_type()); + assign_functor(std::move(f),functor,std::true_type()); } // Assign to a function object allocated on the heap. template void - assign_functor(FunctionObj f, function_buffer& functor, false_type) const + assign_functor(FunctionObj f, function_buffer& functor, std::false_type) const { - functor.members.obj_ptr = new FunctionObj(f); + functor.members.obj_ptr = new FunctionObj(std::move(f)); } template void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, false_type) const + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, std::false_type) const { typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif + wrapper_allocator_type wrapper_allocator(a); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, functor_wrapper_type(f,a)); -#else std::allocator_traits::construct(wrapper_allocator, copy, functor_wrapper_type(f,a)); -#endif + functor_wrapper_type* new_f = static_cast(copy); functor.members.obj_ptr = new_f; } @@ -617,8 +538,8 @@ namespace boost { assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { - assign_functor(f, functor, - integral_constant::value)>()); + assign_functor(std::move(f), functor, + std::integral_constant::value)>()); return true; } else { return false; @@ -629,8 +550,8 @@ namespace boost { assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { - assign_functor_a(f, functor, a, - integral_constant::value)>()); + assign_functor_a(std::move(f), functor, a, + std::integral_constant::value)>()); return true; } else { return false; @@ -644,8 +565,8 @@ namespace boost { function_buffer& functor, function_obj_ref_tag) const { functor.members.obj_ref.obj_ptr = (void *)(f.get_pointer()); - functor.members.obj_ref.is_const_qualified = is_const::value; - functor.members.obj_ref.is_volatile_qualified = is_volatile::value; + functor.members.obj_ref.is_const_qualified = std::is_const::value; + functor.members.obj_ref.is_volatile_qualified = std::is_volatile::value; return true; } template @@ -660,26 +581,146 @@ namespace boost { vtable_base base; invoker_type invoker; }; + + template + struct variadic_function_base + {}; + + template + struct variadic_function_base + { + typedef T1 argument_type; + typedef T1 arg1_type; + }; + + template + struct variadic_function_base + { + typedef T1 first_argument_type; + typedef T2 second_argument_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; + }; + + template + struct variadic_function_base + { + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; + typedef T10 arg10_type; + }; + +#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000 + + template struct is_trivially_copyable: std::integral_constant {}; + +#else + + using std::is_trivially_copyable; + +#endif + } // end namespace function } // end namespace detail template< - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename R, + typename... T > - class BOOST_FUNCTION_FUNCTION : public function_base + class function_n : public function_base + , public detail::function::variadic_function_base { public: -#ifndef BOOST_NO_VOID_RETURNS typedef R result_type; -#else - typedef typename boost::detail::function::function_return_type::type - result_type; -#endif // BOOST_NO_VOID_RETURNS private: - typedef boost::detail::function::BOOST_FUNCTION_VTABLE< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> + typedef boost::detail::function::basic_vtable< + R, T...> vtable_type; vtable_type* get_vtable() const { @@ -690,8 +731,6 @@ namespace boost { struct clear_type {}; public: - BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - // add signature for boost::lambda template struct sig @@ -699,93 +738,68 @@ namespace boost { typedef result_type type; }; -#if BOOST_FUNCTION_NUM_ARGS == 1 - typedef T0 argument_type; -#elif BOOST_FUNCTION_NUM_ARGS == 2 - typedef T0 first_argument_type; - typedef T1 second_argument_type; -#endif + BOOST_STATIC_CONSTANT(int, arity = sizeof...(T)); - BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); - BOOST_FUNCTION_ARG_TYPES + typedef function_n self_type; - typedef BOOST_FUNCTION_FUNCTION self_type; - - BOOST_DEFAULTED_FUNCTION(BOOST_FUNCTION_FUNCTION(), : function_base() {}) + BOOST_DEFAULTED_FUNCTION(function_n(), : function_base() {}) // MSVC chokes if the following two constructors are collapsed into // one with a default parameter. template - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_< - !(is_integral::value), + function_n(Functor f + ,typename std::enable_if< + !std::is_integral::value, int>::type = 0 -#endif // BOOST_NO_SFINAE ) : function_base() { - this->assign_to(f); + this->assign_to(std::move(f)); } template - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_< - !(is_integral::value), + function_n(Functor f, Allocator a + ,typename std::enable_if< + !std::is_integral::value, int>::type = 0 -#endif // BOOST_NO_SFINAE ) : function_base() { - this->assign_to_a(f,a); + this->assign_to_a(std::move(f),a); } -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } -#else - BOOST_FUNCTION_FUNCTION(int zero) : function_base() - { - BOOST_ASSERT(zero == 0); - } -#endif + function_n(clear_type*) : function_base() { } - BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() + function_n(const function_n& f) : function_base() { this->assign_to_own(f); } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() + function_n(function_n&& f) : function_base() { this->move_assign(f); } -#endif - ~BOOST_FUNCTION_FUNCTION() { clear(); } + ~function_n() { clear(); } - result_type operator()(BOOST_FUNCTION_PARMS) const + result_type operator()(T... a) const { if (this->empty()) boost::throw_exception(bad_function_call()); return get_vtable()->invoker - (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + (this->functor, static_cast(a)...); } - // The distinction between when to use BOOST_FUNCTION_FUNCTION and + // The distinction between when to use function_n and // when to use self_type is obnoxious. MSVC cannot handle self_type as // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to + // handle function_n as the type of the temporary to // construct. template -#ifndef BOOST_NO_SFINAE - typename boost::enable_if_< - !(is_integral::value), - BOOST_FUNCTION_FUNCTION&>::type -#else - BOOST_FUNCTION_FUNCTION& -#endif - operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) + typename std::enable_if< + !std::is_integral::value, + function_n&>::type + operator=(Functor f) { this->clear(); BOOST_TRY { @@ -798,7 +812,7 @@ namespace boost { return *this; } template - void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) + void assign(Functor f, Allocator a) { this->clear(); BOOST_TRY{ @@ -810,23 +824,14 @@ namespace boost { BOOST_CATCH_END } -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION& operator=(clear_type*) - { - this->clear(); - return *this; - } -#else - BOOST_FUNCTION_FUNCTION& operator=(int zero) + function_n& operator=(clear_type*) { - BOOST_ASSERT(zero == 0); this->clear(); return *this; } -#endif - // Assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) + // Assignment from another function_n + function_n& operator=(const function_n& f) { if (&f == this) return *this; @@ -842,9 +847,8 @@ namespace boost { return *this; } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - // Move assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) + // Move assignment from another function_n + function_n& operator=(function_n&& f) { if (&f == this) return *this; @@ -859,14 +863,13 @@ namespace boost { BOOST_CATCH_END return *this; } -#endif - void swap(BOOST_FUNCTION_FUNCTION& other) + void swap(function_n& other) { if (&other == this) return; - BOOST_FUNCTION_FUNCTION tmp; + function_n tmp; tmp.move_assign(*this); this->move_assign(other); other.move_assign(tmp); @@ -882,27 +885,10 @@ namespace boost { } } -#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) - // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it - operator bool () const { return !this->empty(); } -#else - private: - struct dummy { - void nonnull() {} - }; - - typedef void (dummy::*safe_bool)(); - - public: - operator safe_bool () const - { return (this->empty())? 0 : &dummy::nonnull; } - - bool operator!() const - { return this->empty(); } -#endif + explicit operator bool () const { return !this->empty(); } private: - void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) + void assign_to_own(const function_n& f) { if (!f.empty()) { this->vtable = f.vtable; @@ -935,10 +921,10 @@ namespace boost { using boost::detail::function::vtable_base; typedef typename boost::detail::function::get_function_tag::type tag; - typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef boost::detail::function::get_invoker get_invoker; typedef typename get_invoker:: - template apply + template apply_ handler_type; typedef typename handler_type::invoker_type invoker_type; @@ -951,11 +937,10 @@ namespace boost { static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; - if (stored_vtable.assign_to(f, functor)) { + if (stored_vtable.assign_to(std::move(f), functor)) { std::size_t value = reinterpret_cast(&stored_vtable.base); // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (boost::has_trivial_copy_constructor::value && - boost::has_trivial_destructor::value && + if (boost::detail::function::is_trivially_copyable::value && boost::detail::function::function_allows_small_object_optimization::value) value |= static_cast(0x01); vtable = reinterpret_cast(value); @@ -969,10 +954,10 @@ namespace boost { using boost::detail::function::vtable_base; typedef typename boost::detail::function::get_function_tag::type tag; - typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef boost::detail::function::get_invoker get_invoker; typedef typename get_invoker:: - template apply_a + template apply_a handler_type; typedef typename handler_type::invoker_type invoker_type; @@ -985,11 +970,10 @@ namespace boost { static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; - if (stored_vtable.assign_to_a(f, functor, a)) { + if (stored_vtable.assign_to_a(std::move(f), functor, a)) { std::size_t value = reinterpret_cast(&stored_vtable.base); // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (boost::has_trivial_copy_constructor::value && - boost::has_trivial_destructor::value && + if (boost::detail::function::is_trivially_copyable::value && boost::detail::function::function_allows_small_object_optimization::value) value |= static_cast(0x01); vtable = reinterpret_cast(value); @@ -1000,7 +984,7 @@ namespace boost { // Moves the value from the specified argument to *this. If the argument // has its function object allocated on the heap, move_assign will pass // its buffer to *this, and set the argument's buffer pointer to NULL. - void move_assign(BOOST_FUNCTION_FUNCTION& f) + void move_assign(function_n& f) { if (&f == this) return; @@ -1048,49 +1032,41 @@ namespace boost { } }; - template - inline void swap(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + template + inline void swap(function_n< + R, + T... >& f1, - BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS + function_n< + R, + T... >& f2) { f1.swap(f2); } // Poison comparisons between boost::function objects of the same type. -template - void operator==(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&); -template - void operator!=(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>& ); - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -#if BOOST_FUNCTION_NUM_ARGS == 0 -#define BOOST_FUNCTION_PARTIAL_SPEC R (void) -#else -#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_FUNCTION_TEMPLATE_ARGS) -#endif - -template -class function - : public BOOST_FUNCTION_FUNCTION +template + void operator==(const function_n< + R, + T...>&, + const function_n< + R, + T...>&); +template + void operator!=(const function_n< + R, + T...>&, + const function_n< + R, + T...>& ); + +template +class function + : public function_n { - typedef BOOST_FUNCTION_FUNCTION base_type; + typedef function_n base_type; typedef function self_type; struct clear_type {}; @@ -1101,40 +1077,32 @@ class function template function(Functor f -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_< - !(is_integral::value), + ,typename std::enable_if< + !std::is_integral::value, int>::type = 0 -#endif ) : - base_type(f) + base_type(std::move(f)) { } template function(Functor f, Allocator a -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_< - !(is_integral::value), + ,typename std::enable_if< + !std::is_integral::value, int>::type = 0 -#endif ) : - base_type(f,a) + base_type(std::move(f),a) { } -#ifndef BOOST_NO_SFINAE function(clear_type*) : base_type() {} -#endif function(const self_type& f) : base_type(static_cast(f)){} function(const base_type& f) : base_type(static_cast(f)){} -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES // Move constructors function(self_type&& f): base_type(static_cast(f)){} function(base_type&& f): base_type(static_cast(f)){} -#endif self_type& operator=(const self_type& f) { @@ -1142,35 +1110,27 @@ class function return *this; } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES self_type& operator=(self_type&& f) { self_type(static_cast(f)).swap(*this); return *this; } -#endif template -#ifndef BOOST_NO_SFINAE - typename boost::enable_if_< - !(is_integral::value), + typename std::enable_if< + !std::is_integral::value, self_type&>::type -#else - self_type& -#endif operator=(Functor f) { self_type(f).swap(*this); return *this; } -#ifndef BOOST_NO_SFINAE self_type& operator=(clear_type*) { this->clear(); return *this; } -#endif self_type& operator=(const base_type& f) { @@ -1178,50 +1138,42 @@ class function return *this; } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES self_type& operator=(base_type&& f) { self_type(static_cast(f)).swap(*this); return *this; } -#endif }; -#undef BOOST_FUNCTION_PARTIAL_SPEC -#endif // have partial specialization - } // end namespace boost -// Cleanup after ourselves... -#undef BOOST_FUNCTION_VTABLE -#undef BOOST_FUNCTION_COMMA -#undef BOOST_FUNCTION_FUNCTION -#undef BOOST_FUNCTION_FUNCTION_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER -#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_MEMBER_INVOKER -#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_INVOKER -#undef BOOST_FUNCTION_TEMPLATE_PARMS -#undef BOOST_FUNCTION_TEMPLATE_ARGS -#undef BOOST_FUNCTION_PARMS -#undef BOOST_FUNCTION_PARM -#ifdef BOOST_FUNCTION_ARG -# undef BOOST_FUNCTION_ARG -#endif -#undef BOOST_FUNCTION_ARGS -#undef BOOST_FUNCTION_ARG_TYPE -#undef BOOST_FUNCTION_ARG_TYPES -#undef BOOST_FUNCTION_VOID_RETURN_TYPE -#undef BOOST_FUNCTION_RETURN - #if defined(BOOST_MSVC) # pragma warning( pop ) #endif + +// Resolve C++20 issue with fn == bind(...) +// https://github.com/boostorg/function/issues/45 + +namespace boost +{ + +namespace _bi +{ + +template class bind_t; + +} // namespace _bi + +template bool operator==( function const& f, _bi::bind_t const& b ) +{ + return f.contains( b ); +} + +template bool operator!=( function const& f, _bi::bind_t const& b ) +{ + return !f.contains( b ); +} + +} // namespace boost + +#endif // #ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED diff --git a/include/boost/geometry/algorithms/append.hpp b/include/boost/geometry/algorithms/append.hpp index 4bb25fcb..cd61be01 100644 --- a/include/boost/geometry/algorithms/append.hpp +++ b/include/boost/geometry/algorithms/append.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2023. // Modifications copyright (c) 2014-2023, Oracle and/or its affiliates. @@ -60,7 +61,7 @@ struct to_range_point static inline void apply(Geometry& geometry, Point const& point, signed_size_type = -1, signed_size_type = 0) { - typename geometry::point_type::type copy; + geometry::point_type_t copy; geometry::detail::conversion::convert_point_to_point(point, copy); traits::push_back::apply(geometry, copy); } @@ -90,7 +91,7 @@ struct to_polygon_point static inline void apply(Polygon& polygon, Point const& point, signed_size_type ring_index, signed_size_type = 0) { - using ring_type = typename ring_type::type; + using ring_type = ring_type_t; if (ring_index == -1) { @@ -112,18 +113,16 @@ struct to_polygon_range static inline void apply(Polygon& polygon, Range const& range, signed_size_type ring_index, signed_size_type = 0) { - using ring_type = typename ring_type::type; - using exterior_ring_type = typename ring_return_type::type; - using interior_ring_range_type = typename interior_return_type::type; - + using ring_type = ring_type_t; + if (ring_index == -1) { - exterior_ring_type ext_ring = exterior_ring(polygon); + auto&& ext_ring = exterior_ring(polygon); to_range_range::apply(ext_ring, range); } else if (ring_index < signed_size_type(num_interior_rings(polygon))) { - interior_ring_range_type int_rings = interior_rings(polygon); + auto&& int_rings = interior_rings(polygon); to_range_range::apply(range::at(int_rings, ring_index), range); } } @@ -159,8 +158,8 @@ template < typename Geometry, typename RangeOrPoint, - typename Tag = typename geometry::tag::type, - typename OtherTag = typename geometry::tag::type + typename Tag = geometry::tag_t, + typename OtherTag = geometry::tag_t > struct append : detail::append::append_no_action diff --git a/include/boost/geometry/algorithms/area.hpp b/include/boost/geometry/algorithms/area.hpp index 9b5af61e..50f48d72 100644 --- a/include/boost/geometry/algorithms/area.hpp +++ b/include/boost/geometry/algorithms/area.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2017-2022 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2017-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -131,13 +131,12 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct area : detail::calculate_null { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return calculate_null::apply < @@ -162,8 +161,7 @@ template struct area : detail::calculate_polygon_sum { template - static inline typename area_result::type - apply(Polygon const& polygon, Strategy const& strategy) + static inline auto apply(Polygon const& polygon, Strategy const& strategy) { return calculate_polygon_sum::apply < @@ -178,8 +176,7 @@ template struct area : detail::multi_sum { template - static inline typename area_result::type - apply(MultiGeometry const& multi, Strategy const& strategy) + static inline auto apply(MultiGeometry const& multi, Strategy const& strategy) { return multi_sum::apply < @@ -205,8 +202,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return dispatch::area::apply(geometry, strategy); } @@ -230,8 +226,7 @@ template <> struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, default_strategy) + static inline auto apply(Geometry const& geometry, default_strategy) { typedef typename strategies::area::services::default_strategy < @@ -249,12 +244,11 @@ struct area namespace resolve_dynamic { -template ::type> +template > struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return resolve_strategy::area::apply(geometry, strategy); } @@ -264,8 +258,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { typename area_result::type result = 0; traits::visit::apply([&](auto const& g) @@ -280,8 +273,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { typename area_result::type result = 0; detail::visit_breadth_first([&](auto const& g) @@ -318,8 +310,7 @@ and Geographic as well. \qbk{[area] [area_output]} */ template -inline typename area_result::type -area(Geometry const& geometry) +inline auto area(Geometry const& geometry) { concepts::check(); @@ -354,8 +345,7 @@ area(Geometry const& geometry) } */ template -inline typename area_result::type -area(Geometry const& geometry, Strategy const& strategy) +inline auto area(Geometry const& geometry, Strategy const& strategy) { concepts::check(); diff --git a/include/boost/geometry/algorithms/assign.hpp b/include/boost/geometry/algorithms/assign.hpp index dabf1b4a..27e168f8 100644 --- a/include/boost/geometry/algorithms/assign.hpp +++ b/include/boost/geometry/algorithms/assign.hpp @@ -4,6 +4,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2014 Samuel Debionne, Grenoble, France. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. @@ -91,7 +92,7 @@ inline void assign_inverse(Geometry& geometry) dispatch::assign_inverse < - typename tag::type, + tag_t, Geometry >::apply(geometry); } @@ -111,7 +112,7 @@ inline void assign_zero(Geometry& geometry) dispatch::assign_zero < - typename tag::type, + tag_t, Geometry >::apply(geometry); } @@ -141,9 +142,9 @@ inline void assign_values(Geometry& geometry, Type const& c1, Type const& c2) dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2); } @@ -174,9 +175,9 @@ inline void assign_values(Geometry& geometry, dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2, c3); } @@ -201,9 +202,9 @@ inline void assign_values(Geometry& geometry, dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2, c3, c4); } @@ -216,7 +217,7 @@ template struct assign { static inline void - apply(Geometry1& geometry1, const Geometry2& geometry2) + apply(Geometry1& geometry1, Geometry2 const& geometry2) { concepts::check(); concepts::check(); diff --git a/include/boost/geometry/algorithms/centroid.hpp b/include/boost/geometry/algorithms/centroid.hpp index 9559f06b..1817d8ad 100644 --- a/include/boost/geometry/algorithms/centroid.hpp +++ b/include/boost/geometry/algorithms/centroid.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2023. // Modifications copyright (c) 2014-2023 Oracle and/or its affiliates. @@ -82,16 +82,9 @@ class centroid_exception : public geometry::exception { public: - /*! - \brief The default constructor - */ inline centroid_exception() {} - /*! - \brief Returns the explanatory string. - \return Pointer to a null-terminated string with explanatory information. - */ - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry Centroid calculation exception"; } @@ -191,7 +184,7 @@ struct centroid_range_state typename PointTransformer::result_type pt = transformer.apply(*it); - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; strategy.apply(static_cast(previous_pt), static_cast(pt), state); @@ -215,7 +208,7 @@ struct centroid_range typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -272,7 +265,7 @@ struct centroid_polygon typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -340,7 +333,7 @@ struct centroid_multi typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -400,7 +393,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct centroid: not_implemented {}; @@ -518,10 +511,10 @@ struct centroid template static inline void apply(Geometry const& geometry, Point& out, default_strategy) { - typedef typename strategies::centroid::services::default_strategy + using strategies_type = typename strategies::centroid::services::default_strategy < Geometry - >::type strategies_type; + >::type; dispatch::centroid::apply(geometry, out, strategies_type()); } @@ -532,7 +525,7 @@ struct centroid namespace resolve_dynamic { -template ::type> +template > struct centroid { template diff --git a/include/boost/geometry/algorithms/clear.hpp b/include/boost/geometry/algorithms/clear.hpp index df3acc8b..efaa93d1 100644 --- a/include/boost/geometry/algorithms/clear.hpp +++ b/include/boost/geometry/algorithms/clear.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023, Oracle and/or its affiliates. @@ -56,17 +57,17 @@ struct polygon_clear { traits::clear < - typename std::remove_reference + std::remove_reference_t < typename traits::interior_mutable_type::type - >::type + > >::apply(interior_rings(polygon)); traits::clear < - typename std::remove_reference + std::remove_reference_t < typename traits::ring_mutable_type::type - >::type + > >::apply(exterior_ring(polygon)); } }; @@ -90,7 +91,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast::type, multi_tag>::type + typename Tag = tag_cast_t, multi_tag> > struct clear: not_implemented {}; diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index 2d07ce2b..26335ec3 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023, Oracle and/or its affiliates. @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -41,10 +40,12 @@ #include #include +#include #include #include +#include #include #include @@ -77,10 +78,8 @@ struct point_to_box { static inline void apply(Point const& point, Box& box) { - typedef typename coordinate_type::type coordinate_type; - set(box, - boost::numeric_cast(get(point))); + util::numeric_cast>(get(point))); point_to_box < Point, Box, @@ -171,8 +170,7 @@ struct range_to_range // point for open output. view_type const view(source); - typedef typename boost::range_size::type size_type; - size_type n = boost::size(view); + auto n = boost::size(view); if (geometry::closure::value == geometry::open) { n--; @@ -181,7 +179,7 @@ struct range_to_range // If size == 0 && geometry::open <=> n = numeric_limits::max() // but ok, sice below it == end() - size_type i = 0; + decltype(n) i = 0; for (auto it = boost::begin(view); it != boost::end(view) && i < n; ++it, ++i) @@ -198,13 +196,12 @@ struct range_to_range template struct polygon_to_polygon { - typedef range_to_range + using per_ring = range_to_range < - typename geometry::ring_type::type, - typename geometry::ring_type::type, - geometry::point_order::value - != geometry::point_order::value - > per_ring; + geometry::ring_type_t, + geometry::ring_type_t, + geometry::point_order::value != geometry::point_order::value + >; static inline void apply(Polygon1 const& source, Polygon2& destination) { @@ -216,10 +213,10 @@ struct polygon_to_polygon // Container should be resizeable traits::resize < - typename std::remove_reference - < - typename traits::interior_mutable_type::type - >::type + std::remove_reference_t + < + typename traits::interior_mutable_type::type + > >::apply(interior_rings(destination), num_interior_rings(source)); auto const& rings_source = interior_rings(source); @@ -280,9 +277,9 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag_cast::type, multi_tag>::type, - typename Tag2 = typename tag_cast::type, multi_tag>::type, - std::size_t DimensionCount = dimension::type::value, + typename Tag1 = tag_cast_t, multi_tag>, + typename Tag2 = tag_cast_t, multi_tag>, + std::size_t DimensionCount = dimension::value, bool UseAssignment = std::is_same::value && !std::is_array::value > @@ -353,8 +350,7 @@ struct convert < Ring1, Ring2, - geometry::point_order::value - != geometry::point_order::value + geometry::point_order::value != geometry::point_order::value > {}; @@ -461,14 +457,8 @@ struct convert < typename boost::range_value::type, typename boost::range_value::type, - typename single_tag_of - < - typename tag::type - >::type, - typename single_tag_of - < - typename tag::type - >::type, + single_tag_of_t>, + single_tag_of_t>, DimensionCount > > @@ -485,11 +475,8 @@ struct convert < Single, typename boost::range_value::type, - typename tag::type, - typename single_tag_of - < - typename tag::type - >::type, + tag_t, + single_tag_of_t>, DimensionCount, false > diff --git a/include/boost/geometry/algorithms/correct.hpp b/include/boost/geometry/algorithms/correct.hpp index 20a94de8..92b9d9c2 100644 --- a/include/boost/geometry/algorithms/correct.hpp +++ b/include/boost/geometry/algorithms/correct.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -75,8 +75,6 @@ struct correct_box template static inline void apply(Box& box, Strategy const& ) { - using coordinate_type = typename geometry::coordinate_type::type; - // Currently only for Cartesian coordinates // (or spherical without crossing dateline) // Future version: adapt using strategies @@ -85,8 +83,8 @@ struct correct_box if (get(box) > get(box)) { // Swap the coordinates - coordinate_type max_value = get(box); - coordinate_type min_value = get(box); + auto max_value = get(box); + auto min_value = get(box); set(box, min_value); set(box, max_value); } @@ -144,7 +142,7 @@ struct correct_polygon namespace dispatch { -template ::type> +template > struct correct: not_implemented {}; @@ -252,7 +250,7 @@ struct correct namespace resolve_dynamic { -template ::type> +template > struct correct { template diff --git a/include/boost/geometry/algorithms/correct_closure.hpp b/include/boost/geometry/algorithms/correct_closure.hpp index 38d982c9..3ea35c4d 100644 --- a/include/boost/geometry/algorithms/correct_closure.hpp +++ b/include/boost/geometry/algorithms/correct_closure.hpp @@ -1,6 +1,7 @@ // Boost.Geometry // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. @@ -26,6 +27,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -101,7 +103,7 @@ struct close_or_open_polygon namespace dispatch { -template ::type> +template > struct correct_closure: not_implemented {}; @@ -165,7 +167,7 @@ struct correct_closure namespace resolve_variant { -template ::type> +template > struct correct_closure { static inline void apply(Geometry& geometry) diff --git a/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp b/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp index 560dc67f..9ae46768 100644 --- a/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp +++ b/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp @@ -21,12 +21,11 @@ #include -#include - #include #include #include #include +#include namespace boost { namespace geometry @@ -60,7 +59,7 @@ inline void assign_point_to_index(Point const& point, Geometry& geometry) detail::for_each_dimension([&](auto dimension) { geometry::set(geometry, - boost::numeric_cast + util::numeric_cast < typename coordinate_type::type >(geometry::get(point))); @@ -92,7 +91,7 @@ inline void assign_point_from_index(Geometry const& geometry, Point& point) detail::for_each_dimension([&](auto dimension) { geometry::set(point, - boost::numeric_cast + util::numeric_cast < typename coordinate_type::type >(geometry::get(geometry))); diff --git a/include/boost/geometry/algorithms/detail/assign_values.hpp b/include/boost/geometry/algorithms/detail/assign_values.hpp index f20a2041..fe72bc56 100644 --- a/include/boost/geometry/algorithms/detail/assign_values.hpp +++ b/include/boost/geometry/algorithms/detail/assign_values.hpp @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include @@ -39,7 +37,8 @@ #include #include -#include +#include +#include namespace boost { namespace geometry @@ -74,8 +73,8 @@ struct assign_inverse_box_or_segment { typedef typename coordinate_type::type coordinate_type; - coordinate_type const highest = geometry::bounds::highest(); - coordinate_type const lowest = geometry::bounds::lowest(); + coordinate_type const highest = util::bounds::highest(); + coordinate_type const lowest = util::bounds::lowest(); detail::for_each_dimension([&](auto dimension) { set<0, dimension>(geometry, highest); @@ -117,8 +116,8 @@ inline void assign_box_2d_corner(Box const& box, Point& point) // Copy coordinates typedef typename coordinate_type::type coordinate_type; - geometry::set<0>(point, boost::numeric_cast(get(box))); - geometry::set<1>(point, boost::numeric_cast(get(box))); + geometry::set<0>(point, util::numeric_cast(get(box))); + geometry::set<1>(point, util::numeric_cast(get(box))); } @@ -136,10 +135,10 @@ struct assign_2d_box_or_segment static inline void apply(Geometry& geometry, Type const& x1, Type const& y1, Type const& x2, Type const& y2) { - geometry::set<0, 0>(geometry, boost::numeric_cast(x1)); - geometry::set<0, 1>(geometry, boost::numeric_cast(y1)); - geometry::set<1, 0>(geometry, boost::numeric_cast(x2)); - geometry::set<1, 1>(geometry, boost::numeric_cast(y2)); + geometry::set<0, 0>(geometry, util::numeric_cast(x1)); + geometry::set<0, 1>(geometry, util::numeric_cast(y1)); + geometry::set<1, 0>(geometry, util::numeric_cast(x2)); + geometry::set<1, 1>(geometry, util::numeric_cast(y2)); } }; @@ -167,8 +166,8 @@ struct assign template static inline void apply(Point& point, T const& c1, T const& c2) { - set<0>(point, boost::numeric_cast(c1)); - set<1>(point, boost::numeric_cast(c2)); + set<0>(point, util::numeric_cast(c1)); + set<1>(point, util::numeric_cast(c2)); } }; @@ -180,9 +179,9 @@ struct assign template static inline void apply(Point& point, T const& c1, T const& c2, T const& c3) { - set<0>(point, boost::numeric_cast(c1)); - set<1>(point, boost::numeric_cast(c2)); - set<2>(point, boost::numeric_cast(c3)); + set<0>(point, util::numeric_cast(c1)); + set<1>(point, util::numeric_cast(c2)); + set<2>(point, util::numeric_cast(c3)); } }; diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp index 5e8635c3..1e6b798c 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2022. -// Modifications copyright (c) 2017-2022 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -18,7 +19,6 @@ #include #include -#include #include #include #include @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -85,8 +86,8 @@ inline void simplify_input(RangeIn const& range, template struct buffer_range { - typedef typename point_type::type output_point_type; - typedef typename coordinate_type::type coordinate_type; + using output_point_type = point_type_t; + using coordinate_type = coordinate_type_t; template < @@ -96,7 +97,6 @@ struct buffer_range typename SegmentStrategy, typename JoinStrategy, typename EndStrategy, - typename RobustPolicy, typename Strategies > static inline @@ -113,7 +113,6 @@ struct buffer_range SegmentStrategy const& segment_strategy, JoinStrategy const& join_strategy, EndStrategy const& end_strategy, - RobustPolicy const& , Strategies const& strategies) { geometry::strategy::buffer::join_selector const join @@ -179,8 +178,7 @@ struct buffer_range output_point_type const& p1, output_point_type const& p2) { - typedef typename cs_tag::type cs_tag; - return direction_code(p0, p1, p2) == 1; + return direction_code>(p0, p1, p2) == 1; } template @@ -205,7 +203,6 @@ struct buffer_range typename SegmentStrategy, typename JoinStrategy, typename EndStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code iterate(Collection& collection, @@ -215,7 +212,6 @@ struct buffer_range SegmentStrategy const& segment_strategy, JoinStrategy const& join_strategy, EndStrategy const& end_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies, bool linear, output_point_type& first_p1, @@ -292,7 +288,7 @@ struct buffer_range *it, generated_side.front(), generated_side.back(), side, distance_strategy, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies); + strategies); } collection.add_side_piece(*prev, *it, generated_side, first, distance_strategy.empty(side)); @@ -341,7 +337,6 @@ struct buffer_multi typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline void apply(Multi const& multi, @@ -351,7 +346,6 @@ struct buffer_multi JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { for (auto it = boost::begin(multi); it != boost::end(multi); ++it) @@ -359,7 +353,7 @@ struct buffer_multi Policy::apply(*it, collection, distance_strategy, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); } } }; @@ -426,7 +420,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline void apply(Point const& point, Collection& collection, @@ -435,12 +428,11 @@ struct buffer_inserter JoinStrategy const& , EndStrategy const& , PointStrategy const& point_strategy, - RobustPolicy const& , Strategies const& ) { detail::buffer::buffer_point < - typename point_type::type + point_type_t >(point, collection, distance_strategy, point_strategy); } }; @@ -454,7 +446,7 @@ template > struct buffer_inserter_ring { - using output_point_type = typename point_type::type; + using output_point_type = point_type_t; template < @@ -464,7 +456,6 @@ struct buffer_inserter_ring typename SegmentStrategy, typename JoinStrategy, typename EndStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code iterate(Collection& collection, @@ -474,7 +465,6 @@ struct buffer_inserter_ring SegmentStrategy const& segment_strategy, JoinStrategy const& join_strategy, EndStrategy const& end_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { output_point_type first_p1, first_p2, last_p1, last_p2; @@ -485,7 +475,7 @@ struct buffer_inserter_ring = buffer_range::iterate(collection, begin, end, side, distance_strategy, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies, + strategies, false, first_p1, first_p2, last_p1, last_p2); // Generate closing join @@ -497,7 +487,7 @@ struct buffer_inserter_ring *(begin + 1), first_p1, first_p2, side, distance_strategy, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies); + strategies); } // Buffer is closed automatically by last closing corner @@ -512,7 +502,6 @@ struct buffer_inserter_ring typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code apply(RingInput const& ring, @@ -522,7 +511,6 @@ struct buffer_inserter_ring JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { // Use helper geometry to support non-mutable input Rings @@ -552,14 +540,14 @@ struct buffer_inserter_ring code = iterate(collection, boost::rbegin(view), boost::rend(view), geometry::strategy::buffer::buffer_side_right, distance, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies); + strategies); } else { code = iterate(collection, boost::begin(view), boost::end(view), geometry::strategy::buffer::buffer_side_left, distance, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies); + strategies); } } @@ -592,7 +580,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code apply(RingInput const& ring, @@ -602,7 +589,6 @@ struct buffer_inserter JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { collection.start_new_ring(distance.negative()); @@ -610,7 +596,7 @@ struct buffer_inserter = buffer_inserter_ring::apply(ring, collection, distance, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); collection.finish_ring(code, ring, false, false); return code; } @@ -623,8 +609,8 @@ template > struct buffer_inserter { - using output_ring_type = typename ring_type::type; - using output_point_type = typename point_type::type; + using output_ring_type = ring_type_t; + using output_point_type = point_type_t; template < @@ -634,7 +620,6 @@ struct buffer_inserter typename SegmentStrategy, typename JoinStrategy, typename EndStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code iterate(Collection& collection, @@ -644,7 +629,6 @@ struct buffer_inserter SegmentStrategy const& segment_strategy, JoinStrategy const& join_strategy, EndStrategy const& end_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies, output_point_type& first_p1) { @@ -681,7 +665,7 @@ struct buffer_inserter = detail::buffer::buffer_range::iterate(collection, begin, end, side, distance_strategy, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies, + strategies, true, first_p1, first_p2, last_p1, last_p2); if (result == geometry::strategy::buffer::result_normal) @@ -702,7 +686,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline geometry::strategy::buffer::result_code apply(Linestring const& linestring, @@ -712,7 +695,6 @@ struct buffer_inserter JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { // Use helper geometry to support non-mutable input Linestrings @@ -729,7 +711,7 @@ struct buffer_inserter boost::begin(simplified), boost::end(simplified), geometry::strategy::buffer::buffer_side_left, distance, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies, + strategies, first_p1); if (code == geometry::strategy::buffer::result_normal) @@ -738,7 +720,7 @@ struct buffer_inserter boost::rbegin(simplified), boost::rend(simplified), geometry::strategy::buffer::buffer_side_right, distance, segment_strategy, join_strategy, end_strategy, - robust_policy, strategies, + strategies, first_p1); } collection.finish_ring(code); @@ -780,7 +762,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline @@ -791,7 +772,6 @@ struct buffer_inserter JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies, bool is_interior) { @@ -807,7 +787,7 @@ struct buffer_inserter geometry::strategy::buffer::result_code const code = policy::apply(*it, collection, distance, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); collection.finish_ring(code, *it, is_interior, false); } @@ -822,7 +802,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline @@ -833,13 +812,12 @@ struct buffer_inserter JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { iterate(boost::begin(interior_rings), boost::end(interior_rings), collection, distance, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies, true); + strategies, true); } public: @@ -851,7 +829,6 @@ struct buffer_inserter typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename RobustPolicy, typename Strategies > static inline void apply(PolygonInput const& polygon, @@ -861,7 +838,6 @@ struct buffer_inserter JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - RobustPolicy const& robust_policy, Strategies const& strategies) { { @@ -871,7 +847,7 @@ struct buffer_inserter = policy::apply(exterior_ring(polygon), collection, distance, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); collection.finish_ring(code, exterior_ring(polygon), false, geometry::num_interior_rings(polygon) > 0u); @@ -880,7 +856,7 @@ struct buffer_inserter apply_interior_rings(interior_rings(polygon), collection, distance, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); } }; @@ -926,7 +902,6 @@ template typename EndStrategy, typename PointStrategy, typename Strategies, - typename RobustPolicy, typename VisitPiecesPolicy > inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out, @@ -936,7 +911,6 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator EndStrategy const& end_strategy, PointStrategy const& point_strategy, Strategies const& strategies, - RobustPolicy const& robust_policy, VisitPiecesPolicy& visit_pieces_policy ) { @@ -946,35 +920,31 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator < typename geometry::ring_type::type, Strategies, - DistanceStrategy, - RobustPolicy + DistanceStrategy >; - collection_type collection(strategies, distance_strategy, robust_policy); + collection_type collection(strategies, distance_strategy); collection_type const& const_collection = collection; static constexpr bool areal = util::is_areal::value; dispatch::buffer_inserter < - typename tag_cast - < - typename tag::type, - multi_tag - >::type, + tag_cast_t, multi_tag>, GeometryInput, GeometryOutput >::apply(geometry_input, collection, distance_strategy, segment_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, strategies); + strategies); collection.get_turns(); if BOOST_GEOMETRY_CONSTEXPR (areal) { collection.check_turn_in_original(); } - - collection.verify_turns(); + collection.handle_colocations(); + collection.check_turn_in_pieces(); + collection.make_traversable_consistent_per_cluster(); // Visit the piece collection. This does nothing (by default), but // optionally a debugging tool can be attached (e.g. console or svg), @@ -1035,8 +1005,7 @@ template typename JoinStrategy, typename EndStrategy, typename PointStrategy, - typename Strategies, - typename RobustPolicy + typename Strategies > inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out, DistanceStrategy const& distance_strategy, @@ -1044,14 +1013,13 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, - Strategies const& strategies, - RobustPolicy const& robust_policy) + Strategies const& strategies) { detail::buffer::visit_pieces_default_policy visitor; buffer_inserter(geometry_input, out, distance_strategy, segment_strategy, join_strategy, end_strategy, point_strategy, - strategies, robust_policy, visitor); + strategies, visitor); } #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp index e75532c3..e843b27d 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -47,7 +48,6 @@ public : typename Turns, typename Geometry, typename Strategy, - typename RobustPolicy, typename Visitor > static inline void apply(std::size_t size_at_start, @@ -59,7 +59,6 @@ public : Geometry const& , Geometry const& , Strategy const& , - RobustPolicy const& , state_type& state, Visitor& /*visitor*/ ) @@ -131,11 +130,11 @@ struct buffer_turn_operation : public detail::overlay::traversal_turn_operation { signed_size_type piece_index; - signed_size_type index_in_robust_ring; + signed_size_type index_in_ring; inline buffer_turn_operation() : piece_index(-1) - , index_in_robust_ring(-1) + , index_in_ring(-1) {} }; @@ -281,16 +280,6 @@ struct turn_overlaps_box Strategy const& m_strategy; }; -struct enriched_map_buffer_include_policy -{ - template - static inline bool include(Operation const& op) - { - return op != detail::overlay::operation_intersection - && op != detail::overlay::operation_blocked; - } -}; - }} // namespace detail::buffer #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index 8aa94934..3f20813b 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2016-2022. -// Modifications copyright (c) 2016-2022 Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2024. +// Modifications copyright (c) 2016-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -59,7 +60,7 @@ #include #include -#include +#include #include @@ -100,7 +101,7 @@ namespace detail { namespace buffer * form together the offsetted ring (marked with o below) * The 8 pieces are part of the piece collection and use for inside-checks * The inner parts form (using 1 or 2 points per piece, often co-located) - * form together the robust_polygons (marked with r below) + * form together the polygons (marked with r below) * The remaining piece-segments are helper-segments (marked with h) * * ooooooooooooooooo @@ -119,8 +120,7 @@ template < typename Ring, typename Strategy, - typename DistanceStrategy, - typename RobustPolicy + typename DistanceStrategy > struct buffered_piece_collection { @@ -135,13 +135,13 @@ struct buffered_piece_collection typedef buffer_turn_info < point_type, - typename segment_ratio_type::type + typename segment_ratio_type::type > buffer_turn_info_type; typedef buffer_turn_operation < point_type, - typename segment_ratio_type::type + typename segment_ratio_type::type > buffer_turn_operation_type; typedef std::vector turn_vector_type; @@ -158,7 +158,7 @@ struct buffered_piece_collection // The next two members (1, 2) form together a complete clockwise ring // for each piece (with one dupped point) - // The complete clockwise ring is also included as a robust ring (3) + // The complete clockwise ring is also included as a ring (3) // 1: half, part of offsetted_rings @@ -228,7 +228,7 @@ struct buffered_piece_collection geometry::sectionalize < false, dimensions - >(m_ring, detail::no_rescale_policy(), m_sections, strategy); + >(m_ring, m_sections, strategy); } clockwise_ring_type m_ring; @@ -249,7 +249,8 @@ struct buffered_piece_collection // Offsetted rings, and representations of original ring(s) // both indexed by multi_index - buffered_ring_collection > offsetted_rings; + using ring_collection_t = buffered_ring_collection>; + ring_collection_t offsetted_rings; std::vector original_rings; std::vector m_linear_end_points; @@ -257,14 +258,8 @@ struct buffered_piece_collection segment_identifier current_segment_id; // Monotonic sections (used for offsetted rings around points) - // are still using a robust type, to be comparable with turn calculations, - // which is using rescaling. - typedef geometry::model::box - < - typename geometry::robust_point_type::type - > robust_box_type; - typedef geometry::sections robust_sections_type; - robust_sections_type monotonic_sections; + typedef geometry::sections sections_type; + sections_type monotonic_sections; // Define the clusters, mapping cluster_id -> turns typedef std::map @@ -277,17 +272,14 @@ struct buffered_piece_collection Strategy m_strategy; DistanceStrategy m_distance_strategy; - RobustPolicy const& m_robust_policy; buffered_piece_collection(Strategy const& strategy, - DistanceStrategy const& distance_strategy, - RobustPolicy const& robust_policy) + DistanceStrategy const& distance_strategy) : m_first_piece_index(-1) , m_deflate(false) , m_has_deflated(false) , m_strategy(strategy) , m_distance_strategy(distance_strategy) - , m_robust_policy(robust_policy) {} inline void check_linear_endpoints(buffer_turn_info_type& turn) const @@ -305,29 +297,6 @@ struct buffered_piece_collection } } - inline void verify_turns() - { - typedef detail::overlay::indexed_turn_operation - < - buffer_turn_operation_type - > indexed_turn_operation; - typedef std::map - < - ring_identifier, - std::vector - > mapped_vector_type; - mapped_vector_type mapped_vector; - - detail::overlay::create_map(m_turns, mapped_vector, - enriched_map_buffer_include_policy()); - - // Sort turns over offsetted ring(s) - for (auto& pair : mapped_vector) - { - std::sort(pair.second.begin(), pair.second.end(), buffer_less()); - } - } - inline void deflate_check_turns() { if (! m_has_deflated) @@ -398,16 +367,18 @@ struct buffered_piece_collection inline void update_turn_administration() { - for_each_with_index(m_turns, [this](std::size_t index, auto& turn) + for (auto const& enumerated : util::enumerate(m_turns)) { - turn.turn_index = index; + // enumerated is const, but its value is a non-const reference + auto& turn = enumerated.value; + turn.turn_index = enumerated.index; // Verify if a turn is a linear endpoint if (! turn.is_linear_end_point) { this->check_linear_endpoints(turn); } - }); + } } // Calculate properties of piece borders which are not influenced @@ -454,40 +425,40 @@ struct buffered_piece_collection piece_vector_type, buffered_ring_collection >, turn_vector_type, - Strategy, - RobustPolicy + Strategy > visitor(m_pieces, offsetted_rings, m_turns, - m_strategy, m_robust_policy); + m_strategy); detail::sectionalize::enlarge_sections(monotonic_sections, m_strategy); geometry::partition < - robust_box_type + box_type >::apply(monotonic_sections, visitor, detail::section::get_section_box(m_strategy), detail::section::overlaps_section_box(m_strategy)); } update_turn_administration(); + } - { - // Check if turns are inside pieces - turn_in_piece_visitor - < - typename geometry::cs_tag::type, - turn_vector_type, piece_vector_type, DistanceStrategy, Strategy - > visitor(m_turns, m_pieces, m_distance_strategy, m_strategy); + inline void check_turn_in_pieces() + { + // Check if turns are inside pieces + turn_in_piece_visitor + < + typename geometry::cs_tag::type, + turn_vector_type, piece_vector_type, DistanceStrategy, Strategy + > visitor(m_turns, m_pieces, m_distance_strategy, m_strategy); - geometry::partition - < - box_type - >::apply(m_turns, m_pieces, visitor, - turn_get_box(m_strategy), - turn_overlaps_box(m_strategy), - piece_get_box(m_strategy), - piece_overlaps_box(m_strategy)); - } + geometry::partition + < + box_type + >::apply(m_turns, m_pieces, visitor, + turn_get_box(m_strategy), + turn_overlaps_box(m_strategy), + piece_get_box(m_strategy), + piece_overlaps_box(m_strategy)); } inline void start_new_ring(bool deflate) @@ -612,8 +583,7 @@ struct buffered_piece_collection if (! boost::empty(input_ring)) { // Assign the ring to the original_ring collection - // For rescaling, it is recalculated. Without rescaling, it - // is just assigning (note that this Ring type is the + // (note that this Ring type is the // GeometryOut type, which might differ from the input ring type) clockwise_ring_type clockwise_ring; @@ -698,7 +668,7 @@ struct buffered_piece_collection BOOST_GEOMETRY_ASSERT(pc.offsetted_count >= 0); } - inline void add_piece_point(piece& pc, const point_type& point, bool add_to_original) + inline void add_piece_point(piece& pc, point_type const& point, bool add_to_original) { if (add_to_original && pc.type != strategy::buffer::buffered_concave) { @@ -725,7 +695,6 @@ struct buffered_piece_collection sectionalizer::apply(monotonic_sections, boost::begin(ring) + pc.first_seg_id.segment_index, boost::begin(ring) + pc.beyond_last_segment_index, - m_robust_policy, m_strategy, ring_id, 10); } @@ -898,11 +867,65 @@ struct buffered_piece_collection //------------------------------------------------------------------------- + inline void handle_colocations() + { + if (! detail::overlay::handle_colocations + < + false, false, overlay_buffer, + ring_collection_t, ring_collection_t + >(m_turns, m_clusters)) + { + return; + } + + detail::overlay::gather_cluster_properties + < + false, false, overlay_buffer + >(m_clusters, m_turns, detail::overlay::operation_union, + offsetted_rings, offsetted_rings, m_strategy); + + for (auto const& cluster : m_clusters) + { + if (cluster.second.open_count == 0 && cluster.second.spike_count == 0) + { + // If the cluster is completely closed, mark it as not traversable. + for (auto const& index : cluster.second.turn_indices) + { + m_turns[index].is_turn_traversable = false; + } + } + } + } + + inline void make_traversable_consistent_per_cluster() + { + for (auto const& cluster : m_clusters) + { + bool is_traversable = false; + for (auto const& index : cluster.second.turn_indices) + { + if (m_turns[index].is_turn_traversable) + { + // If there is one turn traversable in the cluster, + // then all turns should be traversable. + is_traversable = true; + break; + } + } + if (is_traversable) + { + for (auto const& index : cluster.second.turn_indices) + { + m_turns[index].is_turn_traversable = true; + } + } + } + } + inline void enrich() { enrich_intersection_points(m_turns, m_clusters, offsetted_rings, offsetted_rings, - m_robust_policy, m_strategy); } @@ -929,8 +952,8 @@ struct buffered_piece_collection { signed_size_type count_in_original = 0; - // Check of the robust point of this outputted ring is in - // any of the robust original rings + // Check of the point of this outputted ring is in + // any of the original rings // This can go quadratic if the input has many rings, and there // are many untouched deflated rings around for (auto const& original : original_rings) @@ -1018,7 +1041,7 @@ struct buffered_piece_collection traversed_rings.clear(); buffer_overlay_visitor visitor; traverser::apply(offsetted_rings, offsetted_rings, - m_strategy, m_robust_policy, + m_strategy, m_turns, traversed_rings, turn_info_per_ring, m_clusters, visitor); @@ -1057,30 +1080,32 @@ struct buffered_piece_collection // Inner rings, for deflate, which do not have intersections, and // which are outside originals, are skipped // (other ones should be traversed) - for_each_with_index(offsetted_rings, [&](std::size_t index, auto const& ring) + for (auto const& enumerated : util::enumerate(offsetted_rings)) + { + auto const& ring = enumerated.value; + if (! ring.has_intersections() + && ! ring.is_untouched_outside_original) { - if (! ring.has_intersections() - && ! ring.is_untouched_outside_original) + properties const p = properties(ring, m_strategy); + if (p.valid) { - properties p = properties(ring, m_strategy); - if (p.valid) - { - ring_identifier id(0, index, -1); - selected[id] = p; - } + ring_identifier id(0, enumerated.index, -1); + selected[id] = p; } - }); + } + } // Select all created rings - for_each_with_index(traversed_rings, [&](std::size_t index, auto const& ring) + for (auto const& enumerated : util::enumerate(traversed_rings)) + { + auto const& ring = enumerated.value; + properties p = properties(ring, m_strategy); + if (p.valid) { - properties p = properties(ring, m_strategy); - if (p.valid) - { - ring_identifier id(2, index, -1); - selected[id] = p; - } - }); + ring_identifier id(2, enumerated.index, -1); + selected[id] = p; + } + } detail::overlay::assign_parents(offsetted_rings, traversed_rings, selected, m_strategy); diff --git a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp index c5b0aedc..3775e604 100644 --- a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -117,8 +118,7 @@ template typename Pieces, typename Rings, typename Turns, - typename Strategy, - typename RobustPolicy + typename Strategy > class piece_turn_visitor { @@ -126,7 +126,6 @@ class piece_turn_visitor Rings const& m_rings; Turns& m_turns; Strategy const& m_strategy; - RobustPolicy const& m_robust_policy; template inline bool is_adjacent(Piece const& piece1, Piece const& piece2) const @@ -161,8 +160,7 @@ class piece_turn_visitor && it_begin + 1 != it_beyond && detail::section::preceding(dir, *(it_begin + 1), this_bounding_box, - other_bounding_box, - m_robust_policy); + other_bounding_box); ++it_begin, index++) {} } @@ -177,7 +175,7 @@ class piece_turn_visitor && it_beyond - 2 != it_begin) { if (detail::section::exceeding(dir, *(it_beyond - 2), - this_bounding_box, other_bounding_box, m_robust_policy)) + this_bounding_box, other_bounding_box)) { --it_beyond; } @@ -271,7 +269,6 @@ class piece_turn_visitor turn_policy::apply(unique_sub_range1, unique_sub_range2, the_model, m_strategy, - m_robust_policy, std::back_inserter(m_turns)); } } @@ -282,13 +279,11 @@ class piece_turn_visitor piece_turn_visitor(Pieces const& pieces, Rings const& ring_collection, Turns& turns, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) : m_pieces(pieces) , m_rings(ring_collection) , m_turns(turns) , m_strategy(strategy) - , m_robust_policy(robust_policy) {} template diff --git a/include/boost/geometry/algorithms/detail/buffer/implementation.hpp b/include/boost/geometry/algorithms/detail/buffer/implementation.hpp index 8b820e8f..a9608a44 100644 --- a/include/boost/geometry/algorithms/detail/buffer/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/implementation.hpp @@ -4,8 +4,9 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2017-2022. -// Modifications copyright (c) 2017-2022 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -77,27 +78,16 @@ struct buffer_all { typedef typename boost::range_value::type polygon_type; - typedef typename point_type::type point_type; - typedef typename rescale_policy_type - < - point_type, - typename geometry::cs_tag::type - >::type rescale_policy_type; - if (geometry::is_empty(geometry_in)) { // Then output geometry is kept empty as well return; } - model::box box; + model::box> box; geometry::envelope(geometry_in, box); geometry::buffer(box, box, distance_strategy.max_distance(join_strategy, end_strategy)); - rescale_policy_type rescale_policy - = boost::geometry::get_rescale_policy( - box, strategies); - detail::buffer::buffer_inserter(geometry_in, range::back_inserter(geometry_out), distance_strategy, @@ -105,8 +95,7 @@ struct buffer_all join_strategy, end_strategy, point_strategy, - strategies, - rescale_policy); + strategies); } }; diff --git a/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp b/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp index f1014c9b..f217c53b 100644 --- a/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp @@ -77,7 +77,7 @@ struct line_line_intersection // | pa pa | // | qb qb | auto const denominator_pq = determinant(p, q); - constexpr decltype(denominator_pq) const zero = 0; + static decltype(denominator_pq) const zero = 0; if (equidistant) { diff --git a/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp b/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp index d773d32c..3861fcbe 100644 --- a/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/include/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp b/include/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp index daa59b61..12fffc4c 100644 --- a/include/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp @@ -16,8 +16,9 @@ #include -#include +#include +#include #include #include #include diff --git a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp index 042891e6..6baf1907 100644 --- a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp +++ b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp @@ -45,13 +45,12 @@ namespace detail { namespace centroid // cartesian. But if it was needed then one should translate using // CS-specific technique, e.g. in spherical/geographic a translation // vector should contain coordinates being multiplies of 2PI or 360 deg. -template ::type, - areal_tag - >::type, - typename CSTag = typename cs_tag::type> +template +< + typename Geometry, + typename CastedTag = tag_cast_t, areal_tag>, + typename CSTag = cs_tag_t +> struct translating_transformer { typedef typename geometry::point_type::type point_type; diff --git a/include/boost/geometry/algorithms/detail/closest_feature/geometry_to_range.hpp b/include/boost/geometry/algorithms/detail/closest_feature/geometry_to_range.hpp index c5d331aa..d5f53f20 100644 --- a/include/boost/geometry/algorithms/detail/closest_feature/geometry_to_range.hpp +++ b/include/boost/geometry/algorithms/detail/closest_feature/geometry_to_range.hpp @@ -120,14 +120,8 @@ class geometry_to_range typename strategy::distance::services::return_type < Strategy, - typename point_type::type, - typename point_type - < - typename std::iterator_traits - < - RangeIterator - >::value_type - >::type + point_type_t, + point_type_t::value_type> >::type dist_min; return apply(geometry, first, last, strategy, dist_min); diff --git a/include/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp b/include/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp index ed2efd6f..678502bc 100644 --- a/include/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp +++ b/include/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp b/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp index be1729a8..f26af3f2 100644 --- a/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp +++ b/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp @@ -177,14 +177,14 @@ class range_to_range_rtree typename strategy::distance::services::return_type < Strategy, - typename point_type::type, - typename point_type + point_type_t, + point_type_t < typename std::iterator_traits < QueryRangeIterator >::value_type - >::type + > >::type dist_min; return apply(rtree_first, rtree_last, queries_first, queries_last, diff --git a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp index 6d643e1a..d856927f 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp @@ -39,8 +39,8 @@ struct linear_to_areal using point_type = typename std::conditional < std::is_same::type, most_precise_type>::value, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::type; using linestring_type = geometry::model::linestring; @@ -108,7 +108,7 @@ struct segment_to_areal Strategies const& strategies, bool = false) { - using linestring_type = geometry::model::linestring::type>; + using linestring_type = geometry::model::linestring>; linestring_type linestring; convert(segment, linestring); linear_to_areal::apply(linestring, areal, shortest_seg, strategies); @@ -142,8 +142,8 @@ struct areal_to_areal using point_type = typename std::conditional < std::is_same::type, most_precise_type>::value, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::type; using linestring_type = geometry::model::linestring; diff --git a/include/boost/geometry/algorithms/detail/closest_points/linear_to_linear.hpp b/include/boost/geometry/algorithms/detail/closest_points/linear_to_linear.hpp index d2927a6d..2ad332ba 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/linear_to_linear.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/linear_to_linear.hpp @@ -43,7 +43,7 @@ struct linear_to_linear { dispatch::closest_points < - typename point_type::type, + point_type_t, Linear2 >::apply(*points_begin(linear1), linear2, shortest_seg, strategies); return; @@ -53,7 +53,7 @@ struct linear_to_linear { dispatch::closest_points < - typename point_type::type, + point_type_t, Linear1 >::apply(*points_begin(linear2), linear1, shortest_seg, strategies); detail::closest_points::swap_segment_points::apply(shortest_seg); @@ -91,7 +91,7 @@ struct segment_to_linear bool = false) { using linestring_type = geometry::model::linestring - ::type>; + >; linestring_type linestring; convert(segment, linestring); linear_to_linear::apply(linestring, linear, shortest_seg, strategies); diff --git a/include/boost/geometry/algorithms/detail/closest_points/multipoint_to_geometry.hpp b/include/boost/geometry/algorithms/detail/closest_points/multipoint_to_geometry.hpp index f59c85a9..3a38a334 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/multipoint_to_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/multipoint_to_geometry.hpp @@ -12,6 +12,8 @@ #include +#include + #include #include #include @@ -123,7 +125,7 @@ struct segment_to_multipoint { using linestring_type = geometry::model::linestring < - typename point_type::type + point_type_t >; linestring_type linestring; convert(segment, linestring); @@ -148,7 +150,7 @@ struct multipoint_to_segment { using linestring_type = geometry::model::linestring < - typename point_type::type + point_type_t >; linestring_type linestring; convert(segment, linestring); diff --git a/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp b/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp index 57718585..484fe683 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp @@ -68,7 +68,7 @@ struct point_to_segment static inline void apply(Point const& point, Segment const& segment, OutputSegment& shortest_seg, Strategies const& strategies) { - typename point_type::type p[2]; + point_type_t p[2]; geometry::detail::assign_point_from_index<0>(segment, p[0]); geometry::detail::assign_point_from_index<1>(segment, p[1]); diff --git a/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp b/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp index 15d28cd6..7e5419e7 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp @@ -54,7 +54,7 @@ class segment_to_segment { using intersection_return_type = segment_intersection_points < - typename point_type::type + point_type_t >; using intersection_policy = policies::relate::segments_intersection_points @@ -74,11 +74,11 @@ class segment_to_segment return; } - typename point_type::type p[2]; + point_type_t p[2]; detail::assign_point_from_index<0>(segment1, p[0]); detail::assign_point_from_index<1>(segment1, p[1]); - typename point_type::type q[2]; + point_type_t q[2]; detail::assign_point_from_index<0>(segment2, q[0]); detail::assign_point_from_index<1>(segment2, q[1]); diff --git a/include/boost/geometry/algorithms/detail/closest_points/utilities.hpp b/include/boost/geometry/algorithms/detail/closest_points/utilities.hpp index 858c86ef..9aaa4dd8 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/utilities.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/utilities.hpp @@ -57,8 +57,8 @@ using creturn_t = typename strategy::distance::services::return_type < distance_strategy_t >::type, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::type; diff --git a/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp b/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp index fccdf4bb..607fdae0 100644 --- a/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp +++ b/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp @@ -17,10 +17,10 @@ #include -#include #include #include #include +#include namespace boost { namespace geometry @@ -45,10 +45,10 @@ struct indexed_to_indexed typedef typename coordinate_type::type coordinate_type; geometry::set(destination, - boost::numeric_cast( + util::numeric_cast( geometry::get(source))); geometry::set(destination, - boost::numeric_cast( + util::numeric_cast( geometry::get(source))); indexed_to_indexed diff --git a/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp index 8762cd66..a29ca3fc 100644 --- a/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp +++ b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp @@ -18,10 +18,10 @@ #include -#include #include #include #include +#include namespace boost { namespace geometry @@ -45,7 +45,7 @@ struct point_to_point { typedef typename coordinate_type::type coordinate_type; - set(destination, boost::numeric_cast(get(source))); + set(destination, util::numeric_cast(get(source))); point_to_point::apply(source, destination); } }; diff --git a/include/boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp b/include/boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp index 64d81054..20fd09bf 100644 --- a/include/boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp +++ b/include/boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include diff --git a/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp b/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp index b820cc4b..ff8c1703 100644 --- a/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp +++ b/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp @@ -24,6 +24,8 @@ #include +#include + #include #include #include @@ -51,7 +53,7 @@ #include #include -#include +#include #include #include #include @@ -211,7 +213,7 @@ struct convex_hull detail::convex_hull::input_geometry_proxy in_proxy(geometry); detail::convex_hull::graham_andrew < - typename point_type::type + point_type_t >::apply(in_proxy, out, strategy); } }; @@ -232,13 +234,13 @@ struct convex_hull static bool const Reverse = geometry::point_order::value == counterclockwise; - std::array::type, 4> arr; + std::array, 4> arr; // TODO: This assigns only 2d cooridnates! // And it is also used in box_view<>! geometry::detail::assign_box_corners_oriented(box, arr); std::move(arr.begin(), arr.end(), range::back_inserter(out)); - if (BOOST_GEOMETRY_CONDITION(Close)) + if BOOST_GEOMETRY_CONSTEXPR (Close) { range::push_back(out, range::front(out)); } diff --git a/include/boost/geometry/algorithms/detail/covered_by/implementation.hpp b/include/boost/geometry/algorithms/detail/covered_by/implementation.hpp index 13626871..33ba1796 100644 --- a/include/boost/geometry/algorithms/detail/covered_by/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/covered_by/implementation.hpp @@ -65,7 +65,7 @@ struct geometry_covered_by_box template static inline bool apply(Geometry const& geometry, Box const& box, Strategy const& strategy) { - using point_type = typename point_type::type; + using point_type = point_type_t; using mutable_point_type = typename helper_geometry::type; using box_type = model::box; diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp index 8d71dd2e..b8648eb7 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp @@ -61,8 +61,8 @@ namespace detail { namespace disjoint { template ::type, - typename Tag1OrMulti = typename tag_cast::type> + typename Tag1 = tag_t, + typename Tag1OrMulti = tag_cast_t> struct disjoint_no_intersections_policy { /*! @@ -71,8 +71,7 @@ struct disjoint_no_intersections_policy template static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy) { - using point_type = typename point_type::type; - typename helper_geometry::type p; + typename helper_geometry>::type p; geometry::point_on_border(p, g1); return ! geometry::covered_by(p, g2, strategy); @@ -183,7 +182,7 @@ class disjoint_segment_areal return false; } - typename point_type::type p; + point_type_t p; detail::assign_point_from_index<0>(segment, p); return ! geometry::covered_by(p, polygon, strategy); @@ -219,7 +218,7 @@ struct disjoint_segment_areal return false; } - typename point_type::type p; + point_type_t p; detail::assign_point_from_index<0>(segment, p); return ! geometry::covered_by(p, ring, strategy); diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp index 00a6bff8..dbe23010 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp @@ -5,11 +5,11 @@ // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. - -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -36,7 +36,6 @@ #include #include -#include #include @@ -56,14 +55,12 @@ struct disjoint_segment static inline bool apply(Segment1 const& segment1, Segment2 const& segment2, Strategy const& strategy) { - typedef typename point_type::type point_type; - - typedef segment_intersection_points intersection_return_type; - - typedef policies::relate::segments_intersection_points + using point_type = point_type_t; + using intersection_return_type = segment_intersection_points; + using intersection_policy = policies::relate::segments_intersection_points < intersection_return_type - > intersection_policy; + >; detail::segment_as_subrange sub_range1(segment1); detail::segment_as_subrange sub_range2(segment2); @@ -128,7 +125,7 @@ struct disjoint_linear Geometry1, Geometry2, assign_disjoint_policy > >::apply(0, geometry1, 1, geometry2, - strategy, detail::no_rescale_policy(), turns, interrupt_policy); + strategy, turns, interrupt_policy); return !interrupt_policy.has_intersections; } diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp index 4424f144..25b91d3f 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp @@ -22,6 +22,8 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP +#include + #include #include #include @@ -84,7 +86,7 @@ struct disjoint_range_segment_or_box SegmentOrBox const& segment_or_box, Strategy const& strategy) { - using point_type = typename point_type::type; + using point_type = point_type_t; using range_segment = typename geometry::model::referring_segment; detail::closed_view const view(range); diff --git a/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp b/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp index 535c9006..8fa9f8a0 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp @@ -254,7 +254,7 @@ class multipoint_linear // should be passed, where envelope would be lazily calculated when needed the first time geometry::partition < - geometry::model::box::type> + geometry::model::box> >::apply(multipoint, segment_range(linear), visitor, expand_box_point(strategy), overlaps_box_point(strategy), @@ -282,9 +282,9 @@ class multi_point_single_geometry SingleGeometry const& single_geometry, Strategy const& strategy) { - typedef typename point_type::type point1_type; - typedef typename point_type::type point2_type; - typedef model::box box2_type; + using point1_type = point_type_t; + using point2_type = point_type_t; + using box2_type = model::box; box2_type box2; geometry::envelope(single_geometry, box2, strategy); @@ -424,11 +424,11 @@ class multi_point_multi_geometry template static inline bool apply(MultiPoint const& multi_point, MultiGeometry const& multi_geometry, Strategy const& strategy) { - typedef typename point_type::type point1_type; - typedef typename point_type::type point2_type; - typedef model::box box1_type; - typedef model::box box2_type; - typedef std::pair box_pair_type; + using point1_type = point_type_t; + using point2_type = point_type_t; + using box1_type = model::box; + using box2_type = model::box; + using box_pair_type = std::pair; std::size_t count2 = boost::size(multi_geometry); std::vector boxes(count2); diff --git a/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp index 1f2d669e..d959619c 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp @@ -84,8 +84,7 @@ struct disjoint_segment_box_sphere_or_spheroid DisjointPointBoxStrategy const& disjoint_point_box_strategy, DisjointBoxBoxStrategy const& disjoint_box_box_strategy) { - typedef typename point_type::type segment_point; - segment_point vertex; + point_type_t vertex; return apply(segment, box, vertex, azimuth_strategy, normalize_strategy, @@ -112,13 +111,13 @@ struct disjoint_segment_box_sphere_or_spheroid { assert_dimension_equal(); - typedef typename point_type::type segment_point_type; + using segment_point_type = point_type_t; segment_point_type p0, p1; geometry::detail::assign_point_from_index<0>(segment, p0); geometry::detail::assign_point_from_index<1>(segment, p1); - //vertex not computed here + // Vertex is not computed here disjoint_info disjoint_return_value = disjoint_info::disjoint_no_vertex; // Simplest cases first diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp index f2309584..c3d079eb 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp @@ -12,6 +12,8 @@ #include +#include + #include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp index 5af854f9..a0127571 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp @@ -1,7 +1,8 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2021, Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2021, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -35,7 +36,7 @@ #include #include -#include +#include namespace boost { namespace geometry @@ -80,20 +81,16 @@ template class geometry_to_segment_or_box { private: - typedef typename point_type::type segment_or_box_point; - - typedef distance::strategy_t strategy_type; - - typedef detail::closest_feature::point_to_point_range + using segment_or_box_point = point_type_t; + using strategy_type = distance::strategy_t; + using point_to_point_range = detail::closest_feature::point_to_point_range < - typename point_type::type, + point_type_t, std::vector, segment_or_box_point_range_closure::value - > point_to_point_range; - - typedef detail::closest_feature::geometry_to_range geometry_to_range; - - typedef distance::creturn_t comparable_return_type; + >; + using geometry_to_range = detail::closest_feature::geometry_to_range; + using comparable_return_type = distance::creturn_t; // assign the new minimum value for an iterator of the point range // of a segment or a box @@ -247,26 +244,28 @@ class geometry_to_segment_or_box } } - if (BOOST_GEOMETRY_CONDITION(is_comparable::value)) + if BOOST_GEOMETRY_CONSTEXPR (is_comparable::value) { return (std::min)(cd_min1, cd_min2); } - - if (cd_min1 < cd_min2) - { - return strategy.apply(*pit_min, *it_min1, *it_min2); - } - else + else // else prevents unreachable code warning { - return dispatch::distance - < - segment_or_box_point, - typename std::iterator_traits - < - segment_iterator_type - >::value_type, - Strategies - >::apply(*it_min, *sit_min, strategies); + if (cd_min1 < cd_min2) + { + return strategy.apply(*pit_min, *it_min1, *it_min2); + } + else + { + return dispatch::distance + < + segment_or_box_point, + typename std::iterator_traits + < + segment_iterator_type + >::value_type, + Strategies + >::apply(*it_min, *sit_min, strategies); + } } } @@ -317,7 +316,7 @@ class geometry_to_segment_or_box : dispatch::distance < - typename point_type::type, + point_type_t, SegmentOrBox, Strategies >::apply(*it_min, segment_or_box, strategies); diff --git a/include/boost/geometry/algorithms/detail/distance/interface.hpp b/include/boost/geometry/algorithms/detail/distance/interface.hpp index 5fdb66be..f903c5ce 100644 --- a/include/boost/geometry/algorithms/detail/distance/interface.hpp +++ b/include/boost/geometry/algorithms/detail/distance/interface.hpp @@ -297,7 +297,7 @@ struct distance::type, + point_type_t, Linear2, Strategies >::apply(*points_begin(linear1), linear2, strategies); @@ -57,7 +57,7 @@ struct linear_to_linear { return dispatch::distance < - typename point_type::type, + point_type_t, Linear1, Strategies >::apply(*points_begin(linear2), linear1, strategies); diff --git a/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp b/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp index df28acef..08c8f705 100644 --- a/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp @@ -100,7 +100,7 @@ struct point_to_segment static inline auto apply(Point const& point, Segment const& segment, Strategies const& strategies) { - typename point_type::type p[2]; + point_type_t p[2]; geometry::detail::assign_point_from_index<0>(segment, p[0]); geometry::detail::assign_point_from_index<1>(segment, p[1]); @@ -117,7 +117,7 @@ struct point_to_segment static inline auto apply(Point const& point, Segment const& segment, Strategy const& strategy) { - typename point_type::type p[2]; + point_type_t p[2]; geometry::detail::assign_point_from_index<0>(segment, p[0]); geometry::detail::assign_point_from_index<1>(segment, p[1]); diff --git a/include/boost/geometry/algorithms/detail/distance/segment_to_box.hpp b/include/boost/geometry/algorithms/detail/distance/segment_to_box.hpp index 09f3cc4f..70fefae3 100644 --- a/include/boost/geometry/algorithms/detail/distance/segment_to_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/segment_to_box.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2014-2023 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -18,7 +20,6 @@ #include #include -#include #include #include @@ -41,9 +42,10 @@ #include #include -#include +#include #include #include +#include #include #include @@ -80,17 +82,16 @@ template class segment_to_box_2D_generic { private: - typedef typename point_type::type segment_point; - typedef typename point_type::type box_point; - - typedef distance::strategy_t ps_strategy_type; + using segment_point = point_type_t; + using box_point = point_type_t; + using ps_strategy_type = distance::strategy_t; - typedef detail::closest_feature::point_to_point_range + using point_to_point_range = detail::closest_feature::point_to_point_range < segment_point, std::vector, open - > point_to_point_range; + >; public: // TODO: Or should the return type be defined by sb_strategy_type? @@ -154,21 +155,23 @@ class segment_to_box_2D_generic } } - if (BOOST_GEOMETRY_CONDITION(is_comparable::value)) + if BOOST_GEOMETRY_CONSTEXPR (is_comparable::value) { return cd[imin]; } - - if (imin < 4) - { - return strategy.apply(box_points[imin], p[0], p[1]); - } - else + else // else prevents unreachable code warning { - unsigned int bimin = imin - 4; - return strategy.apply(p[bimin], - *bit_min[bimin].first, - *bit_min[bimin].second); + if (imin < 4) + { + return strategy.apply(box_points[imin], p[0], p[1]); + } + else + { + unsigned int bimin = imin - 4; + return strategy.apply(p[bimin], + *bit_min[bimin].first, + *bit_min[bimin].second); + } } } }; @@ -183,15 +186,15 @@ template class segment_to_box_2D_generic // Use both PointSegment and PointBox strategies { private: - typedef typename point_type::type segment_point; - typedef typename point_type::type box_point; + using segment_point = point_type_t; + using box_point = point_type_t; - typedef distance::strategy_t ps_strategy_type; - typedef distance::strategy_t pb_strategy_type; + using ps_strategy_type = distance::strategy_t; + using pb_strategy_type = distance::strategy_t; public: // TODO: Or should the return type be defined by sb_strategy_type? - typedef distance::return_t return_type; + using return_type = distance::return_t; static inline return_type apply(Segment const& segment, Box const& box, @@ -285,7 +288,7 @@ class segment_to_box_2D template static inline Result apply(T const& t) { - return boost::numeric_cast(t); + return util::numeric_cast(t); } }; @@ -728,8 +731,8 @@ class segment_to_box Box const& box, Strategies const& strategies) { - typedef typename point_type::type segment_point; - typedef typename point_type::type box_point; + using segment_point = point_type_t; + using box_point = point_type_t; segment_point p[2]; detail::assign_point_from_index<0>(segment, p[0]); diff --git a/include/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp b/include/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp index 9cbececd..21933bdd 100644 --- a/include/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp +++ b/include/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp @@ -1,7 +1,8 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2021, Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2021, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -28,7 +29,7 @@ #include #include -#include +#include namespace boost { namespace geometry @@ -58,11 +59,11 @@ class segment_to_segment return 0; } - typename point_type::type p[2]; + point_type_t p[2]; detail::assign_point_from_index<0>(segment1, p[0]); detail::assign_point_from_index<1>(segment1, p[1]); - typename point_type::type q[2]; + point_type_t q[2]; detail::assign_point_from_index<0>(segment2, q[0]); detail::assign_point_from_index<1>(segment2, q[1]); @@ -82,21 +83,23 @@ class segment_to_segment std::size_t imin = std::distance(boost::addressof(d[0]), std::min_element(d, d + 4)); - if (BOOST_GEOMETRY_CONDITION(is_comparable::value)) + if BOOST_GEOMETRY_CONSTEXPR (is_comparable::value) { return d[imin]; } - - switch (imin) + else // else prevents unreachable code warning { - case 0: - return strategy.apply(q[0], p[0], p[1]); - case 1: - return strategy.apply(q[1], p[0], p[1]); - case 2: - return strategy.apply(p[0], q[0], q[1]); - default: - return strategy.apply(p[1], q[0], q[1]); + switch (imin) + { + case 0: + return strategy.apply(q[0], p[0], p[1]); + case 1: + return strategy.apply(q[1], p[0], p[1]); + case 2: + return strategy.apply(p[0], q[0], q[1]); + default: + return strategy.apply(p[1], q[0], q[1]); + } } } }; diff --git a/include/boost/geometry/algorithms/detail/distance/strategy_utils.hpp b/include/boost/geometry/algorithms/detail/distance/strategy_utils.hpp index 8002846e..965cb911 100644 --- a/include/boost/geometry/algorithms/detail/distance/strategy_utils.hpp +++ b/include/boost/geometry/algorithms/detail/distance/strategy_utils.hpp @@ -35,8 +35,8 @@ template using return_t = typename strategy::distance::services::return_type < strategy_t, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::type; @@ -51,8 +51,8 @@ template using creturn_t = typename strategy::distance::services::return_type < cstrategy_t, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::type; diff --git a/include/boost/geometry/algorithms/detail/envelope/initialize.hpp b/include/boost/geometry/algorithms/detail/envelope/initialize.hpp index d8e252b5..8d834266 100644 --- a/include/boost/geometry/algorithms/detail/envelope/initialize.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/initialize.hpp @@ -13,11 +13,10 @@ #include -#include - #include #include #include +#include namespace boost { namespace geometry @@ -67,9 +66,9 @@ struct initialize static inline void apply(Box& box, coordinate_type min_value - = boost::numeric::bounds::highest(), + = util::bounds::highest(), coordinate_type max_value - = boost::numeric::bounds::lowest()) + = util::bounds::lowest()) { initialize_loop < diff --git a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp index 04032c62..2fa92270 100644 --- a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp @@ -32,8 +32,8 @@ #include #include +#include #include -#include #include #include @@ -235,7 +235,7 @@ struct envelope_range_of_boxes static const bool is_equatorial = ! std::is_same < - typename cs_tag::type, + cs_tag_t, spherical_polar_tag >::value; diff --git a/include/boost/geometry/algorithms/detail/envelope/segment.hpp b/include/boost/geometry/algorithms/detail/envelope/segment.hpp index 458e8488..7bfcfd96 100644 --- a/include/boost/geometry/algorithms/detail/envelope/segment.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/segment.hpp @@ -70,7 +70,7 @@ struct envelope_segment static inline void apply(Segment const& segment, Box& mbr, Strategy const& strategy) { - typename point_type::type p[2]; + point_type_t p[2]; detail::assign_point_from_index<0>(segment, p[0]); detail::assign_point_from_index<1>(segment, p[1]); diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index b908c3e5..952bf221 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -20,7 +20,7 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EQUALS_COLLECT_VECTORS_HPP -#include +#include #include #include @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -76,7 +77,7 @@ struct collected_vector_cartesian bool normalize() { - T magnitude = math::sqrt(boost::numeric_cast(dx * dx + dy * dy)); + T magnitude = math::sqrt(util::numeric_cast(dx * dx + dy * dy)); // NOTE: shouldn't here math::equals() be called? if (magnitude > 0) @@ -333,7 +334,7 @@ struct range_collect_vectors // Default version (cartesian) -template ::type> +template > struct box_collect_vectors { // Calculate on coordinate type, but if it is integer, @@ -343,7 +344,7 @@ struct box_collect_vectors static inline void apply(Collection& collection, Box const& box) { - typename point_type::type lower_left, lower_right, + point_type_t lower_left, lower_right, upper_left, upper_right; geometry::detail::assign_box_corners(box, lower_left, lower_right, upper_left, upper_right); @@ -364,7 +365,7 @@ struct box_collect_vectors { static inline void apply(Collection& collection, Box const& box) { - typename point_type::type lower_left, lower_right, + point_type_t lower_left, lower_right, upper_left, upper_right; geometry::detail::assign_box_corners(box, lower_left, lower_right, upper_left, upper_right); diff --git a/include/boost/geometry/algorithms/detail/equals/interface.hpp b/include/boost/geometry/algorithms/detail/equals/interface.hpp index f0c44384..5590a8d8 100644 --- a/include/boost/geometry/algorithms/detail/equals/interface.hpp +++ b/include/boost/geometry/algorithms/detail/equals/interface.hpp @@ -49,10 +49,10 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type, - typename CastedTag1 = typename tag_cast::type, - typename CastedTag2 = typename tag_cast::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, + typename CastedTag1 = tag_cast_t, + typename CastedTag2 = tag_cast_t, std::size_t DimensionCount = dimension::type::value, bool Reverse = reverse_dispatch::type::value > diff --git a/include/boost/geometry/algorithms/detail/extreme_points.hpp b/include/boost/geometry/algorithms/detail/extreme_points.hpp index 2ac13fc1..f3845c92 100644 --- a/include/boost/geometry/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/algorithms/detail/extreme_points.hpp @@ -546,10 +546,10 @@ inline bool extreme_points(Geometry const& geometry, Extremes& extremes, Intruders& intruders) { - typedef typename strategy::side::services::default_strategy + using strategy_type = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type strategy_type; + cs_tag_t + >::type; return geometry::extreme_points(geometry,extremes, intruders, strategy_type()); } diff --git a/include/boost/geometry/algorithms/detail/for_each_range.hpp b/include/boost/geometry/algorithms/detail/for_each_range.hpp index 06917000..30b209dc 100644 --- a/include/boost/geometry/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/algorithms/detail/for_each_range.hpp @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/get_max_size.hpp b/include/boost/geometry/algorithms/detail/get_max_size.hpp deleted file mode 100644 index f4741824..00000000 --- a/include/boost/geometry/algorithms/detail/get_max_size.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2014 Bruno Lalande, Paris, France. -// Copyright (c) 2014 Mateusz Loskot, London, UK. -// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2018. -// Modifications copyright (c) 2018, Oracle and/or its affiliates. - -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP - -#include - -#include -#include -#include - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -template -struct get_max_size_box -{ - static inline typename coordinate_type::type apply(Box const& box) - { - typename coordinate_type::type s - = geometry::math::abs(geometry::get<1, Dimension>(box) - geometry::get<0, Dimension>(box)); - - return (std::max)(s, get_max_size_box::apply(box)); - } -}; - -template -struct get_max_size_box -{ - static inline typename coordinate_type::type apply(Box const& box) - { - return geometry::math::abs(geometry::get<1, 0>(box) - geometry::get<0, 0>(box)); - } -}; - -// This might be implemented later on for other geometries too. -// Not dispatched yet. -template -inline typename coordinate_type::type get_max_size(Box const& box) -{ - return get_max_size_box::value - 1>::apply(box); -} - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP diff --git a/include/boost/geometry/algorithms/detail/has_self_intersections.hpp b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp index 0b13eb7b..61cb1dee 100644 --- a/include/boost/geometry/algorithms/detail/has_self_intersections.hpp +++ b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -26,9 +27,6 @@ #include #include -#include -#include -#include #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS # include @@ -53,7 +51,7 @@ class overlay_invalid_input_exception : public geometry::exception inline overlay_invalid_input_exception() {} - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry Overlay invalid input exception"; } @@ -67,18 +65,17 @@ namespace detail { namespace overlay { -template +template inline bool has_self_intersections(Geometry const& geometry, Strategy const& strategy, - RobustPolicy const& robust_policy, bool throw_on_self_intersection = true) { - typedef typename point_type::type point_type; - typedef turn_info + using point_type = point_type_t; + using turn_info = turn_info < point_type, - typename segment_ratio_type::type - > turn_info; + typename segment_ratio_type::type + >; std::deque turns; detail::disjoint::disjoint_interrupt_policy policy; @@ -86,7 +83,7 @@ inline bool has_self_intersections(Geometry const& geometry, < false, detail::overlay::assign_null_policy - >(geometry, strategy, robust_policy, turns, policy, 0, false); + >(geometry, strategy, turns, policy, 0, false); #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS bool first = true; diff --git a/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp b/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp index e657f825..3f5d4388 100644 --- a/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp @@ -1,6 +1,7 @@ // Boost.Geometry -// Copyright (c) 2020-2021, Oracle and/or its affiliates. +// Copyright (c) 2020-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -40,12 +41,10 @@ struct intersection_areal_areal_ < typename Areal1, typename Areal2, - typename RobustPolicy, typename Strategy > static inline void apply(Areal1 const& areal1, Areal2 const& areal2, - RobustPolicy const& robust_policy, GeometryOut& geometry_out, Strategy const& strategy) { @@ -54,7 +53,7 @@ struct intersection_areal_areal_ Areal1, Areal2, typename boost::range_value::type, overlay_intersection - >::apply(areal1, areal2, robust_policy, + >::apply(areal1, areal2, geometry::range::back_inserter(geometry_out), strategy); } @@ -69,12 +68,10 @@ struct intersection_areal_areal_ < typename Areal1, typename Areal2, - typename RobustPolicy, typename Strategy > static inline void apply(Areal1 const& areal1, Areal2 const& areal2, - RobustPolicy const& robust_policy, TupledOut& geometry_out, Strategy const& strategy) { @@ -105,16 +102,8 @@ struct intersection_areal_areal_ single_out, point_tag, point_tag > pointlike; - typedef typename geometry::tuples::element - < - areal::index, TupledOut - >::type areal_out_type; - - // NOTE: The same robust_policy is used in each call of - // intersection_insert. Is that correct? - // A * A -> A - call_intersection(areal1, areal2, robust_policy, + call_intersection(areal1, areal2, areal::get(geometry_out), strategy); @@ -124,7 +113,6 @@ struct intersection_areal_areal_ // L * L -> (L, P) call_intersection(geometry::detail::boundary_view(areal1), geometry::detail::boundary_view(areal2), - robust_policy, ! is_areal_empty ? temp_out : geometry_out, @@ -134,6 +122,13 @@ struct intersection_areal_areal_ { // NOTE: the original areal geometry could be used instead of boundary here // however this results in static assert failure related to rescale policy + // After the removing of rescaling replacing boundary with areal geometry results in + // some tests failing. + typedef typename geometry::tuples::element + < + areal::index, TupledOut + >::type areal_out_type; + typedef geometry::detail::boundary_view < areal_out_type const @@ -144,14 +139,12 @@ struct intersection_areal_areal_ // L - L -> L call_difference(linear::get(temp_out), areal_out_boundary, - robust_policy, linear::get(geometry_out), strategy); // P - L -> P call_difference(pointlike::get(temp_out), areal_out_boundary, - robust_policy, pointlike::get(geometry_out), strategy); } @@ -164,13 +157,11 @@ struct intersection_areal_areal_ < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename GeometryOut, typename Strategy > static inline void call_intersection(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, GeometryOut& geometry_out, Strategy const& strategy) { @@ -185,7 +176,6 @@ struct intersection_areal_areal_ overlay_intersection >::apply(geometry1, geometry2, - robust_policy, geometry::detail::output_geometry_back_inserter(geometry_out), strategy); } @@ -194,13 +184,11 @@ struct intersection_areal_areal_ < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename GeometryOut, typename Strategy > static inline void call_difference(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, GeometryOut& geometry_out, Strategy const& strategy) { @@ -212,7 +200,6 @@ struct intersection_areal_areal_ overlay_difference >::apply(geometry1, geometry2, - robust_policy, geometry::range::back_inserter(geometry_out), strategy); } @@ -225,20 +212,18 @@ struct intersection_areal_areal < typename Areal1, typename Areal2, - typename RobustPolicy, typename GeometryOut, typename Strategy > static inline bool apply(Areal1 const& areal1, Areal2 const& areal2, - RobustPolicy const& robust_policy, GeometryOut& geometry_out, Strategy const& strategy) { intersection_areal_areal_ < GeometryOut - >::apply(areal1, areal2, robust_policy, geometry_out, strategy); + >::apply(areal1, areal2, geometry_out, strategy); return true; } diff --git a/include/boost/geometry/algorithms/detail/intersection/box_box.hpp b/include/boost/geometry/algorithms/detail/intersection/box_box.hpp index 30c31ff1..ff99a229 100644 --- a/include/boost/geometry/algorithms/detail/intersection/box_box.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/box_box.hpp @@ -16,7 +16,7 @@ #include -#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp b/include/boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp similarity index 63% rename from include/boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp rename to include/boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp index 31db94dd..fdfe6678 100644 --- a/include/boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp @@ -2,21 +2,20 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015. -// Modifications copyright (c) 2015, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP #include -#include namespace boost { namespace geometry @@ -32,28 +31,24 @@ struct intersection_box_box template < typename Box1, typename Box2, - typename RobustPolicy, typename BoxOut, typename Strategy > static inline bool apply(Box1 const& box1, Box2 const& box2, - RobustPolicy const& robust_policy, BoxOut& box_out, Strategy const& strategy) { - typedef typename coordinate_type::type ct; - - ct max1 = get(box1); - ct min2 = get(box2); + auto max1 = get(box1); + auto min2 = get(box2); if (max1 < min2) { return false; } - ct max2 = get(box2); - ct min1 = get(box1); + auto max2 = get(box2); + auto min1 = get(box1); if (max2 < min1) { @@ -65,7 +60,7 @@ struct intersection_box_box set(box_out, max1 > max2 ? max2 : max1); return intersection_box_box - ::apply(box1, box2, robust_policy, box_out, strategy); + ::apply(box1, box2, box_out, strategy); } }; @@ -75,12 +70,10 @@ struct intersection_box_box template < typename Box1, typename Box2, - typename RobustPolicy, typename BoxOut, typename Strategy > - static inline bool apply(Box1 const&, Box2 const&, - RobustPolicy const&, BoxOut&, Strategy const&) + static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&) { return true; } @@ -93,4 +86,4 @@ struct intersection_box_box }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP diff --git a/include/boost/geometry/algorithms/detail/intersection/gc.hpp b/include/boost/geometry/algorithms/detail/intersection/gc.hpp index fa492c0f..d47d4c05 100644 --- a/include/boost/geometry/algorithms/detail/intersection/gc.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/gc.hpp @@ -1,6 +1,7 @@ // Boost.Geometry -// Copyright (c) 2022, Oracle and/or its affiliates. +// Copyright (c) 2022-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -12,6 +13,8 @@ #include +#include + #include #include #include @@ -214,22 +217,12 @@ struct intersection template ::value, int> = 0> static void merge_two(Out const& g1, Out const& g2, Out& out, Strategy const& strategy) { - using rescale_policy_type = typename geometry::rescale_overlay_policy_type - < - Out, Out, typename Strategy::cs_tag - >::type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - g1, g2, strategy); - geometry::dispatch::intersection_insert < Out, Out, typename boost::range_value::type, overlay_union >::apply(g1, g2, - robust_policy, geometry::range::back_inserter(out), strategy); } @@ -242,7 +235,6 @@ struct intersection Out, Out, typename boost::range_value::type >::apply(g1, g2, - 0, // dummy robust policy geometry::range::back_inserter(out), strategy); } diff --git a/include/boost/geometry/algorithms/detail/intersection/interface.hpp b/include/boost/geometry/algorithms/detail/intersection/interface.hpp index 84a9a57c..8c4a0087 100644 --- a/include/boost/geometry/algorithms/detail/intersection/interface.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/interface.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014-2022. -// Modifications copyright (c) 2014-2022, Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -17,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -43,10 +43,9 @@ template > struct intersection { - template + template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, GeometryOut& geometry_out, Strategy const& strategy) { @@ -59,7 +58,7 @@ struct intersection < Geometry1, Geometry2, SingleOut, overlay_intersection - >::apply(geometry1, geometry2, robust_policy, + >::apply(geometry1, geometry2, geometry::detail::output_geometry_back_inserter(geometry_out), strategy); @@ -83,11 +82,10 @@ struct intersection > : intersection { - template + template static inline bool apply( Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, GeometryOut& out, Strategy const& strategy) { @@ -96,7 +94,7 @@ struct intersection Geometry2, Geometry1, Tag2, Tag1, false - >::apply(g2, g1, robust_policy, out, strategy); + >::apply(g2, g1, out, strategy); } }; @@ -121,22 +119,11 @@ struct intersection static bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, GeometryOut & geometry_out, Strategy const& strategy) { - typedef typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - >::type rescale_policy_type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - return dispatch::intersection < Geometry1, Geometry2 - >::apply(geometry1, geometry2, robust_policy, geometry_out, + >::apply(geometry1, geometry2, geometry_out, strategy); } }; diff --git a/include/boost/geometry/algorithms/detail/intersection/multi.hpp b/include/boost/geometry/algorithms/detail/intersection/multi.hpp index 7810abab..7a90fd7b 100644 --- a/include/boost/geometry/algorithms/detail/intersection/multi.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/multi.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014-2022. -// Modifications copyright (c) 2014-2022, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -53,12 +53,10 @@ struct intersection_multi_linestring_multi_linestring_point template < typename MultiLinestring1, typename MultiLinestring2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(MultiLinestring1 const& ml1, MultiLinestring2 const& ml2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -69,7 +67,7 @@ struct intersection_multi_linestring_multi_linestring_point for (auto it2 = boost::begin(ml2); it2 != boost::end(ml2); ++it2) { out = intersection_linestring_linestring_point - ::apply(*it1, *it2, robust_policy, out, strategy); + ::apply(*it1, *it2, out, strategy); } } @@ -84,19 +82,17 @@ struct intersection_linestring_multi_linestring_point template < typename Linestring, typename MultiLinestring, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Linestring const& linestring, MultiLinestring const& ml, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { for (auto it = boost::begin(ml); it != boost::end(ml); ++it) { out = intersection_linestring_linestring_point - ::apply(linestring, *it, robust_policy, out, strategy); + ::apply(linestring, *it, out, strategy); } return out; @@ -118,11 +114,9 @@ struct intersection_of_multi_linestring_with_areal template < typename MultiLinestring, typename Areal, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -131,7 +125,7 @@ struct intersection_of_multi_linestring_with_areal out = intersection_of_linestring_with_areal < ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints - >::apply(*it, areal, robust_policy, out, strategy); + >::apply(*it, areal, out, strategy); } return out; @@ -152,18 +146,16 @@ struct intersection_of_areal_with_multi_linestring template < typename Areal, typename MultiLinestring, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return intersection_of_multi_linestring_with_areal < ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints - >::apply(ml, areal, robust_policy, out, strategy); + >::apply(ml, areal, out, strategy); } }; @@ -175,20 +167,17 @@ struct clip_multi_linestring template < typename MultiLinestring, typename Box, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(MultiLinestring const& multi_linestring, Box const& box, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& ) { - typedef typename point_type::type point_type; - strategy::intersection::liang_barsky lb_strategy; + strategy::intersection::liang_barsky> lb_strategy; for (auto it = boost::begin(multi_linestring); it != boost::end(multi_linestring); ++it) { out = detail::intersection::clip_range_with_box - (box, *it, robust_policy, out, lb_strategy); + (box, *it, out, lb_strategy); } return out; } diff --git a/include/boost/geometry/algorithms/detail/intersects/implementation.hpp b/include/boost/geometry/algorithms/detail/intersects/implementation.hpp index 76493f9d..36f57fe6 100644 --- a/include/boost/geometry/algorithms/detail/intersects/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/intersects/implementation.hpp @@ -4,9 +4,9 @@ // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -28,7 +28,6 @@ #include #include -#include #include @@ -69,7 +68,7 @@ struct self_intersects detail::self_get_turn_points::get_turns < false, turn_policy - >::apply(geometry, strategy, detail::no_rescale_policy(), turns, policy, 0, true); + >::apply(geometry, strategy, turns, policy, 0, true); return policy.has_intersections; } }; diff --git a/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp b/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp index 7136e516..720f5b65 100644 --- a/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp +++ b/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp @@ -65,10 +65,7 @@ struct debug_boundary_points_printer { static inline void apply(MultiLinestring const& multilinestring) { - typedef typename point_type::type point_type; - typedef std::vector point_vector; - - point_vector boundary_points; + std::vector> boundary_points; for (auto it = boost::begin(multilinestring); it != boost::end(multilinestring); ++it) { if ( boost::size(*it) > 1 diff --git a/include/boost/geometry/algorithms/detail/is_simple/linear.hpp b/include/boost/geometry/algorithms/detail/is_simple/linear.hpp index e2ac77ad..8c91e0c9 100644 --- a/include/boost/geometry/algorithms/detail/is_simple/linear.hpp +++ b/include/boost/geometry/algorithms/detail/is_simple/linear.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2021, Oracle and/or its affiliates. +// Copyright (c) 2014-2024, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -69,12 +68,11 @@ template inline bool check_segment_indices(Turn const& turn, signed_size_type last_index) { - return - (turn.operations[0].seg_id.segment_index == 0 + return (turn.operations[0].seg_id.segment_index == 0 && turn.operations[1].seg_id.segment_index == last_index) || - (turn.operations[0].seg_id.segment_index == 0 - && turn.operations[1].seg_id.segment_index == last_index); + (turn.operations[1].seg_id.segment_index == 0 + && turn.operations[0].seg_id.segment_index == last_index); } @@ -189,22 +187,19 @@ class is_acceptable_turn template inline bool has_self_intersections(Linear const& linear, Strategy const& strategy) { - typedef typename point_type::type point_type; - - // compute self turns - typedef detail::overlay::turn_info turn_info; - - std::deque turns; - - typedef detail::overlay::get_turn_info + using point_type = point_type_t; + using turn_info = detail::overlay::turn_info; + using turn_policy = detail::overlay::get_turn_info < detail::disjoint::assign_disjoint_policy - > turn_policy; - - typedef is_acceptable_turn + >; + using is_acceptable_turn_type = is_acceptable_turn < Linear, Strategy - > is_acceptable_turn_type; + >; + + // Compute self turns + std::deque turns; is_acceptable_turn_type predicate(linear, strategy); detail::overlay::predicate_based_interrupt_policy @@ -218,7 +213,6 @@ inline bool has_self_intersections(Linear const& linear, Strategy const& strateg false, turn_policy >::apply(linear, strategy, - detail::no_rescale_policy(), turns, interrupt_policy, 0, true); diff --git a/include/boost/geometry/algorithms/detail/is_simple/multipoint.hpp b/include/boost/geometry/algorithms/detail/is_simple/multipoint.hpp index 2eba68f9..25d513f8 100644 --- a/include/boost/geometry/algorithms/detail/is_simple/multipoint.hpp +++ b/include/boost/geometry/algorithms/detail/is_simple/multipoint.hpp @@ -47,7 +47,7 @@ struct is_simple_multipoint { typedef geometry::less < - typename point_type::type, + point_type_t, -1, Strategy > less_type; diff --git a/include/boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp b/include/boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp index b12c42c8..9798694c 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2021, Oracle and/or its affiliates. - +// Copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -26,8 +26,6 @@ #include #include -#include -#include namespace boost { namespace geometry { @@ -46,24 +44,14 @@ template class has_valid_self_turns { private: - typedef typename point_type::type point_type; - - typedef typename geometry::rescale_policy_type - < - point_type, - CSTag - >::type rescale_policy_type; + using point_type = point_type_t; public: - typedef detail::overlay::turn_info + using turn_type = detail::overlay::turn_info < point_type, - typename segment_ratio_type - < - point_type, - rescale_policy_type - >::type - > turn_type; + typename segment_ratio_type::type + >; // returns true if all turns are valid template @@ -74,9 +62,6 @@ class has_valid_self_turns { boost::ignore_unused(visitor); - rescale_policy_type robust_policy - = geometry::get_rescale_policy(geometry, strategy); - detail::overlay::stateless_predicate_based_interrupt_policy < is_acceptable_turn @@ -86,7 +71,7 @@ class has_valid_self_turns detail::self_get_turn_points::self_turns < false, detail::overlay::assign_null_policy - >(geometry, strategy, robust_policy, turns, interrupt_policy, + >(geometry, strategy, turns, interrupt_policy, 0, true); if (interrupt_policy.has_intersections) diff --git a/include/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp b/include/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp index 5af933de..5bf5e733 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -104,8 +103,8 @@ class is_valid_multipolygon } } - typedef geometry::model::box::type> box_type; - typedef typename base::template partition_item item_type; + using box_type = geometry::model::box>; + using item_type = typename base::template partition_item; // put polygon iterators without turns in a vector std::vector polygon_iterators; @@ -124,7 +123,7 @@ class is_valid_multipolygon geometry::partition < - geometry::model::box::type> + geometry::model::box> >::apply(polygon_iterators, item_visitor, typename base::template expand_box(strategy), typename base::template overlaps_box(strategy)); diff --git a/include/boost/geometry/algorithms/detail/is_valid/pointlike.hpp b/include/boost/geometry/algorithms/detail/is_valid/pointlike.hpp index c0cf239c..f4523454 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/pointlike.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/pointlike.hpp @@ -1,7 +1,8 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2020, Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2020, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -20,7 +21,7 @@ #include #include -#include +#include namespace boost { namespace geometry @@ -63,21 +64,21 @@ struct is_valid { boost::ignore_unused(multipoint, visitor); - if (BOOST_GEOMETRY_CONDITION( - AllowEmptyMultiGeometries || !boost::empty(multipoint))) - { - // we allow empty multi-geometries, so an empty multipoint - // is considered valid - return ! detail::is_valid::has_invalid_coordinate - < - MultiPoint - >::apply(multipoint, visitor); - } - else + if BOOST_GEOMETRY_CONSTEXPR (! AllowEmptyMultiGeometries) { - // we do not allow an empty multipoint - return visitor.template apply(); + if (boost::empty(multipoint)) + { + // we do not allow an empty multipoint + return visitor.template apply(); + } } + + // if we allow empty multi-geometries, an empty multipoint + // is considered valid + return ! detail::is_valid::has_invalid_coordinate + < + MultiPoint + >::apply(multipoint, visitor); } }; diff --git a/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp b/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp index 39512ad1..a02ce319 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp @@ -305,8 +305,8 @@ class is_valid_polygon ring_indices.insert(tit->operations[1].seg_id.ring_index); } - typedef geometry::model::box::type> box_type; - typedef partition_item item_type; + using box_type = geometry::model::box>; + using item_type = partition_item; // put iterators for interior rings without turns in a vector std::vector ring_iterators; @@ -450,42 +450,44 @@ class is_valid_polygon { return true; } + else // else prevents unreachable code warning + { + // compute turns and check if all are acceptable + typedef debug_validity_phase debug_phase; + debug_phase::apply(3); - // compute turns and check if all are acceptable - typedef debug_validity_phase debug_phase; - debug_phase::apply(3); - - typedef has_valid_self_turns has_valid_turns; + typedef has_valid_self_turns has_valid_turns; - std::deque turns; - bool has_invalid_turns - = ! has_valid_turns::apply(polygon, turns, visitor, strategy); - debug_print_turns(turns.begin(), turns.end()); + std::deque turns; + bool has_invalid_turns + = ! has_valid_turns::apply(polygon, turns, visitor, strategy); + debug_print_turns(turns.begin(), turns.end()); - if (has_invalid_turns) - { - return false; - } + if (has_invalid_turns) + { + return false; + } - // check if all interior rings are inside the exterior ring - debug_phase::apply(4); + // check if all interior rings are inside the exterior ring + debug_phase::apply(4); - if (! has_holes_inside::apply(polygon, - turns.begin(), turns.end(), - visitor, - strategy)) - { - return false; - } + if (! has_holes_inside::apply(polygon, + turns.begin(), turns.end(), + visitor, + strategy)) + { + return false; + } - // check whether the interior of the polygon is a connected set - debug_phase::apply(5); + // check whether the interior of the polygon is a connected set + debug_phase::apply(5); - return has_connected_interior::apply(polygon, - turns.begin(), - turns.end(), - visitor, - strategy); + return has_connected_interior::apply(polygon, + turns.begin(), + turns.end(), + visitor, + strategy); + } } }; diff --git a/include/boost/geometry/algorithms/detail/is_valid/ring.hpp b/include/boost/geometry/algorithms/detail/is_valid/ring.hpp index e34f02f7..810b94a4 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/ring.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/ring.hpp @@ -15,6 +15,8 @@ #include +#include + #include #include @@ -38,12 +40,11 @@ #include #include -// TEMP - with UmberllaStrategy this will be not needed +// TEMP - with UmbrellaStrategy this will be not needed #include #include // TODO: use point_order instead of area - #ifdef BOOST_GEOMETRY_TEST_DEBUG #include #endif diff --git a/include/boost/geometry/algorithms/detail/is_valid/segment.hpp b/include/boost/geometry/algorithms/detail/is_valid/segment.hpp index b1d27daf..a2a6f061 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/segment.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/segment.hpp @@ -49,7 +49,7 @@ struct is_valid { boost::ignore_unused(visitor); - typename point_type::type p[2]; + point_type_t p[2]; detail::assign_point_from_index<0>(segment, p[0]); detail::assign_point_from_index<1>(segment, p[1]); diff --git a/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp b/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp index a21ee983..03b48134 100644 --- a/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp @@ -1,10 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014-2020. -// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -29,7 +30,7 @@ #include -#include +#include #include @@ -42,48 +43,22 @@ namespace detail { namespace overlay { // TODO: move this / rename this -template +template inline bool points_equal_or_close(Point1 const& point1, Point2 const& point2, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) { if (detail::equals::equals_point_point(point1, point2, strategy)) { return true; } - - if (BOOST_GEOMETRY_CONDITION(! RobustPolicy::enabled)) - { - return false; - } - - // Try using specified robust policy - typedef typename geometry::robust_point_type - < - Point1, - RobustPolicy - >::type robust_point_type; - - robust_point_type point1_rob, point2_rob; - geometry::recalculate(point1_rob, point1, robust_policy); - geometry::recalculate(point2_rob, point2, robust_policy); - - // Only if this is the case the same strategy can be used. - BOOST_STATIC_ASSERT((std::is_same - < - typename geometry::cs_tag::type, - typename geometry::cs_tag::type - >::value)); - - return detail::equals::equals_point_point(point1_rob, point2_rob, strategy); + return false; } -template +template inline void append_no_dups_or_spikes(Range& range, Point const& point, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) { #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION std::cout << " add: (" @@ -94,13 +69,12 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point, // for geometries >= 3 points. // So we have to check the first potential duplicate differently if ( boost::size(range) == 1 - && points_equal_or_close(*(boost::begin(range)), point, strategy, - robust_policy) ) + && points_equal_or_close(*(boost::begin(range)), point, strategy) ) { return; } - auto append = [](auto& r, const auto& p) + auto append = [](auto& r, auto const& p) { using point_t = typename boost::range_value::type; point_t rp; @@ -120,8 +94,8 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point, && point_is_spike_or_equal(point, *(boost::end(range) - 3), *(boost::end(range) - 2), - strategy.side(), // TODO: Pass strategy? - robust_policy)) + strategy.side() // TODO: Pass strategy? + )) { // Use the Concept/traits, so resize and append again traits::resize::apply(range, boost::size(range) - 2); @@ -129,10 +103,9 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point, } } -template +template inline void append_no_collinear(Range& range, Point const& point, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) { // Stricter version, not allowing any point in a linear row // (spike, continuation or same point) @@ -142,8 +115,7 @@ inline void append_no_collinear(Range& range, Point const& point, // So we have to check the first potential duplicate differently if ( boost::size(range) == 1 && points_equal_or_close(*(boost::begin(range)), point, - strategy, - robust_policy) ) + strategy) ) { return; } @@ -159,8 +131,8 @@ inline void append_no_collinear(Range& range, Point const& point, && point_is_collinear(point, *(boost::end(range) - 3), *(boost::end(range) - 2), - strategy.side(), // TODO: Pass strategy? - robust_policy)) + strategy.side() // TODO: Pass strategy? + )) { // Use the Concept/traits, so resize and append again traits::resize::apply(range, boost::size(range) - 2); @@ -168,56 +140,63 @@ inline void append_no_collinear(Range& range, Point const& point, } } -template -inline void clean_closing_dups_and_spikes(Range& range, - Strategy const& strategy, - RobustPolicy const& robust_policy) +// Should only be called internally, from traverse. +template +inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy) { - std::size_t const minsize - = core_detail::closure::minimum_ring_size - < - geometry::closure::value - >::value; - - if (boost::size(range) <= minsize) + // It assumes a closed ring (whatever the closure value) + constexpr std::size_t min_size + = core_detail::closure::minimum_ring_size + < + geometry::closed + >::value; + + if (boost::size(ring) < min_size) { + // Don't act on too small rings. return; } - static bool const closed = geometry::closure::value == geometry::closed; - -// TODO: the following algorithm could be rewritten to first look for spikes -// and then erase some number of points from the beginning of the Range - bool found = false; do { found = false; - auto first = boost::begin(range); - auto second = first + 1; - auto ultimate = boost::end(range) - 1; - if (BOOST_GEOMETRY_CONDITION(closed)) - { - ultimate--; - } + auto const first = boost::begin(ring); + auto const second = first + 1; + auto const penultimate = boost::end(ring) - 2; // Check if closing point is a spike (this is so if the second point is // considered as collinear w.r.t. the last segment) - if (point_is_collinear(*second, *ultimate, *first, - strategy.side(), // TODO: Pass strategy? - robust_policy)) + if (point_is_collinear(*second, *penultimate, *first, + strategy.side() // TODO: Pass strategy? + )) { - range::erase(range, first); - if (BOOST_GEOMETRY_CONDITION(closed)) - { - // Remove closing last point - range::resize(range, boost::size(range) - 1); - // Add new closing point - range::push_back(range, range::front(range)); - } + // Remove first point and last point + range::erase(ring, first); + range::resize(ring, boost::size(ring) - 1); + // Close the ring again + range::push_back(ring, range::front(ring)); + found = true; } - } while(found && boost::size(range) > minsize); + } while (found && boost::size(ring) >= min_size); +} + +template +inline void fix_closure(Ring& ring, Strategy const& strategy) +{ + if BOOST_GEOMETRY_CONSTEXPR (geometry::closure::value == geometry::open) + { + if (! boost::empty(ring) + && detail::equals::equals_point_point(range::front(ring), range::back(ring), strategy)) + { + // Correct closure: traversal automatically closes rings. + // Depending on the geometric configuration, + // remove_spikes_at_closure can remove the closing point. + // But it does not always do that. Therefore it is corrected here explicitly. + range::resize(ring, boost::size(ring) - 1); + } + } } diff --git a/include/boost/geometry/algorithms/detail/overlay/approximately_equals.hpp b/include/boost/geometry/algorithms/detail/overlay/approximately_equals.hpp index 1f41085d..f41996f1 100644 --- a/include/boost/geometry/algorithms/detail/overlay/approximately_equals.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/approximately_equals.hpp @@ -21,6 +21,31 @@ namespace boost { namespace geometry namespace detail { namespace overlay { +// Value for approximately_equals used by get_cluster and sort_by_side +// This is an "epsilon_multiplier" and, therefore, multiplied the epsilon +// belonging to the used floating point type with this value. +template +struct common_approximately_equals_epsilon_multiplier +{ + static T value() + { + // The value is (a bit) arbitrary. For sort_by_side it should be large + // enough to not take a point which is too close by, to calculate the + // side value correctly. For get_cluster it is arbitrary as well, points + // close to each other should form a cluster, which is also important + // for subsequent side calculations. Points too far apart should not be + // clustered. + // + // The value of 100 is currently considered as a sweet spot. + // If the value changes (as of 2023-09-13): + // 10: too small, failing unit test(s): + // - union: issue_1108 + // 50: this would be fine, no tests failing + // 1000: this would be fine, no tests failing + return T(100); + } +}; + template inline bool approximately_equals(Point1 const& a, Point2 const& b, E const& epsilon_multiplier) diff --git a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp index fb3ee1be..73e3bdb2 100644 --- a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp @@ -27,10 +27,10 @@ #include #include #include +#include #include -#include namespace boost { namespace geometry { @@ -271,25 +271,28 @@ inline void assign_parents(Geometry1 const& geometry1, std::size_t index_positive = 0; // only used if count_positive>0 // Copy to vector (this might be obsolete, using the map directly) + // The index in the map is also the index in the vector. using helper = ring_info_helper; std::vector vector(count_total); - for_each_with_index(ring_map, [&](std::size_t index, auto const& pair) + for (auto const& enumerated : util::enumerate(ring_map)) { - vector[index] = helper(pair.first, pair.second.get_area()); - helper& item = vector[index]; - switch(pair.first.source_index) + auto const& ring_id = enumerated.value.first; + auto const& info = enumerated.value.second; + vector[enumerated.index] = helper(ring_id, info.get_area()); + helper& item = vector[enumerated.index]; + switch(ring_id.source_index) { case 0 : - geometry::envelope(get_ring::apply(pair.first, geometry1), + geometry::envelope(get_ring::apply(ring_id, geometry1), item.envelope, strategy); break; case 1 : - geometry::envelope(get_ring::apply(pair.first, geometry2), + geometry::envelope(get_ring::apply(ring_id, geometry2), item.envelope, strategy); break; case 2 : - geometry::envelope(get_ring::apply(pair.first, collection), + geometry::envelope(get_ring::apply(ring_id, collection), item.envelope, strategy); break; } @@ -300,9 +303,9 @@ inline void assign_parents(Geometry1 const& geometry1, if (item.real_area > 0) { count_positive++; - index_positive = index; + index_positive = enumerated.index; } - }); + } if (! check_for_orientation) { @@ -323,15 +326,16 @@ inline void assign_parents(Geometry1 const& geometry1, // located outside the outer ring, this cannot be done ring_identifier id_of_positive = vector[index_positive].id; ring_info_type& outer = ring_map[id_of_positive]; - for_each_with_index(vector, [&](std::size_t index, auto const& item) + for (auto const& item : util::enumerate(vector)) { - if (index != index_positive) + if (item.index != index_positive) { - ring_info_type& inner = ring_map[item.id]; + auto const id = item.value.id; + ring_info_type& inner = ring_map[id]; inner.parent = id_of_positive; - outer.children.push_back(item.id); + outer.children.push_back(id); } - }); + } return; } } @@ -362,7 +366,7 @@ inline void assign_parents(Geometry1 const& geometry1, } else if (info.parent.source_index >= 0) { - const ring_info_type& parent = ring_map[info.parent]; + ring_info_type const& parent = ring_map[info.parent]; bool const pos = math::larger(info.get_area(), 0); bool const parent_pos = math::larger(parent.area, 0); diff --git a/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp b/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp index 49d190bd..2f8e6314 100644 --- a/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -20,7 +21,6 @@ #include #include -#include #include #include #if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) @@ -107,7 +107,6 @@ public : typename Operation, typename Rings, typename Ring, typename Turns, typename Strategy, - typename RobustPolicy, typename Visitor > static inline void apply(std::size_t size_at_start, @@ -120,7 +119,6 @@ public : Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy, - RobustPolicy const& robust_policy, state_type& state, Visitor& visitor) { @@ -132,8 +130,8 @@ public : if (! state.m_checked) { state.m_checked = true; - has_self_intersections(geometry1, strategy, robust_policy); - has_self_intersections(geometry2, strategy, robust_policy); + has_self_intersections(geometry1, strategy); + has_self_intersections(geometry2, strategy); } // Make bad output clean diff --git a/include/boost/geometry/algorithms/detail/overlay/check_enrich.hpp b/include/boost/geometry/algorithms/detail/overlay/check_enrich.hpp index ad3bd6bd..21954941 100644 --- a/include/boost/geometry/algorithms/detail/overlay/check_enrich.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/check_enrich.hpp @@ -26,6 +26,7 @@ #include #include +#include namespace boost { namespace geometry @@ -122,17 +123,17 @@ inline void check_detailed(MetaTurns& meta_turns, MetaTurn const& meta_turn, template -inline bool check_graph(TurnPoints& turn_points, operation_type for_operation) +inline bool check_graph(TurnPoints const& turn_points, operation_type for_operation) { - typedef typename boost::range_value::type turn_point_type; + using turn_point_type = typename boost::range_value::type; bool error = false; std::vector > meta_turns; - for_each_with_index(turn_points, [&](std::size_t index, auto const& point) + for (auto const& item : util::enumerate(turn_points)) { - meta_turns.push_back(meta_turn(index, point)); - }); + meta_turns.push_back(meta_turn(item.index, item.value)); + } int cycle = 0; for (auto& meta_turn : meta_turns) diff --git a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp index 2eb70aa7..e598dcfe 100644 --- a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015-2020. -// Modifications copyright (c) 2015-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -180,20 +180,18 @@ template typename OutputLinestring, typename OutputIterator, typename Range, - typename RobustPolicy, typename Box, typename Strategy > OutputIterator clip_range_with_box(Box const& b, Range const& range, - RobustPolicy const&, - OutputIterator out, Strategy const& strategy) + OutputIterator out, Strategy const& strategy) { if (boost::begin(range) == boost::end(range)) { return out; } - typedef typename point_type::type point_type; + using point_type = point_type_t; OutputLinestring line_out; diff --git a/include/boost/geometry/algorithms/detail/overlay/cluster_exits.hpp b/include/boost/geometry/algorithms/detail/overlay/cluster_exits.hpp deleted file mode 100644 index 8c4f4c7f..00000000 --- a/include/boost/geometry/algorithms/detail/overlay/cluster_exits.hpp +++ /dev/null @@ -1,232 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2020 Barend Gehrels, Amsterdam, the Netherlands. - -// This file was modified by Oracle on 2020-2023. -// Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. -// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CLUSTER_EXITS_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CLUSTER_EXITS_HPP - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) \ - || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) \ - || defined(BOOST_GEOMETRY_DEBUG_TRAVERSE) -# include -# include -# include -#endif - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - -// Structure to check relatively simple cluster cases -template -struct cluster_exits -{ -private : - static const operation_type target_operation = operation_from_overlay::value; - typedef typename boost::range_value::type turn_type; - typedef typename turn_type::turn_operation_type turn_operation_type; - - struct linked_turn_op_info - { - explicit linked_turn_op_info(signed_size_type ti = -1, int oi = -1, - signed_size_type nti = -1) - : turn_index(ti) - , op_index(oi) - , next_turn_index(nti) - , rank_index(-1) - {} - - signed_size_type turn_index; - int op_index; - signed_size_type next_turn_index; - signed_size_type rank_index; - }; - - inline signed_size_type get_rank(Sbs const& sbs, - linked_turn_op_info const& info) const - { - for (auto const& rp : sbs.m_ranked_points) - { - if (rp.turn_index == info.turn_index - && rp.operation_index == info.op_index - && rp.direction == sort_by_side::dir_to) - { - return rp.rank; - } - } - return -1; - } - - std::set const& m_ids; - std::vector possibilities; - std::vector blocked; - - bool m_valid; - - bool collect(Turns const& turns) - { - for (auto cluster_turn_index : m_ids) - { - turn_type const& cluster_turn = turns[cluster_turn_index]; - if (cluster_turn.discarded) - { - continue; - } - if (cluster_turn.both(target_operation)) - { - // Not (yet) supported, can be cluster of u/u turns - return false; - } - for (int i = 0; i < 2; i++) - { - turn_operation_type const& op = cluster_turn.operations[i]; - turn_operation_type const& other_op = cluster_turn.operations[1 - i]; - signed_size_type const ni = op.enriched.get_next_turn_index(); - - if (op.operation == target_operation - || op.operation == operation_continue) - { - if (ni == cluster_turn_index) - { - // Not (yet) supported, traveling to itself, can be - // hole - return false; - } - possibilities.push_back( - linked_turn_op_info(cluster_turn_index, i, ni)); - } - else if (op.operation == operation_blocked - && ! (ni == other_op.enriched.get_next_turn_index()) - && m_ids.count(ni) == 0) - { - // Points to turn, not part of this cluster, - // and that way is blocked. But if the other operation - // points at the same turn, it is still fine. - blocked.push_back( - linked_turn_op_info(cluster_turn_index, i, ni)); - } - } - } - return true; - } - - bool check_blocked(Sbs const& sbs) - { - if (blocked.empty()) - { - return true; - } - - for (auto& info : possibilities) - { - info.rank_index = get_rank(sbs, info); - } - for (auto& info : blocked) - { - info.rank_index = get_rank(sbs, info); - } - - for (auto const& lti : possibilities) - { - for (auto const& blti : blocked) - { - if (blti.next_turn_index == lti.next_turn_index - && blti.rank_index == lti.rank_index) - { - return false; - } - } - } - return true; - } - -public : - cluster_exits(Turns const& turns, - std::set const& ids, - Sbs const& sbs) - : m_ids(ids) - , m_valid(collect(turns) && check_blocked(sbs)) - { - } - - inline bool apply(signed_size_type& turn_index, - int& op_index, - bool first_run = true) const - { - if (! m_valid) - { - return false; - } - - // Traversal can either enter the cluster in the first turn, - // or it can start halfway. - // If there is one (and only one) possibility pointing outside - // the cluster, take that one. - linked_turn_op_info target; - for (auto const& lti : possibilities) - { - if (m_ids.count(lti.next_turn_index) == 0) - { - if (target.turn_index >= 0 - && target.next_turn_index != lti.next_turn_index) - { - // Points to different target - return false; - } - if (first_run - && BOOST_GEOMETRY_CONDITION(OverlayType == overlay_buffer) - && target.turn_index >= 0) - { - // Target already assigned, so there are more targets - // or more ways to the same target - return false; - } - - target = lti; - } - } - if (target.turn_index < 0) - { - return false; - } - - turn_index = target.turn_index; - op_index = target.op_index; - - return true; - } -}; - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CLUSTER_EXITS_HPP diff --git a/include/boost/geometry/algorithms/detail/overlay/cluster_info.hpp b/include/boost/geometry/algorithms/detail/overlay/cluster_info.hpp index 19343488..dae519c1 100644 --- a/include/boost/geometry/algorithms/detail/overlay/cluster_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/cluster_info.hpp @@ -27,11 +27,11 @@ struct cluster_info std::set turn_indices; //! Number of open spaces (e.g. 2 for touch) - std::size_t open_count; + std::size_t open_count{0}; - inline cluster_info() - : open_count(0) - {} + //! Number of spikes, where a segment goes to the cluster point + //! and leaves immediately in the opposite direction. + std::size_t spike_count{0}; }; diff --git a/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp b/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp index 06d6e7bd..6d04f0a0 100644 --- a/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp @@ -62,14 +62,14 @@ struct cluster_colocator { CoordinateType centroid_0 = 0; CoordinateType centroid_1 = 0; - for (const auto& index : indices) + for (auto const& index : indices) { centroid_0 += geometry::get<0>(turns[index].point); centroid_1 += geometry::get<1>(turns[index].point); } centroid_0 /= indices.size(); centroid_1 /= indices.size(); - for (const auto& index : indices) + for (auto const& index : indices) { geometry::set<0>(turns[index].point, centroid_0); geometry::set<1>(turns[index].point, centroid_1); @@ -86,14 +86,14 @@ inline void colocate_clusters(Clusters const& clusters, Turns& turns) { for (auto const& pair : clusters) { - auto const& indices = pair.second.turn_indices; - if (indices.size() < 2) + auto const& turn_indices = pair.second.turn_indices; + if (turn_indices.size() < 2) { // Defensive check continue; } - using point_t = decltype(turns[*indices.begin()].point); - cluster_colocator::apply(indices, turns); + using point_t = decltype(turns[*turn_indices.begin()].point); + cluster_colocator::apply(turn_indices, turns); } } diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index 8280a250..ad5d2f5c 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -115,7 +115,7 @@ struct copy_segment_point_box SegmentIdentifier const& seg_id, signed_size_type offset, PointOut& point) { - std::array::type, 4> bp; + std::array, 4> bp; assign_box_corners_oriented(box, bp); signed_size_type const target = circular_offset(4, seg_id.segment_index, offset); diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index 545bdc03..f6a70648 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014-2021. -// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -62,14 +63,12 @@ struct copy_segments_ring typename Ring, typename SegmentIdentifier, typename Strategy, - typename RobustPolicy, typename RangeOut > static inline void apply(Ring const& ring, SegmentIdentifier const& seg_id, signed_size_type to_index, Strategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& current_output) { using view_type = detail::closed_clockwise_view @@ -108,7 +107,7 @@ struct copy_segments_ring for (signed_size_type i = 0; i < count; ++i, ++it) { - detail::overlay::append_no_dups_or_spikes(current_output, *it, strategy, robust_policy); + detail::overlay::append_no_dups_or_spikes(current_output, *it, strategy); } } }; @@ -118,24 +117,21 @@ class copy_segments_linestring { private: // remove spikes - template + template static inline void append_to_output(RangeOut& current_output, Point const& point, Strategy const& strategy, - RobustPolicy const& robust_policy, std::true_type const&) { detail::overlay::append_no_dups_or_spikes(current_output, point, - strategy, - robust_policy); + strategy); } // keep spikes - template + template static inline void append_to_output(RangeOut& current_output, Point const& point, Strategy const& strategy, - RobustPolicy const&, std::false_type const&) { detail::overlay::append_no_duplicates(current_output, point, strategy); @@ -147,14 +143,12 @@ class copy_segments_linestring typename LineString, typename SegmentIdentifier, typename SideStrategy, - typename RobustPolicy, typename RangeOut > static inline void apply(LineString const& ls, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& current_output) { signed_size_type const from_index = seg_id.segment_index + 1; @@ -171,7 +165,7 @@ class copy_segments_linestring auto it = boost::begin(ls) + from_index; for (signed_size_type i = 0; i < count; ++i, ++it) { - append_to_output(current_output, *it, strategy, robust_policy, + append_to_output(current_output, *it, strategy, std::integral_constant()); } } @@ -185,14 +179,12 @@ struct copy_segments_polygon typename Polygon, typename SegmentIdentifier, typename SideStrategy, - typename RobustPolicy, typename RangeOut > static inline void apply(Polygon const& polygon, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& current_output) { // Call ring-version with the right ring @@ -203,7 +195,6 @@ struct copy_segments_polygon : range::at(geometry::interior_rings(polygon), seg_id.ring_index), seg_id, to_index, strategy, - robust_policy, current_output ); } @@ -218,14 +209,12 @@ struct copy_segments_box typename Box, typename SegmentIdentifier, typename SideStrategy, - typename RobustPolicy, typename RangeOut > static inline void apply(Box const& box, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& current_output) { signed_size_type index = seg_id.segment_index + 1; @@ -236,7 +225,7 @@ struct copy_segments_box : 5 - index + to_index + 1; // Create array of points, the fifth one closes it - std::array::type, 5> bp; + std::array, 5> bp; assign_box_corners_oriented(box, bp); bp[4] = bp[0]; @@ -245,7 +234,7 @@ struct copy_segments_box for (signed_size_type i = 0; i < count; i++, index++) { detail::overlay::append_no_dups_or_spikes(current_output, - bp[index % 5], strategy, robust_policy); + bp[index % 5], strategy); } } @@ -260,14 +249,12 @@ struct copy_segments_multi typename MultiGeometry, typename SegmentIdentifier, typename SideStrategy, - typename RobustPolicy, typename RangeOut > static inline void apply(MultiGeometry const& multi_geometry, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& current_output) { @@ -281,7 +268,6 @@ struct copy_segments_multi Policy::apply(range::at(multi_geometry, seg_id.multi_index), seg_id, to_index, strategy, - robust_policy, current_output); } }; @@ -351,14 +337,12 @@ template typename Geometry, typename SegmentIdentifier, typename SideStrategy, - typename RobustPolicy, typename RangeOut > inline void copy_segments(Geometry const& geometry, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, - RobustPolicy const& robust_policy, RangeOut& range_out) { concepts::check(); @@ -367,7 +351,7 @@ inline void copy_segments(Geometry const& geometry, < typename tag::type, Reverse - >::apply(geometry, seg_id, to_index, strategy, robust_policy, range_out); + >::apply(geometry, seg_id, to_index, strategy, range_out); } diff --git a/include/boost/geometry/algorithms/detail/overlay/discard_duplicate_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/discard_duplicate_turns.hpp index 258a815f..3c1ef5f3 100644 --- a/include/boost/geometry/algorithms/detail/overlay/discard_duplicate_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/discard_duplicate_turns.hpp @@ -14,9 +14,11 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DISCARD_DUPLICATE_TURNS_HPP #include +#include #include #include +#include namespace boost { namespace geometry { @@ -88,10 +90,109 @@ inline bool corresponding_turn(Turn const& turn, Turn const& start_turn, return count == 2; } +// Verify turns (other than start, and cross) if they are present in the map, and if so, +// if they have the other turns as corresponding, discard the start turn. +template +void discard_duplicate_start_turns(Turns& turns, + TurnBySegmentMap const& start_turns_by_segment, + Geometry0 const& geometry0, + Geometry1 const& geometry1) +{ + using multi_and_ring_id_type = std::pair; + auto adapt_id = [](segment_identifier const& seg_id) + { + return multi_and_ring_id_type{seg_id.multi_index, seg_id.ring_index}; + }; + + for (auto& turn : turns) + { + // Any turn which "crosses" does not have a corresponding turn. + // Also avoid comparing "start" with itself + if (turn.method == method_crosses || turn.method == method_start) + { + continue; + } + bool const is_touch = turn.method == method_touch; + for (auto const& op : turn.operations) + { + auto it = start_turns_by_segment.find(adapt_id(op.seg_id)); + if (it == start_turns_by_segment.end()) + { + continue; + } + for (std::size_t const& i : it->second) + { + auto& start_turn = turns[i]; + if (start_turn.cluster_id == turn.cluster_id + && corresponding_turn(turn, start_turn, geometry0, geometry1)) + { + // Discard the start turn, unless there is a touch before. + // In that case the start is used and the touch is discarded. + (is_touch ? turn : start_turn).discarded = true; + } + } + } + } +} + +// Discard turns for the following (rare) case: +// - they are consecutive +// - the first has a touch, the second a touch_interior +// And then one of the segments touches the others next in the middle. +// This is geometrically not possible, and caused by floating point precision. +// Discard the second (touch interior) +template +void discard_touch_touch_interior_turns(Turns& turns, + Geometry0 const& geometry0, + Geometry1 const& geometry1) +{ + for (auto& current_turn : turns) + { + if (current_turn.method != method_touch_interior) + { + // Because touch_interior is a rarer case, it is more efficient to start with that + continue; + } + for (auto const& previous_turn : turns) + { + if (previous_turn.method != method_touch) + { + continue; + } + + // Compare 0 with 0 and 1 with 1 + // Note that 0 has always source 0 and 1 has always source 1 + // (not in buffer). Therefore this comparison is OK. + // MAYBE we need to check for buffer. + bool const common0 = current_turn.operations[0].seg_id == previous_turn.operations[0].seg_id; + bool const common1 = current_turn.operations[1].seg_id == previous_turn.operations[1].seg_id; + + // If one of the operations is common, and the other is not, then there is one comment segment. + bool const has_common_segment = common0 != common1; + + if (! has_common_segment) + { + continue; + } + + // If the second index (1) is common, we need to check consecutivity of the first index (0) + // and vice versa. + bool const consecutive = + common1 ? is_consecutive(previous_turn.operations[0].seg_id, current_turn.operations[0].seg_id, geometry0, geometry1) + : is_consecutive(previous_turn.operations[1].seg_id, current_turn.operations[1].seg_id, geometry0, geometry1); + + if (consecutive) + { + current_turn.discarded = true; + } + } + } +} + template -inline void discard_duplicate_start_turns(Turns& turns, - Geometry0 const& geometry0, - Geometry1 const& geometry1) +void discard_duplicate_turns(Turns& turns, + Geometry0 const& geometry0, + Geometry1 const& geometry1) { // Start turns are generated, in case the previous turn is missed. // But often it is not missed, and then it should be deleted. @@ -99,54 +200,49 @@ inline void discard_duplicate_start_turns(Turns& turns, // (in float, collinear, points far apart due to floating point precision) // [m, i s:0, v:6 1/1 (1) // u s:1, v:5 pnt (2.54044, 3.12623)] // [s, i s:0, v:7 0/1 (0) // u s:1, v:5 pnt (2.70711, 3.29289)] + // + // Also, if two turns are consecutive, and one is touch and the other touch_interior, + // the touch_interior is discarded. using multi_and_ring_id_type = std::pair; - auto adapt_id = [](segment_identifier const& seg_id) + auto add_to_map = [](auto const& turn, auto& map, std::size_t index) { - return multi_and_ring_id_type{seg_id.multi_index, seg_id.ring_index}; + auto adapt_id = [](segment_identifier const& seg_id) + { + return multi_and_ring_id_type{seg_id.multi_index, seg_id.ring_index}; + }; + for (auto const& op : turn.operations) + { + map[adapt_id(op.seg_id)].insert(index); + } }; - // 1 Build map of start turns (multi/ring-id -> turn indices) - std::map> start_turns_per_segment; - std::size_t index = 0; - for (auto const& turn : turns) + // Build map of start turns (multi/ring-id -> turn indices) + // and count touch and touch_interior turns (to verify if later checks are needed) + std::map> start_turns_by_segment; + std::size_t touch_count = 0; + std::size_t touch_interior_count = 0; + for (auto const& item : util::enumerate(turns)) { - if (turn.method == method_start) + auto const& turn = item.value; + switch(turn.method) { - for (const auto& op : turn.operations) - { - start_turns_per_segment[adapt_id(op.seg_id)].push_back(index); - } + case method_start: add_to_map(turn, start_turns_by_segment, item.index); break; + case method_touch: touch_count++; break; + case method_touch_interior: touch_interior_count++; break; + default: break; } - index++; } - // 2: Verify all other turns if they are present in the map, and if so, - // if they have the other turns as corresponding - for (auto const& turn : turns) + if (!start_turns_by_segment.empty()) { - // Any turn which "crosses" does not have a corresponding turn. - // Also avoid comparing "start" with itself. - if (turn.method != method_crosses && turn.method != method_start) - { - for (const auto& op : turn.operations) - { - auto it = start_turns_per_segment.find(adapt_id(op.seg_id)); - if (it != start_turns_per_segment.end()) - { - for (std::size_t const& i : it->second) - { - if (corresponding_turn(turn, turns[i], - geometry0, geometry1)) - { - turns[i].discarded = true; - } - } - } - } - } - index++; + discard_duplicate_start_turns(turns, start_turns_by_segment, geometry0, geometry1); + } + + if (touch_count > 0 && touch_interior_count > 0) + { + discard_touch_touch_interior_turns(turns, geometry0, geometry1); } } diff --git a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp index b94bba6c..215a5329 100644 --- a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2021. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -34,18 +35,16 @@ #include #include +#include #include #include #include #include #include #include -#include -#include +#include +#include -#ifdef BOOST_GEOMETRY_DEBUG_ENRICH -# include -#endif namespace boost { namespace geometry @@ -82,14 +81,12 @@ template typename Operations, typename Turns, typename Geometry1, typename Geometry2, - typename RobustPolicy, typename Strategy > inline void enrich_sort(Operations& operations, Turns const& turns, Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, Strategy const& strategy) { std::sort(std::begin(operations), @@ -99,76 +96,94 @@ inline void enrich_sort(Operations& operations, Turns, typename boost::range_value::type, Geometry1, Geometry2, - RobustPolicy, Strategy, Reverse1, Reverse2 - >(turns, geometry1, geometry2, robust_policy, strategy)); + >(turns, geometry1, geometry2, strategy)); } +// Assign travel-to-vertex/ip index for each turn. template inline void enrich_assign(Operations& operations, Turns& turns, - bool check_turns) + bool check_consecutive_turns) { - if (operations.empty()) - { - return; - } - - // Assign travel-to-vertex/ip index for each turning point. - // Iterator "next" is circular - - geometry::ever_circling_range_iterator next(operations); - ++next; - - for (auto const& indexed : operations) + for (auto const& item : util::enumerate(operations)) { + auto const& index = item.index; + auto const& indexed = item.value; auto& turn = turns[indexed.turn_index]; auto& op = turn.operations[indexed.operation_index]; - if (check_turns && indexed.turn_index == next->turn_index) + std::size_t next_index = index + 1 < operations.size() ? index + 1 : 0; + auto advance = [&operations](auto index) + { + std::size_t const result = index + 1; + return result >= operations.size() ? 0 : result; + }; + + auto next_turn = [&operations, &turns, &next_index]() + { + return turns[operations[next_index].turn_index]; + }; + auto next_operation = [&operations, &turns, &next_index]() { - // Normal behaviour: next points at next turn, increase next. - // For dissolve this should not be done, turn_index is often - // the same for two consecutive operations - ++next; + auto const& next_turn = turns[operations[next_index].turn_index]; + return next_turn.operations[operations[next_index].operation_index]; + }; + + if (check_consecutive_turns + && indexed.turn_index == operations[next_index].turn_index + && op.seg_id == next_operation().seg_id) + { + // If the two operations on the same turn are ordered consecutively, + // and they are on the same segment, then the turn where to travel to should + // be considered one further. Therefore next is increased. + // + // It often happens in buffer, in these configurations: + // +---->--+ + // | | + // | +->-*----> + // | | | + // ^ +-<-+ + // If the next index is not corrected, the small rectangle + // will be kept in the output. + + // This is a normal situation and occurs, for example, in every concave bend. + // In general it should always travel from turn to next turn. + // Only in some circumstances traveling to the same turn is necessary, for example + // if there is only one turn in the outer ring. + // + // (For dissolve this is not done, turn_index is often + // the same for two consecutive operations - but the conditions are changed + // and this should be verified again) + next_index = advance(next_index); } // Cluster behaviour: next should point after cluster, unless // their seg_ids are not the same // (For dissolve, this is still to be examined - TODO) while (turn.is_clustered() - && indexed.turn_index != next->turn_index - && turn.cluster_id == turns[next->turn_index].cluster_id - && op.seg_id == turns[next->turn_index].operations[next->operation_index].seg_id) + && turn.cluster_id == next_turn().cluster_id + && op.seg_id == next_operation().seg_id + && indexed.turn_index != operations[next_index].turn_index) { - ++next; + next_index = advance(next_index); } - auto const& next_turn = turns[next->turn_index]; - auto const& next_op = next_turn.operations[next->operation_index]; - op.enriched.travels_to_ip_index - = static_cast(next->turn_index); + = static_cast(operations[next_index].turn_index); op.enriched.travels_to_vertex_index - = next->subject->seg_id.segment_index; + = operations[next_index].subject->seg_id.segment_index; + auto const& next_op = next_operation(); if (op.seg_id.segment_index == next_op.seg_id.segment_index - && op.fraction < next_op.fraction) - { - // Next turn is located further on same segment - // assign next_ip_index - // (this is one not circular therefore fraction is considered) - op.enriched.next_ip_index = static_cast(next->turn_index); - } - - if (! check_turns) + && op.fraction < next_op.fraction) { - ++next; + // Next turn is located further on same segment: assign next_ip_index + op.enriched.next_ip_index = static_cast(operations[next_index].turn_index); } } - // DEBUG #ifdef BOOST_GEOMETRY_DEBUG_ENRICH for (auto const& indexed_op : operations) { @@ -185,12 +200,11 @@ inline void enrich_assign(Operations& operations, Turns& turns, << " nxt=" << op.enriched.next_ip_index << " / " << op.enriched.travels_to_ip_index << " [vx " << op.enriched.travels_to_vertex_index << "]" - << (turns[indexed_op.turn_index].discarded ? " discarded" : "") + << (turns[indexed_op.turn_index].discarded ? " [discarded]" : "") + << (op.enriched.startable ? "" : " [not startable]") << std::endl; } #endif - // END DEBUG - } template @@ -206,8 +220,10 @@ inline void enrich_adapt(Operations& operations, Turns& turns) bool next_phase = false; std::size_t previous_index = operations.size() - 1; - for_each_with_index(operations, [&](std::size_t index, auto const& indexed) + for (auto const& item : util::enumerate(operations)) { + auto const& index = item.index; + auto const& indexed = item.value; auto& turn = turns[indexed.turn_index]; auto& op = turn.operations[indexed.operation_index]; @@ -226,7 +242,7 @@ inline void enrich_adapt(Operations& operations, Turns& turns) } } previous_index = index; - }); + } if (! next_phase) { @@ -273,12 +289,16 @@ template inline void create_map(Turns const& turns, MappedVector& mapped_vector, IncludePolicy const& include_policy) { - for_each_with_index(turns, [&](std::size_t index, auto const& turn) + for (auto const& turn_item : util::enumerate(turns)) { + auto const& index = turn_item.index; + auto const& turn = turn_item.value; if (! turn.discarded) { - for_each_with_index(turn.operations, [&](std::size_t op_index, auto const& op) + for (auto const& op_item : util::enumerate(turn.operations)) { + auto const& op_index = op_item.index; + auto const& op = op_item.value; if (include_policy.include(op.operation)) { ring_identifier const ring_id @@ -292,9 +312,9 @@ inline void create_map(Turns const& turns, MappedVector& mapped_vector, index, op_index, op, turn.operations[1 - op_index].seg_id ); } - }); + } } - }); + } } template @@ -356,7 +376,6 @@ inline void calculate_remaining_distance(Turns& turns) \param clusters container containing clusters \param geometry1 \param_geometry \param geometry2 \param_geometry -\param robust_policy policy to handle robustness issues \param strategy point in geometry strategy */ template @@ -366,13 +385,11 @@ template typename Turns, typename Clusters, typename Geometry1, typename Geometry2, - typename RobustPolicy, typename IntersectionStrategy > inline void enrich_intersection_points(Turns& turns, Clusters& clusters, Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, IntersectionStrategy const& strategy) { constexpr detail::overlay::operation_type target_operation @@ -382,6 +399,7 @@ inline void enrich_intersection_points(Turns& turns, ? detail::overlay::operation_intersection : detail::overlay::operation_union; constexpr bool is_dissolve = OverlayType == overlay_dissolve; + constexpr bool is_buffer = OverlayType == overlay_buffer; using turn_type = typename boost::range_value::type; using indexed_turn_operation = detail::overlay::indexed_turn_operation @@ -395,16 +413,36 @@ inline void enrich_intersection_points(Turns& turns, std::vector >; - // From here on, turn indexes are used (in clusters, next_index, etc) - // and turns may not be DELETED - they may only be flagged as discarded - discard_duplicate_start_turns(turns, geometry1, geometry2); + // Turns are often used by index (in clusters, next_index, etc) + // and turns may therefore NOT be DELETED - they may only be flagged as discarded bool has_cc = false; - bool const has_colocations - = detail::overlay::handle_colocations + bool has_colocations = false; + + if BOOST_GEOMETRY_CONSTEXPR (! is_buffer) + { + // Handle colocations, gathering clusters and (below) their properties. + has_colocations = detail::overlay::handle_colocations + < + Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 + >(turns, clusters); + // Gather cluster properties (using even clusters with + // discarded turns - for open turns) + detail::overlay::gather_cluster_properties < - Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 - >(turns, clusters, robust_policy); + Reverse1, + Reverse2, + OverlayType + >(clusters, turns, target_operation, + geometry1, geometry2, strategy); + } + else + { + // For buffer, this was already done before calling enrich_intersection_points. + has_colocations = ! clusters.empty(); + } + + discard_duplicate_turns(turns, geometry1, geometry2); // Discard turns not part of target overlay for (auto& turn : turns) @@ -466,29 +504,13 @@ inline void enrich_intersection_points(Turns& turns, detail::overlay::enrich_sort( pair.second, turns, geometry1, geometry2, - robust_policy, strategy); -#ifdef BOOST_GEOMETRY_DEBUG_ENRICH - std::cout << "ENRICH-sort Ring " << pair.first << std::endl; - for (auto const& op : pair.second) - { - std::cout << op.turn_index << " " << op.operation_index << std::endl; - } -#endif + strategy); } if (has_colocations) { - // First gather cluster properties (using even clusters with - // discarded turns - for open turns), then clean up clusters - detail::overlay::gather_cluster_properties - < - Reverse1, - Reverse2, - OverlayType - >(clusters, turns, target_operation, - geometry1, geometry2, strategy.side()); // TODO: pass strategy - detail::overlay::cleanup_clusters(turns, clusters); + detail::overlay::colocate_clusters(clusters, turns); } // After cleaning up clusters assign the next turns @@ -512,9 +534,15 @@ inline void enrich_intersection_points(Turns& turns, } #ifdef BOOST_GEOMETRY_DEBUG_ENRICH - //detail::overlay::check_graph(turns, for_operation); + constexpr bool do_check_graph = true; +#else + constexpr bool do_check_graph = false; #endif + if BOOST_GEOMETRY_CONSTEXPR (do_check_graph) + { + detail::overlay::check_graph(turns, target_operation); + } } }} // namespace boost::geometry diff --git a/include/boost/geometry/algorithms/detail/overlay/follow.hpp b/include/boost/geometry/algorithms/detail/overlay/follow.hpp index d9456054..133f1c93 100644 --- a/include/boost/geometry/algorithms/detail/overlay/follow.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/follow.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014-2022. -// Modifications copyright (c) 2014-2022 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -220,8 +221,7 @@ struct action_selector typename LineString, typename Point, typename Operation, - typename Strategy, - typename RobustPolicy + typename Strategy > static inline void enter(LineStringOut& current_piece, LineString const& , @@ -229,7 +229,6 @@ struct action_selector signed_size_type , Point const& point, Operation const& operation, Strategy const& strategy, - RobustPolicy const& , OutputIterator& ) { // On enter, append the intersection point and remember starting point @@ -245,8 +244,7 @@ struct action_selector typename LineString, typename Point, typename Operation, - typename Strategy, - typename RobustPolicy + typename Strategy > static inline void leave(LineStringOut& current_piece, LineString const& linestring, @@ -254,7 +252,6 @@ struct action_selector signed_size_type index, Point const& point, Operation const& , Strategy const& strategy, - RobustPolicy const& robust_policy, OutputIterator& out) { // On leave, copy all segments from starting point, append the intersection point @@ -262,7 +259,7 @@ struct action_selector detail::copy_segments::copy_segments_linestring < false, RemoveSpikes - >::apply(linestring, segment_id, index, strategy, robust_policy, current_piece); + >::apply(linestring, segment_id, index, strategy, current_piece); detail::overlay::append_no_duplicates(current_piece, point, strategy); if (::boost::size(current_piece) > 1) { @@ -309,8 +306,7 @@ struct action_selector typename LineString, typename Point, typename Operation, - typename Strategy, - typename RobustPolicy + typename Strategy > static inline void enter(LineStringOut& current_piece, LineString const& linestring, @@ -318,11 +314,10 @@ struct action_selector signed_size_type index, Point const& point, Operation const& operation, Strategy const& strategy, - RobustPolicy const& robust_policy, OutputIterator& out) { normal_action::leave(current_piece, linestring, segment_id, index, - point, operation, strategy, robust_policy, out); + point, operation, strategy, out); } template @@ -332,8 +327,7 @@ struct action_selector typename LineString, typename Point, typename Operation, - typename Strategy, - typename RobustPolicy + typename Strategy > static inline void leave(LineStringOut& current_piece, LineString const& linestring, @@ -341,11 +335,10 @@ struct action_selector signed_size_type index, Point const& point, Operation const& operation, Strategy const& strategy, - RobustPolicy const& robust_policy, OutputIterator& out) { normal_action::enter(current_piece, linestring, segment_id, index, - point, operation, strategy, robust_policy, out); + point, operation, strategy, out); } template @@ -412,13 +405,11 @@ public : < typename Turns, typename OutputIterator, - typename RobustPolicy, typename Strategy > static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon, detail::overlay::operation_type , // TODO: this parameter might be redundant Turns& turns, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -464,7 +455,7 @@ public : entered = true; action::enter(current_piece, linestring, current_segment_id, op.seg_id.segment_index, turn.point, op, - strategy, robust_policy, + strategy, linear::get(out)); } else if (following::is_leaving(turn, op, entered, first, linestring, polygon, strategy)) @@ -474,7 +465,7 @@ public : entered = false; action::leave(current_piece, linestring, current_segment_id, op.seg_id.segment_index, turn.point, op, - strategy, robust_policy, + strategy, linear::get(out)); } else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints) @@ -499,7 +490,7 @@ public : >::apply(linestring, current_segment_id, static_cast(boost::size(linestring) - 1), - strategy, robust_policy, + strategy, current_piece); } diff --git a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp index 5d1577c4..1a6cd280 100644 --- a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2014-2020, Oracle and/or its affiliates. - +// Copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -212,9 +212,6 @@ class follow_linestring_linear OutputIterator oit, SideStrategy const& strategy) { - // We don't rescale linear/linear - detail::no_rescale_policy robust_policy; - if ( is_entering(*it, *op_it) ) { detail::turns::debug_turn(*it, *op_it, "-> Entering"); @@ -226,7 +223,7 @@ class follow_linestring_linear linestring, current_segment_id, op_it->seg_id.segment_index, - it->point, *op_it, strategy, robust_policy, + it->point, *op_it, strategy, linear::get(oit)); } ++enter_count; @@ -243,7 +240,7 @@ class follow_linestring_linear linestring, current_segment_id, op_it->seg_id.segment_index, - it->point, *op_it, strategy, robust_policy, + it->point, *op_it, strategy, linear::get(oit)); } } @@ -284,9 +281,6 @@ class follow_linestring_linear { if ( action::is_entered(entered) ) { - // We don't rescale linear/linear - detail::no_rescale_policy robust_policy; - detail::copy_segments::copy_segments_linestring < false, false // do not reverse; do not remove spikes @@ -294,7 +288,6 @@ class follow_linestring_linear current_segment_id, static_cast(boost::size(linestring) - 1), strategy, - robust_policy, current_piece); } diff --git a/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp b/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp index 2747fa68..783acc84 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2024. +// Modifications copyright (c) 2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -17,14 +21,9 @@ #include #include #include -#include -#include #include #include -#define BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS - - namespace boost { namespace geometry { @@ -32,37 +31,33 @@ namespace boost { namespace geometry namespace detail { namespace overlay { -template +template struct sweep_equal_policy { -private: - template - static inline T threshold() - { - // Points within some epsilons are considered as equal. - return T(100); - } + public: - // Returns true if point are considered equal (within an epsilon) + // Returns true if point are considered equal template static inline bool equals(P const& p1, P const& p2) { using coor_t = typename coordinate_type

::type; - return approximately_equals(p1, p2, threshold()); + static auto const tolerance + = common_approximately_equals_epsilon_multiplier::value(); + return approximately_equals(p1, p2, tolerance); } template static inline bool exceeds(T value) { - // This threshold is an arbitrary value - // as long as it is bigger than the used value above - T const limit = T(1) / threshold(); + static auto const tolerance + = common_approximately_equals_epsilon_multiplier::value(); + T const limit = T(1) / tolerance; return value > limit; } }; template <> -struct sweep_equal_policy +struct sweep_equal_policy { template static inline bool equals(P const& p1, P const& p2) @@ -78,26 +73,6 @@ struct sweep_equal_policy } }; -#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS -template <> -struct sweep_equal_policy -{ - template - static inline bool equals(P const& p1, P const& p2) - { - // Neighbouring cells in the "integer grid" are considered as equal - return math::abs(geometry::get<0>(p1) - geometry::get<0>(p2)) <= 1 - && math::abs(geometry::get<1>(p1) - geometry::get<1>(p2)) <= 1; - } - - template - static inline bool exceeds(T value) - { - return value > 1; - } -}; -#endif - template struct turn_with_point { @@ -116,29 +91,16 @@ struct cluster_with_point template < typename Turns, - typename Clusters, - typename RobustPolicy + typename Clusters > -inline void get_clusters(Turns& turns, Clusters& clusters, - RobustPolicy const& robust_policy) +inline void get_clusters(Turns& turns, Clusters& clusters) { using turn_type = typename boost::range_value::type; using cluster_type = typename Clusters::mapped_type; - -#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS - // For now still use robust points for rescaled, otherwise points do not match - using point_type = typename geometry::robust_point_type - < - typename turn_type::point_type, - RobustPolicy - >::type; -#else using point_type = typename turn_type::point_type; -#endif sweep_equal_policy < - typename rescale_policy_type::type, std::is_integral::type>::value > equal_policy; @@ -148,13 +110,7 @@ inline void get_clusters(Turns& turns, Clusters& clusters, { if (! turn.discarded) { -#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS - point_type pnt; - geometry::recalculate(pnt, turn.point, robust_policy); - points.push_back({turn_index, pnt}); -#else points.push_back({turn_index, turn.point}); -#endif } turn_index++; } diff --git a/include/boost/geometry/algorithms/detail/overlay/get_distance_measure.hpp b/include/boost/geometry/algorithms/detail/overlay/get_distance_measure.hpp index d462bb52..81a9418a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_distance_measure.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_distance_measure.hpp @@ -78,7 +78,7 @@ struct get_distance_measure static result_type apply(SegmentPoint const& , SegmentPoint const& , Point const& ) { - const result_type result; + result_type const result; return result; } }; @@ -125,7 +125,7 @@ inline auto get_distance_measure(SegmentPoint const& p1, SegmentPoint const& p2, // Verify equality, without using a tolerance // (so don't use equals or equals_point_point) // because it is about very tiny differences. - auto identical = [](const auto& point1, const auto& point2) + auto identical = [](auto const& point1, auto const& point2) { return geometry::get<0>(point1) == geometry::get<0>(point2) && geometry::get<1>(point1) == geometry::get<1>(point2); diff --git a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp index f0e3dbce..9085387c 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -22,7 +22,6 @@ #include #include -#include #include @@ -48,23 +47,14 @@ struct get_turn_without_info typename UniqueSubRange1, typename UniqueSubRange2, typename Strategy, - typename RobustPolicy, typename OutputIterator > static inline OutputIterator apply(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, TurnInfo const& , Strategy const& strategy, - RobustPolicy const& , OutputIterator out) { - // Make sure this is only called with no rescaling - BOOST_STATIC_ASSERT((std::is_same - < - no_rescale_policy_tag, - typename rescale_policy_type::type - >::value)); - typedef typename TurnInfo::point_type turn_point_type; typedef policies::relate::segments_intersection_points @@ -96,13 +86,11 @@ template < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename Turns, typename Strategy > inline void get_intersection_points(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, Turns& turns, Strategy const& strategy) { @@ -110,8 +98,8 @@ inline void get_intersection_points(Geometry1 const& geometry1, typedef detail::get_intersection_points::get_turn_without_info < - typename point_type::type, - typename point_type::type, + point_type_t, + point_type_t, typename boost::range_value::type > TurnPolicy; @@ -139,7 +127,6 @@ inline void get_intersection_points(Geometry1 const& geometry1, >::apply(0, geometry1, 1, geometry2, strategy, - robust_policy, turns, interrupt_policy); } diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index 4e10c07b..e61ad728 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -1,10 +1,11 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry -// Copyright (c) 2007-2021 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2007-2023 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2015-2022. -// Modifications copyright (c) 2015-2022 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -27,7 +28,7 @@ #include #include -#include +#include namespace boost { namespace geometry @@ -46,10 +47,7 @@ class turn_info_exception : public geometry::exception message += method; } - virtual ~turn_info_exception() throw() - {} - - virtual char const* what() const throw() + virtual char const* What() const noexcept { return message.c_str(); } @@ -79,17 +77,10 @@ struct policy_verify_all static bool const use_handle_imperfect_touch = true; }; - -#if defined(BOOST_GEOMETRY_USE_RESCALING) -using verify_policy_aa = policy_verify_nothing; -#else using verify_policy_aa = policy_verify_all; -#endif - using verify_policy_ll = policy_verify_nothing; using verify_policy_la = policy_verify_nothing; - struct base_turn_handler { // Returns true if both sides are opposite @@ -141,8 +132,8 @@ struct base_turn_handler BOOST_GEOMETRY_ASSERT(index < info.count); geometry::convert(info.intersections[index], ti.point); - ti.operations[0].fraction = info.fractions[index].robust_ra; - ti.operations[1].fraction = info.fractions[index].robust_rb; + ti.operations[0].fraction = info.fractions[index].ra; + ti.operations[1].fraction = info.fractions[index].rb; } template @@ -173,8 +164,8 @@ struct base_turn_handler } else { - ti.operations[i].fraction = i == 0 ? info.fractions[index].robust_ra - : info.fractions[index].robust_rb; + ti.operations[i].fraction = i == 0 ? info.fractions[index].ra + : info.fractions[index].rb; } } } @@ -182,7 +173,7 @@ struct base_turn_handler template static inline unsigned int non_opposite_to_index(IntersectionInfo const& info) { - return info.fractions[0].robust_rb < info.fractions[1].robust_rb + return info.fractions[0].rb < info.fractions[1].rb ? 1 : 0; } @@ -289,7 +280,7 @@ struct turn_info_verification_functions std::size_t index_p, std::size_t index_q, TurnInfo& ti) { - if (BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_side_verification)) + if BOOST_GEOMETRY_CONSTEXPR (VerifyPolicy::use_side_verification) { set_both_verified(range_p, range_q, umbrella_strategy, index_p, index_q, ti); @@ -312,29 +303,29 @@ struct turn_info_verification_functions UmbrellaStrategy const& umbrella_strategy, int index_p, int index_q) { - if (side == 0 - && BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_side_verification)) + if BOOST_GEOMETRY_CONSTEXPR (VerifyPolicy::use_side_verification) { - if (index_p >= 1 && range_p.is_last_segment()) + if (side == 0) { - return 0; - } - if (index_q >= 2 && range_q.is_last_segment()) - { - return 0; - } + if (index_p >= 1 && range_p.is_last_segment()) + { + return 0; + } + if (index_q >= 2 && range_q.is_last_segment()) + { + return 0; + } - auto const dm = get_distance_measure(range_p.at(index_p), - range_p.at(index_p + 1), - range_q.at(index_q), - umbrella_strategy); - static decltype(dm.measure) const zero = 0; - return dm.measure == zero ? 0 : dm.measure > zero ? 1 : -1; - } - else - { - return side; + auto const dm = get_distance_measure(range_p.at(index_p), + range_p.at(index_p + 1), + range_q.at(index_q), + umbrella_strategy); + static decltype(dm.measure) const zero = 0; + return dm.measure == zero ? 0 : dm.measure > zero ? 1 : -1; + } } + + return side; } }; @@ -352,50 +343,70 @@ struct touch_interior : public base_turn_handler template < typename IntersectionInfo, - typename UniqueSubRange + typename SideCalculator, + typename UniqueSubRange1, + typename UniqueSubRange2 > static bool handle_as_touch(IntersectionInfo const& info, - UniqueSubRange const& non_touching_range) + SideCalculator const& side, + UniqueSubRange1 const& non_touching_range, + UniqueSubRange2 const& other_range) { - if (! BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_handle_as_touch)) + if BOOST_GEOMETRY_CONSTEXPR (! VerifyPolicy::use_handle_as_touch) { return false; } + else // else prevents unreachable code warning + { + bool const has_k = ! non_touching_range.is_last_segment() + && ! other_range.is_last_segment(); + if (has_k + && (same(side.pj_wrt_q1(), side.qj_wrt_p2()) + || same(side.pj_wrt_q2(), side.qj_wrt_p1()))) + { + // At a touch, the touching points (pj and qj) should be collinear + // with both other segments. + // If that is not the case (both left or both right), it should not be handled as a touch, + // (though the intersection point might be close to the end), + // because segments might cross each other or touch the other in the middle. + return false; + } + + // + // + // ^ Q(i) ^ P(i) + // \ / + // \ / + // \ / + // \ / + // \ / + // \ / + // \ / + // \ / + // \ / + // \ / it is about buffer_rt_r + // P(k) v/ they touch here "in the middle", but at the intersection... + // <---------------->v there is no follow up IP + // / + // / + // / + // / + // / + // / + // v Q(k) + // - // - // - // ^ Q(i) ^ P(i) - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / it is about buffer_rt_r - // P(k) v/ they touch here "in the middle", but at the intersection... - // <---------------->v there is no follow up IP - // / - // / - // / - // / - // / - // / - // v Q(k) - // - - // Measure where the IP is located. If it is really close to the end, - // then there is no space for the next IP (on P(1)/Q(2). A "from" - // intersection will be generated, but those are never handled. - // Therefore handle it as a normal touch (two segments arrive at the - // intersection point). It currently checks for zero, but even a - // distance a little bit larger would do. - auto const dm = fun::distance_measure(info.intersections[0], non_touching_range.at(1)); - decltype(dm) const zero = 0; - bool const result = math::equals(dm, zero); - return result; + // Measure where the IP is located. If it is really close to the end, + // then there is no space for the next IP (on P(1)/Q(2). A "from" + // intersection will be generated, but those are never handled. + // Therefore handle it as a normal touch (two segments arrive at the + // intersection point). It currently checks for zero, but even a + // distance a little bit larger would do. + auto const dm = fun::distance_measure(info.intersections[0], non_touching_range.at(1)); + decltype(dm) const zero = 0; + bool const result = math::equals(dm, zero); + return result; + } } // Index: 0, P is the interior, Q is touching and vice versa @@ -564,65 +575,75 @@ struct touch : public base_turn_handler UmbrellaStrategy const& umbrella_strategy, TurnInfo& ti) { - if (! BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_handle_imperfect_touch)) + if BOOST_GEOMETRY_CONSTEXPR (! VerifyPolicy::use_handle_imperfect_touch) { return false; } - - // Q - // ^ - // || - // || - // |^---- - // >----->P - // * * they touch here (P/Q are (nearly) on top) - // - // Q continues from where P comes. - // P continues from where Q comes - // This is often a blocking situation, - // unless there are FP issues: there might be a distance - // between Pj and Qj, in that case handle it as a union. - // - // Exaggerated: - // Q - // ^ Q is nearly vertical - // \ but not completely - and still ends above P - // | \qj In this case it should block P and - // | ^------ set Q to Union - // >----->P qj is LEFT of P1 and pi is LEFT of Q2 - // (the other way round is also possible) - - auto has_distance = [&](const auto& r1, const auto& r2) -> bool + else // else prevents unreachable code warning { - auto const d1 = get_distance_measure(r1.at(0), r1.at(1), r2.at(1), umbrella_strategy); - auto const d2 = get_distance_measure(r2.at(1), r2.at(2), r1.at(0), umbrella_strategy); - return d1.measure > 0 && d2.measure > 0; - }; + // Q + // ^ + // || + // || + // |^---- + // >----->P + // * * they touch here (P/Q are (nearly) on top of each other) + // + // Q continues from where P comes. + // P continues from where Q comes + // This is often a blocking situation, + // unless there are FP issues: there might be a distance + // between Pj and Qj, in that case handle it as a union. + // + // Exaggerated: + // Q + // ^ Q is nearly vertical + // \ but not completely - and still ends above P + // | \qj In this case it should block P and + // | ^------ set Q to Union + // >----->P qj is LEFT of P1 and pi is LEFT of Q2 + // (the other way round is also possible) + + // There are also cases like this: + // P + // ^ + // || + // || + // P----^----- bool + { + auto const d1 = get_distance_measure(r1.at(0), r1.at(1), r2.at(1), umbrella_strategy); + auto const d2 = get_distance_measure(r2.at(1), r2.at(2), r1.at(0), umbrella_strategy); + return d1.measure > 0 && d2.measure > 0; + }; - if (side_pk_q2 == -1 && has_distance(range_p, range_q)) - { - // Even though there is a touch, Q(j) is left of P1 - // and P(i) is still left from Q2. - // Q continues to the right. - // It can continue. - ti.operations[0].operation = operation_blocked; - // Q turns right -> union (both independent), - // Q turns left -> intersection - ti.operations[1].operation = operation_union; - ti.touch_only = true; - return true; - } + if (side_pk_q2 == -1 && has_distance(range_p, range_q)) + { + // Even though there is a touch, Q(j) is left of P1 + // and P(i) is still left from Q2. + // Q continues to the right. + // It can continue. + ti.operations[0].operation = operation_blocked; + // Q turns right -> union (both independent), + // Q turns left -> intersection + ti.operations[1].operation = operation_union; + ti.touch_only = true; + return true; + } - if (side_pk_q2 == 1 && has_distance(range_q, range_p)) - { - // Similarly, but the other way round. - // Q continues to the left. - ti.operations[0].operation = operation_union; - ti.operations[1].operation = operation_blocked; - ti.touch_only = true; - return true; + if (side_pk_q2 == 1 && has_distance(range_q, range_p)) + { + // Similarly, but the other way round. + // Q continues to the left. + ti.operations[0].operation = operation_union; + ti.operations[1].operation = operation_blocked; + ti.touch_only = true; + return true; + } + return false; } - return false; } template @@ -679,6 +700,7 @@ struct touch : public base_turn_handler { if (side_qk_p1 == 0 && side_pk_q1 == 0 && has_pk && has_qk + && opposite(side.pi_wrt_q1(), side.qk_wrt_p2()) && handle_imperfect_touch(range_p, range_q, side_pk_q2, umbrella_strategy, ti)) { // If q continues collinearly (opposite) with p, it should be blocked @@ -855,24 +877,15 @@ struct equal : public base_turn_handler int const side_pk_p = has_pk ? side.pk_wrt_p1() : 0; int const side_qk_p = has_qk ? side.qk_wrt_p1() : 0; - if (BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_side_verification) - && has_pk && has_qk && side_pk_p == side_qk_p) + if (has_pk && has_qk && side_pk_p == side_qk_p) { // They turn to the same side, or continue both collinearly - // Without rescaling, to check for union/intersection, - // try to check side values (without any thresholds) - auto const dm_pk_q2 - = get_distance_measure(range_q.at(1), range_q.at(2), range_p.at(2), - umbrella_strategy); - auto const dm_qk_p2 - = get_distance_measure(range_p.at(1), range_p.at(2), range_q.at(2), - umbrella_strategy); - - if (dm_qk_p2.measure != dm_pk_q2.measure) + // To check for union/intersection, try to check side values + int const side_qk_p2 = side.qk_wrt_p2(); + + if (opposite(side_qk_p2, side_pk_q2)) { - // A (possibly very small) difference is detected, which - // can be used to distinguish between union/intersection - ui_else_iu(dm_qk_p2.measure < dm_pk_q2.measure, ti); + ui_else_iu(side_pk_q2 == 1, ti); return; } } @@ -927,39 +940,40 @@ struct start : public base_turn_handler SideCalculator const& side, UmbrellaStrategy const& ) { - if (! BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_start_turn)) + if BOOST_GEOMETRY_CONSTEXPR (! VerifyPolicy::use_start_turn) { return false; } + else // else prevents unreachable code warning + { + // Start turns have either how_a = -1, or how_b = -1 (either p leaves or q leaves) + BOOST_GEOMETRY_ASSERT(dir_info.how_a != dir_info.how_b); + BOOST_GEOMETRY_ASSERT(dir_info.how_a == -1 || dir_info.how_b == -1); + BOOST_GEOMETRY_ASSERT(dir_info.how_a == 0 || dir_info.how_b == 0); - // Start turns have either how_a = -1, or how_b = -1 (either p leaves or q leaves) - BOOST_GEOMETRY_ASSERT(dir_info.how_a != dir_info.how_b); - BOOST_GEOMETRY_ASSERT(dir_info.how_a == -1 || dir_info.how_b == -1); - BOOST_GEOMETRY_ASSERT(dir_info.how_a == 0 || dir_info.how_b == 0); + if (dir_info.how_b == -1) + { + // p ---------------> + // | + // | q q leaves + // v + // - if (dir_info.how_b == -1) - { - // p ---------------> - // | - // | q q leaves - // v - // + int const side_qj_p1 = side.qj_wrt_p1(); + ui_else_iu(side_qj_p1 == -1, ti); + } + else if (dir_info.how_a == -1) + { + // p leaves + int const side_pj_q1 = side.pj_wrt_q1(); + ui_else_iu(side_pj_q1 == 1, ti); + } - int const side_qj_p1 = side.qj_wrt_p1(); - ui_else_iu(side_qj_p1 == -1, ti); - } - else if (dir_info.how_a == -1) - { - // p leaves - int const side_pj_q1 = side.pj_wrt_q1(); - ui_else_iu(side_pj_q1 == 1, ti); + // Copy intersection point + assign_point_and_correct(ti, method_start, info, dir_info); + return true; } - - // Copy intersection point - assign_point_and_correct(ti, method_start, info, dir_info); - return true; } - }; @@ -985,7 +999,7 @@ struct equal_opposite : public base_turn_handler IntersectionInfo const& intersection_info) { // For equal-opposite segments, normally don't do anything. - if (BOOST_GEOMETRY_CONDITION(AssignPolicy::include_opposite)) + if BOOST_GEOMETRY_CONSTEXPR (AssignPolicy::include_opposite) { tp.method = method_equal; for (unsigned int i = 0; i < 2; i++) @@ -1022,24 +1036,26 @@ struct collinear : public base_turn_handler UniqueSubRange2 const& range_q, DirInfo const& dir_info) { - if (! BOOST_GEOMETRY_CONDITION(VerifyPolicy::use_handle_as_equal)) + if BOOST_GEOMETRY_CONSTEXPR (! VerifyPolicy::use_handle_as_equal) { return false; } - - int const arrival_p = dir_info.arrival[0]; - int const arrival_q = dir_info.arrival[1]; - if (arrival_p * arrival_q != -1 || info.count != 2) + else // else prevents unreachable code warning { - // Code below assumes that either p or q arrives in the other segment - return false; - } + int const arrival_p = dir_info.arrival[0]; + int const arrival_q = dir_info.arrival[1]; + if (arrival_p * arrival_q != -1 || info.count != 2) + { + // Code below assumes that either p or q arrives in the other segment + return false; + } - auto const dm = arrival_p == 1 - ? fun::distance_measure(info.intersections[1], range_q.at(1)) - : fun::distance_measure(info.intersections[1], range_p.at(1)); - decltype(dm) const zero = 0; - return math::equals(dm, zero); + auto const dm = arrival_p == 1 + ? fun::distance_measure(info.intersections[1], range_q.at(1)) + : fun::distance_measure(info.intersections[1], range_p.at(1)); + decltype(dm) const zero = 0; + return math::equals(dm, zero); + } } /* @@ -1203,7 +1219,7 @@ private : // two operations blocked, so the whole point does not need // to be generated. // So return false to indicate nothing is to be done. - if (BOOST_GEOMETRY_CONDITION(AssignPolicy::include_opposite)) + if BOOST_GEOMETRY_CONSTEXPR (AssignPolicy::include_opposite) { tp.operations[Index].operation = operation_opposite; blocked = operation_opposite; @@ -1297,7 +1313,7 @@ private : *out++ = tp; } - if (BOOST_GEOMETRY_CONDITION(AssignPolicy::include_opposite)) + if BOOST_GEOMETRY_CONSTEXPR (AssignPolicy::include_opposite) { // Handle cases not yet handled above if ((arrival_q == -1 && arrival_p == 0) @@ -1399,7 +1415,6 @@ struct get_turn_info typename UniqueSubRange2, typename TurnInfo, typename UmbrellaStrategy, - typename RobustPolicy, typename OutputIterator > static inline OutputIterator apply( @@ -1407,18 +1422,16 @@ struct get_turn_info UniqueSubRange2 const& range_q, TurnInfo const& tp_model, UmbrellaStrategy const& umbrella_strategy, - RobustPolicy const& robust_policy, OutputIterator out) { typedef intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, - UmbrellaStrategy, - RobustPolicy + UmbrellaStrategy > inters_info; - inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); + inters_info inters(range_p, range_q, umbrella_strategy); char const method = inters.d_info().how; @@ -1466,7 +1479,7 @@ struct get_turn_info if ( inters.d_info().arrival[1] == 1 ) { // Q arrives - if (handler::handle_as_touch(inters.i_info(), range_p)) + if (handler::handle_as_touch(inters.i_info(), inters.sides(), range_p, range_q)) { handle_as_touch = true; } @@ -1480,7 +1493,7 @@ struct get_turn_info else { // P arrives, swap p/q - if (handler::handle_as_touch(inters.i_info(), range_q)) + if (handler::handle_as_touch(inters.i_info(), inters.swapped_sides(), range_q, range_p)) { handle_as_touch = true; } diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp index 007ada0f..229277ab 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -19,7 +19,6 @@ #include #include #include -#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp index 00a6004f..12db5ac8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -16,10 +16,8 @@ #include #include -#include #include #include -#include #include namespace boost { namespace geometry { @@ -60,6 +58,13 @@ struct side_calculator , m_range_q(range_q) {} + inline int pi_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pi()); } + + inline int pj_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pj()); } + inline int pj_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pj()); } + inline int qj_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qj()); } + inline int qj_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qj()); } + inline int pk_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_pk()); } inline int pk_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pk()); } inline int qk_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qk()); } @@ -68,12 +73,6 @@ struct side_calculator inline int pk_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pk()); } inline int qk_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qk()); } - // Necessary when rescaling turns off: - inline int qj_wrt_p1() const { return m_side_strategy.apply(get_pi(), get_pj(), get_qj()); } - inline int qj_wrt_p2() const { return m_side_strategy.apply(get_pj(), get_pk(), get_qj()); } - inline int pj_wrt_q1() const { return m_side_strategy.apply(get_qi(), get_qj(), get_pj()); } - inline int pj_wrt_q2() const { return m_side_strategy.apply(get_qj(), get_qk(), get_pj()); } - inline auto const& get_pi() const { return m_range_p.at(0); } inline auto const& get_pj() const { return m_range_p.at(1); } inline auto const& get_pk() const { return m_range_p.at(2); } @@ -85,246 +84,17 @@ struct side_calculator // Used side-strategy, owned by the calculator side_strategy_type m_side_strategy; - // Used ranges - owned by get_turns or (for robust points) by intersection_info_base + // Used ranges - owned by get_turns or (for points) by intersection_info_base UniqueSubRange1 const& m_range_p; UniqueSubRange2 const& m_range_q; }; -template -struct robust_subrange_adapter -{ - typedef Point point_type; - - robust_subrange_adapter(UniqueSubRange const& unique_sub_range, - Point const& robust_point_i, Point const& robust_point_j, - RobustPolicy const& robust_policy) - - : m_unique_sub_range(unique_sub_range) - , m_robust_policy(robust_policy) - , m_robust_point_i(robust_point_i) - , m_robust_point_j(robust_point_j) - , m_k_retrieved(false) - {} - - std::size_t size() const { return m_unique_sub_range.size(); } - - //! Get precalculated point - Point const& at(std::size_t index) const - { - BOOST_GEOMETRY_ASSERT(index < size()); - switch (index) - { - case 0 : return m_robust_point_i; - case 1 : return m_robust_point_j; - case 2 : return get_point_k(); - default : return m_robust_point_i; - } - } - -private : - Point const& get_point_k() const - { - if (! m_k_retrieved) - { - geometry::recalculate(m_robust_point_k, m_unique_sub_range.at(2), m_robust_policy); - m_k_retrieved = true; - } - return m_robust_point_k; - } - - UniqueSubRange const& m_unique_sub_range; - RobustPolicy const& m_robust_policy; - - Point const& m_robust_point_i; - Point const& m_robust_point_j; - mutable Point m_robust_point_k; - - mutable bool m_k_retrieved; -}; - -template -< - typename UniqueSubRange1, typename UniqueSubRange2, - typename RobustPolicy -> -struct robust_point_calculator -{ - typedef typename geometry::robust_point_type - < - typename UniqueSubRange1::point_type, RobustPolicy - >::type robust_point1_type; - typedef typename geometry::robust_point_type - < - typename UniqueSubRange2::point_type, RobustPolicy - >::type robust_point2_type; - - inline robust_point_calculator(UniqueSubRange1 const& range_p, - UniqueSubRange2 const& range_q, - RobustPolicy const& robust_policy) - : m_robust_policy(robust_policy) - , m_range_p(range_p) - , m_range_q(range_q) - , m_pk_retrieved(false) - , m_qk_retrieved(false) - { - // Calculate pi,pj and qi,qj which are almost always necessary - // But don't calculate pk/qk yet, which is retrieved (taking - // more time) and not always necessary. - geometry::recalculate(m_rpi, range_p.at(0), robust_policy); - geometry::recalculate(m_rpj, range_p.at(1), robust_policy); - geometry::recalculate(m_rqi, range_q.at(0), robust_policy); - geometry::recalculate(m_rqj, range_q.at(1), robust_policy); - } - - inline robust_point1_type const& get_rpk() const - { - if (! m_pk_retrieved) - { - geometry::recalculate(m_rpk, m_range_p.at(2), m_robust_policy); - m_pk_retrieved = true; - } - return m_rpk; - } - inline robust_point2_type const& get_rqk() const - { - if (! m_qk_retrieved) - { - geometry::recalculate(m_rqk, m_range_q.at(2), m_robust_policy); - m_qk_retrieved = true; - } - return m_rqk; - } - - robust_point1_type m_rpi, m_rpj; - robust_point2_type m_rqi, m_rqj; - -private : - RobustPolicy const& m_robust_policy; - UniqueSubRange1 const& m_range_p; - UniqueSubRange2 const& m_range_q; - - // On retrieval - mutable robust_point1_type m_rpk; - mutable robust_point2_type m_rqk; - mutable bool m_pk_retrieved; - mutable bool m_qk_retrieved; -}; - -// Default version (empty - specialized below) -template -< - typename UniqueSubRange1, typename UniqueSubRange2, - typename TurnPoint, typename UmbrellaStrategy, - typename RobustPolicy, - typename Tag = typename rescale_policy_type::type -> -class intersection_info_base {}; - -// Version with rescaling, having robust points -template -< - typename UniqueSubRange1, typename UniqueSubRange2, - typename TurnPoint, typename UmbrellaStrategy, - typename RobustPolicy -> -class intersection_info_base -{ - typedef robust_point_calculator - < - UniqueSubRange1, UniqueSubRange2, - RobustPolicy - > - robust_calc_type; - -public: - typedef segment_intersection_points - < - TurnPoint, - geometry::segment_ratio - > intersection_point_type; - typedef policies::relate::segments_intersection_policy - < - intersection_point_type - > intersection_policy_type; - - typedef typename intersection_policy_type::return_type result_type; - - typedef typename robust_calc_type::robust_point1_type robust_point1_type; - typedef typename robust_calc_type::robust_point2_type robust_point2_type; - - typedef robust_subrange_adapter robust_subrange1; - typedef robust_subrange_adapter robust_subrange2; - - typedef side_calculator - < - robust_subrange1, robust_subrange2, UmbrellaStrategy - > side_calculator_type; - - typedef side_calculator - < - robust_subrange2, robust_subrange1, UmbrellaStrategy - > robust_swapped_side_calculator_type; - - intersection_info_base(UniqueSubRange1 const& range_p, - UniqueSubRange2 const& range_q, - UmbrellaStrategy const& umbrella_strategy, - RobustPolicy const& robust_policy) - : m_range_p(range_p) - , m_range_q(range_q) - , m_robust_calc(range_p, range_q, robust_policy) - , m_robust_range_p(range_p, m_robust_calc.m_rpi, m_robust_calc.m_rpj, robust_policy) - , m_robust_range_q(range_q, m_robust_calc.m_rqi, m_robust_calc.m_rqj, robust_policy) - , m_side_calc(m_robust_range_p, m_robust_range_q, umbrella_strategy) - , m_swapped_side_calc(m_robust_range_q, m_robust_range_p, umbrella_strategy) - , m_result(umbrella_strategy.relate().apply(range_p, range_q, - intersection_policy_type(), - m_robust_range_p, m_robust_range_q)) - {} - - inline bool p_is_last_segment() const { return m_range_p.is_last_segment(); } - inline bool q_is_last_segment() const { return m_range_q.is_last_segment(); } - - inline robust_point1_type const& rpi() const { return m_robust_calc.m_rpi; } - inline robust_point1_type const& rpj() const { return m_robust_calc.m_rpj; } - inline robust_point1_type const& rpk() const { return m_robust_calc.get_rpk(); } - - inline robust_point2_type const& rqi() const { return m_robust_calc.m_rqi; } - inline robust_point2_type const& rqj() const { return m_robust_calc.m_rqj; } - inline robust_point2_type const& rqk() const { return m_robust_calc.get_rqk(); } - - inline side_calculator_type const& sides() const { return m_side_calc; } - inline robust_swapped_side_calculator_type const& swapped_sides() const - { - return m_swapped_side_calc; - } - -private : - - // Owned by get_turns - UniqueSubRange1 const& m_range_p; - UniqueSubRange2 const& m_range_q; - - // Owned by this class - robust_calc_type m_robust_calc; - robust_subrange1 m_robust_range_p; - robust_subrange2 m_robust_range_q; - side_calculator_type m_side_calc; - robust_swapped_side_calculator_type m_swapped_side_calc; - -protected : - result_type m_result; -}; - -// Version without rescaling template < typename UniqueSubRange1, typename UniqueSubRange2, - typename TurnPoint, typename UmbrellaStrategy, - typename RobustPolicy + typename TurnPoint, typename UmbrellaStrategy > -class intersection_info_base +class intersection_info_base { public: @@ -348,8 +118,7 @@ class intersection_info_base class intersection_info : public intersection_info_base + TurnPoint, UmbrellaStrategy> { typedef intersection_info_base base; + TurnPoint, UmbrellaStrategy> base; public: @@ -415,11 +183,9 @@ class intersection_info intersection_info(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, - UmbrellaStrategy const& umbrella_strategy, - RobustPolicy const& robust_policy) - : base(range_p, range_q, umbrella_strategy, robust_policy) + UmbrellaStrategy const& umbrella_strategy) + : base(range_p, range_q, umbrella_strategy) , m_umbrella_strategy(umbrella_strategy) - , m_robust_policy(robust_policy) {} inline result_type const& result() const { return base::m_result; } @@ -530,7 +296,6 @@ class intersection_info } UmbrellaStrategy const& m_umbrella_strategy; - RobustPolicy const& m_robust_policy; }; }} // namespace detail::overlay diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp index 76d7faf6..95e6ed66 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp @@ -1,11 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -19,7 +19,7 @@ #include -#include +#include #include #include @@ -45,7 +45,6 @@ struct get_turn_info_linear_areal typename UniqueSubRange2, typename TurnInfo, typename UmbrellaStrategy, - typename RobustPolicy, typename OutputIterator > static inline OutputIterator apply( @@ -53,18 +52,16 @@ struct get_turn_info_linear_areal UniqueSubRange2 const& range_q, TurnInfo const& tp_model, UmbrellaStrategy const& umbrella_strategy, - RobustPolicy const& robust_policy, OutputIterator out) { typedef intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, - UmbrellaStrategy, - RobustPolicy + UmbrellaStrategy > inters_info; - inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); + inters_info inters(range_p, range_q, umbrella_strategy); char const method = inters.d_info().how; @@ -216,15 +213,17 @@ struct get_turn_info_linear_areal tp.operations[0].operation, tp.operations[1].operation); - bool ignore_spike - = calculate_spike_operation(tp.operations[0].operation, - inters, - umbrella_strategy); + bool const ignore_spike = calculate_spike_operation(tp.operations[0].operation, + inters, + umbrella_strategy); - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ignore_spike - || ! append_opposite_spikes( // for 'i' or 'c' i??? - tp, inters, out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (ignore_spike + // for 'i' or 'c' i??? + || ! append_opposite_spikes(tp, inters, out)) { *out++ = tp; } @@ -256,9 +255,12 @@ struct get_turn_info_linear_areal transformer(tp); // conditionally handle spikes - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ! append_collinear_spikes(tp, inters, - method_touch, append_equal, out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (! append_collinear_spikes(tp, inters, method_touch, + append_equal, out)) { *out++ = tp; // no spikes } @@ -319,9 +321,12 @@ struct get_turn_info_linear_areal transformer(tp); // conditionally handle spikes - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ! append_collinear_spikes(tp, inters, - method_replace, version, out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (! append_collinear_spikes(tp, inters, method_replace, + version, out)) { // no spikes *out++ = tp; @@ -333,10 +338,9 @@ struct get_turn_info_linear_areal turn_transformer_ec transformer(method_touch_interior); // conditionally handle spikes - if ( BOOST_GEOMETRY_CONDITION(handle_spikes) ) + if BOOST_GEOMETRY_CONSTEXPR (handle_spikes) { - append_opposite_spikes( - tp, inters, out); + append_opposite_spikes(tp, inters, out); } // TODO: ignore for spikes? @@ -357,7 +361,7 @@ struct get_turn_info_linear_areal case '0' : { // degenerate points - if ( BOOST_GEOMETRY_CONDITION(AssignPolicy::include_degenerate) ) + if BOOST_GEOMETRY_CONSTEXPR (AssignPolicy::include_degenerate) { only_convert::apply(tp, inters.i_info()); @@ -381,9 +385,6 @@ struct get_turn_info_linear_areal break; default : { -#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) - std::cout << "TURN: Unknown method: " << method << std::endl; -#endif #if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) BOOST_THROW_EXCEPTION(turn_info_exception(method)); #endif @@ -542,26 +543,30 @@ struct get_turn_info_linear_areal return false; } else*/ - if ( is_p_spike ) + if (is_p_spike) { - if ( BOOST_GEOMETRY_CONDITION(is_version_touches) - || inters.d_info().arrival[0] == 1 ) + bool output_spike = false; + if BOOST_GEOMETRY_CONSTEXPR (is_version_touches) { - if ( BOOST_GEOMETRY_CONDITION(is_version_touches) ) - { - tp.operations[0].is_collinear = true; - //tp.operations[1].is_collinear = false; - tp.method = method_touch; - } - else - { - tp.operations[0].is_collinear = true; - //tp.operations[1].is_collinear = false; + tp.operations[0].is_collinear = true; + //tp.operations[1].is_collinear = false; + tp.method = method_touch; - BOOST_GEOMETRY_ASSERT(inters.i_info().count > 1); - base_turn_handler::assign_point(tp, method_touch_interior, inters.i_info(), 1); - } + output_spike = true; + } + else if (inters.d_info().arrival[0] == 1) + { + tp.operations[0].is_collinear = true; + //tp.operations[1].is_collinear = false; + + BOOST_GEOMETRY_ASSERT(inters.i_info().count > 1); + base_turn_handler::assign_point(tp, method_touch_interior, inters.i_info(), 1); + + output_spike = true; + } + if (output_spike) + { tp.operations[0].operation = operation_blocked; tp.operations[1].operation = operation_continue; // boundary *out++ = tp; @@ -636,9 +641,12 @@ struct get_turn_info_linear_areal operation_type & op1 = turn.operations[1].operation; // NOTE: probably only if methods are WRT IPs, not segments! - if ( BOOST_GEOMETRY_CONDITION(IsFront) - || op0 == operation_intersection || op0 == operation_union - || op1 == operation_intersection || op1 == operation_union ) + if BOOST_GEOMETRY_CONSTEXPR (IsFront) + { + turn.method = m_method; + } + else if (op0 == operation_intersection || op0 == operation_union + || op1 == operation_intersection || op1 == operation_union) { turn.method = m_method; } @@ -696,7 +704,7 @@ struct get_turn_info_linear_areal namespace ov = overlay; typedef ov::get_turn_info_for_endpoint get_info_e; - const std::size_t ip_count = inters.i_info().count; + std::size_t const ip_count = inters.i_info().count; // no intersection points if (ip_count == 0) { @@ -724,145 +732,151 @@ struct get_turn_info_linear_areal // IP on the first point of Linear Geometry bool was_first_point_handled = false; - if ( BOOST_GEOMETRY_CONDITION(EnableFirst) - && range_p.is_first_segment() && ip0.is_pi && !ip0.is_qi ) // !q0i prevents duplication + if BOOST_GEOMETRY_CONSTEXPR (EnableFirst) { - TurnInfo tp = tp_model; - tp.operations[0].position = position_front; - tp.operations[1].position = position_middle; - - if ( opposite ) // opposite -> collinear - { - tp.operations[0].operation = operation_continue; - tp.operations[1].operation = operation_union; - tp.method = ip0.is_qj ? method_touch : method_touch_interior; - } - else + if (range_p.is_first_segment() && ip0.is_pi && ! ip0.is_qi ) // !q0i prevents duplication { - auto const sides = strategy.side(); - - // pi is the intersection point at qj or in the middle of q1 - // so consider segments - // 1. pi at qj: qi-qj-pj and qi-qj-qk - // x: qi-qj, y: qj-qk, qz: qk - // 2. pi in the middle of q1: qi-pi-pj and qi-pi-qj - // x: qi-pi, y: pi-qj, qz: qj - // qi-pi, side the same as WRT q1 - // pi-qj, side the same as WRT q1 - // qj WRT q1 is 0 - method_type replaced_method = method_none; - int side_pj_y = 0, side_pj_x = 0, side_qz_x = 0; - // 1. ip0 or pi at qj - if ( ip0.is_qj ) + TurnInfo tp = tp_model; + tp.operations[0].position = position_front; + tp.operations[1].position = position_middle; + + if ( opposite ) // opposite -> collinear { - replaced_method = method_touch; - side_pj_y = sides.apply(range_q.at(1), range_q.at(2), range_p.at(1)); // pj wrt q2 - side_pj_x = sides.apply(range_q.at(0), range_q.at(1), range_p.at(1)); // pj wrt q1 - side_qz_x = sides.apply(range_q.at(0), range_q.at(1), range_q.at(2)); // qk wrt q1 + tp.operations[0].operation = operation_continue; + tp.operations[1].operation = operation_union; + tp.method = ip0.is_qj ? method_touch : method_touch_interior; } - // 2. ip0 or pi in the middle of q1 else { - replaced_method = method_touch_interior; - side_pj_y = sides.apply(range_q.at(0), range_q.at(1), range_p.at(1)); // pj wrt q1 - side_pj_x = side_pj_y; // pj wrt q1 - side_qz_x = 0; // qj wrt q1 - } + auto const sides = strategy.side(); + + // pi is the intersection point at qj or in the middle of q1 + // so consider segments + // 1. pi at qj: qi-qj-pj and qi-qj-qk + // x: qi-qj, y: qj-qk, qz: qk + // 2. pi in the middle of q1: qi-pi-pj and qi-pi-qj + // x: qi-pi, y: pi-qj, qz: qj + // qi-pi, side the same as WRT q1 + // pi-qj, side the same as WRT q1 + // qj WRT q1 is 0 + method_type replaced_method = method_none; + int side_pj_y = 0, side_pj_x = 0, side_qz_x = 0; + // 1. ip0 or pi at qj + if ( ip0.is_qj ) + { + replaced_method = method_touch; + side_pj_y = sides.apply(range_q.at(1), range_q.at(2), range_p.at(1)); // pj wrt q2 + side_pj_x = sides.apply(range_q.at(0), range_q.at(1), range_p.at(1)); // pj wrt q1 + side_qz_x = sides.apply(range_q.at(0), range_q.at(1), range_q.at(2)); // qk wrt q1 + } + // 2. ip0 or pi in the middle of q1 + else + { + replaced_method = method_touch_interior; + side_pj_y = sides.apply(range_q.at(0), range_q.at(1), range_p.at(1)); // pj wrt q1 + side_pj_x = side_pj_y; // pj wrt q1 + side_qz_x = 0; // qj wrt q1 + } - std::pair operations - = get_info_e::operations_of_equal(side_pj_y, side_pj_x, side_qz_x); + std::pair operations + = get_info_e::operations_of_equal(side_pj_y, side_pj_x, side_qz_x); - tp.operations[0].operation = operations.first; - tp.operations[1].operation = operations.second; + tp.operations[0].operation = operations.first; + tp.operations[1].operation = operations.second; - turn_transformer_ec transformer(replaced_method); - transformer(tp); - } + turn_transformer_ec transformer(replaced_method); + transformer(tp); + } - // equals<> or collinear<> will assign the second point, - // we'd like to assign the first one - base_turn_handler::assign_point(tp, tp.method, inters.i_info(), 0); + // equals<> or collinear<> will assign the second point, + // we'd like to assign the first one + base_turn_handler::assign_point(tp, tp.method, inters.i_info(), 0); - // NOTE: is_collinear is not set for the first endpoint of L - // for which there is no preceding segment - // here is_p_first_ip == true - tp.operations[0].is_collinear = false; + // NOTE: is_collinear is not set for the first endpoint of L + // for which there is no preceding segment + // here is_p_first_ip == true + tp.operations[0].is_collinear = false; - *out++ = tp; + *out++ = tp; - was_first_point_handled = true; + was_first_point_handled = true; + } } // ANALYSE AND ASSIGN LAST // IP on the last point of Linear Geometry - if ( BOOST_GEOMETRY_CONDITION(EnableLast) - && range_p.is_last_segment() - && ( ip_count > 1 ? (ip1.is_pj && !ip1.is_qi) : (ip0.is_pj && !ip0.is_qi) ) ) // prevents duplication + if BOOST_GEOMETRY_CONSTEXPR (EnableLast) { - TurnInfo tp = tp_model; - - if ( inters.i_info().count > 1 ) - { - //BOOST_GEOMETRY_ASSERT( result.template get<1>().dir_a == 0 && result.template get<1>().dir_b == 0 ); - tp.operations[0].is_collinear = true; - tp.operations[1].operation = opposite ? operation_continue : operation_union; - } - else //if ( result.template get<0>().count == 1 ) + if (range_p.is_last_segment() + && (ip_count > 1 + ? (ip1.is_pj && ! ip1.is_qi) + : (ip0.is_pj && ! ip0.is_qi))) // prevents duplication { - auto const sides = strategy.side(); - - // pj is the intersection point at qj or in the middle of q1 - // so consider segments - // 1. pj at qj: qi-qj-pi and qi-qj-qk - // x: qi-qj, y: qj-qk, qz: qk - // 2. pj in the middle of q1: qi-pj-pi and qi-pj-qj - // x: qi-pj, y: pj-qj, qz: qj - // qi-pj, the side is the same as WRT q1 - // pj-qj, the side is the same as WRT q1 - // side of qj WRT q1 is 0 - int side_pi_y = 0, side_pi_x = 0, side_qz_x = 0; - // 1. ip0 or pj at qj - if ( ip0.is_qj ) + TurnInfo tp = tp_model; + + if ( inters.i_info().count > 1 ) { - side_pi_y = sides.apply(range_q.at(1), range_q.at(2), range_p.at(0)); // pi wrt q2 - side_pi_x = sides.apply(range_q.at(0), range_q.at(1), range_p.at(0)); // pi wrt q1 - side_qz_x = sides.apply(range_q.at(0), range_q.at(1), range_q.at(2)); // qk wrt q1 + //BOOST_GEOMETRY_ASSERT( result.template get<1>().dir_a == 0 && result.template get<1>().dir_b == 0 ); + tp.operations[0].is_collinear = true; + tp.operations[1].operation = opposite ? operation_continue : operation_union; } - // 2. ip0 or pj in the middle of q1 - else + else //if ( result.template get<0>().count == 1 ) { - side_pi_y = sides.apply(range_q.at(0), range_q.at(1), range_p.at(0)); // pi wrt q1 - side_pi_x = side_pi_y; // pi wrt q1 - side_qz_x = 0; // qj wrt q1 - } + auto const sides = strategy.side(); + + // pj is the intersection point at qj or in the middle of q1 + // so consider segments + // 1. pj at qj: qi-qj-pi and qi-qj-qk + // x: qi-qj, y: qj-qk, qz: qk + // 2. pj in the middle of q1: qi-pj-pi and qi-pj-qj + // x: qi-pj, y: pj-qj, qz: qj + // qi-pj, the side is the same as WRT q1 + // pj-qj, the side is the same as WRT q1 + // side of qj WRT q1 is 0 + int side_pi_y = 0, side_pi_x = 0, side_qz_x = 0; + // 1. ip0 or pj at qj + if ( ip0.is_qj ) + { + side_pi_y = sides.apply(range_q.at(1), range_q.at(2), range_p.at(0)); // pi wrt q2 + side_pi_x = sides.apply(range_q.at(0), range_q.at(1), range_p.at(0)); // pi wrt q1 + side_qz_x = sides.apply(range_q.at(0), range_q.at(1), range_q.at(2)); // qk wrt q1 + } + // 2. ip0 or pj in the middle of q1 + else + { + side_pi_y = sides.apply(range_q.at(0), range_q.at(1), range_p.at(0)); // pi wrt q1 + side_pi_x = side_pi_y; // pi wrt q1 + side_qz_x = 0; // qj wrt q1 + } - std::pair operations - = get_info_e::operations_of_equal(side_pi_y, side_pi_x, side_qz_x); + std::pair operations + = get_info_e::operations_of_equal(side_pi_y, side_pi_x, side_qz_x); - tp.operations[0].operation = operations.first; - tp.operations[1].operation = operations.second; + tp.operations[0].operation = operations.first; + tp.operations[1].operation = operations.second; - turn_transformer_ec transformer(method_none); - transformer(tp); + turn_transformer_ec transformer(method_none); + transformer(tp); - tp.operations[0].is_collinear = tp.both(operation_continue); - } + tp.operations[0].is_collinear = tp.both(operation_continue); + } - tp.method = ( ip_count > 1 ? ip1.is_qj : ip0.is_qj ) ? method_touch : method_touch_interior; - tp.operations[0].operation = operation_blocked; - tp.operations[0].position = position_back; - tp.operations[1].position = position_middle; + tp.method = ( ip_count > 1 ? ip1.is_qj : ip0.is_qj ) ? method_touch : method_touch_interior; + tp.operations[0].operation = operation_blocked; + tp.operations[0].position = position_back; + tp.operations[1].position = position_middle; - // equals<> or collinear<> will assign the second point, - // we'd like to assign the first one - unsigned int ip_index = ip_count > 1 ? 1 : 0; - base_turn_handler::assign_point(tp, tp.method, inters.i_info(), ip_index); + // equals<> or collinear<> will assign the second point, + // we'd like to assign the first one + unsigned int ip_index = ip_count > 1 ? 1 : 0; + base_turn_handler::assign_point(tp, tp.method, inters.i_info(), ip_index); - *out++ = tp; + *out++ = tp; - // don't ignore the first IP if the segment is opposite - return !( opposite && ip_count > 1 ) || was_first_point_handled; + // don't ignore the first IP if the segment is opposite + return !( opposite && ip_count > 1 ) || was_first_point_handled; + } } // don't ignore anything for now diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp index 6dbd6d68..00349f29 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp @@ -1,11 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018. -// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -22,7 +22,7 @@ #include #include -#include +#include namespace boost { namespace geometry { @@ -40,7 +40,6 @@ struct get_turn_info_linear_linear typename UniqueSubRange2, typename TurnInfo, typename UmbrellaStrategy, - typename RobustPolicy, typename OutputIterator > static inline OutputIterator apply( @@ -48,18 +47,16 @@ struct get_turn_info_linear_linear UniqueSubRange2 const& range_q, TurnInfo const& tp_model, UmbrellaStrategy const& umbrella_strategy, - RobustPolicy const& robust_policy, OutputIterator out) { typedef intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, - UmbrellaStrategy, - RobustPolicy + UmbrellaStrategy > inters_info; - inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); + inters_info inters(range_p, range_q, umbrella_strategy); char const method = inters.d_info().how; @@ -264,8 +261,11 @@ struct get_turn_info_linear_linear tp.operations[0].operation, tp.operations[1].operation); - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ! append_opposite_spikes(tp, inters, out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (! append_opposite_spikes(tp, inters, out)) { *out++ = tp; } @@ -307,10 +307,12 @@ struct get_turn_info_linear_linear transformer(tp); // conditionally handle spikes - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ! append_collinear_spikes(tp, inters, - method_touch, spike_op, - out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (! append_collinear_spikes(tp, inters, method_touch, + spike_op, out)) { *out++ = tp; // no spikes } @@ -381,10 +383,12 @@ struct get_turn_info_linear_linear transformer(tp); // conditionally handle spikes - if ( ! BOOST_GEOMETRY_CONDITION(handle_spikes) - || ! append_collinear_spikes(tp, inters, - method_replace, spike_op, - out) ) + if BOOST_GEOMETRY_CONSTEXPR (! handle_spikes) + { + *out++ = tp; + } + else if (! append_collinear_spikes(tp, inters, method_replace, + spike_op, out)) { // no spikes *out++ = tp; @@ -396,7 +400,7 @@ struct get_turn_info_linear_linear turn_transformer_ec transformer(method_touch_interior); // conditionally handle spikes - if ( BOOST_GEOMETRY_CONDITION(handle_spikes) ) + if BOOST_GEOMETRY_CONSTEXPR (handle_spikes) { append_opposite_spikes(tp, inters, out); } @@ -419,7 +423,7 @@ struct get_turn_info_linear_linear case '0' : { // degenerate points - if ( BOOST_GEOMETRY_CONDITION(AssignPolicy::include_degenerate) ) + if BOOST_GEOMETRY_CONSTEXPR (AssignPolicy::include_degenerate) { only_convert::apply(tp, inters.i_info()); @@ -451,9 +455,6 @@ struct get_turn_info_linear_linear break; default : { -#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) - std::cout << "TURN: Unknown method: " << method << std::endl; -#endif #if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) BOOST_THROW_EXCEPTION(turn_info_exception(method)); #endif @@ -553,65 +554,75 @@ struct get_turn_info_linear_linear bool res = false; - if ( is_p_spike - && ( BOOST_GEOMETRY_CONDITION(is_version_touches) - || inters.d_info().arrival[0] == 1 ) ) + if (is_p_spike) { - if ( BOOST_GEOMETRY_CONDITION(is_version_touches) ) + bool output_spike = false; + if BOOST_GEOMETRY_CONSTEXPR (is_version_touches) { tp.operations[0].is_collinear = true; tp.operations[1].is_collinear = false; tp.method = method_touch; + + output_spike = true; } - else // Version == append_collinear_opposite + else if (inters.d_info().arrival[0] == 1) // Version == append_collinear_opposite { tp.operations[0].is_collinear = true; tp.operations[1].is_collinear = false; BOOST_GEOMETRY_ASSERT(inters.i_info().count > 1); - base_turn_handler::assign_point(tp, method_touch_interior, inters.i_info(), 1); + + output_spike = true; } - tp.operations[0].operation = operation_blocked; - tp.operations[1].operation = operation_intersection; - *out++ = tp; - tp.operations[0].operation = operation_intersection; - //tp.operations[1].operation = operation_intersection; - *out++ = tp; + if (output_spike) + { + tp.operations[0].operation = operation_blocked; + tp.operations[1].operation = operation_intersection; + *out++ = tp; + tp.operations[0].operation = operation_intersection; + //tp.operations[1].operation = operation_intersection; + *out++ = tp; - res = true; + res = true; + } } - if ( is_q_spike - && ( BOOST_GEOMETRY_CONDITION(is_version_touches) - || inters.d_info().arrival[1] == 1 ) ) + if (is_q_spike) { - if ( BOOST_GEOMETRY_CONDITION(is_version_touches) ) + bool output_spike = false; + if BOOST_GEOMETRY_CONSTEXPR (is_version_touches) { tp.operations[0].is_collinear = false; tp.operations[1].is_collinear = true; tp.method = method_touch; + + output_spike = true; } - else // Version == append_collinear_opposite + else if (inters.d_info().arrival[1] == 1) // Version == append_collinear_opposite { tp.operations[0].is_collinear = false; tp.operations[1].is_collinear = true; BOOST_GEOMETRY_ASSERT(inters.i_info().count > 0); - base_turn_handler::assign_point(tp, method_touch_interior, inters.i_info(), 0); + + output_spike = true; } - tp.operations[0].operation = operation_intersection; - tp.operations[1].operation = operation_blocked; - *out++ = tp; - //tp.operations[0].operation = operation_intersection; - tp.operations[1].operation = operation_intersection; - *out++ = tp; + if (output_spike) + { + tp.operations[0].operation = operation_intersection; + tp.operations[1].operation = operation_blocked; + *out++ = tp; + //tp.operations[0].operation = operation_intersection; + tp.operations[1].operation = operation_intersection; + *out++ = tp; - res = true; + res = true; + } } return res; diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 326c883b..b8cb1ea0 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2014-2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014-2021. -// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -33,19 +34,18 @@ #include #include #include -#include #include #include #include #include -#include #include #include #include #include #include #include +#include #include #include @@ -104,8 +104,7 @@ template typename Section, typename Point, typename CircularIterator, - typename Strategy, - typename RobustPolicy + typename Strategy > struct unique_sub_range_from_section { @@ -114,8 +113,7 @@ struct unique_sub_range_from_section unique_sub_range_from_section(Section const& section, signed_size_type index, CircularIterator circular_iterator, Point const& previous, Point const& current, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) : m_section(section) , m_index(index) , m_previous_point(previous) @@ -123,7 +121,6 @@ struct unique_sub_range_from_section , m_circular_iterator(circular_iterator) , m_next_point_retrieved(false) , m_strategy(strategy) - , m_robust_policy(robust_policy) {} inline bool is_first_segment() const @@ -166,13 +163,6 @@ private : inline void advance_to_non_duplicate_next(Point const& current, CircularIterator& circular_iterator) const { - using box_point_type = typename geometry::point_type::type; - using robust_point_type = typename robust_point_type::type; - robust_point_type current_robust_point; - robust_point_type next_robust_point; - geometry::recalculate(current_robust_point, current, m_robust_policy); - geometry::recalculate(next_robust_point, *circular_iterator, m_robust_policy); - // To see where the next segments bend to, in case of touch/intersections // on end points, we need (in case of degenerate/duplicate points) an extra // iterator which moves to the REAL next point, so non duplicate. @@ -183,12 +173,10 @@ private : // So advance to the "non duplicate next" // (the check is defensive, to avoid endless loops) std::size_t check = 0; - while (! detail::disjoint::disjoint_point_point( - current_robust_point, next_robust_point, m_strategy) + while (! detail::disjoint::disjoint_point_point(current, *circular_iterator, m_strategy) && check++ < m_section.range_count) { circular_iterator++; - geometry::recalculate(next_robust_point, *circular_iterator, m_robust_policy); } } @@ -199,7 +187,6 @@ private : mutable CircularIterator m_circular_iterator; mutable bool m_next_point_retrieved; Strategy m_strategy; - RobustPolicy m_robust_policy; }; template @@ -253,13 +240,12 @@ class get_turns_in_sections public : // Returns true if terminated, false if interrupted - template + template static inline bool apply( int source_id1, Geometry1 const& geometry1, Section1 const& sec1, int source_id2, Geometry2 const& geometry2, Section2 const& sec2, bool skip_larger, bool skip_adjacent, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy) { @@ -295,7 +281,7 @@ public : range1_iterator prev1, it1, end1; get_start_point_iterator(sec1, view1, prev1, it1, end1, - index1, ndi1, dir1, sec2.bounding_box, robust_policy); + index1, ndi1, dir1, sec2.bounding_box); // We need a circular iterator because it might run through the closing point. // One circle is actually enough but this one is just convenient. @@ -306,17 +292,17 @@ public : // section 2: [--------------] // section 1: |----|---|---|---|---| for (prev1 = it1++, next1++; - it1 != end1 && ! detail::section::exceeding<0>(dir1, *prev1, sec1.bounding_box, sec2.bounding_box, robust_policy); + it1 != end1 && ! detail::section::exceeding<0>(dir1, *prev1, sec1.bounding_box, sec2.bounding_box); ++prev1, ++it1, ++index1, ++next1, ++ndi1) { unique_sub_range_from_section < areal1, Section1, point1_type, circular1_iterator, - Strategy, RobustPolicy + Strategy > unique_sub_range1(sec1, index1, circular1_iterator(begin_range_1, end_range_1, next1, true), *prev1, *it1, - strategy, robust_policy); + strategy); signed_size_type index2 = sec2.begin_index; signed_size_type ndi2 = sec2.non_duplicate_index; @@ -324,12 +310,12 @@ public : range2_iterator prev2, it2, end2; get_start_point_iterator(sec2, view2, prev2, it2, end2, - index2, ndi2, dir2, sec1.bounding_box, robust_policy); + index2, ndi2, dir2, sec1.bounding_box); circular2_iterator next2(begin_range_2, end_range_2, it2, true); next2++; for (prev2 = it2++, next2++; - it2 != end2 && ! detail::section::exceeding<0>(dir2, *prev2, sec2.bounding_box, sec1.bounding_box, robust_policy); + it2 != end2 && ! detail::section::exceeding<0>(dir2, *prev2, sec2.bounding_box, sec1.bounding_box); ++prev2, ++it2, ++index2, ++next2, ++ndi2) { bool skip = false; @@ -365,11 +351,11 @@ public : unique_sub_range_from_section < areal2, Section2, point2_type, circular2_iterator, - Strategy, RobustPolicy + Strategy > unique_sub_range2(sec2, index2, circular2_iterator(begin_range_2, end_range_2, next2), *prev2, *it2, - strategy, robust_policy); + strategy); typedef typename boost::range_value::type turn_info; @@ -384,7 +370,7 @@ public : std::size_t const size_before = boost::size(turns); TurnPolicy::apply(unique_sub_range1, unique_sub_range2, - ti, strategy, robust_policy, + ti, strategy, std::back_inserter(turns)); if (InterruptPolicy::enabled) @@ -411,14 +397,14 @@ private : // because of the logistics of "index" (the section-iterator automatically // skips to the begin-point, we loose the index or have to recalculate it) // So we mimic it here - template + template static inline void get_start_point_iterator(Section const& section, Range const& range, typename boost::range_iterator::type& it, typename boost::range_iterator::type& prev, typename boost::range_iterator::type& end, signed_size_type& index, signed_size_type& ndi, - int dir, Box const& other_bounding_box, RobustPolicy const& robust_policy) + int dir, Box const& other_bounding_box) { it = boost::begin(range) + section.begin_index; end = boost::begin(range) + section.end_index + 1; @@ -426,7 +412,7 @@ private : // Mimic section-iterator: // Skip to point such that section interects other box prev = it++; - for(; it != end && detail::section::preceding<0>(dir, *it, section.bounding_box, other_bounding_box, robust_policy); + for(; it != end && detail::section::preceding<0>(dir, *it, section.bounding_box, other_bounding_box); prev = it++, index++, ndi++) {} // Go back one step because we want to start completely preceding @@ -440,7 +426,6 @@ template bool Reverse1, bool Reverse2, typename TurnPolicy, typename Strategy, - typename RobustPolicy, typename Turns, typename InterruptPolicy > @@ -451,20 +436,17 @@ struct section_visitor int m_source_id2; Geometry2 const& m_geometry2; Strategy const& m_strategy; - RobustPolicy const& m_rescale_policy; Turns& m_turns; InterruptPolicy& m_interrupt_policy; section_visitor(int id1, Geometry1 const& g1, int id2, Geometry2 const& g2, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& ip) : m_source_id1(id1), m_geometry1(g1) , m_source_id2(id2), m_geometry2(g2) , m_strategy(strategy) - , m_rescale_policy(robust_policy) , m_turns(turns) , m_interrupt_policy(ip) {} @@ -488,7 +470,6 @@ struct section_visitor m_source_id2, m_geometry2, sec2, false, false, m_strategy, - m_rescale_policy, m_turns, m_interrupt_policy); } return true; @@ -506,12 +487,11 @@ class get_turns_generic { public: - template + template static inline void apply( int source_id1, Geometry1 const& geometry1, int source_id2, Geometry2 const& geometry2, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy) { @@ -519,21 +499,15 @@ class get_turns_generic typedef typename boost::range_value::type ip_type; typedef typename ip_type::point_type point_type; - typedef model::box - < - typename geometry::robust_point_type - < - point_type, RobustPolicy - >::type - > box_type; + typedef model::box box_type; typedef geometry::sections sections_type; sections_type sec1, sec2; typedef std::integer_sequence dimensions; - geometry::sectionalize(geometry1, robust_policy, + geometry::sectionalize(geometry1, sec1, strategy, 0); - geometry::sectionalize(geometry2, robust_policy, + geometry::sectionalize(geometry2, sec2, strategy, 1); // ... and then partition them, intersecting overlapping sections in visitor method @@ -542,10 +516,10 @@ class get_turns_generic Geometry1, Geometry2, Reverse1, Reverse2, TurnPolicy, - Strategy, RobustPolicy, + Strategy, Turns, InterruptPolicy > visitor(source_id1, geometry1, source_id2, geometry2, - strategy, robust_policy, turns, interrupt_policy); + strategy, turns, interrupt_policy); geometry::partition < @@ -644,12 +618,11 @@ struct get_turns_cs ever_circling_iterator m_circular_iterator; }; - template + template static inline void apply( int source_id1, Range const& range, int source_id2, Box const& box, IntersectionStrategy const& intersection_strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, signed_size_type multi_index = -1, @@ -669,10 +642,6 @@ struct get_turns_cs // into account (not in the iterator, nor in the retrieve policy) iterator_type it = boost::begin(view); - //bool first = true; - - //char previous_side[2] = {0, 0}; - signed_size_type index = 0; for (iterator_type prev = it++; @@ -684,77 +653,29 @@ struct get_turns_cs unique_sub_range_from_view_policy view_unique_sub_range(view, *prev, *it, it); - /*if (first) - { - previous_side[0] = get_side<0>(box, *prev); - previous_side[1] = get_side<1>(box, *prev); - } - - char current_side[2]; - current_side[0] = get_side<0>(box, *it); - current_side[1] = get_side<1>(box, *it); - - // There can NOT be intersections if - // 1) EITHER the two points are lying on one side of the box (! 0 && the same) - // 2) OR same in Y-direction - // 3) OR all points are inside the box (0) - if (! ( - (current_side[0] != 0 && current_side[0] == previous_side[0]) - || (current_side[1] != 0 && current_side[1] == previous_side[1]) - || (current_side[0] == 0 - && current_side[1] == 0 - && previous_side[0] == 0 - && previous_side[1] == 0) - ) - )*/ - if (true) - { - get_turns_with_box(seg_id, source_id2, - view_unique_sub_range, - box_points, - intersection_strategy, - robust_policy, - turns, - interrupt_policy); - // Future performance enhancement: - // return if told by the interrupt policy - } + get_turns_with_box(seg_id, source_id2, + view_unique_sub_range, + box_points, + intersection_strategy, + turns, + interrupt_policy); + // Future performance enhancement: + // return if told by the interrupt policy } } private: - template - static inline int get_side(Box const& box, Point const& point) - { - // Inside -> 0 - // Outside -> -1 (left/below) or 1 (right/above) - // On border -> -2 (left/lower) or 2 (right/upper) - // The only purpose of the value is to not be the same, - // and to denote if it is inside (0) - - typename coordinate_type::type const& c = get(point); - typename coordinate_type::type const& left = get(box); - typename coordinate_type::type const& right = get(box); - - if (geometry::math::equals(c, left)) return -2; - else if (geometry::math::equals(c, right)) return 2; - else if (c < left) return -1; - else if (c > right) return 1; - else return 0; - } template < typename IntersectionStrategy, typename Turns, - typename InterruptPolicy, - typename RobustPolicy + typename InterruptPolicy > static inline void get_turns_with_box(segment_identifier const& seg_id, int source_id2, unique_sub_range_from_view_policy const& range_unique_sub_range, box_array const& box, IntersectionStrategy const& intersection_strategy, - RobustPolicy const& robust_policy, // Output Turns& turns, InterruptPolicy& interrupt_policy) @@ -771,25 +692,25 @@ struct get_turns_cs unique_sub_range_from_box_policy box_unique_sub_range(box); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 0); TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, - ti, intersection_strategy, robust_policy, + ti, intersection_strategy, std::back_inserter(turns)); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 1); box_unique_sub_range.next(); TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, - ti, intersection_strategy, robust_policy, + ti, intersection_strategy, std::back_inserter(turns)); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 2); box_unique_sub_range.next(); TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, - ti, intersection_strategy, robust_policy, + ti, intersection_strategy, std::back_inserter(turns)); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3); box_unique_sub_range.next(); TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, - ti, intersection_strategy, robust_policy, + ti, intersection_strategy, std::back_inserter(turns)); if (InterruptPolicy::enabled) @@ -810,12 +731,11 @@ template > struct get_turns_polygon_cs { - template + template static inline void apply( int source_id1, Polygon const& polygon, int source_id2, Box const& box, IntersectionStrategy const& intersection_strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, signed_size_type multi_index = -1) @@ -833,7 +753,6 @@ struct get_turns_polygon_cs source_id1, geometry::exterior_ring(polygon), source_id2, box, intersection_strategy, - robust_policy, turns, interrupt_policy, multi_index, -1); @@ -847,7 +766,6 @@ struct get_turns_polygon_cs source_id1, *it, source_id2, box, intersection_strategy, - robust_policy, turns, interrupt_policy, multi_index, i); } @@ -864,12 +782,11 @@ template > struct get_turns_multi_polygon_cs { - template + template static inline void apply( int source_id1, Multi const& multi, int source_id2, Box const& box, IntersectionStrategy const& intersection_strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy) { @@ -883,7 +800,7 @@ struct get_turns_multi_polygon_cs Reverse, ReverseBox, TurnPolicy >::apply(source_id1, *it, source_id2, box, - intersection_strategy, robust_policy, + intersection_strategy, turns, interrupt_policy, i); } } @@ -895,7 +812,7 @@ struct get_turns_multi_polygon_cs template struct topological_tag_base { - typedef typename tag_cast::type, pointlike_tag, linear_tag, areal_tag>::type type; + using type = tag_cast_t, pointlike_tag, linear_tag, areal_tag>; }; template struct get_turns_reversed { - template + template static inline void apply(int source_id1, Geometry1 const& g1, int source_id2, Geometry2 const& g2, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy) { @@ -1051,7 +967,7 @@ struct get_turns_reversed Reverse2, Reverse1, TurnPolicy >::apply(source_id2, g2, source_id1, g1, - strategy, robust_policy, + strategy, turns, interrupt_policy); } }; @@ -1070,8 +986,7 @@ struct get_turns_reversed \tparam Turns type of turn-container (e.g. vector of "intersection/turn point"'s) \param geometry1 \param_geometry \param geometry2 \param_geometry -\param intersection_strategy segments intersection strategy -\param robust_policy policy to handle robustness issues +\param strategy segments intersection strategy \param turns container which will contain turn points \param interrupt_policy policy determining if process is stopped when intersection is found @@ -1083,14 +998,12 @@ template typename Geometry1, typename Geometry2, typename Strategy, - typename RobustPolicy, typename Turns, typename InterruptPolicy > inline void get_turns(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy) { @@ -1121,7 +1034,6 @@ inline void get_turns(Geometry1 const& geometry1, >::apply(0, geometry1, 1, geometry2, strategy, - robust_policy, turns, interrupt_policy); } diff --git a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp index aaabb4a4..fa5f52c5 100644 --- a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp @@ -1,11 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -37,7 +37,7 @@ #include #include #include -#include +#include #if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS) # include @@ -97,7 +97,6 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters) } remove_clusters(turns, clusters); - colocate_clusters(clusters, turns); } template @@ -296,7 +295,7 @@ inline void assign_cluster_ids(Turns& turns, Clusters const& clusters) } for (auto const& kv : clusters) { - for (const auto& index : kv.second.turn_indices) + for (auto const& index : kv.second.turn_indices) { turns[index].cluster_id = kv.first; } @@ -317,16 +316,14 @@ template typename Geometry0, typename Geometry1, typename Turns, - typename Clusters, - typename RobustPolicy + typename Clusters > -inline bool handle_colocations(Turns& turns, Clusters& clusters, - RobustPolicy const& robust_policy) +inline bool handle_colocations(Turns& turns, Clusters& clusters) { static const detail::overlay::operation_type target_operation = detail::overlay::operation_from_overlay::value; - get_clusters(turns, clusters, robust_policy); + get_clusters(turns, clusters); if (clusters.empty()) { @@ -339,7 +336,7 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters, // on turns which are discarded afterwards set_colocation(turns, clusters); - if (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection)) + if BOOST_GEOMETRY_CONSTEXPR (target_operation == operation_intersection) { discard_interior_exterior_turns < @@ -427,12 +424,12 @@ template typename Clusters, typename Geometry1, typename Geometry2, - typename SideStrategy + typename Strategy > inline void gather_cluster_properties(Clusters& clusters, Turns& turns, operation_type for_operation, Geometry1 const& geometry1, Geometry2 const& geometry2, - SideStrategy const& strategy) + Strategy const& strategy) { typedef typename boost::range_value::type turn_type; typedef typename turn_type::point_type point_type; @@ -442,7 +439,7 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, // right side typedef sort_by_side::side_sorter < - Reverse1, Reverse2, OverlayType, point_type, SideStrategy, std::less + Reverse1, Reverse2, OverlayType, point_type, Strategy, std::less > sbs_type; for (auto& pair : clusters) @@ -463,6 +460,21 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, cinfo.open_count = sbs.open_count(for_operation); + // Determine spikes + cinfo.spike_count = 0; + for (std::size_t i = 0; i + 1 < sbs.m_ranked_points.size(); i++) + { + auto const& current = sbs.m_ranked_points[i]; + auto const& next = sbs.m_ranked_points[i + 1]; + if (current.rank == next.rank + && current.direction == detail::overlay::sort_by_side::dir_from + && next.direction == detail::overlay::sort_by_side::dir_to) + { + // It leaves, from cluster point, and immediately returns. + cinfo.spike_count += 1; + } + } + bool const set_startable = OverlayType != overlay_dissolve; // Unset the startable flag for all 'closed' zones. This does not @@ -475,7 +487,8 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, turn_operation_type& op = turn.operations[ranked.operation_index]; if (set_startable - && for_operation == operation_union && cinfo.open_count == 0) + && for_operation == operation_union + && cinfo.open_count == 0) { op.enriched.startable = false; } @@ -495,11 +508,13 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, continue; } - if (BOOST_GEOMETRY_CONDITION(OverlayType == overlay_difference) - && is_self_turn(turn)) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType == overlay_difference) { - // TODO: investigate - continue; + if (is_self_turn(turn)) + { + // TODO: investigate + continue; + } } if ((for_operation == operation_union diff --git a/include/boost/geometry/algorithms/detail/overlay/handle_self_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/handle_self_turns.hpp index 435a80c2..3d7ea5eb 100644 --- a/include/boost/geometry/algorithms/detail/overlay/handle_self_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/handle_self_turns.hpp @@ -128,7 +128,7 @@ private : template static inline bool is_self_cluster(signed_size_type cluster_id, - const Turns& turns, Clusters const& clusters) + Turns const& turns, Clusters const& clusters) { auto cit = clusters.find(cluster_id); if (cit == clusters.end()) diff --git a/include/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp b/include/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp index 1486f94f..4f91c054 100644 --- a/include/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp @@ -22,10 +22,7 @@ class inconsistent_turns_exception : public geometry::exception inline inconsistent_turns_exception() {} - virtual ~inconsistent_turns_exception() throw() - {} - - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry Inconsistent Turns exception"; } diff --git a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index df3b70a4..1dbd717a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014-2021. -// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -42,13 +42,10 @@ #include #include #include +#include #include -#include -#include -#include - #include #include #include @@ -59,7 +56,7 @@ #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW) #include #include -#include +#include #endif namespace boost { namespace geometry @@ -75,32 +72,21 @@ struct intersection_segment_segment_point template < typename Segment1, typename Segment2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Segment1 const& segment1, Segment2 const& segment2, - RobustPolicy const& , OutputIterator out, Strategy const& strategy) { - // Make sure this is only called with no rescaling - BOOST_STATIC_ASSERT((std::is_same - < - no_rescale_policy_tag, - typename rescale_policy_type::type - >::value)); - - typedef typename point_type::type point_type; - - // Get the intersection point (or two points) - typedef segment_intersection_points intersection_return_type; - - typedef policies::relate::segments_intersection_points + using point_type = point_type_t; + using intersection_return_type = segment_intersection_points; + using policy_type = policies::relate::segments_intersection_points < intersection_return_type - > policy_type; + >; + // Get the intersection point (or two points) detail::segment_as_subrange sub_range1(segment1); detail::segment_as_subrange sub_range2(segment2); @@ -123,28 +109,19 @@ struct intersection_linestring_linestring_point template < typename Linestring1, typename Linestring2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Linestring1 const& linestring1, Linestring2 const& linestring2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { - // Make sure this is only called with no rescaling - BOOST_STATIC_ASSERT((std::is_same - < - no_rescale_policy_tag, - typename rescale_policy_type::type - >::value)); - typedef detail::overlay::turn_info turn_info; std::deque turns; geometry::get_intersection_points(linestring1, linestring2, - robust_policy, turns, strategy); + turns, strategy); for (auto const& turn : turns) { @@ -281,21 +258,12 @@ struct intersection_of_linestring_with_areal template < typename LineString, typename Areal, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(LineString const& linestring, Areal const& areal, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { - // Make sure this is only called with no rescaling - BOOST_STATIC_ASSERT((std::is_same - < - no_rescale_policy_tag, - typename rescale_policy_type::type - >::value)); - if (boost::size(linestring) == 0) { return out; @@ -316,10 +284,7 @@ struct intersection_of_linestring_with_areal GeometryOut, linestring_tag, linestring_tag > linear; - typedef typename point_type - < - typename linear::type - >::type point_type; + using point_type = point_type_t; typedef geometry::segment_ratio < @@ -356,7 +321,7 @@ struct intersection_of_linestring_with_areal (OverlayType == overlay_intersection ? ReverseAreal : !ReverseAreal), turn_policy >::apply(0, linestring, 1, areal, - strategy, robust_policy, + strategy, turns, policy); int inside_value = 0; @@ -379,17 +344,18 @@ struct intersection_of_linestring_with_areal } #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW) - for_each_with_index(turns, [](auto index, auto const& turn) + for (auto const& item : util::enumerate(turns)) { - debug_follow(turn, turn.operations[0], index); - }); + auto const& turn = item.value; + debug_follow(turn, turn.operations[0], item.index); + } #endif return follower::apply ( linestring, areal, geometry::detail::overlay::operation_intersection, - turns, robust_policy, out, strategy + turns, out, strategy ); } }; @@ -413,20 +379,18 @@ struct intersection_areal_areal_point template < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { typedef detail::overlay::turn_info < PointOut, - typename segment_ratio_type::type + typename segment_ratio_type::type > turn_info; std::vector turns; @@ -435,7 +399,7 @@ struct intersection_areal_areal_point geometry::get_turns < false, false, detail::overlay::assign_null_policy - >(geometry1, geometry2, strategy, robust_policy, turns, policy); + >(geometry1, geometry2, strategy, turns, policy); return intersection_output_turn_points(turns, out); } @@ -447,23 +411,14 @@ struct intersection_linear_areal_point template < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { - // Make sure this is only called with no rescaling - BOOST_STATIC_ASSERT((std::is_same - < - no_rescale_policy_tag, - typename rescale_policy_type::type - >::value)); - typedef geometry::segment_ratio::type> ratio_type; typedef detail::overlay::turn_info @@ -496,7 +451,7 @@ struct intersection_linear_areal_point false, turn_policy >::apply(0, geometry1, 1, geometry2, - strategy, robust_policy, + strategy, turns, interrupt_policy); return intersection_output_turn_points(turns, out); @@ -509,20 +464,18 @@ struct intersection_areal_linear_point template < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return intersection_linear_areal_point < PointOut - >::apply(geometry2, geometry1, robust_policy, out, strategy); + >::apply(geometry2, geometry1, out, strategy); } }; @@ -547,13 +500,13 @@ template bool Reverse1 = detail::overlay::do_reverse::value>::value, bool Reverse2 = detail::overlay::do_reverse::value>::value, // tag dispatching: - typename TagIn1 = typename geometry::tag::type, - typename TagIn2 = typename geometry::tag::type, + typename TagIn1 = tag_t, + typename TagIn2 = tag_t, typename TagOut = typename detail::setop_insert_output_tag::type, // metafunction finetuning helpers: - typename CastedTagIn1 = typename geometry::tag_cast::type, - typename CastedTagIn2 = typename geometry::tag_cast::type, - typename CastedTagOut = typename geometry::tag_cast::type + typename CastedTagIn1 = tag_cast_t, + typename CastedTagIn2 = tag_cast_t, + typename CastedTagOut = tag_cast_t > struct intersection_insert { @@ -669,16 +622,14 @@ struct intersection_insert linear_tag, areal_tag, linear_tag > { - template + template static inline OutputIterator apply(Linestring const& linestring, Box const& box, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& ) { - typedef typename point_type::type point_type; - strategy::intersection::liang_barsky lb_strategy; + strategy::intersection::liang_barsky> lb_strategy; return detail::intersection::clip_range_with_box - (box, linestring, robust_policy, out, lb_strategy); + (box, linestring, out, lb_strategy); } }; @@ -749,18 +700,16 @@ struct intersection_insert linear_tag, areal_tag, linear_tag > { - template + template static inline OutputIterator apply(Segment const& segment, Box const& box, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& ) { geometry::segment_view range(segment); - typedef typename point_type::type point_type; - strategy::intersection::liang_barsky lb_strategy; + strategy::intersection::liang_barsky> lb_strategy; return detail::intersection::clip_range_with_box - (box, range, robust_policy, out, lb_strategy); + (box, range, out, lb_strategy); } }; @@ -841,10 +790,9 @@ template > struct intersection_insert_reversed { - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -853,7 +801,7 @@ struct intersection_insert_reversed Geometry2, Geometry1, GeometryOut, OverlayType, Reverse2, Reverse1 - >::apply(g2, g1, robust_policy, out, strategy); + >::apply(g2, g1, out, strategy); } }; @@ -878,11 +826,10 @@ struct intersection_insert { template < - typename RobustPolicy, typename OutputIterator, typename Strategy + typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -895,7 +842,7 @@ struct intersection_insert detail::boundary_view, LinestringOut, overlay_intersection - >::apply(view1, view2, robust_policy, oit, strategy); + >::apply(view1, view2, oit, strategy); } }; @@ -950,18 +897,17 @@ struct intersection_insert // iterators in OutputIterators tuple/pair. template < - typename RobustPolicy, typename OutputIterators, typename Strategy + typename OutputIterators, typename Strategy > static inline OutputIterators apply(Linear1 const& linear1, Linear2 const& linear2, - RobustPolicy const& robust_policy, OutputIterators oit, Strategy const& strategy) { return detail::overlay::linear_linear_linestring < Linear1, Linear2, TupledOut, OverlayType - >::apply(linear1, linear2, robust_policy, oit, strategy); + >::apply(linear1, linear2, oit, strategy); } }; @@ -1064,11 +1010,10 @@ struct intersection_insert // of iterators in OutputIterators tuple/pair. template < - typename RobustPolicy, typename OutputIterators, typename Strategy + typename OutputIterators, typename Strategy > static inline OutputIterators apply(PointLike1 const& pointlike1, PointLike2 const& pointlike2, - RobustPolicy const& robust_policy, OutputIterators oits, Strategy const& strategy) { @@ -1087,7 +1032,7 @@ struct intersection_insert out_point_index, TupledOut >::type, OverlayType - >::apply(pointlike1, pointlike2, robust_policy, + >::apply(pointlike1, pointlike2, bgt::get(oits), strategy); @@ -1113,7 +1058,7 @@ struct intersection_insert > : detail_dispatch::overlay::pointlike_linear_point < Point, Linear, PointOut, OverlayType, - point_tag, typename tag_cast::type + point_tag, tag_cast_t > {}; @@ -1135,7 +1080,7 @@ struct intersection_insert < MultiPoint, Linear, PointOut, OverlayType, multi_point_tag, - typename tag_cast::type + tag_cast_t > {}; @@ -1155,10 +1100,9 @@ struct intersection_insert linear_tag, pointlike_tag, pointlike_tag > { - template + template static inline OutputIterator apply(Linestring const& linestring, MultiPoint const& multipoint, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -1166,7 +1110,7 @@ struct intersection_insert < MultiPoint, Linestring, PointOut, overlay_intersection, multi_point_tag, linear_tag - >::apply(multipoint, linestring, robust_policy, out, strategy); + >::apply(multipoint, linestring, out, strategy); } }; @@ -1211,17 +1155,16 @@ struct intersection_insert linear_tag, pointlike_tag, detail::tupled_output_tag > { - template + template static inline OutputIterators apply(Linestring const& linestring, MultiPoint const& multipoint, - RobustPolicy const& robust_policy, OutputIterators out, Strategy const& strategy) { return intersection_insert < MultiPoint, Linestring, TupledOut, overlay_intersection - >::apply(multipoint, linestring, robust_policy, out, strategy); + >::apply(multipoint, linestring, out, strategy); } }; @@ -1283,10 +1226,9 @@ struct intersection_insert areal_tag, pointlike_tag, pointlike_tag > { - template + template static inline OutputIterator apply(Areal const& areal, MultiPoint const& multipoint, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -1294,7 +1236,7 @@ struct intersection_insert < MultiPoint, Areal, PointOut, overlay_intersection, multi_point_tag, ArealTag - >::apply(multipoint, areal, robust_policy, out, strategy); + >::apply(multipoint, areal, out, strategy); } }; @@ -1340,17 +1282,16 @@ struct intersection_insert areal_tag, pointlike_tag, detail::tupled_output_tag > { - template + template static inline OutputIterators apply(Areal const& areal, MultiPoint const& multipoint, - RobustPolicy const& robust_policy, OutputIterators out, Strategy const& strategy) { return intersection_insert < MultiPoint, Areal, TupledOut, overlay_intersection - >::apply(multipoint, areal, robust_policy, out, strategy); + >::apply(multipoint, areal, out, strategy); } }; @@ -1419,13 +1360,11 @@ template bool ReverseSecond, overlay_type OverlayType, typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > inline OutputIterator insert(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy robust_policy, OutputIterator out, Strategy const& strategy) { @@ -1448,7 +1387,7 @@ inline OutputIterator insert(Geometry1 const& geometry1, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, ReverseSecond>::value > - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } @@ -1487,21 +1426,10 @@ inline OutputIterator intersection_insert(Geometry1 const& geometry1, concepts::check(); concepts::check(); - typedef typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - >::type rescale_policy_type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - return detail::intersection::insert < GeometryOut, false, overlay_intersection - >(geometry1, geometry2, robust_policy, out, strategy); + >(geometry1, geometry2, out, strategy); } diff --git a/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp b/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp index 1ce97d26..140c6aaf 100644 --- a/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp @@ -2,9 +2,9 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -65,7 +65,6 @@ template typename Turns, typename Indexed, typename Geometry1, typename Geometry2, - typename RobustPolicy, typename Strategy, bool Reverse1, bool Reverse2 > @@ -74,12 +73,10 @@ struct less_by_segment_ratio inline less_by_segment_ratio(Turns const& turns , Geometry1 const& geometry1 , Geometry2 const& geometry2 - , RobustPolicy const& robust_policy , Strategy const& strategy) : m_turns(turns) , m_geometry1(geometry1) , m_geometry2(geometry2) - , m_robust_policy(robust_policy) , m_strategy(strategy) { } @@ -89,7 +86,6 @@ private : Turns const& m_turns; Geometry1 const& m_geometry1; Geometry2 const& m_geometry2; - RobustPolicy const& m_robust_policy; Strategy const& m_strategy; typedef typename geometry::point_type::type point_type; diff --git a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp index f67a06b0..75ff4743 100644 --- a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp @@ -1,6 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2022, Oracle and/or its affiliates. +// Copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -145,14 +146,12 @@ class linear_linear_linestring typename Turns, typename LinearGeometry1, typename LinearGeometry2, - typename Strategy, - typename RobustPolicy + typename Strategy > static inline void compute_turns(Turns& turns, LinearGeometry1 const& linear1, LinearGeometry2 const& linear2, - Strategy const& strategy, - RobustPolicy const& robust_policy) + Strategy const& strategy) { turns.clear(); @@ -168,7 +167,7 @@ class linear_linear_linestring LinearGeometry2, assign_policy > - >::apply(turns, linear1, linear2, interrupt_policy, strategy, robust_policy); + >::apply(turns, linear1, linear2, interrupt_policy, strategy); } @@ -221,11 +220,10 @@ class linear_linear_linestring public: template < - typename RobustPolicy, typename OutputIterator, typename Strategy + typename OutputIterator, typename Strategy > static inline OutputIterator apply(Linear1 const& linear1, Linear2 const& linear2, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -239,12 +237,12 @@ class linear_linear_linestring Linear2, assign_policy > - >::template turn_info_type::type turn_info; + >::template turn_info_type::type turn_info; typedef std::vector turns_container; turns_container turns; - compute_turns(turns, linear1, linear2, strategy, robust_policy); + compute_turns(turns, linear1, linear2, strategy); if ( turns.empty() ) { @@ -289,11 +287,10 @@ struct linear_linear_linestring { template < - typename RobustPolicy, typename OutputIterator, typename Strategy + typename OutputIterator, typename Strategy > static inline OutputIterator apply(Linear1 const& linear1, Linear2 const& linear2, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -310,7 +307,7 @@ struct linear_linear_linestring Linear2, Linear1, LinestringOut, overlay_difference, EnableFilterContinueTurns, EnableRemoveDuplicateTurns, EnableDegenerateTurns, EnableFollowIsolatedPoints - >::apply(linear2, linear1, robust_policy, oit, strategy); + >::apply(linear2, linear1, oit, strategy); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp index e0451f9d..6ce28be7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland -// This file was modified by Oracle on 2015-2020. -// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -35,8 +36,6 @@ #include #include -#include - #include #include @@ -46,14 +45,8 @@ #include #include -#include - #include -#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE -# include -#endif - namespace boost { namespace geometry { @@ -109,38 +102,42 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C = target_operation == operation_union ? operation_intersection : operation_union; + static const bool is_union = target_operation == operation_union; for (auto const& turn : turns) { bool cluster_checked = false; bool has_blocked = false; - if (is_self_turn(turn) && turn.discarded) + if (turn.discarded && (turn.method == method_start || is_self_turn(turn))) { - // Discarded self-turns don't count as traversed + // Discarded self-turns or start turns don't need to block the ring continue; } - for (auto const& op : turn.operations) + for (int i = 0; i < 2; i++) { + auto const& op = turn.operations[i]; + auto const& other_op = turn.operations[1 - i]; ring_identifier const ring_id = ring_id_by_seg_id(op.seg_id); - if (! is_self_turn(turn) - && ( - (BOOST_GEOMETRY_CONDITION(target_operation == operation_union) - && op.enriched.count_left > 0) - || (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection) - && op.enriched.count_right <= 2))) + // If the turn (one of its operations) is used during traversal, + // and it is an intersection or difference, it cannot be set to blocked. + // This is a rare case, related to floating point precision, + // and can happen if there is, for example, only one start turn which is + // used to traverse through one of the rings (the other should be marked + // as not traversed, but neither blocked). + bool const can_block + = is_union + || ! (op.visited.finalized() || other_op.visited.finalized()); + + if (! is_self_turn(turn) && can_block) { - // Avoid including untraversed rings which have polygons on - // their left side (union) or not two on their right side (int) - // This can only be done for non-self-turns because of count - // information turn_info_map[ring_id].has_blocked_turn = true; continue; } - if (turn.any_blocked()) + if (is_union && turn.any_blocked()) { turn_info_map[ring_id].has_blocked_turn = true; } @@ -164,6 +161,7 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C // don't block (for union) i/u if there is an self-ii too if (has_blocked || (op.operation == opposite_operation + && can_block && ! turn.has_colocated_both && ! (turn.both(opposite_operation) && is_self_turn(turn)))) @@ -232,10 +230,9 @@ template > struct overlay { - template + template static inline OutputIterator apply( Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy, Visitor& visitor) @@ -260,7 +257,7 @@ struct overlay typedef detail::overlay::traversal_turn_info < point_type, - typename segment_ratio_type::type + typename segment_ratio_type::type > turn_info; typedef std::deque turn_container_type; @@ -276,15 +273,12 @@ struct overlay turn_container_type turns; -#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE -std::cout << "get turns" << std::endl; -#endif detail::get_turns::no_interrupt_policy policy; geometry::get_turns < Reverse1, Reverse2, assign_policy_only_start_turns - >(geometry1, geometry2, strategy, robust_policy, turns, policy); + >(geometry1, geometry2, strategy, turns, policy); visitor.visit_turns(1, turns); @@ -296,34 +290,26 @@ std::cout << "get turns" << std::endl; if (needs_self_turns::apply(geometry1)) { self_get_turn_points::self_turns(geometry1, - strategy, robust_policy, turns, policy, 0); + strategy, turns, policy, 0); } if (needs_self_turns::apply(geometry2)) { self_get_turn_points::self_turns(geometry2, - strategy, robust_policy, turns, policy, 1); + strategy, turns, policy, 1); } } #endif - -#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE -std::cout << "enrich" << std::endl; -#endif - cluster_type clusters; std::map turn_info_per_ring; geometry::enrich_intersection_points( - turns, clusters, geometry1, geometry2, robust_policy, strategy); + turns, clusters, geometry1, geometry2, strategy); visitor.visit_turns(2, turns); visitor.visit_clusters(clusters, turns); -#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE -std::cout << "traverse" << std::endl; -#endif // Traverse through intersection/turn points and create rings of them. // These rings are always in clockwise order. // In CCW polygons they are marked as "to be reversed" below. @@ -332,7 +318,6 @@ std::cout << "traverse" << std::endl; ( geometry1, geometry2, strategy, - robust_policy, turns, rings, turn_info_per_ring, clusters, @@ -390,15 +375,14 @@ std::cout << "traverse" << std::endl; ); } - template + template static inline OutputIterator apply( Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { overlay_null_visitor visitor; - return apply(geometry1, geometry2, robust_policy, out, strategy, visitor); + return apply(geometry1, geometry2, out, strategy, visitor); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp index 503d6564..5cfbae09 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2020, Oracle and/or its affiliates. - +// Copyright (c) 2020-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -211,10 +211,9 @@ class multipoint_multipolygon_point } public: - template + template static inline OutputIterator apply(MultiPoint const& multipoint, MultiPolygon const& multipolygon, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -233,7 +232,7 @@ class multipoint_multipolygon_point return multipoint_multipoint_point < MultiPoint, point_vector_type, PointOut, OverlayType - >::apply(multipoint, common_points, robust_policy, oit, strategy); + >::apply(multipoint, common_points, oit, strategy); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp index 19045b25..bfb4880a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2015-2020, Oracle and/or its affiliates. - +// Copyright (c) 2015-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -65,10 +65,9 @@ template > struct point_single_point { - template + template static inline OutputIterator apply(Point const& point, Geometry const& geometry, - RobustPolicy const&, OutputIterator oit, Strategy const& strategy) { @@ -91,10 +90,9 @@ template > struct multipoint_single_point { - template + template static inline OutputIterator apply(MultiPoint const& multipoint, Geometry const& geometry, - RobustPolicy const&, OutputIterator oit, Strategy const& strategy) { @@ -269,10 +267,9 @@ class multipoint_linear_point } public: - template + template static inline OutputIterator apply(MultiPoint const& multipoint, Linear const& linear, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -291,7 +288,7 @@ class multipoint_linear_point return multipoint_multipoint_point < MultiPoint, point_vector_type, PointOut, OverlayType - >::apply(multipoint, common_points, robust_policy, oit, strategy); + >::apply(multipoint, common_points, oit, strategy); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp index 4ad31127..1745bcf4 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp @@ -2,7 +2,7 @@ // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2014-2023, Oracle and/or its affiliates. +// Copyright (c) 2014-2024, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -36,7 +36,7 @@ #include -#include +#include namespace boost { namespace geometry @@ -149,10 +149,9 @@ template > struct point_point_point { - template + template static inline OutputIterator apply(Point1 const& point1, Point2 const& point2, - RobustPolicy const& , OutputIterator oit, Strategy const& strategy) { @@ -183,10 +182,9 @@ template > struct multipoint_point_point { - template + template static inline OutputIterator apply(MultiPoint const& multipoint, Point const& point, - RobustPolicy const& , OutputIterator oit, Strategy const& strategy) { @@ -217,10 +215,9 @@ template > struct point_multipoint_point { - template + template static inline OutputIterator apply(Point const& point, MultiPoint const& multipoint, - RobustPolicy const& , OutputIterator oit, Strategy const& strategy) { @@ -252,22 +249,23 @@ template > struct multipoint_multipoint_point { - template + template static inline OutputIterator apply(MultiPoint1 const& multipoint1, MultiPoint2 const& multipoint2, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { typedef geometry::less less_type; - if (BOOST_GEOMETRY_CONDITION(OverlayType != overlay_difference) - && boost::size(multipoint1) > boost::size(multipoint2)) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType != overlay_difference) { - return multipoint_multipoint_point - < - MultiPoint2, MultiPoint1, PointOut, OverlayType - >::apply(multipoint2, multipoint1, robust_policy, oit, strategy); + if (boost::size(multipoint1) > boost::size(multipoint2)) + { + return multipoint_multipoint_point + < + MultiPoint2, MultiPoint1, PointOut, OverlayType + >::apply(multipoint2, multipoint1, oit, strategy); + } } typedef typename boost::range_value::type point2_type; @@ -412,10 +410,9 @@ template > struct union_pointlike_pointlike_point { - template + template static inline OutputIterator apply(PointLike1 const& pointlike1, PointLike2 const& pointlike2, - RobustPolicy const& robust_policy, OutputIterator oit, Strategy const& strategy) { @@ -426,7 +423,7 @@ struct union_pointlike_pointlike_point PointLike2, PointLike1, PointOut, overlay_difference, typename tag::type, typename tag::type - >::apply(pointlike2, pointlike1, robust_policy, oit, strategy); + >::apply(pointlike2, pointlike1, oit, strategy); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp b/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp index e41ee823..4fd69411 100644 --- a/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp @@ -13,7 +13,6 @@ #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp index 20369fa9..49c4357c 100644 --- a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp @@ -3,8 +3,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2021. -// Modifications copyright (c) 2017-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -24,7 +25,6 @@ #include #include -#include #include #include #include @@ -37,7 +37,6 @@ #include - namespace boost { namespace geometry { @@ -66,14 +65,12 @@ template typename Turns, typename TurnPolicy, typename Strategy, - typename RobustPolicy, typename InterruptPolicy > struct self_section_visitor { Geometry const& m_geometry; Strategy const& m_strategy; - RobustPolicy const& m_rescale_policy; Turns& m_turns; InterruptPolicy& m_interrupt_policy; int m_source_index; @@ -81,14 +78,12 @@ struct self_section_visitor inline self_section_visitor(Geometry const& g, Strategy const& s, - RobustPolicy const& rp, Turns& turns, InterruptPolicy& ip, int source_index, bool skip_adjacent) : m_geometry(g) , m_strategy(s) - , m_rescale_policy(rp) , m_turns(turns) , m_interrupt_policy(ip) , m_source_index(source_index) @@ -115,7 +110,6 @@ struct self_section_visitor m_source_index, m_geometry, sec2, false, m_skip_adjacent, m_strategy, - m_rescale_policy, m_turns, m_interrupt_policy); } @@ -129,23 +123,15 @@ struct self_section_visitor template struct get_turns { - template + template static inline bool apply( Geometry const& geometry, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, int source_index, bool skip_adjacent) { - typedef model::box - < - typename geometry::robust_point_type - < - typename geometry::point_type::type, - RobustPolicy - >::type - > box_type; + typedef model::box::type> box_type; // sectionalize in two dimensions to detect // all potential spikes correctly @@ -154,14 +140,14 @@ struct get_turns typedef std::integer_sequence dimensions; sections_type sec; - geometry::sectionalize(geometry, robust_policy, + geometry::sectionalize(geometry, sec, strategy); self_section_visitor < Reverse, Geometry, - Turns, TurnPolicy, Strategy, RobustPolicy, InterruptPolicy - > visitor(geometry, strategy, robust_policy, turns, interrupt_policy, + Turns, TurnPolicy, Strategy, InterruptPolicy + > visitor(geometry, strategy, turns, interrupt_policy, source_index, skip_adjacent); // false if interrupted @@ -224,11 +210,10 @@ struct self_get_turn_points TurnPolicy > { - template + template static inline bool apply( Box const& , Strategy const& , - RobustPolicy const& , Turns& , InterruptPolicy& , int /*source_index*/, @@ -288,13 +273,11 @@ struct self_get_turn_points template < typename Geometry, - typename RobustPolicy, typename Turns, typename InterruptPolicy > static inline void apply(Geometry const& geometry, Strategies const& strategies, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, int source_index, @@ -308,7 +291,7 @@ struct self_get_turn_points typename tag::type, Geometry, turn_policy - >::apply(geometry, strategies, robust_policy, turns, interrupt_policy, + >::apply(geometry, strategies, turns, interrupt_policy, source_index, skip_adjacent); } }; @@ -319,13 +302,11 @@ struct self_get_turn_points template < typename Geometry, - typename RobustPolicy, typename Turns, typename InterruptPolicy > static inline void apply(Geometry const& geometry, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, int source_index, @@ -340,7 +321,6 @@ struct self_get_turn_points decltype(strategy_converter::get(strategy)) >::apply(geometry, strategy_converter::get(strategy), - robust_policy, turns, interrupt_policy, source_index, @@ -364,13 +344,11 @@ template typename AssignPolicy, typename Geometry, typename Strategy, - typename RobustPolicy, typename Turns, typename InterruptPolicy > inline void self_turns(Geometry const& geometry, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, int source_index = 0, @@ -381,7 +359,7 @@ inline void self_turns(Geometry const& geometry, resolve_strategy::self_get_turn_points < Reverse, AssignPolicy, Strategy - >::apply(geometry, strategy, robust_policy, turns, interrupt_policy, + >::apply(geometry, strategy, turns, interrupt_policy, source_index, skip_adjacent); } @@ -396,7 +374,6 @@ inline void self_turns(Geometry const& geometry, (e.g. vector of "intersection/turn point"'s) \param geometry geometry \param strategy strategy to be used - \param robust_policy policy to handle robustness issues \param turns container which will contain intersection points \param interrupt_policy policy determining if process is stopped when intersection is found @@ -408,13 +385,11 @@ template typename AssignPolicy, typename Geometry, typename Strategy, - typename RobustPolicy, typename Turns, typename InterruptPolicy > inline void self_turns(Geometry const& geometry, Strategy const& strategy, - RobustPolicy const& robust_policy, Turns& turns, InterruptPolicy& interrupt_policy, int source_index = 0, @@ -430,7 +405,7 @@ inline void self_turns(Geometry const& geometry, resolve_strategy::self_get_turn_points < reverse, AssignPolicy, Strategy - >::apply(geometry, strategy, robust_policy, turns, interrupt_policy, + >::apply(geometry, strategy, turns, interrupt_policy, source_index, skip_adjacent); } diff --git a/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp b/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp index 503b3672..14f32bee 100644 --- a/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -39,35 +39,22 @@ namespace boost { namespace geometry namespace detail { namespace overlay { namespace sort_by_side { +// From means: from intersecting-segment-begin-point to cluster +// To means: from cluster to intersecting-segment-end-point enum direction_type { dir_unknown = -1, dir_from = 0, dir_to = 1 }; -typedef signed_size_type rank_type; - +using rank_type = signed_size_type; // Point-wrapper, adding some properties template struct ranked_point { - ranked_point() - : rank(0) - , turn_index(-1) - , operation_index(-1) - , direction(dir_unknown) - , count_left(0) - , count_right(0) - , operation(operation_none) - {} - ranked_point(Point const& p, signed_size_type ti, int oi, direction_type d, operation_type op, segment_identifier const& si) : point(p) - , rank(0) - , zone(-1) , turn_index(ti) , operation_index(oi) , direction(d) - , count_left(0) - , count_right(0) , operation(op) , seg_id(si) {} @@ -75,79 +62,76 @@ struct ranked_point using point_type = Point; Point point; - rank_type rank; - signed_size_type zone; // index of closed zone, in uu turn there would be 2 zones - signed_size_type turn_index; - int operation_index; // 0,1 - direction_type direction; - std::size_t count_left; - std::size_t count_right; - operation_type operation; + rank_type rank{0}; + signed_size_type zone{-1}; // index of closed zone, in uu turn there would be 2 zones + signed_size_type turn_index{-1}; + int operation_index{-1}; // 0,1 + direction_type direction{dir_unknown}; + + // The number of polygons on the left side + std::size_t count_left{0}; + + // The number of polygons on the right side + std::size_t count_right{0}; + + operation_type operation{operation_none}; segment_identifier seg_id; }; struct less_by_turn_index { template - inline bool operator()(const T& first, const T& second) const + inline bool operator()(T const& first, T const& second) const { - return first.turn_index == second.turn_index - ? first.index < second.index - : first.turn_index < second.turn_index - ; + return std::tie(first.turn_index, first.index) + < std::tie(second.turn_index, second.index); } }; struct less_by_index { template - inline bool operator()(const T& first, const T& second) const + inline bool operator()(T const& first, T const& second) const { - // Length might be considered too - // First order by from/to - if (first.direction != second.direction) - { - return first.direction < second.direction; - } + // First order by direction (from/to) // Then by turn index - if (first.turn_index != second.turn_index) - { - return first.turn_index < second.turn_index; - } // This can also be the same (for example in buffer), but seg_id is // never the same - return first.seg_id < second.seg_id; + // (Length might be considered too) + return std::tie(first.direction, first.turn_index, first.seg_id) + < std::tie(second.direction, second.turn_index, second.seg_id); } }; struct less_false { template - inline bool operator()(const T&, const T& ) const + inline bool operator()(T const&, T const& ) const { return false; } }; -template +template struct less_by_side { - less_by_side(const PointOrigin& p1, const PointTurn& p2, SideStrategy const& strategy) + less_by_side(PointOrigin const& p1, PointTurn const& p2, Strategy const& strategy) : m_origin(p1) , m_turn_point(p2) , m_strategy(strategy) {} template - inline bool operator()(const T& first, const T& second) const + inline bool operator()(T const& first, T const& second) const { - typedef typename SideStrategy::cs_tag cs_tag; + using cs_tag = typename Strategy::cs_tag; LessOnSame on_same; Compare compare; - int const side_first = m_strategy.apply(m_origin, m_turn_point, first.point); - int const side_second = m_strategy.apply(m_origin, m_turn_point, second.point); + auto const side_strategy = m_strategy.side(); + int const side_first = side_strategy.apply(m_origin, m_turn_point, first.point); + int const side_second = side_strategy.apply(m_origin, m_turn_point, second.point); if (side_first == 0 && side_second == 0) { @@ -187,14 +171,14 @@ struct less_by_side // They are both left, both right, and/or both collinear (with each other and/or with p1,p2) // Check mutual side - int const side_second_wrt_first = m_strategy.apply(m_turn_point, first.point, second.point); + int const side_second_wrt_first = side_strategy.apply(m_turn_point, first.point, second.point); if (side_second_wrt_first == 0) { return on_same(first, second); } - int const side_first_wrt_second = m_strategy.apply(m_turn_point, second.point, first.point); + int const side_first_wrt_second = side_strategy.apply(m_turn_point, second.point, first.point); if (side_second_wrt_first != -side_first_wrt_second) { // (FP) accuracy error in side calculation, the sides are not opposite. @@ -213,22 +197,28 @@ struct less_by_side private : PointOrigin const& m_origin; PointTurn const& m_turn_point; - SideStrategy const& m_strategy; + + // Umbrella strategy containing side strategy + Strategy const& m_strategy; }; // Sorts vectors in counter clockwise order (by default) +// Purposes: +// - from one entry vector, find the next exit vector +// - find the open counts +// - find zones template < bool Reverse1, bool Reverse2, overlay_type OverlayType, typename Point, - typename SideStrategy, + typename Strategy, typename Compare > struct side_sorter { - typedef ranked_point rp; + using rp = ranked_point; private : struct include_union @@ -254,7 +244,7 @@ private : }; public : - side_sorter(SideStrategy const& strategy) + side_sorter(Strategy const& strategy) : m_origin_count(0) , m_origin_segment_distance(0) , m_strategy(strategy) @@ -289,6 +279,17 @@ public : Point const& point_from, Point const& point_to, Operation const& op, bool is_origin) { + // The segment is added in two parts (sub-segment). + // In picture: + // + // from -----> * -----> to + // + // where * means: cluster point (intersection point) + // from means: start point of original segment + // to means: end point of original segment + // So from/to is from the perspective of the segment. + // From the perspective of the cluster, it is the other way round + // (from means: from-segment-to-cluster, to means: from-cluster-to-segment) add_segment_from(turn_index, op_index, point_from, op, is_origin); add_segment_to(turn_index, op_index, point_to, op); } @@ -325,7 +326,8 @@ public : double >::type; - ct_type const tolerance = 1000000000; + static auto const tolerance + = common_approximately_equals_epsilon_multiplier::value(); int offset = 0; while (approximately_equals(point_from, turn.point, tolerance) @@ -355,7 +357,7 @@ public : Geometry2 const& geometry2, bool is_departure) { - Point potential_origin = add(turn, op, turn_index, op_index, geometry1, geometry2, false); + auto const potential_origin = add(turn, op, turn_index, op_index, geometry1, geometry2, false); if (is_departure) { @@ -391,8 +393,8 @@ public : // to give colinear points // Sort by side and assign rank - less_by_side less_unique(m_origin, turn_point, m_strategy); - less_by_side less_non_unique(m_origin, turn_point, m_strategy); + less_by_side less_unique(m_origin, turn_point, m_strategy); + less_by_side less_non_unique(m_origin, turn_point, m_strategy); std::sort(m_ranked_points.begin(), m_ranked_points.end(), less_unique); @@ -417,7 +419,7 @@ public : for (std::size_t i = 0; i < m_ranked_points.size(); i++) { - const rp& ranked = m_ranked_points[i]; + rp const& ranked = m_ranked_points[i]; if (ranked.direction != dir_from) { continue; @@ -439,7 +441,7 @@ public : bool handled[2] = {false, false}; for (std::size_t i = 0; i < m_ranked_points.size(); i++) { - const rp& ranked = m_ranked_points[i]; + rp const& ranked = m_ranked_points[i]; if (ranked.direction != dir_from) { continue; @@ -457,7 +459,7 @@ public : void find_open() { - if (BOOST_GEOMETRY_CONDITION(OverlayType == overlay_buffer)) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType == overlay_buffer) { find_open_by_piece_index(); } @@ -511,12 +513,14 @@ public : //private : - typedef std::vector container_type; + using container_type = std::vector; container_type m_ranked_points; Point m_origin; std::size_t m_origin_count; signed_size_type m_origin_segment_distance; - SideStrategy m_strategy; + + // Umbrella strategy containing side strategy + Strategy m_strategy; private : @@ -723,13 +727,13 @@ struct side_compare {}; template <> struct side_compare { - typedef std::greater type; + using type = std::greater; }; template <> struct side_compare { - typedef std::less type; + using type = std::less; }; diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp index 22ae1a2d..e3066888 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp @@ -1,10 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. - -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// Copyright (c) 2007-2024 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -22,13 +23,11 @@ #include #include -#include #include #include #include -#include #include -#include +#include #if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) \ || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) \ @@ -84,8 +83,7 @@ template typename Geometry2, typename Turns, typename Clusters, - typename RobustPolicy, - typename SideStrategy, + typename Strategy, typename Visitor > struct traversal @@ -102,19 +100,18 @@ private : typedef sort_by_side::side_sorter < Reverse1, Reverse2, OverlayType, - point_type, SideStrategy, side_compare_type + point_type, Strategy, side_compare_type > sbs_type; public : inline traversal(Geometry1 const& geometry1, Geometry2 const& geometry2, Turns& turns, Clusters const& clusters, - RobustPolicy const& robust_policy, SideStrategy const& strategy, + Strategy const& strategy, Visitor& visitor) : m_geometry1(geometry1) , m_geometry2(geometry2) , m_turns(turns) , m_clusters(clusters) - , m_robust_policy(robust_policy) , m_strategy(strategy) , m_visitor(visitor) { @@ -233,24 +230,12 @@ public : segment_identifier const& previous_seg_id) const { // For uu/ii, only switch sources if indicated - - if (BOOST_GEOMETRY_CONDITION(OverlayType == overlay_buffer)) - { - // Buffer does not use source_index (always 0). - return select_source_generic<&segment_identifier::multi_index>( - turn, candidate_seg_id, previous_seg_id); - } - - if (is_self_turn(turn)) - { - // Also, if it is a self-turn, stay on same ring (multi/ring) - return select_source_generic<&segment_identifier::multi_index>( + // Buffer and self-turns do not use source_index (always 0). + return OverlayType == overlay_buffer || is_self_turn(turn) + ? select_source_generic<&segment_identifier::multi_index>( + turn, candidate_seg_id, previous_seg_id) + : select_source_generic<&segment_identifier::source_index>( turn, candidate_seg_id, previous_seg_id); - } - - // Use source_index - return select_source_generic<&segment_identifier::source_index>( - turn, candidate_seg_id, previous_seg_id); } inline bool traverse_possible(signed_size_type turn_index) const @@ -343,25 +328,27 @@ public : return true; } - if (BOOST_GEOMETRY_CONDITION(OverlayType == overlay_buffer) - && possible[0] && possible[1]) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType == overlay_buffer) { - // Buffers sometimes have multiple overlapping pieces, where remaining - // distance could lead to the wrong choice. Take the matching operation. - - bool is_target[2] = {0}; - for (int i = 0; i < 2; i++) + if (possible[0] && possible[1]) { - turn_operation_type const& next_op = m_turns[next[i]].operations[i]; - is_target[i] = next_op.operation == target_operation; - } + // Buffers sometimes have multiple overlapping pieces, where remaining + // distance could lead to the wrong choice. Take the matching operation. - if (is_target[0] != is_target[1]) - { - // Take the matching operation - selected_op_index = is_target[0] ? 0 : 1; - debug_traverse(turn, turn.operations[selected_op_index], "Candidate cc target"); - return true; + bool is_target[2] = {0}; + for (int i = 0; i < 2; i++) + { + turn_operation_type const& next_op = m_turns[next[i]].operations[i]; + is_target[i] = next_op.operation == target_operation; + } + + if (is_target[0] != is_target[1]) + { + // Take the matching operation + selected_op_index = is_target[0] ? 0 : 1; + debug_traverse(turn, turn.operations[selected_op_index], "Candidate cc target"); + return true; + } } } @@ -505,7 +492,7 @@ public : } inline - bool select_operation(const turn_type& turn, + bool select_operation(turn_type const& turn, signed_size_type turn_index, signed_size_type start_turn_index, segment_identifier const& previous_seg_id, @@ -518,7 +505,7 @@ public : result = select_cc_operation(turn, start_turn_index, selected_op_index); } - else if (BOOST_GEOMETRY_CONDITION(OverlayType == overlay_dissolve)) + else if BOOST_GEOMETRY_CONSTEXPR (OverlayType == overlay_dissolve) { result = select_preferred_operation(turn, turn_index, start_turn_index, selected_op_index); @@ -536,7 +523,7 @@ public : return result; } - inline int starting_operation_index(const turn_type& turn) const + inline int starting_operation_index(turn_type const& turn) const { for (int i = 0; i < 2; i++) { @@ -548,7 +535,7 @@ public : return -1; } - inline bool both_finished(const turn_type& turn) const + inline bool both_finished(turn_type const& turn) const { for (int i = 0; i < 2; i++) { @@ -560,16 +547,18 @@ public : return true; } - inline int priority_of_turn_in_cluster_union(sort_by_side::rank_type selected_rank, + // Returns a priority, the one with the highst priority will be selected + // 0: not OK + // 1: OK following spike out + // 2: OK but next turn is in same cluster + // 3: OK + // 4: OK and start turn matches + // 5: OK and start turn and start operation both match, this is the best + inline int priority_of_turn_in_cluster(sort_by_side::rank_type selected_rank, typename sbs_type::rp const& ranked_point, - std::set const& cluster_indices, + cluster_info const& cinfo, signed_size_type start_turn_index, int start_op_index) const { - // Returns 0: not OK - // Returns 1: OK but next turn is in same cluster - // Returns 2: OK - // Returns 3: OK and start turn matches - // Returns 4: OK and start turn and start op both match if (ranked_point.rank != selected_rank || ranked_point.direction != sort_by_side::dir_to) { @@ -585,24 +574,30 @@ public : return 0; } - if (BOOST_GEOMETRY_CONDITION(OverlayType != overlay_dissolve) - && (op.enriched.count_left != 0 || op.enriched.count_right == 0)) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType != overlay_dissolve) { - // Check counts: in some cases interior rings might be generated with - // polygons on both sides. For dissolve it can be anything. - return 0; + if ((op.enriched.count_left != 0 || op.enriched.count_right == 0) && cinfo.spike_count > 0) + { + // Check counts: in some cases interior rings might be generated with + // polygons on both sides. For dissolve it can be anything. + + // If this forms a spike, going to/from the cluster point in the same + // (opposite) direction, it can still be used. + return 1; + } } bool const to_start = ranked_point.turn_index == start_turn_index; bool const to_start_index = ranked_point.operation_index == start_op_index; bool const next_in_same_cluster - = cluster_indices.count(op.enriched.get_next_turn_index()) > 0; + = cinfo.turn_indices.count(op.enriched.get_next_turn_index()) > 0; - return to_start && to_start_index ? 4 - : to_start ? 3 - : next_in_same_cluster ? 1 - : 2 + // Return the priority as described above + return to_start && to_start_index ? 5 + : to_start ? 4 + : next_in_same_cluster ? 2 + : 3 ; } @@ -647,9 +642,8 @@ public : return -1; } - inline bool select_from_cluster_union(signed_size_type& turn_index, - std::set const& cluster_indices, - int& op_index, sbs_type const& sbs, + inline bool select_from_cluster(signed_size_type& turn_index, int& op_index, + cluster_info const& cinfo, sbs_type const& sbs, signed_size_type start_turn_index, int start_op_index) const { sort_by_side::rank_type const selected_rank = select_rank(sbs); @@ -657,15 +651,15 @@ public : int current_priority = 0; for (std::size_t i = 1; i < sbs.m_ranked_points.size(); i++) { - typename sbs_type::rp const& ranked_point = sbs.m_ranked_points[i]; + auto const& ranked_point = sbs.m_ranked_points[i]; if (ranked_point.rank > selected_rank) { break; } - int const priority = priority_of_turn_in_cluster_union(selected_rank, - ranked_point, cluster_indices, start_turn_index, start_op_index); + int const priority = priority_of_turn_in_cluster(selected_rank, + ranked_point, cinfo, start_turn_index, start_op_index); if (priority > current_priority) { @@ -677,7 +671,9 @@ public : return current_priority > 0; } - inline bool analyze_cluster_intersection(signed_size_type& turn_index, + // Analyzes a clustered intersection, as if it is clustered. + // This is used for II intersections + inline bool analyze_ii_cluster(signed_size_type& turn_index, int& op_index, sbs_type const& sbs) const { // Select the rank based on regions and isolation @@ -792,34 +788,34 @@ public : return false; } - cluster_exits exits(m_turns, cinfo.turn_indices, sbs); - - if (exits.apply(turn_index, op_index)) - { - return true; - } - - bool result = false; - - if (is_union) + if BOOST_GEOMETRY_CONSTEXPR (is_union) { - result = select_from_cluster_union(turn_index, cinfo.turn_indices, - op_index, sbs, - start_turn_index, start_op_index); - if (! result) + if (cinfo.open_count == 0 && cinfo.spike_count > 0) { - // There no way out found, try second pass in collected cluster exits - result = exits.apply(turn_index, op_index, false); + // Leave the cluster from the spike. + for (std::size_t i = 0; i + 1 < sbs.m_ranked_points.size(); i++) + { + auto const& current = sbs.m_ranked_points[i]; + auto const& next = sbs.m_ranked_points[i + 1]; + if (current.rank == next.rank + && current.direction == detail::overlay::sort_by_side::dir_from + && next.direction == detail::overlay::sort_by_side::dir_to) + { + turn_index = next.turn_index; + op_index = next.operation_index; + return true; + } + } } } - else - { - result = analyze_cluster_intersection(turn_index, op_index, sbs); - } - return result; + + return select_from_cluster(turn_index, op_index, cinfo, sbs, start_turn_index, start_op_index); } // Analyzes a non-clustered "ii" intersection, as if it is clustered. + // TODO: it, since select_from_cluster is generalized (July 2024), + // uses a specific function used only for "ii" intersections. + // Therefore the sort-by-side solution should not be necessary and can be refactored. inline bool analyze_ii_intersection(signed_size_type& turn_index, int& op_index, turn_type const& current_turn, segment_identifier const& previous_seg_id) @@ -843,9 +839,7 @@ public : sbs.apply(current_turn.point); - bool result = analyze_cluster_intersection(turn_index, op_index, sbs); - - return result; + return analyze_ii_cluster(turn_index, op_index, sbs); } inline void change_index_for_self_turn(signed_size_type& to_vertex_index, @@ -853,56 +847,58 @@ public : turn_operation_type const& start_op, int start_op_index) const { - if (BOOST_GEOMETRY_CONDITION(OverlayType != overlay_buffer - && OverlayType != overlay_dissolve)) + if BOOST_GEOMETRY_CONSTEXPR (OverlayType != overlay_buffer + && OverlayType != overlay_dissolve) { return; } - - const bool allow_uu = OverlayType != overlay_buffer; - - // It travels to itself, can happen. If this is a buffer, it can - // sometimes travel to itself in the following configuration: - // - // +---->--+ - // | | - // | +---*----+ *: one turn, with segment index 2/7 - // | | | | - // | +---C | C: closing point (start/end) - // | | - // +------------+ - // - // If it starts on segment 2 and travels to itself on segment 2, that - // should be corrected to 7 because that is the shortest path - // - // Also a uu turn (touching with another buffered ring) might have this - // apparent configuration, but there it should - // always travel the whole ring - - turn_operation_type const& other_op - = start_turn.operations[1 - start_op_index]; - - bool const correct - = (allow_uu || ! start_turn.both(operation_union)) - && start_op.seg_id.source_index == other_op.seg_id.source_index - && start_op.seg_id.multi_index == other_op.seg_id.multi_index - && start_op.seg_id.ring_index == other_op.seg_id.ring_index - && start_op.seg_id.segment_index == to_vertex_index; + else // else prevents unreachable code warning + { + const bool allow_uu = OverlayType != overlay_buffer; + + // It travels to itself, can happen. If this is a buffer, it can + // sometimes travel to itself in the following configuration: + // + // +---->--+ + // | | + // | +---*----+ *: one turn, with segment index 2/7 + // | | | | + // | +---C | C: closing point (start/end) + // | | + // +------------+ + // + // If it starts on segment 2 and travels to itself on segment 2, that + // should be corrected to 7 because that is the shortest path + // + // Also a uu turn (touching with another buffered ring) might have this + // apparent configuration, but there it should + // always travel the whole ring + + turn_operation_type const& other_op + = start_turn.operations[1 - start_op_index]; + + bool const correct + = (allow_uu || ! start_turn.both(operation_union)) + && start_op.seg_id.source_index == other_op.seg_id.source_index + && start_op.seg_id.multi_index == other_op.seg_id.multi_index + && start_op.seg_id.ring_index == other_op.seg_id.ring_index + && start_op.seg_id.segment_index == to_vertex_index; #if defined(BOOST_GEOMETRY_DEBUG_TRAVERSE) - std::cout << " WARNING: self-buffer " - << " correct=" << correct - << " turn=" << operation_char(start_turn.operations[0].operation) - << operation_char(start_turn.operations[1].operation) - << " start=" << start_op.seg_id.segment_index - << " from=" << to_vertex_index - << " to=" << other_op.enriched.travels_to_vertex_index - << std::endl; + std::cout << " WARNING: self-buffer " + << " correct=" << correct + << " turn=" << operation_char(start_turn.operations[0].operation) + << operation_char(start_turn.operations[1].operation) + << " start=" << start_op.seg_id.segment_index + << " from=" << to_vertex_index + << " to=" << other_op.enriched.travels_to_vertex_index + << std::endl; #endif - if (correct) - { - to_vertex_index = other_op.enriched.travels_to_vertex_index; + if (correct) + { + to_vertex_index = other_op.enriched.travels_to_vertex_index; + } } } @@ -961,7 +957,7 @@ public : = has_points && current_turn.is_clustered() && m_turns[start_turn_index].cluster_id == current_turn.cluster_id; - if (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection)) + if BOOST_GEOMETRY_CONSTEXPR (target_operation == operation_intersection) { // Intersection or difference @@ -1037,13 +1033,11 @@ private : Geometry2 const& m_geometry2; Turns& m_turns; Clusters const& m_clusters; - RobustPolicy const& m_robust_policy; - SideStrategy m_strategy; + Strategy m_strategy; Visitor& m_visitor; }; - }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp index fd3513ff..89d44b5b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -16,13 +17,13 @@ #include #include +#include #include #include #include #include #include -#include #include #include @@ -45,7 +46,6 @@ template typename TurnInfoMap, typename Clusters, typename Strategy, - typename RobustPolicy, typename Visitor, typename Backtrack > @@ -55,8 +55,7 @@ struct traversal_ring_creator < Reverse1, Reverse2, OverlayType, Geometry1, Geometry2, Turns, Clusters, - RobustPolicy, - decltype(std::declval().side()), + Strategy, Visitor > traversal_type; @@ -70,16 +69,15 @@ struct traversal_ring_creator Turns& turns, TurnInfoMap& turn_info_map, Clusters const& clusters, Strategy const& strategy, - RobustPolicy const& robust_policy, Visitor& visitor) + Visitor& visitor) : m_trav(geometry1, geometry2, turns, clusters, - robust_policy, strategy.side(), visitor) + strategy, visitor) , m_geometry1(geometry1) , m_geometry2(geometry2) , m_turns(turns) , m_turn_info_map(turn_info_map) , m_clusters(clusters) , m_strategy(strategy) - , m_robust_policy(robust_policy) , m_visitor(visitor) { } @@ -113,13 +111,13 @@ struct traversal_ring_creator { geometry::copy_segments(m_geometry1, previous_op.seg_id, to_vertex_index, - m_strategy, m_robust_policy, current_ring); + m_strategy, current_ring); } else { geometry::copy_segments(m_geometry2, previous_op.seg_id, to_vertex_index, - m_strategy, m_robust_policy, current_ring); + m_strategy, current_ring); } } @@ -140,7 +138,7 @@ struct traversal_ring_creator if (! m_trav.select_turn(start_turn_index, start_op_index, turn_index, op_index, previous_op_index, previous_turn_index, previous_seg_id, - is_start, current_ring.size() > 1)) + is_start, boost::size(current_ring) > 1)) { return is_start ? traverse_error_no_next_ip_at_start @@ -149,8 +147,8 @@ struct traversal_ring_creator { // Check operation (TODO: this might be redundant or should be catched before) - const turn_type& current_turn = m_turns[turn_index]; - const turn_operation_type& op = current_turn.operations[op_index]; + turn_type const& current_turn = m_turns[turn_index]; + turn_operation_type const& op = current_turn.operations[op_index]; if (op.visited.finalized() || m_trav.is_visited(current_turn, op, turn_index, op_index)) { @@ -162,7 +160,7 @@ struct traversal_ring_creator turn_type& current_turn = m_turns[turn_index]; turn_operation_type& op = current_turn.operations[op_index]; detail::overlay::append_no_collinear(current_ring, current_turn.point, - m_strategy, m_robust_policy); + m_strategy); // Register the visit m_trav.set_visited(current_turn, op); @@ -179,7 +177,7 @@ struct traversal_ring_creator turn_operation_type& start_op = m_turns[start_turn_index].operations[start_op_index]; detail::overlay::append_no_collinear(ring, start_turn.point, - m_strategy, m_robust_policy); + m_strategy); signed_size_type current_turn_index = start_turn_index; int current_op_index = start_op_index; @@ -274,6 +272,9 @@ struct traversal_ring_creator if (traverse_error == traverse_error_none) { + remove_spikes_at_closure(ring, m_strategy); + fix_closure(ring, m_strategy); + std::size_t const min_num_points = core_detail::closure::minimum_ring_size < @@ -282,7 +283,6 @@ struct traversal_ring_creator if (geometry::num_points(ring) >= min_num_points) { - clean_closing_dups_and_spikes(ring, m_strategy, m_robust_policy); rings.push_back(ring); m_trav.finalize_visit_info(m_turn_info_map); @@ -296,7 +296,7 @@ struct traversal_ring_creator m_turns[turn_index].operations[op_index], traverse_error, m_geometry1, m_geometry2, - m_strategy, m_robust_policy, + m_strategy, state, m_visitor); } } @@ -322,31 +322,40 @@ struct traversal_ring_creator void iterate(Rings& rings, std::size_t& finalized_ring_size, typename Backtrack::state_type& state) { - for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index) + auto do_iterate = [&](int phase) { - turn_type const& turn = m_turns[turn_index]; - - if (turn.discarded || turn.blocked()) + for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index) { - // Skip discarded and blocked turns - continue; - } + turn_type const& turn = m_turns[turn_index]; - if (turn.both(operation_continue)) - { - traverse_with_operation(turn, turn_index, - get_operation_index(turn), - rings, finalized_ring_size, state); - } - else - { - for (int op_index = 0; op_index < 2; op_index++) + if (turn.discarded || turn.blocked() || (phase == 0 && turn.is_clustered())) { - traverse_with_operation(turn, turn_index, op_index, + // Skip discarded and blocked turns + continue; + } + + if (turn.both(operation_continue)) + { + traverse_with_operation(turn, turn_index, + get_operation_index(turn), rings, finalized_ring_size, state); } + else + { + for (int op_index = 0; op_index < 2; op_index++) + { + traverse_with_operation(turn, turn_index, op_index, + rings, finalized_ring_size, state); + } + } } - } + }; + + // Traverse all turns, first starting with the non-clustered ones. + do_iterate(0); + + // Traverse remaining clustered turns, if any. + do_iterate(1); } template @@ -407,7 +416,6 @@ struct traversal_ring_creator TurnInfoMap& m_turn_info_map; // contains turn-info information per ring Clusters const& m_clusters; Strategy const& m_strategy; - RobustPolicy const& m_robust_policy; Visitor& m_visitor; }; diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp index be0f2bcd..0756034a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp @@ -1,10 +1,11 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2015-2016 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2018-2020. -// Modifications copyright (c) 2018-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2018-2024. +// Modifications copyright (c) 2018-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -21,8 +22,12 @@ #include #include #include + +#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR) #include -#include +#endif + +#include #include #include @@ -79,7 +84,6 @@ template typename Geometry2, typename Turns, typename Clusters, - typename RobustPolicy, typename Visitor > struct traversal_switch_detector @@ -134,12 +138,11 @@ struct traversal_switch_detector inline traversal_switch_detector(Geometry1 const& geometry1, Geometry2 const& geometry2, Turns& turns, Clusters const& clusters, - RobustPolicy const& robust_policy, Visitor& visitor) + Visitor& visitor) : m_geometry1(geometry1) , m_geometry2(geometry2) , m_turns(turns) , m_clusters(clusters) - , m_robust_policy(robust_policy) , m_visitor(visitor) { } @@ -387,11 +390,19 @@ struct traversal_switch_detector { for (turn_type& turn : m_turns) { + constexpr auto order1 = geometry::point_order::value; + constexpr bool reverse1 = (order1 == boost::geometry::counterclockwise) + ? ! Reverse1 : Reverse1; + + constexpr auto order2 = geometry::point_order::value; + constexpr bool reverse2 = (order2 == boost::geometry::counterclockwise) + ? ! Reverse2 : Reverse2; + // For difference, for the input walked through in reverse, // the meaning is reversed: what is isolated is actually not, // and vice versa. bool const reverseMeaningInTurn - = (Reverse1 || Reverse2) + = (reverse1 || reverse2) && ! turn.is_self() && ! turn.is_clustered() && uu_or_ii(turn) @@ -405,8 +416,8 @@ struct traversal_switch_detector { bool const reverseMeaningInOp = reverseMeaningInTurn - && ((op.seg_id.source_index == 0 && Reverse1) - || (op.seg_id.source_index == 1 && Reverse2)); + && ((op.seg_id.source_index == 0 && reverse1) + || (op.seg_id.source_index == 1 && reverse2)); // It is assigned to isolated if it's property is "Yes", // (one connected interior, or chained). @@ -521,19 +532,21 @@ struct traversal_switch_detector return ! uu_or_ii(turn); } - if (BOOST_GEOMETRY_CONDITION(target_operation == operation_union)) + if BOOST_GEOMETRY_CONSTEXPR (target_operation == operation_union) { // It is a cluster, check zones // (assigned by sort_by_side/handle colocations) of both operations return turn.operations[0].enriched.zone == turn.operations[1].enriched.zone; } - - // For an intersection, two regions connect if they are not ii - // (ii-regions are isolated) or, in some cases, not iu (for example - // when a multi-polygon is inside an interior ring and connecting it) - return ! (turn.both(operation_intersection) - || turn.combination(operation_intersection, operation_union)); + else // else prevents unreachable code warning + { + // For an intersection, two regions connect if they are not ii + // (ii-regions are isolated) or, in some cases, not iu (for example + // when a multi-polygon is inside an interior ring and connecting it) + return ! (turn.both(operation_intersection) + || turn.combination(operation_intersection, operation_union)); + } } void create_region(signed_size_type& new_region_id, ring_identifier const& ring_id, @@ -678,11 +691,13 @@ struct traversal_switch_detector { turn_type const& turn = m_turns[turn_index]; - if (turn.discarded - && BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection)) + if BOOST_GEOMETRY_CONSTEXPR (target_operation == operation_intersection) { - // Discarded turn (union currently still needs it to determine regions) - continue; + if (turn.discarded) + { + // Discarded turn (union currently still needs it to determine regions) + continue; + } } for (auto const& op : turn.operations) @@ -720,7 +735,6 @@ struct traversal_switch_detector Clusters const& m_clusters; merge_map m_turns_per_ring; region_connection_map m_connected_regions; - RobustPolicy const& m_robust_policy; Visitor& m_visitor; }; diff --git a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index 710cea09..6c0b4488 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2024. +// Modifications copyright (c) 2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -11,6 +15,8 @@ #include +#include + #include #include #include @@ -56,7 +62,6 @@ public : template < typename IntersectionStrategy, - typename RobustPolicy, typename Turns, typename Rings, typename TurnInfoMap, @@ -66,7 +71,6 @@ public : static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, IntersectionStrategy const& intersection_strategy, - RobustPolicy const& robust_policy, Turns& turns, Rings& rings, TurnInfoMap& turn_info_map, Clusters& clusters, @@ -77,9 +81,9 @@ public : Reverse1, Reverse2, OverlayType, Geometry1, Geometry2, Turns, Clusters, - RobustPolicy, Visitor + Visitor > switch_detector(geometry1, geometry2, turns, clusters, - robust_policy, visitor); + visitor); switch_detector.iterate(); reset_visits(turns); @@ -90,10 +94,10 @@ public : Geometry1, Geometry2, Turns, TurnInfoMap, Clusters, IntersectionStrategy, - RobustPolicy, Visitor, + Visitor, Backtrack > trav(geometry1, geometry2, turns, turn_info_map, clusters, - intersection_strategy, robust_policy, visitor); + intersection_strategy, visitor); std::size_t finalized_ring_size = boost::size(rings); diff --git a/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp b/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp index e5ba6e30..2b86d3c6 100644 --- a/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp +++ b/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp @@ -3,11 +3,11 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2015, 2017, 2019. -// Modifications copyright (c) 2015-2019 Oracle and/or its affiliates. +// Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -19,11 +19,9 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_POINT_IS_EQUAL_OR_SPIKE_HPP #include -#include #include -#include #include -#include +#include #include @@ -71,87 +69,19 @@ template typename Point1, typename Point2, typename Point3, - typename SideStrategy, - typename RobustPolicy -> -inline bool point_is_spike_or_equal(Point1 const& last_point, - Point2 const& segment_a, - Point3 const& segment_b, - SideStrategy const& strategy, - RobustPolicy const& robust_policy) -{ - if (point_is_spike_or_equal(last_point, segment_a, segment_b, strategy)) - { - return true; - } - - if (BOOST_GEOMETRY_CONDITION(! RobustPolicy::enabled)) - { - return false; - } - - // Try using specified robust policy - typedef typename geometry::robust_point_type - < - Point1, - RobustPolicy - >::type robust_point_type; - - robust_point_type last_point_rob, segment_a_rob, segment_b_rob; - geometry::recalculate(last_point_rob, last_point, robust_policy); - geometry::recalculate(segment_a_rob, segment_a, robust_policy); - geometry::recalculate(segment_b_rob, segment_b, robust_policy); - - return point_is_spike_or_equal - ( - last_point_rob, - segment_a_rob, - segment_b_rob, - strategy - ); -} - -template -< - typename Point1, - typename Point2, - typename Point3, - typename SideStrategy, - typename RobustPolicy + typename SideStrategy > inline bool point_is_collinear(Point1 const& last_point, Point2 const& segment_a, Point3 const& segment_b, - SideStrategy const& strategy, - RobustPolicy const& robust_policy) + SideStrategy const& strategy) { int const side = strategy.apply(segment_a, segment_b, last_point); if (side == 0) { return true; } - - // This part (or whole method, because it is then trivial) - // will be removed after rescaling - if (BOOST_GEOMETRY_CONDITION(! RobustPolicy::enabled)) - { - return false; - } - - // Redo, using specified robust policy - typedef typename geometry::robust_point_type - < - Point1, - RobustPolicy - >::type robust_point_type; - - robust_point_type last_point_rob, segment_a_rob, segment_b_rob; - geometry::recalculate(last_point_rob, last_point, robust_policy); - geometry::recalculate(segment_a_rob, segment_a, robust_policy); - geometry::recalculate(segment_b_rob, segment_b, robust_policy); - - int const side_rob = strategy.apply(segment_a_rob, segment_b_rob, last_point_rob); - return side_rob == 0; + return false; } diff --git a/include/boost/geometry/algorithms/detail/recalculate.hpp b/include/boost/geometry/algorithms/detail/recalculate.hpp deleted file mode 100644 index eb633c9c..00000000 --- a/include/boost/geometry/algorithms/detail/recalculate.hpp +++ /dev/null @@ -1,232 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2013 Bruno Lalande, Paris, France. -// Copyright (c) 2013 Mateusz Loskot, London, UK. -// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace recalculate -{ - -template -struct recalculate_point -{ - template - static inline void apply(Point1& point1, Point2 const& point2, Strategy const& strategy) - { - std::size_t const dim = Dimension - 1; - geometry::set(point1, strategy.template apply(geometry::get(point2))); - recalculate_point::apply(point1, point2, strategy); - } -}; - -template <> -struct recalculate_point<0> -{ - template - static inline void apply(Point1&, Point2 const&, Strategy const&) - { - } -}; - - -template -struct recalculate_indexed -{ - template - static inline void apply(Geometry1& geometry1, Geometry2 const& geometry2, Strategy const& strategy) - { - // Do it for both indices in one dimension - static std::size_t const dim = Dimension - 1; - geometry::set<0, dim>(geometry1, strategy.template apply(geometry::get<0, dim>(geometry2))); - geometry::set<1, dim>(geometry1, strategy.template apply(geometry::get<1, dim>(geometry2))); - recalculate_indexed::apply(geometry1, geometry2, strategy); - } -}; - -template <> -struct recalculate_indexed<0> -{ - - template - static inline void apply(Geometry1& , Geometry2 const& , Strategy const& ) - { - } -}; - -struct range_to_range -{ - template - < - typename Range1, - typename Range2, - typename Strategy - > - static inline void apply(Range1& destination, Range2 const& source, - Strategy const& strategy) - { - typedef typename geometry::point_type::type point_type; - typedef recalculate_point::value> per_point; - geometry::clear(destination); - - for (auto const& source_point : source) - { - point_type p; - per_point::apply(p, source_point, strategy); - geometry::append(destination, p); - } - } -}; - -struct polygon_to_polygon -{ -private: - template - < - typename IteratorIn, - typename IteratorOut, - typename Strategy - > - static inline void iterate(IteratorIn begin, IteratorIn end, - IteratorOut it_out, - Strategy const& strategy) - { - for (IteratorIn it_in = begin; it_in != end; ++it_in, ++it_out) - { - range_to_range::apply(*it_out, *it_in, strategy); - } - } - - template - < - typename InteriorRingsOut, - typename InteriorRingsIn, - typename Strategy - > - static inline void apply_interior_rings( - InteriorRingsOut& interior_rings_out, - InteriorRingsIn const& interior_rings_in, - Strategy const& strategy) - { - traits::resize::apply(interior_rings_out, - boost::size(interior_rings_in)); - - iterate( - boost::begin(interior_rings_in), boost::end(interior_rings_in), - boost::begin(interior_rings_out), - strategy); - } - -public: - template - < - typename Polygon1, - typename Polygon2, - typename Strategy - > - static inline void apply(Polygon1& destination, Polygon2 const& source, - Strategy const& strategy) - { - range_to_range::apply(geometry::exterior_ring(destination), - geometry::exterior_ring(source), strategy); - - apply_interior_rings(geometry::interior_rings(destination), - geometry::interior_rings(source), strategy); - } -}; - -}} // namespace detail::recalculate -#endif // DOXYGEN_NO_DETAIL - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - -template -< - typename Geometry1, - typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type -> -struct recalculate : not_implemented -{}; - -template -struct recalculate - : detail::recalculate::recalculate_point::value> -{}; - -template -struct recalculate - : detail::recalculate::recalculate_indexed::value> -{}; - -template -struct recalculate - : detail::recalculate::recalculate_indexed::value> -{}; - -template -struct recalculate - : detail::recalculate::polygon_to_polygon -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - - -template -inline void recalculate(Geometry1& geometry1, Geometry2 const& geometry2, Strategy const& strategy) -{ - concepts::check(); - concepts::check(); - - // static assert dimensions (/types) are the same - - dispatch::recalculate::apply(geometry1, geometry2, strategy); -} - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP diff --git a/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp b/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp index 41366e31..3a2b3078 100644 --- a/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp @@ -31,6 +31,8 @@ #include +#include + namespace boost { namespace geometry { @@ -836,7 +838,7 @@ struct areal_areal segment_identifier const& seg_id = turn.operations[OpId].seg_id; signed_size_type - count = boost::numeric_cast( + count = util::numeric_cast( geometry::num_interior_rings( detail::single_geometry(analyser.geometry, seg_id))); diff --git a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp index 0d95aaba..d513ec31 100644 --- a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp +++ b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp @@ -13,6 +13,7 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_BOUNDARY_CHECKER_HPP #include +#include #include #include @@ -149,7 +150,7 @@ inline void copy_boundary_points_of_mls(MultiLinestring const& mls, Strategy con template class boundary_checker { - using point_type = typename point_type::type; + using point_type = point_type_t; using mutable_point_type = typename helper_geometry::type; public: diff --git a/include/boost/geometry/algorithms/detail/relate/box_areal.hpp b/include/boost/geometry/algorithms/detail/relate/box_areal.hpp index a9e749fd..425e17e2 100644 --- a/include/boost/geometry/algorithms/detail/relate/box_areal.hpp +++ b/include/boost/geometry/algorithms/detail/relate/box_areal.hpp @@ -51,9 +51,9 @@ struct box_areal } template - static inline void apply(Box const& box, Areal const& areal, - Result& result, - Strategy const& strategy, + static inline void apply(Box const& /* box */, Areal const& /* areal */, + Result& /* result */, + Strategy const& /* strategy */, std::false_type /*is_cartesian*/) { BOOST_GEOMETRY_STATIC_ASSERT_FALSE( diff --git a/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp b/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp index cb1f0f40..7bea3227 100644 --- a/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -29,6 +30,7 @@ #include #include +#include #include @@ -41,10 +43,12 @@ namespace detail { namespace relate { // NOTE: This iterates through single geometries for which turns were not generated. // It doesn't mean that the geometry is disjoint, only that no turns were detected. -template ::type, - bool IsMulti = std::is_base_of::value +template +< + std::size_t OpId, + typename Geometry, + typename Tag = typename geometry::tag::type, + bool IsMulti = util::is_multi::value > struct for_each_disjoint_geometry_if : public not_implemented @@ -98,7 +102,7 @@ struct for_each_disjoint_geometry_if { BOOST_GEOMETRY_ASSERT(first != last); - const std::size_t count = boost::size(geometry); + std::size_t const count = boost::size(geometry); // O(I) // gather info about turns generated for contained geometries @@ -229,8 +233,8 @@ class segment_watcher template class exit_watcher { - static const std::size_t op_id = OpId; - static const std::size_t other_op_id = (OpId + 1) % 2; + static std::size_t const op_id = OpId; + static std::size_t const other_op_id = (OpId + 1) % 2; typedef typename TurnInfo::point_type point_type; typedef detail::relate::point_info point_info; diff --git a/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp b/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp index 1e35e64f..1dfea749 100644 --- a/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp @@ -17,25 +17,20 @@ #include #include -#include -#include - -#include -#include -#include - -#include #include -#include -#include - -#include -#include #include #include - +#include +#include +#include +#include +#include +#include +#include #include - +#include +#include +#include #include namespace boost { namespace geometry @@ -854,30 +849,30 @@ struct linear_areal m_exit_watcher.reset_detected_exit(); } - if ( BOOST_GEOMETRY_CONDITION( util::is_multi::value ) - && m_first_from_unknown ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_multi::value) { - // For MultiPolygon many x/u operations may be generated as a first IP - // if for all turns x/u was generated and any of the Polygons doesn't contain the LineString - // then we know that the LineString is outside - // Similar with the u/u turns, if it was the first one it doesn't mean that the - // Linestring came from the exterior - if ( ( m_previous_operation == overlay::operation_blocked - && ( op != overlay::operation_blocked // operation different than block - || seg_id.multi_index != m_previous_turn_ptr->operations[op_id].seg_id.multi_index ) ) // or the next single-geometry - || ( m_previous_operation == overlay::operation_union - && ! turn_on_the_same_ip(*m_previous_turn_ptr, *it, - strategy) ) - ) + if (m_first_from_unknown) { - update(res); - if ( m_first_from_unknown_boundary_detected ) + // For MultiPolygon many x/u operations may be generated as a first IP + // if for all turns x/u was generated and any of the Polygons doesn't contain the LineString + // then we know that the LineString is outside + // Similar with the u/u turns, if it was the first one it doesn't mean that the + // Linestring came from the exterior + if ((m_previous_operation == overlay::operation_blocked + && (op != overlay::operation_blocked // operation different than block + || seg_id.multi_index != m_previous_turn_ptr->operations[op_id].seg_id.multi_index)) // or the next single-geometry + || (m_previous_operation == overlay::operation_union + && ! turn_on_the_same_ip(*m_previous_turn_ptr, *it, strategy))) { - update(res); - } + update(res); + if ( m_first_from_unknown_boundary_detected ) + { + update(res); + } - m_first_from_unknown = false; - m_first_from_unknown_boundary_detected = false; + m_first_from_unknown = false; + m_first_from_unknown_boundary_detected = false; + } } } @@ -1037,7 +1032,7 @@ struct linear_areal } } - if ( BOOST_GEOMETRY_CONDITION( util::is_multi::value ) ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_multi::value) { m_first_from_unknown = false; m_first_from_unknown_boundary_detected = false; @@ -1123,9 +1118,9 @@ struct linear_areal } else { - if ( BOOST_GEOMETRY_CONDITION( util::is_multi::value ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_multi::value) /*&& ( op == overlay::operation_blocked - || op == overlay::operation_union )*/ ) // if we're here it's u or x + || op == overlay::operation_union )*/ // if we're here it's u or x { m_first_from_unknown = true; } @@ -1150,9 +1145,9 @@ struct linear_areal } else { - if ( BOOST_GEOMETRY_CONDITION( util::is_multi::value ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_multi::value) /*&& ( op == overlay::operation_blocked - || op == overlay::operation_union )*/ ) // if we're here it's u or x + || op == overlay::operation_union )*/ // if we're here it's u or x { BOOST_GEOMETRY_ASSERT(m_first_from_unknown); m_first_from_unknown_boundary_detected = true; @@ -1200,18 +1195,20 @@ struct linear_areal // For MultiPolygon many x/u operations may be generated as a first IP // if for all turns x/u was generated and any of the Polygons doesn't contain the LineString // then we know that the LineString is outside - if ( BOOST_GEOMETRY_CONDITION( util::is_multi::value ) - && m_first_from_unknown ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_multi::value) { - update(res); - if ( m_first_from_unknown_boundary_detected ) + if (m_first_from_unknown) { - update(res); - } + update(res); + if ( m_first_from_unknown_boundary_detected ) + { + update(res); + } - // done below - //m_first_from_unknown = false; - //m_first_from_unknown_boundary_detected = false; + // done below + //m_first_from_unknown = false; + //m_first_from_unknown_boundary_detected = false; + } } // here, the possible exit is the real one diff --git a/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp b/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp index 204a4fe2..8d6fe39a 100644 --- a/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp @@ -182,8 +182,7 @@ struct multi_point_single_geometry Result & result, Strategy const& strategy) { - typedef typename point_type::type point2_type; - typedef model::box box2_type; + using box2_type = model::box> ; box2_type box2; geometry::envelope(single_geometry, box2, strategy); @@ -402,11 +401,9 @@ class multi_point_multi_geometry_ii_ib }; public: - typedef typename point_type::type point1_type; - typedef typename point_type::type point2_type; - typedef model::box box1_type; - typedef model::box box2_type; - typedef std::pair box_pair_type; + using box1_type = model::box>; + using box2_type = model::box>; + using box_pair_type = std::pair; template static inline void apply(MultiPoint const& multi_point, @@ -439,12 +436,10 @@ class multi_point_multi_geometry_ii_ib template struct multi_point_multi_geometry_ii_ib_ie { - typedef typename point_type::type point1_type; - typedef typename point_type::type point2_type; - typedef model::box box1_type; - typedef model::box box2_type; - typedef std::pair box_pair_type; - typedef std::vector boxes_type; + using box1_type = model::box>; + using box2_type = model::box>; + using box_pair_type = std::pair; + using boxes_type = std::vector; template static inline void apply(MultiPoint const& multi_point, @@ -532,9 +527,7 @@ struct multi_point_multi_geometry Result & result, Strategy const& strategy) { - typedef typename point_type::type point2_type; - typedef model::box box2_type; - typedef std::pair box_pair_type; + using box_pair_type = std::pair>, std::size_t>; std::size_t count2 = boost::size(multi_geometry); std::vector boxes(count2); diff --git a/include/boost/geometry/algorithms/detail/relate/point_point.hpp b/include/boost/geometry/algorithms/detail/relate/point_point.hpp index c987bb44..1348c0dc 100644 --- a/include/boost/geometry/algorithms/detail/relate/point_point.hpp +++ b/include/boost/geometry/algorithms/detail/relate/point_point.hpp @@ -1,10 +1,10 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2013-2022. // Modifications copyright (c) 2013-2023, Oracle and/or its affiliates. - // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -196,10 +197,12 @@ struct multipoint_multipoint || relate::may_update(result) ) { // NlogN + MlogN - bool is_disjoint = search(first_sorted_mpt, first_iterated_mpt, result); + bool const is_disjoint = search(first_sorted_mpt, first_iterated_mpt, result); - if ( BOOST_GEOMETRY_CONDITION(is_disjoint || result.interrupt) ) + if (is_disjoint || BOOST_GEOMETRY_CONDITION(result.interrupt) ) + { return; + } } if ( relate::may_update(result) diff --git a/include/boost/geometry/algorithms/detail/relate/result.hpp b/include/boost/geometry/algorithms/detail/relate/result.hpp index 84c342e6..de982c37 100644 --- a/include/boost/geometry/algorithms/detail/relate/result.hpp +++ b/include/boost/geometry/algorithms/detail/relate/result.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include namespace boost { namespace geometry { @@ -292,15 +292,18 @@ struct interrupt_dispatch template static inline bool check_element(char m) { - if ( BOOST_GEOMETRY_CONDITION(V >= '0' && V <= '9') ) + if BOOST_GEOMETRY_CONSTEXPR (V >= '0' && V <= '9') { return m == 'F' || ( m < V && m >= '0' && m <= '9' ); } - else if ( BOOST_GEOMETRY_CONDITION(V == 'T') ) + else if BOOST_GEOMETRY_CONSTEXPR (V == 'T') { return m == 'F'; } - return false; + else + { + return false; + } } }; diff --git a/include/boost/geometry/algorithms/detail/relate/topology_check.hpp b/include/boost/geometry/algorithms/detail/relate/topology_check.hpp index 2fc31ab5..90f1ebd5 100644 --- a/include/boost/geometry/algorithms/detail/relate/topology_check.hpp +++ b/include/boost/geometry/algorithms/detail/relate/topology_check.hpp @@ -12,6 +12,7 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_TOPOLOGY_CHECK_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_TOPOLOGY_CHECK_HPP +#include #include #include diff --git a/include/boost/geometry/algorithms/detail/relate/turns.hpp b/include/boost/geometry/algorithms/detail/relate/turns.hpp index d98794e7..48661261 100644 --- a/include/boost/geometry/algorithms/detail/relate/turns.hpp +++ b/include/boost/geometry/algorithms/detail/relate/turns.hpp @@ -2,11 +2,11 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013-2022. -// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates. - -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -22,9 +22,6 @@ #include -#include -#include - #include #include #include @@ -60,24 +57,13 @@ struct get_turns typename geometry::point_type::type >::type; - template - struct robust_policy_type - : geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - > - {}; - template < - typename Strategy, - typename RobustPolicy = typename robust_policy_type::type + typename Strategy > struct turn_info_type { - using ratio_type = typename segment_ratio_type::type; + using ratio_type = typename segment_ratio_type::type; using type = overlay::turn_info < turn_point_type, @@ -95,23 +81,6 @@ struct get_turns Geometry2 const& geometry2, InterruptPolicy & interrupt_policy, Strategy const& strategy) - { - typedef typename robust_policy_type::type robust_policy_t; - - robust_policy_t robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - - apply(turns, geometry1, geometry2, interrupt_policy, strategy, robust_policy); - } - - template - static inline void apply(Turns & turns, - Geometry1 const& geometry1, - Geometry2 const& geometry2, - InterruptPolicy & interrupt_policy, - Strategy const& strategy, - RobustPolicy const& robust_policy) { static const bool reverse1 = detail::overlay::do_reverse < @@ -133,7 +102,7 @@ struct get_turns reverse2, GetTurnPolicy >::apply(0, geometry1, 1, geometry2, - strategy, robust_policy, + strategy, turns, interrupt_policy); } }; diff --git a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp index f321b40b..fd029db1 100644 --- a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp index df4f3102..d91ce763 100644 --- a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp +++ b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015-2021. -// Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -15,8 +16,7 @@ #include #include -#include -#include +#include // For spherical/geographic longitudes covered_by point/box #include @@ -37,11 +37,7 @@ template < std::size_t Dimension, typename Geometry, - typename CastedCSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CastedCSTag = tag_cast_t, spherical_tag> > struct preceding_check { @@ -121,41 +117,28 @@ template < std::size_t Dimension, typename Point, - typename Box, - typename RobustPolicy + typename Box > inline bool preceding(int dir, Point const& point, Box const& point_box, - Box const& other_box, - RobustPolicy const& robust_policy) + Box const& other_box) { - using box_point_type = typename geometry::point_type::type; - typename geometry::robust_point_type::type robust_point; - geometry::recalculate(robust_point, point, robust_policy); - - // After recalculate() to prevent warning: 'robust_point' may be used uninitialized - assert_coordinate_type_equal(robust_point, point_box); - - return preceding_check::apply(dir, robust_point, - point_box, - other_box); + return preceding_check::apply(dir, point, point_box, other_box); } template < std::size_t Dimension, typename Point, - typename Box, - typename RobustPolicy + typename Box > inline bool exceeding(int dir, Point const& point, Box const& point_box, - Box const& other_box, - RobustPolicy const& robust_policy) + Box const& other_box) { - return preceding(-dir, point, point_box, other_box, robust_policy); + return preceding(-dir, point, point_box, other_box); } diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 3317ff70..872f5466 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -5,11 +5,11 @@ // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2021. -// Modifications copyright (c) 2013-2021 Oracle and/or its affiliates. - -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -47,13 +46,12 @@ #include #include #include +#include #include #include #include #include -#include -#include #include #include #include @@ -151,11 +149,7 @@ template typename DimensionVector, std::size_t Index, std::size_t Count, - typename CastedCSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CastedCSTag = tag_cast_t, spherical_tag> > struct get_direction_loop { @@ -386,19 +380,15 @@ struct sectionalize_part template < typename Iterator, - typename RobustPolicy, typename Sections, typename Strategy > static inline void apply(Sections& sections, Iterator begin, Iterator end, - RobustPolicy const& robust_policy, Strategy const& strategy, ring_identifier ring_id, std::size_t max_count) { - boost::ignore_unused(robust_policy); - using section_type = typename boost::range_value::type; using box_type = typename section_type::box_type; using point_type = typename geometry::point_type::type; @@ -409,12 +399,6 @@ struct sectionalize_part == util::sequence_size::value ); - using robust_point_type = typename geometry::robust_point_type - < - point_type, - RobustPolicy - >::type; - std::size_t const count = std::distance(begin, end); if (count == 0) { @@ -429,23 +413,20 @@ struct sectionalize_part std::size_t last_non_duplicate_index = sections.size(); Iterator it = begin; - robust_point_type previous_robust_point; - geometry::recalculate(previous_robust_point, *it, robust_policy); + point_type previous_point; + geometry::detail::conversion::convert_point_to_point(*it, previous_point); - for(Iterator previous = it++; - it != end; - ++previous, ++it, index++) + for (Iterator previous = it++; it != end; ++previous, ++it, index++) { - robust_point_type current_robust_point; - geometry::recalculate(current_robust_point, *it, robust_policy); - model::referring_segment robust_segment( - previous_robust_point, current_robust_point); + point_type current_point; + geometry::detail::conversion::convert_point_to_point(*it, current_point); + model::referring_segment segment(previous_point, current_point); int direction_classes[dimension_count] = {0}; get_direction_loop < point_type, DimensionVector, 0, dimension_count - >::apply(robust_segment, direction_classes); + >::apply(segment, direction_classes); // if "dir" == 0 for all point-dimensions, it is duplicate. // Those sections might be omitted, if wished, lateron @@ -459,7 +440,7 @@ struct sectionalize_part if (check_duplicate_loop < 0, geometry::dimension::type::value - >::apply(robust_segment) + >::apply(segment) ) { duplicate = true; @@ -513,15 +494,15 @@ struct sectionalize_part // In cartesian this is envelope of previous point expanded with current point // in non-cartesian this is envelope of a segment - box_first_in_section::type> - ::apply(section.bounding_box, previous_robust_point, current_robust_point, strategy); + box_first_in_section> + ::apply(section.bounding_box, previous_point, current_point, strategy); } else { // In cartesian this is expand with current point // in non-cartesian this is expand with a segment - box_next_in_section::type> - ::apply(section.bounding_box, previous_robust_point, current_robust_point, strategy); + box_next_in_section> + ::apply(section.bounding_box, previous_point, current_point, strategy); } section.end_index = index + 1; @@ -530,7 +511,7 @@ struct sectionalize_part { ndi++; } - previous_robust_point = current_robust_point; + previous_point = current_point; } // Add last section if applicable @@ -564,12 +545,10 @@ struct sectionalize_range template < typename Range, - typename RobustPolicy, typename Sections, typename Strategy > static inline void apply(Range const& range, - RobustPolicy const& robust_policy, Sections& sections, Strategy const& strategy, ring_identifier ring_id, @@ -597,7 +576,7 @@ struct sectionalize_range sectionalize_part::apply(sections, boost::begin(view), boost::end(view), - robust_policy, strategy, + strategy, ring_id, max_count); } }; @@ -612,12 +591,10 @@ struct sectionalize_polygon template < typename Polygon, - typename RobustPolicy, typename Sections, typename Strategy > static inline void apply(Polygon const& poly, - RobustPolicy const& robust_policy, Sections& sections, Strategy const& strategy, ring_identifier ring_id, @@ -629,7 +606,7 @@ struct sectionalize_polygon >; ring_id.ring_index = -1; - sectionalizer::apply(exterior_ring(poly), robust_policy, sections, + sectionalizer::apply(exterior_ring(poly), sections, strategy, ring_id, max_count); ring_id.ring_index++; @@ -637,7 +614,7 @@ struct sectionalize_polygon for (auto it = boost::begin(rings); it != boost::end(rings); ++it, ++ring_id.ring_index) { - sectionalizer::apply(*it, robust_policy, sections, + sectionalizer::apply(*it, sections, strategy, ring_id, max_count); } } @@ -649,17 +626,15 @@ struct sectionalize_box template < typename Box, - typename RobustPolicy, typename Sections, typename Strategy > static inline void apply(Box const& box, - RobustPolicy const& robust_policy, Sections& sections, Strategy const& strategy, ring_identifier const& ring_id, std::size_t max_count) { - using point_type = typename point_type::type; + using point_type = point_type_t; assert_dimension(); @@ -686,7 +661,7 @@ struct sectionalize_box sectionalize_range < closed, false, DimensionVector - >::apply(points, robust_policy, sections, + >::apply(points, sections, strategy, ring_id, max_count); } }; @@ -697,12 +672,10 @@ struct sectionalize_multi template < typename MultiGeometry, - typename RobustPolicy, typename Sections, typename Strategy > static inline void apply(MultiGeometry const& multi, - RobustPolicy const& robust_policy, Sections& sections, Strategy const& strategy, ring_identifier ring_id, @@ -711,7 +684,7 @@ struct sectionalize_multi ring_id.multi_index = 0; for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++ring_id.multi_index) { - Policy::apply(*it, robust_policy, sections, + Policy::apply(*it, sections, strategy, ring_id, max_count); } @@ -721,24 +694,31 @@ struct sectionalize_multi template inline void enlarge_sections(Sections& sections, Strategy const&) { - // Expand the box to avoid missing any intersection. The amount is - // should be larger than epsilon. About the value itself: the smaller - // it is, the higher the risk to miss intersections. The larger it is, - // the more comparisons are made, which is not harmful for the result - // (but it might be for the performance). - // So it should be on the high side. - - // Use a compilable and workable epsilon for all types, for example: + // Expand the box to avoid missing any intersection. + // About the value itself: the smaller it is, + // the higher the risk to miss intersections. + // The larger it is, the more comparisons are made, + // which is not harmful for the result, + // but it might be for the performance. + // So it should be on the higher side. + // + // The current value: // - for double :~ 2.22e-13 // - for float :~ 1e-4 // - for Boost.Multiprecision (50) :~ 5.35e-48 // - for Boost.Rational : 0/1 + // WARNING: don't use decltype here. + // Earlier code used decltype(section.bonding_box) below, + // but that somehow is not accepted by the NVCC (CUDA 12.4) compiler. + using section_t = typename boost::range_value::type; + using box_t = typename section_t::box_type; + using coor_t = typename geometry::coordinate_type::type; + + static auto const eps = math::scaled_epsilon(1000); + for (auto& section : sections) { - using gt = decltype(section.bounding_box); - using ct = typename geometry::coordinate_type::type; - static ct const eps = math::scaled_epsilon(1000); expand_by_epsilon(section.bounding_box, eps); } } @@ -862,10 +842,8 @@ struct sectionalize inline void sectionalize(Geometry const& geometry, - RobustPolicy const& robust_policy, Sections& sections, Strategy const& strategy, int source_index = 0, @@ -900,7 +876,7 @@ inline void sectionalize(Geometry const& geometry, Geometry, Reverse, DimensionVector - >::apply(geometry, robust_policy, sections, + >::apply(geometry, sections, strategy, ring_id, max_count); @@ -913,11 +889,9 @@ template bool Reverse, typename DimensionVector, typename Geometry, - typename Sections, - typename RobustPolicy + typename Sections > inline void sectionalize(Geometry const& geometry, - RobustPolicy const& robust_policy, Sections& sections, int source_index = 0, std::size_t max_count = 10) @@ -932,7 +906,7 @@ inline void sectionalize(Geometry const& geometry, boost::geometry::sectionalize < Reverse, DimensionVector - >(geometry, robust_policy, sections, + >(geometry, sections, strategy_type(), source_index, max_count); } diff --git a/include/boost/geometry/algorithms/detail/single_geometry.hpp b/include/boost/geometry/algorithms/detail/single_geometry.hpp index c7d2192f..054771fe 100644 --- a/include/boost/geometry/algorithms/detail/single_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/single_geometry.hpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace boost { namespace geometry { @@ -29,11 +30,7 @@ namespace detail_dispatch { template < typename Geometry, - bool IsMulti = std::is_base_of - < - multi_tag, - typename geometry::tag::type - >::value + bool IsMulti = util::is_multi::value > struct single_geometry { diff --git a/include/boost/geometry/algorithms/detail/sub_range.hpp b/include/boost/geometry/algorithms/detail/sub_range.hpp index d0ac6fba..c1ae9fef 100644 --- a/include/boost/geometry/algorithms/detail/sub_range.hpp +++ b/include/boost/geometry/algorithms/detail/sub_range.hpp @@ -25,6 +25,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -33,9 +34,12 @@ namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DISPATCH namespace detail_dispatch { -template ::type, - bool IsMulti = std::is_base_of::value> +template +< + typename Geometry, + typename Tag = typename geometry::tag::type, + bool IsMulti = util::is_multi::value +> struct sub_range : not_implemented {}; diff --git a/include/boost/geometry/algorithms/detail/touches/implementation.hpp b/include/boost/geometry/algorithms/detail/touches/implementation.hpp index 15a899e7..515f827d 100644 --- a/include/boost/geometry/algorithms/detail/touches/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/touches/implementation.hpp @@ -5,9 +5,9 @@ // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2013-2022 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2022. -// Modifications copyright (c) 2013-2022, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -255,7 +253,7 @@ struct areal_areal detail::overlay::do_reverse::value>::value, detail::overlay::do_reverse::value>::value, detail::overlay::assign_null_policy - >(geometry1, geometry2, strategy, detail::no_rescale_policy(), turns, policy); + >(geometry1, geometry2, strategy, turns, policy); return policy.result() && ! geometry::detail::touches::rings_containing(geometry1, geometry2, strategy) @@ -526,7 +524,7 @@ struct self_touches detail::self_get_turn_points::get_turns < false, policy_type - >::apply(geometry, strategy, detail::no_rescale_policy(), + >::apply(geometry, strategy, turns, policy, 0, true); return policy.result(); diff --git a/include/boost/geometry/algorithms/detail/touches/interface.hpp b/include/boost/geometry/algorithms/detail/touches/interface.hpp index 271697c5..b7f6f10b 100644 --- a/include/boost/geometry/algorithms/detail/touches/interface.hpp +++ b/include/boost/geometry/algorithms/detail/touches/interface.hpp @@ -49,10 +49,10 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type, - typename CastedTag1 = typename tag_cast::type, - typename CastedTag2 = typename tag_cast::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, + typename CastedTag1 = tag_cast_t, + typename CastedTag2 = tag_cast_t, bool Reverse = reverse_dispatch::type::value > struct touches diff --git a/include/boost/geometry/algorithms/detail/tupled_output.hpp b/include/boost/geometry/algorithms/detail/tupled_output.hpp index 8d965268..d13793e7 100644 --- a/include/boost/geometry/algorithms/detail/tupled_output.hpp +++ b/include/boost/geometry/algorithms/detail/tupled_output.hpp @@ -520,10 +520,10 @@ struct expect_output_assert TupledOut, is_tag_same_as_pred::template pred >::value, - typename geometry::tag_cast + tag_cast_t < Tag, pointlike_tag, linear_tag, areal_tag - >::type + > > {}; @@ -540,29 +540,6 @@ struct expect_output : expect_output_assert... {}; - -template -struct single_tag_from_base_tag; - -template <> -struct single_tag_from_base_tag -{ - typedef point_tag type; -}; - -template <> -struct single_tag_from_base_tag -{ - typedef linestring_tag type; -}; - -template <> -struct single_tag_from_base_tag -{ - typedef polygon_tag type; -}; - - template < typename Geometry, diff --git a/include/boost/geometry/algorithms/detail/within/multi_point.hpp b/include/boost/geometry/algorithms/detail/within/multi_point.hpp index be984e93..8ba07e09 100644 --- a/include/boost/geometry/algorithms/detail/within/multi_point.hpp +++ b/include/boost/geometry/algorithms/detail/within/multi_point.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,7 @@ #include #include -#include +#include #include @@ -123,12 +122,8 @@ struct multi_point_single_geometry LinearOrAreal const& linear_or_areal, Strategy const& strategy) { - //typedef typename boost::range_value::type point1_type; - typedef typename point_type::type point2_type; - typedef model::box box2_type; - // Create envelope of geometry - box2_type box; + model::box> box; geometry::envelope(linear_or_areal, box, strategy); geometry::detail::expand_by_epsilon(box); @@ -171,16 +166,17 @@ struct multi_point_multi_geometry LinearOrAreal const& linear_or_areal, Strategy const& strategy) { - typedef typename point_type::type point2_type; - typedef model::box box2_type; + using point2_type = point_type_t; + using box2_type = model::box; + using box_pair_type = std::pair; + using box_pair_vector = std::vector; + static const bool is_linear = util::is_linear::value; // TODO: box pairs could be constructed on the fly, inside the rtree // Prepare range of envelopes and ids std::size_t count2 = boost::size(linear_or_areal); - typedef std::pair box_pair_type; - typedef std::vector box_pair_vector; box_pair_vector boxes(count2); for (std::size_t i = 0 ; i < count2 ; ++i) { @@ -238,9 +234,16 @@ struct multi_point_multi_geometry if (boundaries > 0) { - if (BOOST_GEOMETRY_CONDITION(is_linear) && boundaries % 2 == 0) + if BOOST_GEOMETRY_CONSTEXPR (is_linear) { - found_interior = true; + if (boundaries % 2 == 0) + { + found_interior = true; + } + else + { + found_boundary = true; + } } else { diff --git a/include/boost/geometry/algorithms/difference.hpp b/include/boost/geometry/algorithms/difference.hpp index ec6e4ea7..2d18b314 100644 --- a/include/boost/geometry/algorithms/difference.hpp +++ b/include/boost/geometry/algorithms/difference.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2023. -// Modifications copyright (c) 2017-2023, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -21,8 +21,9 @@ #include #include #include +#include +#include #include // For backward compatibility -#include #include #include #include @@ -62,12 +63,10 @@ struct call_intersection_insert template < typename OutputIterator, - typename RobustPolicy, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -78,7 +77,7 @@ struct call_intersection_insert overlay_difference, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, true>::value - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } }; @@ -86,10 +85,9 @@ struct call_intersection_insert template struct call_intersection_insert { - template + template static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& , - RobustPolicy const& , OutputIterator out, Strategy const& ) { @@ -110,14 +108,10 @@ template > struct call_intersection_insert_tupled_base { - typedef typename geometry::detail::single_tag_from_base_tag + using single_tag = primary_single_tag_t < - typename geometry::tag_cast - < - typename geometry::tag::type, - pointlike_tag, linear_tag, areal_tag - >::type - >::type single_tag; + tag_cast_t, pointlike_tag, linear_tag, areal_tag> + >; typedef detail::expect_output < @@ -149,12 +143,10 @@ struct call_intersection_insert template < typename OutputIterator, - typename RobustPolicy, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -162,7 +154,7 @@ struct call_intersection_insert < Geometry1, Geometry2, typename base_t::access::type - >::apply(geometry1, geometry2, robust_policy, + >::apply(geometry1, geometry2, base_t::access::get(out), strategy); return out; @@ -188,12 +180,10 @@ struct call_intersection_insert template < typename OutputIterator, - typename RobustPolicy, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& , - RobustPolicy const& , OutputIterator out, Strategy const& ) { @@ -244,21 +234,10 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1, //concepts::check(); geometry::detail::output_geometry_concept_check::apply(); - typedef typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - >::type rescale_policy_type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - return geometry::detail::difference::call_intersection_insert < Geometry1, Geometry2, GeometryOut - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } /*! @@ -302,11 +281,7 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1, template < typename Geometry, typename Collection, - typename CastedTag = typename geometry::tag_cast - < - typename geometry::tag::type, - pointlike_tag, linear_tag, areal_tag - >::type + typename CastedTag = tag_cast_t, pointlike_tag, linear_tag, areal_tag> > struct multi_output_type { diff --git a/include/boost/geometry/algorithms/discrete_frechet_distance.hpp b/include/boost/geometry/algorithms/discrete_frechet_distance.hpp index 094ae14a..aff35155 100644 --- a/include/boost/geometry/algorithms/discrete_frechet_distance.hpp +++ b/include/boost/geometry/algorithms/discrete_frechet_distance.hpp @@ -22,6 +22,8 @@ #include +#include + #include #include #include @@ -74,8 +76,8 @@ struct linestring_linestring { typedef typename distance_result < - typename point_type::type, - typename point_type::type, + point_type_t, + point_type_t, Strategies >::type result_type; typedef typename boost::range_size::type size_type1; @@ -223,15 +225,15 @@ struct discrete_frechet_distance /*! -\brief Calculate discrete Frechet distance between two geometries (currently - works for LineString-LineString) using specified strategy. +\brief \brief_calc2{discrete Frechet distance, between} \brief_strategy +\details \details_free_function{discrete_frechet_distance, discrete Frechet distance, between}. \ingroup discrete_frechet_distance \tparam Geometry1 \tparam_geometry \tparam Geometry2 \tparam_geometry -\tparam Strategy A type fulfilling a DistanceStrategy concept -\param geometry1 Input geometry -\param geometry2 Input geometry -\param strategy Distance strategy to be used to calculate Pt-Pt distance +\tparam Strategy \tparam_strategy{Distance} +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\param strategy \param_strategy{point to point distance} \qbk{distinguish,with strategy} \qbk{[include reference/algorithms/discrete_frechet_distance.qbk]} @@ -240,7 +242,8 @@ struct discrete_frechet_distance [heading Available Strategies] \* [link geometry.reference.strategies.strategy_distance_pythagoras Pythagoras (cartesian)] \* [link geometry.reference.strategies.strategy_distance_haversine Haversine (spherical)] -[/ \* more (currently extensions): Vincenty\, Andoyer (geographic) ] +\* One of the geographic point to point strategies + [heading Example] [discrete_frechet_distance_strategy] @@ -261,13 +264,13 @@ inline auto discrete_frechet_distance(Geometry1 const& geometry1, // Algorithm overload using default Pt-Pt distance strategy /*! -\brief Calculate discrete Frechet distance between two geometries (currently - work for LineString-LineString). +\brief \brief_calc2{discrete Frechet distance, between} +\details \details_free_function{discrete_frechet_distance, discrete Frechet distance, between}. \ingroup discrete_frechet_distance \tparam Geometry1 \tparam_geometry \tparam Geometry2 \tparam_geometry -\param geometry1 Input geometry -\param geometry2 Input geometry +\param geometry1 \param_geometry +\param geometry2 \param_geometry \qbk{[include reference/algorithms/discrete_frechet_distance.qbk]} diff --git a/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp b/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp index 115909c0..88c5bb3a 100644 --- a/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp +++ b/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp @@ -26,6 +26,8 @@ #include #include +#include + #include #include #include @@ -57,29 +59,29 @@ namespace detail { namespace discrete_hausdorff_distance struct point_range { template - static inline auto apply(Point const& pnt, Range const& rng, + static inline auto apply(Point const& pnt, Range const& range, Strategies const& strategies) { typedef typename distance_result < Point, - typename point_type::type, + point_type_t, Strategies >::type result_type; typedef typename boost::range_size::type size_type; - boost::geometry::detail::throw_on_empty_input(rng); + boost::geometry::detail::throw_on_empty_input(range); auto const strategy = strategies.distance(dummy_point(), dummy_point()); - size_type const n = boost::size(rng); + size_type const n = boost::size(range); result_type dis_min = 0; bool is_dis_min_set = false; for (size_type i = 0 ; i < n ; i++) { - result_type dis_temp = strategy.apply(pnt, range::at(rng, i)); + result_type dis_temp = strategy.apply(pnt, range::at(range, i)); if (! is_dis_min_set || dis_temp < dis_min) { dis_min = dis_temp; @@ -98,8 +100,8 @@ struct range_range { typedef typename distance_result < - typename point_type::type, - typename point_type::type, + point_type_t, + point_type_t, Strategies >::type result_type; @@ -113,8 +115,8 @@ struct range_range #ifdef BOOST_GEOMETRY_ENABLE_SIMILARITY_RTREE namespace bgi = boost::geometry::index; - typedef typename point_type::type point_t; - typedef bgi::rtree > rtree_type; + using point_t = point_type_t; + using rtree_type = bgi::rtree >; rtree_type rtree(boost::begin(r2), boost::end(r2)); point_t res; #endif @@ -139,27 +141,27 @@ struct range_range struct range_multi_range { - template - static inline auto apply(Range const& rng, Multi_range const& mrng, + template + static inline auto apply(Range const& range, MultiRange const& multi_range, Strategies const& strategies) { typedef typename distance_result < - typename point_type::type, - typename point_type::type, + point_type_t, + point_type_t, Strategies >::type result_type; - typedef typename boost::range_size::type size_type; + typedef typename boost::range_size::type size_type; - boost::geometry::detail::throw_on_empty_input(rng); - boost::geometry::detail::throw_on_empty_input(mrng); + boost::geometry::detail::throw_on_empty_input(range); + boost::geometry::detail::throw_on_empty_input(multi_range); - size_type b = boost::size(mrng); + size_type b = boost::size(multi_range); result_type haus_dis = 0; for (size_type j = 0 ; j < b ; j++) { - result_type dis_max = range_range::apply(rng, range::at(mrng, j), strategies); + result_type dis_max = range_range::apply(range, range::at(multi_range, j), strategies); if (dis_max > haus_dis) { haus_dis = dis_max; @@ -173,27 +175,27 @@ struct range_multi_range struct multi_range_multi_range { - template - static inline auto apply(Multi_Range1 const& mrng1, Multi_range2 const& mrng2, + template + static inline auto apply(MultiRange1 const& multi_range1, MultiRange2 const& multi_range2, Strategies const& strategies) { typedef typename distance_result < - typename point_type::type, - typename point_type::type, + point_type_t, + point_type_t, Strategies >::type result_type; - typedef typename boost::range_size::type size_type; + typedef typename boost::range_size::type size_type; - boost::geometry::detail::throw_on_empty_input(mrng1); - boost::geometry::detail::throw_on_empty_input(mrng2); + boost::geometry::detail::throw_on_empty_input(multi_range1); + boost::geometry::detail::throw_on_empty_input(multi_range2); - size_type n = boost::size(mrng1); + size_type n = boost::size(multi_range1); result_type haus_dis = 0; for (size_type i = 0 ; i < n ; i++) { - result_type dis_max = range_multi_range::apply(range::at(mrng1, i), mrng2, strategies); + result_type dis_max = range_multi_range::apply(range::at(multi_range1, i), multi_range2, strategies); if (dis_max > haus_dis) { haus_dis = dis_max; @@ -312,16 +314,15 @@ struct discrete_hausdorff_distance /*! -\brief Calculate discrete Hausdorff distance between two geometries (currently - works for LineString-LineString, MultiPoint-MultiPoint, Point-MultiPoint, - MultiLineString-MultiLineString) using specified strategy. +\brief \brief_calc2{discrete Hausdorff distance, between} \brief_strategy +\details \details_free_function{discrete_hausdorff_distance, discrete Hausdorff distance, between}. \ingroup discrete_hausdorff_distance \tparam Geometry1 \tparam_geometry \tparam Geometry2 \tparam_geometry -\tparam Strategy A type fulfilling a DistanceStrategy concept -\param geometry1 Input geometry -\param geometry2 Input geometry -\param strategy Distance strategy to be used to calculate Pt-Pt distance +\tparam Strategy \tparam_strategy{Distance} +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\param strategy \param_strategy{point to point distance} \qbk{distinguish,with strategy} \qbk{[include reference/algorithms/discrete_hausdorff_distance.qbk]} @@ -330,7 +331,7 @@ struct discrete_hausdorff_distance [heading Available Strategies] \* [link geometry.reference.strategies.strategy_distance_pythagoras Pythagoras (cartesian)] \* [link geometry.reference.strategies.strategy_distance_haversine Haversine (spherical)] -[/ \* more (currently extensions): Vincenty\, Andoyer (geographic) ] +\* One of the geographic point to point strategies [heading Example] [discrete_hausdorff_distance_strategy] @@ -349,14 +350,13 @@ inline auto discrete_hausdorff_distance(Geometry1 const& geometry1, } /*! -\brief Calculate discrete Hausdorff distance between two geometries (currently - works for LineString-LineString, MultiPoint-MultiPoint, Point-MultiPoint, - MultiLineString-MultiLineString). +\brief \brief_calc2{discrete Hausdorff distance, between} +\details \details_free_function{discrete_hausdorff_distance, discrete Hausdorff distance, between}. \ingroup discrete_hausdorff_distance \tparam Geometry1 \tparam_geometry \tparam Geometry2 \tparam_geometry -\param geometry1 Input geometry -\param geometry2 Input geometry +\param geometry1 \param_geometry +\param geometry2 \param_geometry \qbk{[include reference/algorithms/discrete_hausdorff_distance.qbk]} diff --git a/include/boost/geometry/algorithms/dispatch/closest_points.hpp b/include/boost/geometry/algorithms/dispatch/closest_points.hpp index e4f72de6..c803316d 100644 --- a/include/boost/geometry/algorithms/dispatch/closest_points.hpp +++ b/include/boost/geometry/algorithms/dispatch/closest_points.hpp @@ -34,22 +34,22 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, bool Reverse = reverse_dispatch::type::value > struct closest_points : not_implemented diff --git a/include/boost/geometry/algorithms/dispatch/disjoint.hpp b/include/boost/geometry/algorithms/dispatch/disjoint.hpp index ef749918..897ef991 100644 --- a/include/boost/geometry/algorithms/dispatch/disjoint.hpp +++ b/include/boost/geometry/algorithms/dispatch/disjoint.hpp @@ -45,16 +45,16 @@ template < typename Geometry1, typename Geometry2, std::size_t DimensionCount = dimension::type::value, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, bool Reverse = reverse_dispatch::type::value > struct disjoint diff --git a/include/boost/geometry/algorithms/dispatch/distance.hpp b/include/boost/geometry/algorithms/dispatch/distance.hpp index eb9cd92f..9272fd49 100644 --- a/include/boost/geometry/algorithms/dispatch/distance.hpp +++ b/include/boost/geometry/algorithms/dispatch/distance.hpp @@ -98,22 +98,22 @@ template < Geometry1, Geometry2 >::type, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, typename StrategyTag = typename distance_strategy_tag < Geometry1, Geometry2, Strategy diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index d03643ab..a1fd0a6c 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -117,7 +117,7 @@ struct fe_point_type typedef util::transcribe_const_t < Range, - typename point_type::type + point_type_t > type; }; @@ -369,7 +369,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast::type, multi_tag>::type + typename Tag = tag_cast_t, multi_tag> > struct for_each_point: not_implemented {}; diff --git a/include/boost/geometry/algorithms/is_convex.hpp b/include/boost/geometry/algorithms/is_convex.hpp index afde6453..c5aef2ec 100644 --- a/include/boost/geometry/algorithms/is_convex.hpp +++ b/include/boost/geometry/algorithms/is_convex.hpp @@ -16,6 +16,7 @@ #include +#include #include #include diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index 6e453389..a79e78dd 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -64,8 +64,7 @@ struct segment_length static inline typename default_length_result::type apply(Segment const& segment, Strategies const& strategies) { - typedef typename point_type::type point_type; - point_type p1, p2; + point_type_t p1, p2; geometry::detail::assign_point_from_index<0>(segment, p1); geometry::detail::assign_point_from_index<1>(segment, p2); return strategies.distance(p1, p2).apply(p1, p2); diff --git a/include/boost/geometry/algorithms/line_interpolate.hpp b/include/boost/geometry/algorithms/line_interpolate.hpp index 5739c444..9afbe509 100644 --- a/include/boost/geometry/algorithms/line_interpolate.hpp +++ b/include/boost/geometry/algorithms/line_interpolate.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2018-2023 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -35,7 +37,7 @@ #include #include -#include +#include #include #include @@ -133,13 +135,16 @@ struct interpolate_range p, diff_distance); Policy::apply(p, pointlike); - if ( BOOST_GEOMETRY_CONDITION(util::is_point::value) ) + if BOOST_GEOMETRY_CONSTEXPR (util::is_point::value) { return; } - start_p = p; - prev_distance = repeated_distance; - repeated_distance += max_distance; + else // else prevents unreachable code warning + { + start_p = p; + prev_distance = repeated_distance; + repeated_distance += max_distance; + } } prev_distance = current_distance; prev = it; diff --git a/include/boost/geometry/algorithms/num_geometries.hpp b/include/boost/geometry/algorithms/num_geometries.hpp index 2fc24428..1609dee1 100644 --- a/include/boost/geometry/algorithms/num_geometries.hpp +++ b/include/boost/geometry/algorithms/num_geometries.hpp @@ -51,12 +51,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast - < - typename tag::type, - single_tag, - multi_tag - >::type + typename Tag = tag_cast_t, single_tag, multi_tag> > struct num_geometries: not_implemented {}; diff --git a/include/boost/geometry/algorithms/num_points.hpp b/include/boost/geometry/algorithms/num_points.hpp index ee1609dc..6a59c2bb 100644 --- a/include/boost/geometry/algorithms/num_points.hpp +++ b/include/boost/geometry/algorithms/num_points.hpp @@ -86,10 +86,7 @@ template < typename Geometry, bool AddForOpen, - typename Tag = typename tag_cast - < - typename tag::type, multi_tag - >::type + typename Tag = tag_cast_t, multi_tag> > struct num_points: not_implemented {}; diff --git a/include/boost/geometry/algorithms/point_on_surface.hpp b/include/boost/geometry/algorithms/point_on_surface.hpp index 5b90db47..88077bcc 100644 --- a/include/boost/geometry/algorithms/point_on_surface.hpp +++ b/include/boost/geometry/algorithms/point_on_surface.hpp @@ -310,10 +310,10 @@ inline void point_on_surface(Geometry const& geometry, Point & point, template inline void point_on_surface(Geometry const& geometry, Point & point) { - typedef typename strategy::side::services::default_strategy + using strategy_type = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type strategy_type; + cs_tag_t + >::type; point_on_surface(geometry, point, strategy_type()); } diff --git a/include/boost/geometry/algorithms/remove_spikes.hpp b/include/boost/geometry/algorithms/remove_spikes.hpp index 7a144db1..48880a50 100644 --- a/include/boost/geometry/algorithms/remove_spikes.hpp +++ b/include/boost/geometry/algorithms/remove_spikes.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2013 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2013 Bruno Lalande, Paris, France. // Copyright (c) 2009-2013 Mateusz Loskot, London, UK. -// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -37,7 +37,7 @@ #include -#include +#include #include @@ -68,9 +68,7 @@ struct range_remove_spikes template static inline void apply(Range& range, SideStrategy const& strategy) { - typedef typename point_type::type point_type; - - std::size_t n = boost::size(range); + std::size_t const n = boost::size(range); std::size_t const min_num_points = core_detail::closure::minimum_ring_size < geometry::closure::value @@ -80,7 +78,7 @@ struct range_remove_spikes return; } - std::vector cleaned; + std::vector> cleaned; cleaned.reserve(n); for (auto const& p : range) @@ -104,7 +102,7 @@ struct range_remove_spikes std::size_t cleaned_count = cleaned.size(); // For a closed-polygon, remove closing point, this makes checking first point(s) easier and consistent - if ( BOOST_GEOMETRY_CONDITION(geometry::closure::value == geometry::closed) ) + if BOOST_GEOMETRY_CONSTEXPR (geometry::closure::value == geometry::closed) { --cleaned_e; --cleaned_count; @@ -148,7 +146,7 @@ struct range_remove_spikes } // Close if necessary - if ( BOOST_GEOMETRY_CONDITION(geometry::closure::value == geometry::closed) ) + if BOOST_GEOMETRY_CONSTEXPR (geometry::closure::value == geometry::closed) { BOOST_GEOMETRY_ASSERT(cleaned_e != cleaned.end()); *cleaned_e = *cleaned_b; @@ -258,10 +256,10 @@ struct remove_spikes static void apply(Geometry& geometry, geometry::default_strategy const&) { - typedef typename strategy::side::services::default_strategy + using side_strategy = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type side_strategy; + cs_tag_t + >::type; apply(geometry, side_strategy()); } diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 40c66e91..28a3a558 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2018-2023. // Modifications copyright (c) 2018-2023 Oracle and/or its affiliates. @@ -61,6 +61,7 @@ #include #include +#include #include #ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER @@ -429,10 +430,10 @@ public : return; } - bool const is_closed_in = geometry::closure::value == closed; - bool const is_closed_out = geometry::closure::value == closed; - bool const is_clockwise_in = geometry::point_order::value == clockwise; - bool const is_clockwise_out = geometry::point_order::value == clockwise; + constexpr bool is_closed_in = geometry::closure::value == closed; + constexpr bool is_closed_out = geometry::closure::value == closed; + constexpr bool is_clockwise_in = geometry::point_order::value == clockwise; + constexpr bool is_clockwise_out = geometry::point_order::value == clockwise; // TODO: instead of area() use calculate_point_order() ? @@ -482,10 +483,13 @@ public : // Do not duplicate the closing point auto rot_end = boost::end(ring); std::size_t rot_index = index; - if (BOOST_GEOMETRY_CONDITION(is_closed_in) && size > 1) + if BOOST_GEOMETRY_CONSTEXPR (is_closed_in) { - --rot_end; - if (rot_index == size - 1) { rot_index = 0; } + if (size > 1) + { + --rot_end; + if (rot_index == size - 1) { rot_index = 0; } + } } std::rotate_copy(boost::begin(ring), range::pos(ring, rot_index), @@ -497,9 +501,12 @@ public : simplify_range<0>::apply(rotated, out, max_distance, impl, strategies); // Open output if needed - if (BOOST_GEOMETRY_CONDITION(! is_closed_out) && boost::size(out) > 1) + if BOOST_GEOMETRY_CONSTEXPR (! is_closed_out) { - range::pop_back(out); + if (boost::size(out) > 1) + { + range::pop_back(out); + } } // TODO: instead of area() use calculate_point_order() ? @@ -532,7 +539,7 @@ public : rotated.clear(); } - if (BOOST_GEOMETRY_CONDITION(is_clockwise_in != is_clockwise_out)) + if BOOST_GEOMETRY_CONSTEXPR (is_clockwise_in != is_clockwise_out) { std::reverse(boost::begin(out), boost::end(out)); } @@ -976,7 +983,6 @@ struct simplify(); - concepts::check::type>(); + concepts::check>(); simplify_insert(geometry, out, max_distance, default_strategy()); } diff --git a/include/boost/geometry/algorithms/sym_difference.hpp b/include/boost/geometry/algorithms/sym_difference.hpp index 894e88c7..b5507500 100644 --- a/include/boost/geometry/algorithms/sym_difference.hpp +++ b/include/boost/geometry/algorithms/sym_difference.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015-2023. -// Modifications copyright (c) 2015-2023 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -18,11 +18,12 @@ #include +#include +#include #include #include #include #include -#include #include #include #include @@ -45,13 +46,11 @@ struct compute_difference < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -69,7 +68,7 @@ struct compute_difference < geometry::point_order::value, true >::value - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } }; @@ -80,25 +79,23 @@ struct sym_difference_generic { template < - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { out = compute_difference < GeometryOut - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); return compute_difference < GeometryOut - >::apply(geometry2, geometry1, robust_policy, out, strategy); + >::apply(geometry2, geometry1, out, strategy); } }; @@ -108,13 +105,11 @@ struct sym_difference_areal_areal { template < - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Areal1 const& areal1, Areal2 const& areal2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -131,19 +126,19 @@ struct sym_difference_areal_areal compute_difference < GeometryOut - >::apply(areal1, areal2, robust_policy, oit12, strategy); + >::apply(areal1, areal2, oit12, strategy); compute_difference < GeometryOut - >::apply(areal2, areal1, robust_policy, oit21, strategy); + >::apply(areal2, areal1, oit21, strategy); return geometry::dispatch::union_insert < helper_geometry_type, helper_geometry_type, GeometryOut - >::apply(diff12, diff21, robust_policy, out, strategy); + >::apply(diff12, diff21, out, strategy); } }; @@ -160,13 +155,11 @@ struct sym_difference_same_inputs_tupled_output < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -178,7 +171,7 @@ struct sym_difference_same_inputs_tupled_output access::get(out) = Algorithm < typename access::type, Geometry1, Geometry2 - >::apply(geometry1, geometry2, robust_policy, access::get(out), strategy); + >::apply(geometry1, geometry2, access::get(out), strategy); return out; } @@ -199,20 +192,18 @@ struct sym_difference_different_inputs_tupled_output < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return sym_difference_different_inputs_tupled_output < GeometryOut, SingleTag2, SingleTag1 - >::apply(geometry2, geometry1, robust_policy, out, strategy); + >::apply(geometry2, geometry1, out, strategy); } }; @@ -231,13 +222,11 @@ struct sym_difference_different_inputs_tupled_output < typename Geometry1, typename Geometry2, - typename RobustPolicy, typename OutputIterator, typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -253,7 +242,7 @@ struct sym_difference_different_inputs_tupled_output access1::get(out) = compute_difference < typename access1::type - >::apply(geometry1, geometry2, robust_policy, access1::get(out), strategy); + >::apply(geometry1, geometry2, access1::get(out), strategy); access2::get(out) = geometry::detail::convert_to_output < @@ -281,14 +270,14 @@ template typename Geometry1, typename Geometry2, typename GeometryOut, - typename TagIn1 = typename geometry::tag_cast + typename TagIn1 = tag_cast_t < - typename tag::type, pointlike_tag, linear_tag, areal_tag - >::type, - typename TagIn2 = typename geometry::tag_cast + tag_t, pointlike_tag, linear_tag, areal_tag + >, + typename TagIn2 = tag_cast_t < - typename tag::type, pointlike_tag, linear_tag, areal_tag - >::type, + tag_t, pointlike_tag, linear_tag, areal_tag + >, typename TagOut = typename detail::setop_insert_output_tag::type > struct sym_difference_insert @@ -393,15 +382,11 @@ struct sym_difference_insert > : detail::expect_output < - Geometry1, Geometry2, GeometryOut, - typename detail::single_tag_from_base_tag::type, - typename detail::single_tag_from_base_tag::type + Geometry1, Geometry2, GeometryOut, primary_single_tag_t, primary_single_tag_t > , detail::sym_difference::sym_difference_different_inputs_tupled_output < - GeometryOut, - typename detail::single_tag_from_base_tag::type, - typename detail::single_tag_from_base_tag::type + GeometryOut, primary_single_tag_t, primary_single_tag_t > {}; @@ -452,21 +437,10 @@ inline OutputIterator sym_difference_insert(Geometry1 const& geometry1, //concepts::check(); geometry::detail::output_geometry_concept_check::apply(); - typedef typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - >::type rescale_policy_type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - return dispatch::sym_difference_insert < Geometry1, Geometry2, GeometryOut - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } diff --git a/include/boost/geometry/algorithms/transform.hpp b/include/boost/geometry/algorithms/transform.hpp index 66d56d71..8b7e814e 100644 --- a/include/boost/geometry/algorithms/transform.hpp +++ b/include/boost/geometry/algorithms/transform.hpp @@ -70,8 +70,8 @@ struct transform_box static inline bool apply(Box1 const& b1, Box2& b2, Strategy const& strategy) { - typedef typename point_type::type point_type1; - typedef typename point_type::type point_type2; + using point_type1 = point_type_t; + using point_type2 = point_type_t; point_type1 lower_left, upper_right; geometry::detail::assign::assign_box_2d_corner( @@ -83,7 +83,7 @@ struct transform_box if (strategy.apply(lower_left, p1) && strategy.apply(upper_right, p2)) { // Create a valid box and therefore swap if necessary - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; coordinate_type x1 = geometry::get<0>(p1) , y1 = geometry::get<1>(p1) , x2 = geometry::get<0>(p2) @@ -109,14 +109,11 @@ struct transform_box_or_segment static inline bool apply(Geometry1 const& source, Geometry2& target, Strategy const& strategy) { - typedef typename point_type::type point_type1; - typedef typename point_type::type point_type2; - - point_type1 source_point[2]; + point_type_t source_point[2]; geometry::detail::assign_point_from_index<0>(source, source_point[0]); geometry::detail::assign_point_from_index<1>(source, source_point[1]); - point_type2 target_point[2]; + point_type_t target_point[2]; if (strategy.apply(source_point[0], target_point[0]) && strategy.apply(source_point[1], target_point[1])) { @@ -158,7 +155,7 @@ struct transform_polygon static inline bool apply(Polygon1 const& poly1, Polygon2& poly2, Strategy const& strategy) { - typedef typename point_type::type point2_type; + using point2_type = point_type_t; geometry::clear(poly2); @@ -198,20 +195,20 @@ struct transform_polygon }; -template +template struct select_strategy { - typedef typename strategy::transform::services::default_strategy + using type = typename strategy::transform::services::default_strategy < - typename cs_tag::type, - typename cs_tag::type, - typename coordinate_system::type, - typename coordinate_system::type, - dimension::type::value, - dimension::type::value, - typename point_type::type, - typename point_type::type - >::type type; + cs_tag_t, + cs_tag_t, + coordinate_system_t, + coordinate_system_t, + dimension::value, + dimension::value, + point_type_t, + point_type_t + >::type; }; struct transform_range @@ -220,11 +217,9 @@ struct transform_range static inline bool apply(Range1 const& range1, Range2& range2, Strategy const& strategy) { - typedef typename point_type::type point_type; - - // Should NOT be done here! + // "clear" should NOT be done here! // geometry::clear(range2); - return transform_range_out(range1, + return transform_range_out>(range1, range::back_inserter(range2), strategy); } }; @@ -268,8 +263,8 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag_cast::type, multi_tag>::type, - typename Tag2 = typename tag_cast::type, multi_tag>::type + typename Tag1 = tag_cast_t, multi_tag>, + typename Tag2 = tag_cast_t, multi_tag> > struct transform {}; diff --git a/include/boost/geometry/algorithms/union.hpp b/include/boost/geometry/algorithms/union.hpp index 3d88cc14..3deced91 100644 --- a/include/boost/geometry/algorithms/union.hpp +++ b/include/boost/geometry/algorithms/union.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014-2023. -// Modifications copyright (c) 2014-2023 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -24,10 +24,11 @@ #include #include #include +#include #include +#include #include #include -#include #include #include #include @@ -48,12 +49,12 @@ namespace dispatch template < typename Geometry1, typename Geometry2, typename GeometryOut, - typename TagIn1 = typename tag::type, - typename TagIn2 = typename tag::type, + typename TagIn1 = tag_t, + typename TagIn2 = tag_t, typename TagOut = typename detail::setop_insert_output_tag::type, - typename CastedTagIn1 = typename geometry::tag_cast::type, - typename CastedTagIn2 = typename geometry::tag_cast::type, - typename CastedTagOut = typename geometry::tag_cast::type, + typename CastedTagIn1 = tag_cast_t, + typename CastedTagIn2 = tag_cast_t, + typename CastedTagOut = tag_cast_t, bool Reverse = geometry::reverse_dispatch::type::value > struct union_insert: not_implemented @@ -76,17 +77,16 @@ struct union_insert true > { - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return union_insert < Geometry2, Geometry1, GeometryOut - >::apply(g2, g1, robust_policy, out, strategy); + >::apply(g2, g1, out, strategy); } }; @@ -166,10 +166,7 @@ struct union_insert false > { - using single_tag = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn - >::type; + using single_tag = primary_single_tag_t; using expect_check = detail::expect_output < @@ -181,17 +178,16 @@ struct union_insert SingleTupledOut, single_tag, single_tag >; - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { access::get(out) = union_insert < Geometry2, Geometry1, typename access::type - >::apply(g2, g1, robust_policy, access::get(out), strategy); + >::apply(g2, g1, access::get(out), strategy); return out; } @@ -217,10 +213,9 @@ struct union_insert_tupled_different SingleTupledOut, SingleTag2, SingleTag2 >; - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { @@ -231,7 +226,7 @@ struct union_insert_tupled_different overlay_difference, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, true>::value - >::apply(g1, g2, robust_policy, access1::get(out), strategy); + >::apply(g1, g2, access1::get(out), strategy); access2::get(out) = geometry::detail::convert_to_output < @@ -254,17 +249,16 @@ struct union_insert_tupled_different Geometry1, Geometry2, SingleTupledOut, SingleTag1, SingleTag2, false > { - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return union_insert_tupled_different < Geometry2, Geometry1, SingleTupledOut, SingleTag2, SingleTag1, true - >::apply(g2, g1, robust_policy, out, strategy); + >::apply(g2, g1, out, strategy); } }; @@ -283,37 +277,30 @@ struct union_insert false > { - using single_tag1 = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn1 - >::type; + using single_tag1 = primary_single_tag_t; using expect_check1 = detail::expect_output < Geometry1, Geometry2, SingleTupledOut, single_tag1 >; - using single_tag2 = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn2 - >::type; + using single_tag2 = primary_single_tag_t; using expect_check2 = detail::expect_output < Geometry1, Geometry2, SingleTupledOut, single_tag2 >; - template + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, - RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { return union_insert_tupled_different < Geometry1, Geometry2, SingleTupledOut, single_tag1, single_tag2 - >::apply(g1, g2, robust_policy, out, strategy); + >::apply(g1, g2, out, strategy); } }; @@ -359,20 +346,10 @@ inline OutputIterator union_insert(Geometry1 const& geometry1, Geometry1, Geometry2 >::type strategy; - using rescale_policy_type = typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2 - >::type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - return dispatch::union_insert < Geometry1, Geometry2, GeometryOut - >::apply(geometry1, geometry2, robust_policy, out, strategy); + >::apply(geometry1, geometry2, out, strategy); } @@ -401,21 +378,10 @@ struct union_ GeometryOut >::type; - using rescale_policy_type = typename geometry::rescale_overlay_policy_type - < - Geometry1, - Geometry2, - typename Strategy::cs_tag - >::type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - geometry1, geometry2, strategy); - dispatch::union_insert < Geometry1, Geometry2, single_out - >::apply(geometry1, geometry2, robust_policy, + >::apply(geometry1, geometry2, geometry::detail::output_geometry_back_inserter(geometry_out), strategy); } @@ -594,15 +560,6 @@ struct union_ template static inline void subtract_greater_topodim(Multi1 const& multi1, Multi2 const& multi2, Multi1& multi_out, Strategy const& strategy) { - using rescale_policy_type = typename geometry::rescale_overlay_policy_type - < - Multi1, Multi2 - >::type; - - rescale_policy_type robust_policy - = geometry::get_rescale_policy( - multi1, multi2, strategy); - geometry::dispatch::intersection_insert < Multi1, Multi2, @@ -610,7 +567,7 @@ struct union_ overlay_difference, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, true>::value - >::apply(multi1, multi2, robust_policy, range::back_inserter(multi_out), strategy); + >::apply(multi1, multi2, range::back_inserter(multi_out), strategy); } */ }; diff --git a/include/boost/geometry/arithmetic/determinant.hpp b/include/boost/geometry/arithmetic/determinant.hpp index 59c596b1..63974a9e 100644 --- a/include/boost/geometry/arithmetic/determinant.hpp +++ b/include/boost/geometry/arithmetic/determinant.hpp @@ -16,9 +16,9 @@ #include #include +#include #include -#include namespace boost { namespace geometry { @@ -33,7 +33,7 @@ class calculate_determinant template static inline ReturnType rt(T const& v) { - return boost::numeric_cast(v); + return util::numeric_cast(v); } public : diff --git a/include/boost/geometry/arithmetic/infinite_line_functions.hpp b/include/boost/geometry/arithmetic/infinite_line_functions.hpp index 529e8371..16acb866 100644 --- a/include/boost/geometry/arithmetic/infinite_line_functions.hpp +++ b/include/boost/geometry/arithmetic/infinite_line_functions.hpp @@ -97,7 +97,7 @@ side_value(model::infinite_line const& line, Point const& p) } template -inline bool is_degenerate(const model::infinite_line& line) +inline bool is_degenerate(model::infinite_line const& line) { static Type const zero = 0; return math::equals(line.a, zero) && math::equals(line.b, zero); diff --git a/include/boost/geometry/core/access.hpp b/include/boost/geometry/core/access.hpp index c59ff12c..f863d5cb 100644 --- a/include/boost/geometry/core/access.hpp +++ b/include/boost/geometry/core/access.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -75,7 +76,12 @@ struct access \ingroup traits */ template -struct indexed_access {}; +struct indexed_access +{ + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry type.", + Geometry); +}; } // namespace traits @@ -87,17 +93,16 @@ namespace detail template < typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension > struct indexed_access_non_pointer { - static constexpr CoordinateType get(Geometry const& geometry) + static constexpr coordinate_type_t get(Geometry const& geometry) { return traits::indexed_access::get(geometry); } - static void set(Geometry& b, CoordinateType const& value) + static void set(Geometry& b, coordinate_type_t const& value) { traits::indexed_access::set(b, value); } @@ -106,19 +111,18 @@ struct indexed_access_non_pointer template < typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension > struct indexed_access_pointer { - static constexpr CoordinateType get(Geometry const* geometry) + static constexpr coordinate_type_t get(Geometry const* geometry) { - return traits::indexed_access::type, Index, Dimension>::get(*geometry); + return traits::indexed_access, Index, Dimension>::get(*geometry); } - static void set(Geometry* geometry, CoordinateType const& value) + static void set(Geometry* geometry, coordinate_type_t const& value) { - traits::indexed_access::type, Index, Dimension>::set(*geometry, value); + traits::indexed_access, Index, Dimension>::set(*geometry, value); } }; @@ -135,13 +139,14 @@ template < typename Tag, typename Geometry, - typename - CoordinateType, std::size_t Dimension, - typename IsPointer + bool IsPointer > struct access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline T get(G const&) {} //static inline void set(G& g, T const& value) {} }; @@ -150,40 +155,42 @@ template < typename Tag, typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension, - typename IsPointer + bool IsPointer > struct indexed_access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline T get(G const&) {} //static inline void set(G& g, T const& value) {} }; -template -struct access +template +struct access { - static constexpr CoordinateType get(Point const& point) + static constexpr coordinate_type_t get(Point const& point) { return traits::access::get(point); } - static void set(Point& p, CoordinateType const& value) + static void set(Point& p, coordinate_type_t const& value) { traits::access::set(p, value); } }; -template -struct access +template +struct access { - static constexpr CoordinateType get(Point const* point) + static constexpr coordinate_type_t get(Point const* point) { - return traits::access::type, Dimension>::get(*point); + return traits::access, Dimension>::get(*point); } - static void set(Point* p, CoordinateType const& value) + static void set(Point* p, coordinate_type_t const& value) { - traits::access::type, Dimension>::set(*p, value); + traits::access, Dimension>::set(*p, value); } }; @@ -191,47 +198,43 @@ struct access template < typename Box, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_non_pointer +struct indexed_access + : detail::indexed_access_non_pointer {}; template < typename Box, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_pointer +struct indexed_access + : detail::indexed_access_pointer {}; template < typename Segment, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_non_pointer +struct indexed_access + : detail::indexed_access_non_pointer {}; template < typename Segment, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_pointer +struct indexed_access + : detail::indexed_access_pointer {}; } // namespace core_dispatch @@ -265,22 +268,19 @@ struct signature_getset_index_dimension {}; \qbk{[include reference/core/get_point.qbk]} */ template -constexpr inline typename coordinate_type::type get(Geometry const& geometry +constexpr inline coordinate_type_t get(Geometry const& geometry #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_dimension* = 0 #endif ) { - typedef core_dispatch::access + return core_dispatch::access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Dimension, - typename std::is_pointer::type - > coord_access_type; - - return coord_access_type::get(geometry); + std::is_pointer::value + >::get(geometry); } @@ -289,8 +289,7 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge \details \details_get_set \tparam Dimension \tparam_dimension_required \tparam Geometry \tparam_geometry (usually a Point Concept) -\param geometry geometry to assign coordinate to -\param geometry \param_geometry (usually a point) +\param geometry \param_geometry \param value The coordinate value to set \ingroup set @@ -298,22 +297,19 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge */ template inline void set(Geometry& geometry - , typename coordinate_type::type const& value + , coordinate_type_t const& value #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_dimension* = 0 #endif ) { - typedef core_dispatch::access + core_dispatch::access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Dimension, - typename std::is_pointer::type - > coord_access_type; - - coord_access_type::set(geometry, value); + std::is_pointer::value + >::set(geometry, value); } @@ -331,23 +327,20 @@ inline void set(Geometry& geometry \qbk{[include reference/core/get_box.qbk]} */ template -constexpr inline typename coordinate_type::type get(Geometry const& geometry +constexpr inline coordinate_type_t get(Geometry const& geometry #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_index_dimension* = 0 #endif ) { - typedef core_dispatch::indexed_access + return core_dispatch::indexed_access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Index, Dimension, - typename std::is_pointer::type - > coord_access_type; - - return coord_access_type::get(geometry); + std::is_pointer::value + >::get(geometry); } /*! @@ -356,7 +349,6 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge \tparam Index \tparam_index_required \tparam Dimension \tparam_dimension_required \tparam Geometry \tparam_box_or_segment -\param geometry geometry to assign coordinate to \param geometry \param_geometry \param value The coordinate value to set \ingroup set @@ -366,23 +358,20 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge */ template inline void set(Geometry& geometry - , typename coordinate_type::type const& value + , coordinate_type_t const& value #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_index_dimension* = 0 #endif ) { - typedef core_dispatch::indexed_access + core_dispatch::indexed_access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Index, Dimension, - typename std::is_pointer::type - > coord_access_type; - - coord_access_type::set(geometry, value); + std::is_pointer::value + >::set(geometry, value); } }} // namespace boost::geometry diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index 46c3d793..09abb8e1 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -3,7 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// // This file was modified by Oracle on 2014-2021. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -187,25 +188,33 @@ struct closure */ template struct closure -{ - static const closure_selector value = core_dispatch::closure + : std::integral_constant < - typename tag::type, - typename util::remove_cptrref::type - >::value; -}; + closure_selector, + core_dispatch::closure + < + tag_t, + util::remove_cptrref_t + >::value + > +{}; + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr closure_selector closure_v = closure::value; +#endif #ifndef DOXYGEN_NO_DETAIL namespace detail { -template -< - typename Geometry, - closure_selector Closure = geometry::closure::value -> -using minimum_ring_size = core_detail::closure::minimum_ring_size; +template +using minimum_ring_size = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >; + } // namespace detail #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/core/config.hpp b/include/boost/geometry/core/config.hpp index f5ab449f..a96c47c9 100644 --- a/include/boost/geometry/core/config.hpp +++ b/include/boost/geometry/core/config.hpp @@ -2,7 +2,7 @@ // Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2018-2023 Oracle and/or its affiliates. +// Copyright (c) 2018-2024 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,25 +14,5 @@ #define BOOST_GEOMETRY_CORE_CONFIG_HPP #include -#include - -// If no define is specified, it uses BOOST_GEOMETRY_NO_ROBUSTNESS, which means: no rescaling. -// (Rescaling was an earlier approach to fix robustness issues.) -// However, if BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE is specified, it flips the default. -#if !defined(BOOST_GEOMETRY_NO_ROBUSTNESS) && !defined(BOOST_GEOMETRY_USE_RESCALING) - #if defined(BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE) - #define BOOST_GEOMETRY_USE_RESCALING - #else - #define BOOST_GEOMETRY_NO_ROBUSTNESS - #endif -#endif - -#if defined(BOOST_GEOMETRY_USE_RESCALING) && ! defined(BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE) - BOOST_PRAGMA_MESSAGE("Rescaling is deprecated and its functionality will be removed in Boost 1.84") -#endif - -#if defined(BOOST_GEOMETRY_USE_RESCALING) && defined(BOOST_GEOMETRY_NO_ROBUSTNESS) - #error "Define either BOOST_GEOMETRY_NO_ROBUSTNESS (default) or BOOST_GEOMETRY_USE_RESCALING" -#endif #endif // BOOST_GEOMETRY_CORE_CONFIG_HPP diff --git a/include/boost/geometry/core/coordinate_dimension.hpp b/include/boost/geometry/core/coordinate_dimension.hpp index 3a87dabf..7f2e94ac 100644 --- a/include/boost/geometry/core/coordinate_dimension.hpp +++ b/include/boost/geometry/core/coordinate_dimension.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -88,11 +89,18 @@ template struct dimension : core_dispatch::dimension < - typename tag::type, - typename util::remove_cptrref::type + tag_t, + util::remove_cptrref_t > {}; + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr std::size_t dimension_v = dimension::value; +#endif + + /*! \brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected \ingroup utility diff --git a/include/boost/geometry/core/coordinate_system.hpp b/include/boost/geometry/core/coordinate_system.hpp index a9dae31e..cebdbc2e 100644 --- a/include/boost/geometry/core/coordinate_system.hpp +++ b/include/boost/geometry/core/coordinate_system.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -88,14 +89,18 @@ namespace core_dispatch template struct coordinate_system { - typedef typename core_dispatch::coordinate_system + using type = typename core_dispatch::coordinate_system < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; +template +using coordinate_system_t = typename coordinate_system::type; + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/coordinate_type.hpp b/include/boost/geometry/core/coordinate_type.hpp index 760b122a..ab86b09c 100644 --- a/include/boost/geometry/core/coordinate_type.hpp +++ b/include/boost/geometry/core/coordinate_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -56,19 +57,21 @@ namespace core_dispatch template struct coordinate_type { - typedef typename point_type::type point_type; - // Call its own specialization on point-tag - typedef typename coordinate_type::type type; + using type = typename coordinate_type + < + point_tag, + typename point_type::type + >::type; }; template struct coordinate_type { - typedef typename traits::coordinate_type + using type = typename traits::coordinate_type < - typename util::remove_cptrref::type - >::type type; + util::remove_cptrref_t + >::type; }; @@ -86,13 +89,18 @@ struct coordinate_type template struct coordinate_type { - typedef typename core_dispatch::coordinate_type + using type = typename core_dispatch::coordinate_type < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; + +template +using coordinate_type_t = typename coordinate_type::type; + + /*! \brief assert_coordinate_type_equal, a compile-time check for equality of two coordinate types \ingroup utility @@ -100,11 +108,8 @@ struct coordinate_type template constexpr inline void assert_coordinate_type_equal(Geometry1 const& , Geometry2 const& ) { - static_assert(std::is_same - < - typename coordinate_type::type, - typename coordinate_type::type - >::value, "Coordinate types in geometries should be the same"); + static_assert(std::is_same, coordinate_type_t>::value, + "Coordinate types in geometries should be the same"); } }} // namespace boost::geometry diff --git a/include/boost/geometry/core/cs.hpp b/include/boost/geometry/core/cs.hpp index 0e2f4c5c..e6bc4e34 100644 --- a/include/boost/geometry/core/cs.hpp +++ b/include/boost/geometry/core/cs.hpp @@ -3,10 +3,10 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. - // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -237,13 +237,17 @@ struct cs_tag template struct cs_tag { - typedef typename traits::cs_tag + using type = typename traits::cs_tag < - typename geometry::coordinate_system::type - >::type type; + geometry::coordinate_system_t + >::type; }; +template +using cs_tag_t = typename cs_tag::type; + + namespace traits { @@ -287,13 +291,17 @@ namespace detail template struct cs_angular_units { - typedef typename traits::cs_angular_units + using type = typename traits::cs_angular_units < - typename geometry::coordinate_system::type - >::type type; + geometry::coordinate_system_t + >::type; }; +template +using cs_angular_units_t = typename cs_angular_units::type; + + template struct cs_tag_to_coordinate_system { @@ -332,6 +340,11 @@ struct cs_tag_to_coordinate_system typedef cs::geographic type; }; + +template +using cs_tag_to_coordinate_system_t = typename cs_tag_to_coordinate_system::type; + + } // namespace detail #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/core/exception.hpp b/include/boost/geometry/core/exception.hpp index 72bc598b..2dbd298c 100644 --- a/include/boost/geometry/core/exception.hpp +++ b/include/boost/geometry/core/exception.hpp @@ -33,7 +33,7 @@ namespace boost { namespace geometry class exception : public std::exception { public: - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry exception"; } @@ -52,7 +52,7 @@ class invalid_input_exception : public geometry::exception inline invalid_input_exception() {} - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry Invalid-Input exception"; } @@ -77,7 +77,7 @@ class empty_input_exception : public geometry::invalid_input_exception inline empty_input_exception() {} - virtual char const* what() const throw() + virtual char const* what() const noexcept { return "Boost.Geometry Empty-Input exception"; } @@ -96,7 +96,7 @@ class invalid_output_exception : public geometry::exception inline invalid_output_exception() {} - virtual char const* what() const throw() + char const* what() const noexcept override { return "Boost.Geometry Invalid-Output exception"; } diff --git a/include/boost/geometry/core/geometry_id.hpp b/include/boost/geometry/core/geometry_id.hpp index 2c68cedc..ed2a238c 100644 --- a/include/boost/geometry/core/geometry_id.hpp +++ b/include/boost/geometry/core/geometry_id.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020 Oracle and/or its affiliates. @@ -103,6 +104,12 @@ struct geometry_id : core_dispatch::geometry_id::type> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr int geometry_id_v = geometry_id::value; +#endif + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index 2fedae59..8f8cddd6 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -3,10 +3,10 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -172,13 +172,23 @@ struct point_order */ template struct point_order -{ - static const order_selector value = core_dispatch::point_order + : std::integral_constant < - typename tag::type, - typename util::remove_cptrref::type - >::value; -}; + order_selector, + core_dispatch::point_order + < + tag_t, + util::remove_cptrref_t + >::value + > +{}; + + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr order_selector point_order_v = point_order::value; +#endif + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/point_type.hpp b/include/boost/geometry/core/point_type.hpp index f5d28237..ccb259c1 100644 --- a/include/boost/geometry/core/point_type.hpp +++ b/include/boost/geometry/core/point_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2021. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates. @@ -183,14 +184,18 @@ struct point_type template struct point_type { - typedef typename core_dispatch::point_type + using type = typename core_dispatch::point_type < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; +template +using point_type_t = typename point_type::type; + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/primary_single_tag.hpp b/include/boost/geometry/core/primary_single_tag.hpp new file mode 100644 index 00000000..4fc23c6b --- /dev/null +++ b/include/boost/geometry/core/primary_single_tag.hpp @@ -0,0 +1,55 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP +#define BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP + +#include + +namespace boost { namespace geometry +{ + +/*! +\brief Metafunction defining a type being the primary tag + (point, linestring, polygon) of the tag related to its topological dimension. +\details pointlike_tag will be casted to point_tag, linear_tag to linestring_tag, + areal_tag to polygon_tag. +\ingroup core +\tparam Tag The tag to get the canonical tag from +*/ +template +struct primary_single_tag +{ + +}; + +template <> +struct primary_single_tag +{ + using type = point_tag; +}; + +template <> +struct primary_single_tag +{ + using type = linestring_tag; +}; + +template <> +struct primary_single_tag +{ + using type = polygon_tag; +}; + +template +using primary_single_tag_t = typename primary_single_tag::type; + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP diff --git a/include/boost/geometry/core/radian_access.hpp b/include/boost/geometry/core/radian_access.hpp index c2f00552..ef87701b 100644 --- a/include/boost/geometry/core/radian_access.hpp +++ b/include/boost/geometry/core/radian_access.hpp @@ -23,13 +23,12 @@ #include -#include - #include #include #include #include +#include @@ -48,7 +47,7 @@ struct degree_radian_converter static inline coordinate_type get(Geometry const& geometry) { - return boost::numeric_cast + return util::numeric_cast < coordinate_type >(geometry::get(geometry) @@ -57,7 +56,7 @@ struct degree_radian_converter static inline void set(Geometry& geometry, coordinate_type const& radians) { - geometry::set(geometry, boost::numeric_cast + geometry::set(geometry, util::numeric_cast < coordinate_type >(radians * math::r2d())); @@ -113,7 +112,7 @@ struct degree_radian_converter_box_segment static inline coordinate_type get(Geometry const& geometry) { - return boost::numeric_cast + return util::numeric_cast < coordinate_type >(geometry::get(geometry) @@ -122,7 +121,7 @@ struct degree_radian_converter_box_segment static inline void set(Geometry& geometry, coordinate_type const& radians) { - geometry::set(geometry, boost::numeric_cast + geometry::set(geometry, util::numeric_cast < coordinate_type >(radians * math::r2d())); diff --git a/include/boost/geometry/core/radius.hpp b/include/boost/geometry/core/radius.hpp index 0033c3d4..984f61a9 100644 --- a/include/boost/geometry/core/radius.hpp +++ b/include/boost/geometry/core/radius.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. @@ -23,8 +24,7 @@ #include -#include - +#include #include #include #include @@ -79,18 +79,27 @@ namespace core_dispatch template struct radius_type { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //typedef core_dispatch_specialization_required type; }; /*! \brief radius access meta-functions, used by concept n-sphere and upcoming ellipse. */ -template +template +< + typename Tag, + typename Geometry, + std::size_t Dimension, + bool IsPointer +> struct radius_access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline CoordinateType get(Geometry const& ) {} //static inline void set(Geometry& g, CoordinateType const& value) {} }; @@ -107,13 +116,18 @@ struct radius_access template struct radius_type { - typedef typename core_dispatch::radius_type - < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + using type = typename core_dispatch::radius_type + < + tag_t, + util::remove_cptrref_t + >::type; }; + +template +using radius_type_t = typename radius_type::type; + + /*! \brief Function to get radius of a circle / sphere / ellipse / etc. \return radius The radius for a given axis @@ -122,15 +136,15 @@ struct radius_type \tparam I index of the axis */ template -inline typename radius_type::type get_radius(Geometry const& geometry) +inline radius_type_t get_radius(Geometry const& geometry) { return core_dispatch::radius_access - < - typename tag::type, - typename util::remove_cptrref::type, - I, - typename std::is_pointer::type - >::get(geometry); + < + tag_t, + util::remove_cptrref_t, + I, + std::is_pointer::value + >::get(geometry); } /*! @@ -142,14 +156,14 @@ inline typename radius_type::type get_radius(Geometry const& geometry) */ template inline void set_radius(Geometry& geometry, - typename radius_type::type const& radius) + radius_type_t const& radius) { core_dispatch::radius_access < - typename tag::type, - typename util::remove_cptrref::type, + tag_t, + util::remove_cptrref_t, I, - typename std::is_pointer::type + std::is_pointer::value >::set(geometry, radius); } @@ -162,12 +176,12 @@ namespace detail template struct radius_access { - static inline typename radius_type::type get(Geometry const& geometry) + static inline radius_type_t get(Geometry const& geometry) { return traits::radius_access::get(geometry); } static inline void set(Geometry& geometry, - typename radius_type::type const& value) + radius_type_t const& value) { traits::radius_access::set(geometry, value); } @@ -181,33 +195,34 @@ struct radius_access namespace core_dispatch { -template -struct radius_access +template +< + typename Tag, + typename Geometry, + std::size_t Dimension +> +struct radius_access { - typedef typename geometry::radius_type::type radius_type; - - static inline radius_type get(const Geometry * geometry) + static inline radius_type_t get(const Geometry * geometry) { return radius_access - < - Tag, - Geometry, - Dimension, - typename std::is_pointer::type - >::get(*geometry); + < + Tag, + Geometry, + Dimension, + std::is_pointer::value + >::get(*geometry); } - static inline void set(Geometry * geometry, radius_type const& value) + static inline void set(Geometry * geometry, radius_type_t const& value) { return radius_access - < - Tag, - Geometry, - Dimension, - typename std::is_pointer::type - >::set(*geometry, value); + < + Tag, + Geometry, + Dimension, + std::is_pointer::value + >::set(*geometry, value); } }; @@ -215,11 +230,11 @@ struct radius_access template struct radius_type { - typedef typename traits::radius_type::type type; + using type = typename traits::radius_type::type; }; template -struct radius_access +struct radius_access : detail::radius_access { //BOOST_STATIC_ASSERT(Dimension == 0); @@ -229,11 +244,11 @@ struct radius_access template struct radius_type { - typedef typename traits::radius_type::type type; + using type = typename traits::radius_type::type; }; template -struct radius_access +struct radius_access : detail::radius_access { //BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2); diff --git a/include/boost/geometry/core/reverse_dispatch.hpp b/include/boost/geometry/core/reverse_dispatch.hpp index 8d43f2fb..8d27b43a 100644 --- a/include/boost/geometry/core/reverse_dispatch.hpp +++ b/include/boost/geometry/core/reverse_dispatch.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -57,8 +58,8 @@ struct reverse_dispatch : std::false_type {}; template struct reverse_dispatch : detail::reverse_dispatch < - geometry_id::type::value, - geometry_id::type::value + geometry_id::value, + geometry_id::value > {}; diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index 4aca0719..eea52ec3 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2015-2021. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. @@ -201,24 +202,30 @@ struct ring_type template struct ring_type { - typedef typename core_dispatch::ring_type + using type = typename core_dispatch::ring_type < typename tag::type, Geometry - >::type type; + >::type; }; +template +using ring_type_t = typename ring_type::type; + template struct ring_return_type { - typedef typename core_dispatch::ring_return_type + using type = typename core_dispatch::ring_return_type < typename tag::type, Geometry - >::type type; + >::type; }; +template +using ring_return_type_t = typename ring_return_type::type; + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/tag.hpp b/include/boost/geometry/core/tag.hpp index a33856e9..19674156 100644 --- a/include/boost/geometry/core/tag.hpp +++ b/include/boost/geometry/core/tag.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020 Oracle and/or its affiliates. @@ -62,12 +63,17 @@ struct tag template struct tag { - typedef typename traits::tag + using type = typename traits::tag < - typename util::remove_cptrref::type - >::type type; + util::remove_cptrref_t + >::type; }; + +template +using tag_t = typename tag::type; + + }} // namespace boost::geometry #endif // BOOST_GEOMETRY_CORE_TAG_HPP diff --git a/include/boost/geometry/core/tag_cast.hpp b/include/boost/geometry/core/tag_cast.hpp index 18c403b5..2a1eb19a 100644 --- a/include/boost/geometry/core/tag_cast.hpp +++ b/include/boost/geometry/core/tag_cast.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -41,15 +42,14 @@ namespace boost { namespace geometry template struct tag_cast { - typedef Tag type; + using type = Tag; }; #ifndef DOXYGEN_NO_SPECIALIZATIONS template struct tag_cast -{ - typedef std::conditional_t + : std::conditional < std::is_base_of::value, BaseTag, @@ -57,12 +57,15 @@ struct tag_cast < Tag, BaseTags... >::type - > type; -}; + > +{}; #endif // DOXYGEN_NO_SPECIALIZATIONS +template +using tag_cast_t = typename tag_cast::type; + }} // namespace boost::geometry #endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP diff --git a/include/boost/geometry/core/tags.hpp b/include/boost/geometry/core/tags.hpp index 6220f8f1..f0d62783 100644 --- a/include/boost/geometry/core/tags.hpp +++ b/include/boost/geometry/core/tags.hpp @@ -152,6 +152,9 @@ struct single_tag_of #endif +template +using single_tag_of_t = typename single_tag_of::type; + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/topological_dimension.hpp b/include/boost/geometry/core/topological_dimension.hpp index a4bc16eb..c1c75024 100644 --- a/include/boost/geometry/core/topological_dimension.hpp +++ b/include/boost/geometry/core/topological_dimension.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2022. // Modifications copyright (c) 2020-2022, Oracle and/or its affiliates. @@ -102,6 +103,12 @@ struct topological_dimension : core_dispatch::top_dim::type> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr int topological_dimension_v = topological_dimension::value; +#endif + + }} // namespace boost::geometry diff --git a/include/boost/geometry/formulas/andoyer_inverse.hpp b/include/boost/geometry/formulas/andoyer_inverse.hpp index 98f5dcd7..708a5743 100644 --- a/include/boost/geometry/formulas/andoyer_inverse.hpp +++ b/include/boost/geometry/formulas/andoyer_inverse.hpp @@ -1,9 +1,8 @@ // Boost.Geometry -// Copyright (c) 2018 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2018-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2015-2020 Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -18,7 +17,7 @@ #include -#include +#include #include #include @@ -98,7 +97,7 @@ class andoyer_inverse CT const d = acos(cos_d); // [0, pi] CT const sin_d = sin(d); // [-1, 1] - if ( BOOST_GEOMETRY_CONDITION(EnableDistance) ) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance) { CT const K = math::sqr(sin_lat1-sin_lat2); CT const L = math::sqr(sin_lat1+sin_lat2); @@ -123,7 +122,7 @@ class andoyer_inverse result.distance = a * (d + dd); } - if ( BOOST_GEOMETRY_CONDITION(CalcAzimuths) ) + if BOOST_GEOMETRY_CONSTEXPR (CalcAzimuths) { // sin_d = 0 <=> antipodal points (incl. poles) or very close if (math::equals(sin_d, c0)) @@ -210,14 +209,14 @@ class andoyer_inverse // therefore dA and dB may be great and the resulting azimuths // may be some more or less arbitrary angles - if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcFwdAzimuth) { CT const dA = V*T - U; result.azimuth = A - dA; normalize_azimuth(result.azimuth, A, dA); } - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { CT const dB = -U*T + V; if (B >= 0) @@ -229,7 +228,7 @@ class andoyer_inverse } } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { CT const b = CT(get_radius<2>(spheroid)); diff --git a/include/boost/geometry/formulas/area_formulas.hpp b/include/boost/geometry/formulas/area_formulas.hpp index b8da8a67..c45cd94f 100644 --- a/include/boost/geometry/formulas/area_formulas.hpp +++ b/include/boost/geometry/formulas/area_formulas.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2015-2022 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -381,26 +382,33 @@ class area_formulas return pi; } - if (BOOST_GEOMETRY_CONDITION(LongSegment) && lat1r != lat2r) // not for segments parallel to equator + if BOOST_GEOMETRY_CONSTEXPR (LongSegment) { - CT const cbet1 = cos(lat1r); - CT const sbet1 = sin(lat1r); - CT const cbet2 = cos(lat2r); - CT const sbet2 = sin(lat2r); - - CT const omg12 = lon2r - lon1r; - CT const comg12 = cos(omg12); - CT const somg12 = sin(omg12); - - CT const cbet1_sbet2 = cbet1 * sbet2; - CT const sbet1_cbet2 = sbet1 * cbet2; - CT const alp1 = atan2(cbet1_sbet2 - sbet1_cbet2 * comg12, cbet2 * somg12); - CT const alp2 = atan2(cbet1_sbet2 * comg12 - sbet1_cbet2, cbet1 * somg12); + if (lat1r != lat2r) // not for segments parallel to equator + { + CT const cbet1 = cos(lat1r); + CT const sbet1 = sin(lat1r); + CT const cbet2 = cos(lat2r); + CT const sbet2 = sin(lat2r); - excess = alp2 - alp1; + CT const omg12 = lon2r - lon1r; + CT const comg12 = cos(omg12); + CT const somg12 = sin(omg12); - } else { + CT const cbet1_sbet2 = cbet1 * sbet2; + CT const sbet1_cbet2 = sbet1 * cbet2; + CT const alp1 = atan2(cbet1_sbet2 - sbet1_cbet2 * comg12, cbet2 * somg12); + CT const alp2 = atan2(cbet1_sbet2 * comg12 - sbet1_cbet2, cbet1 * somg12); + excess = alp2 - alp1; + } + else + { + excess = trapezoidal_formula(lat1r, lat2r, lon12r); + } + } + else + { excess = trapezoidal_formula(lat1r, lat2r, lon12r); } diff --git a/include/boost/geometry/formulas/differential_quantities.hpp b/include/boost/geometry/formulas/differential_quantities.hpp index 1df9adb8..140a7386 100644 --- a/include/boost/geometry/formulas/differential_quantities.hpp +++ b/include/boost/geometry/formulas/differential_quantities.hpp @@ -14,7 +14,7 @@ #include -#include +#include #include @@ -73,7 +73,7 @@ class differential_quantities if (math::equals(sin_bet1, c0) && math::equals(sin_bet2, c0)) { CT const sig_12 = dlon / one_minus_f; - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength) { BOOST_GEOMETRY_ASSERT((-math::pi() <= azimuth && azimuth <= math::pi())); @@ -82,7 +82,7 @@ class differential_quantities reduced_length = m12; } - if (BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableGeodesicScale) { CT M12 = cos(sig_12); geodesic_scale = M12; @@ -123,7 +123,7 @@ class differential_quantities CT const dn1 = math::sqrt(c1 + ep2 * math::sqr(sin_bet1)); CT const dn2 = math::sqrt(c1 + ep2 * math::sqr(sin_bet2)); - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength) { CT const m12_b = dn2 * (cos_sig1 * sin_sig2) - dn1 * (sin_sig1 * cos_sig2) @@ -133,7 +133,7 @@ class differential_quantities reduced_length = m12; } - if (BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableGeodesicScale) { CT const cos_sig12 = cos_sig1 * cos_sig2 + sin_sig1 * sin_sig2; CT const t = ep2 * (cos_bet1 - cos_bet2) * (cos_bet1 + cos_bet2) / (dn1 + dn2); diff --git a/include/boost/geometry/formulas/karney_direct.hpp b/include/boost/geometry/formulas/karney_direct.hpp index bfe35ddc..ed365c8f 100644 --- a/include/boost/geometry/formulas/karney_direct.hpp +++ b/include/boost/geometry/formulas/karney_direct.hpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include @@ -162,7 +162,7 @@ class karney_direct CT const sin_sigma2 = sin_sigma1 * cos_sigma12 + cos_sigma1 * sin_sigma12; CT const cos_sigma2 = cos_sigma1 * cos_sigma12 - sin_sigma1 * sin_sigma12; - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { CT const sin_alpha2 = sin_alpha0; CT const cos_alpha2 = cos_alpha0 * cos_sigma2; @@ -170,7 +170,7 @@ class karney_direct result.reverse_azimuth = atan2(sin_alpha2, cos_alpha2); } - if (BOOST_GEOMETRY_CONDITION(CalcCoordinates)) + if BOOST_GEOMETRY_CONSTEXPR (CalcCoordinates) { // Find the latitude at the second point. CT const sin_beta2 = cos_alpha0 * sin_sigma2; @@ -217,7 +217,7 @@ class karney_direct result.lon2 *= math::d2r(); } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { // Evaluate the coefficients for C2. // Index zero element of coeffs_C2 is unused. diff --git a/include/boost/geometry/formulas/karney_inverse.hpp b/include/boost/geometry/formulas/karney_inverse.hpp index 47efc9ff..320984d3 100644 --- a/include/boost/geometry/formulas/karney_inverse.hpp +++ b/include/boost/geometry/formulas/karney_inverse.hpp @@ -32,10 +32,11 @@ #define BOOST_GEOMETRY_FORMULAS_KARNEY_INVERSE_HPP +#include #include #include -#include +#include #include #include #include @@ -191,7 +192,7 @@ class karney_inverse if (swap_point < 0) { lon12_sign *= -1; - swap(lat1, lat2); + boost::core::invoke_swap(lat1, lat2); } // Enforce lat1 to be <= 0. @@ -308,7 +309,7 @@ class karney_inverse sigma12 = omega12 = lam12 / one_minus_f; m12x = b * sin(sigma12); - if (BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableGeodesicScale) { result.geodesic_scale = cos(sigma12); } @@ -334,7 +335,7 @@ class karney_inverse // Short lines case (newton_start sets sin_alpha2, cos_alpha2, dnm). s12x = sigma12 * b * dnm; m12x = math::sqr(dnm) * b * sin(sigma12 / dnm); - if (BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableGeodesicScale) { result.geodesic_scale = cos(sigma12 / dnm); } @@ -370,7 +371,6 @@ class karney_inverse sin_sigma1, cos_sigma1, sin_sigma2, cos_sigma2, eps, diff_omega12, - iteration < max_iterations, dv, f, n, ep2, tiny, coeffs_C1); // Reversed test to allow escape with NaNs. @@ -391,7 +391,7 @@ class karney_inverse cos_alpha1a = cos_alpha1; } - if (iteration < max_iterations && dv > c0) + if (dv > c0) { CT diff_alpha1 = -v / dv; @@ -448,9 +448,9 @@ class karney_inverse if (swap_point < 0) { - swap(sin_alpha1, sin_alpha2); - swap(cos_alpha1, cos_alpha2); - swap(result.geodesic_scale, M21); + boost::core::invoke_swap(sin_alpha1, sin_alpha2); + boost::core::invoke_swap(cos_alpha1, cos_alpha2); + boost::core::invoke_swap(result.geodesic_scale, M21); } sin_alpha1 *= swap_point * lon12_sign; @@ -459,25 +459,25 @@ class karney_inverse sin_alpha2 *= swap_point * lon12_sign; cos_alpha2 *= swap_point * lat_sign; - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength) { result.reduced_length = m12x; } - if (BOOST_GEOMETRY_CONDITION(CalcAzimuths)) + if BOOST_GEOMETRY_CONSTEXPR (CalcAzimuths) { - if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcFwdAzimuth) { result.azimuth = atan2(sin_alpha1, cos_alpha1); } - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { result.reverse_azimuth = atan2(sin_alpha2, cos_alpha2); } } - if (BOOST_GEOMETRY_CONDITION(EnableDistance)) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance) { result.distance = s12x; } @@ -502,16 +502,13 @@ class karney_inverse // Evaluate the coefficients for C2. se::coeffs_C2 coeffs_C2(epsilon); - if (BOOST_GEOMETRY_CONDITION(EnableDistance) || - BOOST_GEOMETRY_CONDITION(EnableReducedLength) || - BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance || EnableReducedLength || EnableGeodesicScale) { // Find the coefficients for A1 by computing the // series expansion using Horner scehme. expansion_A1 = se::evaluate_A1(epsilon); - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength) || - BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength || EnableGeodesicScale) { // Find the coefficients for A2 by computing the // series expansion using Horner scehme. @@ -523,15 +520,14 @@ class karney_inverse expansion_A1 += c1; } - if (BOOST_GEOMETRY_CONDITION(EnableDistance)) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance) { CT B1 = se::sin_cos_series(sin_sigma2, cos_sigma2, coeffs_C1) - se::sin_cos_series(sin_sigma1, cos_sigma1, coeffs_C1); s12x = expansion_A1 * (sigma12 + B1); - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength) || - BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength || EnableGeodesicScale) { CT B2 = se::sin_cos_series(sin_sigma2, cos_sigma2, coeffs_C2) - se::sin_cos_series(sin_sigma1, cos_sigma1, coeffs_C2); @@ -539,8 +535,7 @@ class karney_inverse J12 = A12x * sigma12 + (expansion_A1 * B1 - expansion_A2 * B2); } } - else if (BOOST_GEOMETRY_CONDITION(EnableReducedLength) || - BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + else if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength || EnableGeodesicScale) { for (size_t i = 1; i <= SeriesOrder; ++i) { @@ -553,7 +548,7 @@ class karney_inverse - se::sin_cos_series(sin_sigma1, cos_sigma1, coeffs_C2)); } - if (BOOST_GEOMETRY_CONDITION(EnableReducedLength)) + if BOOST_GEOMETRY_CONSTEXPR (EnableReducedLength) { m0 = A12x; @@ -562,7 +557,7 @@ class karney_inverse cos_sigma1 * cos_sigma2 * J12; } - if (BOOST_GEOMETRY_CONDITION(EnableGeodesicScale)) + if BOOST_GEOMETRY_CONSTEXPR (EnableGeodesicScale) { CT cos_sigma12 = cos_sigma1 * cos_sigma2 + sin_sigma1 * sin_sigma2; CT t = ep2 * (cos_beta1 - cos_beta2) * @@ -847,7 +842,7 @@ class karney_inverse CT& sin_sigma1, CT& cos_sigma1, CT& sin_sigma2, CT& cos_sigma2, CT& eps, CT& diff_omega12, - bool diffp, CT& diff_lam12, + CT& diff_lam12, CT const& f, CT const& n, CT const& ep2, CT const& tiny, CoeffsC1 const& coeffs_C1) { @@ -933,24 +928,22 @@ class karney_inverse diff_omega12 = -f * A3 * sin_alpha0 * (sigma12 + B312); lam12 = eta + diff_omega12; - if (diffp) + if (cos_alpha2 == c0) { - if (cos_alpha2 == c0) - { - diff_lam12 = - c2 * one_minus_f * dn1 / sin_beta1; - } - else - { - CT dummy; - meridian_length(eps, ep2, sigma12, sin_sigma1, cos_sigma1, dn1, - sin_sigma2, cos_sigma2, dn2, - cos_beta1, cos_beta2, dummy, - diff_lam12, dummy, dummy, - dummy, coeffs_C1); + diff_lam12 = - c2 * one_minus_f * dn1 / sin_beta1; + } + else + { + CT dummy; + meridian_length(eps, ep2, sigma12, sin_sigma1, cos_sigma1, dn1, + sin_sigma2, cos_sigma2, dn2, + cos_beta1, cos_beta2, dummy, + diff_lam12, dummy, dummy, + dummy, coeffs_C1); - diff_lam12 *= one_minus_f / (cos_alpha2 * cos_beta2); - } + diff_lam12 *= one_minus_f / (cos_alpha2 * cos_beta2); } + return lam12; } diff --git a/include/boost/geometry/formulas/thomas_direct.hpp b/include/boost/geometry/formulas/thomas_direct.hpp index 58890566..c39c3751 100644 --- a/include/boost/geometry/formulas/thomas_direct.hpp +++ b/include/boost/geometry/formulas/thomas_direct.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2016-2020 Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2016-2020 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -18,7 +19,7 @@ #include #include -#include +#include #include #include @@ -108,7 +109,7 @@ class thomas_direct CT const C2 = f * (c1 - math::sqr(M)) / c4; // lower-case c2 in the technical report CT D = 0; CT P = 0; - if ( BOOST_GEOMETRY_CONDITION(SecondOrder) ) + if BOOST_GEOMETRY_CONSTEXPR (SecondOrder) { D = (c1 - C2) * (c1 - C2 - C1 * M); P = C2 * (c1 + C1 * M / c2) / D; @@ -142,7 +143,7 @@ class thomas_direct CT const Y = c2 * P * V * W * sin_d; CT X = 0; CT d_sigma = d - Y; - if ( BOOST_GEOMETRY_CONDITION(SecondOrder) ) + if BOOST_GEOMETRY_CONSTEXPR (SecondOrder) { X = math::sqr(C2) * sin_d * cos_d * (2 * math::sqr(V) - c1); d_sigma += X; @@ -150,7 +151,7 @@ class thomas_direct CT const sin_d_sigma = sin(d_sigma); CT const cos_d_sigma = cos(d_sigma); - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { result.reverse_azimuth = atan2(M, N * cos_d_sigma - sin_theta1 * sin_d_sigma); @@ -160,12 +161,12 @@ class thomas_direct } } - if (BOOST_GEOMETRY_CONDITION(CalcCoordinates)) + if BOOST_GEOMETRY_CONSTEXPR (CalcCoordinates) { CT const S_sigma = c2 * sigma1 - d_sigma; CT cos_S_sigma = 0; CT H = C1 * d_sigma; - if ( BOOST_GEOMETRY_CONDITION(SecondOrder) ) + if BOOST_GEOMETRY_CONSTEXPR (SecondOrder) { cos_S_sigma = cos(S_sigma); H = H * (c1 - C2) - C1 * C2 * sin_d_sigma * cos_S_sigma; @@ -196,7 +197,7 @@ class thomas_direct } } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { typedef differential_quantities quantities; quantities::apply(lon1, lat1, result.lon2, result.lat2, @@ -205,7 +206,7 @@ class thomas_direct result.reduced_length, result.geodesic_scale); } - if (BOOST_GEOMETRY_CONDITION(CalcCoordinates)) + if BOOST_GEOMETRY_CONSTEXPR (CalcCoordinates) { // For longitudes close to the antimeridian the result can be out // of range. Therefore normalize. diff --git a/include/boost/geometry/formulas/thomas_inverse.hpp b/include/boost/geometry/formulas/thomas_inverse.hpp index c93aaf83..5a6236d5 100644 --- a/include/boost/geometry/formulas/thomas_inverse.hpp +++ b/include/boost/geometry/formulas/thomas_inverse.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2015-2018 Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2015-2018 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -17,7 +18,7 @@ #include -#include +#include #include #include @@ -137,7 +138,7 @@ class thomas_inverse CT const f_sqr = math::sqr(f); CT const f_sqr_per_64 = f_sqr / CT(64); - if ( BOOST_GEOMETRY_CONDITION(EnableDistance) ) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance) { CT const n1 = X * (A + C*X); CT const n2 = Y * (B + E*Y); @@ -152,7 +153,7 @@ class thomas_inverse result.distance = a * sin_d * (T - delta1d + delta2d); } - if ( BOOST_GEOMETRY_CONDITION(CalcAzimuths) ) + if BOOST_GEOMETRY_CONSTEXPR (CalcAzimuths) { // NOTE: if both cos_latX == 0 then below we'd have 0 * INF // it's a situation when the endpoints are on the poles +-90 deg @@ -178,7 +179,7 @@ class thomas_inverse CT const pi = math::pi(); - if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcFwdAzimuth) { CT alpha1 = v + u; if (alpha1 > pi) @@ -189,7 +190,7 @@ class thomas_inverse result.azimuth = alpha1; } - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { CT alpha2 = pi - (v - u); if (alpha2 > pi) @@ -201,7 +202,7 @@ class thomas_inverse } } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { typedef differential_quantities quantities; quantities::apply(lon1, lat1, lon2, lat2, diff --git a/include/boost/geometry/formulas/vincenty_direct.hpp b/include/boost/geometry/formulas/vincenty_direct.hpp index 274af3f2..2692266a 100644 --- a/include/boost/geometry/formulas/vincenty_direct.hpp +++ b/include/boost/geometry/formulas/vincenty_direct.hpp @@ -1,10 +1,10 @@ // Boost.Geometry // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -19,7 +19,7 @@ #include -#include +#include #include #include @@ -136,7 +136,7 @@ class vincenty_direct //&& geometry::math::abs(sigma) < pi && counter < BOOST_GEOMETRY_DETAIL_VINCENTY_MAX_STEPS ); // robustness - if (BOOST_GEOMETRY_CONDITION(CalcCoordinates)) + if BOOST_GEOMETRY_CONSTEXPR (CalcCoordinates) { result.lat2 = atan2( sin_U1 * cos_sigma + cos_U1 * sin_sigma * cos_azimuth12, @@ -151,13 +151,13 @@ class vincenty_direct result.lon2 = lon1 + L; } - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { result.reverse_azimuth = atan2(sin_alpha, -sin_U1 * sin_sigma + cos_U1 * cos_sigma * cos_azimuth12); // (12) } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { typedef differential_quantities quantities; quantities::apply(lon1, lat1, result.lon2, result.lat2, @@ -166,7 +166,7 @@ class vincenty_direct result.reduced_length, result.geodesic_scale); } - if (BOOST_GEOMETRY_CONDITION(CalcCoordinates)) + if BOOST_GEOMETRY_CONSTEXPR (CalcCoordinates) { // For longitudes close to the antimeridian the result can be out // of range. Therefore normalize. diff --git a/include/boost/geometry/formulas/vincenty_inverse.hpp b/include/boost/geometry/formulas/vincenty_inverse.hpp index 24f285d9..7789e17e 100644 --- a/include/boost/geometry/formulas/vincenty_inverse.hpp +++ b/include/boost/geometry/formulas/vincenty_inverse.hpp @@ -1,11 +1,10 @@ // Boost.Geometry // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2018 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2018-2023 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014, 2016, 2017. // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -20,7 +19,7 @@ #include -#include +#include #include #include @@ -160,7 +159,7 @@ struct vincenty_inverse && geometry::math::abs(lambda) < pi && counter < BOOST_GEOMETRY_DETAIL_VINCENTY_MAX_STEPS ); // robustness - if ( BOOST_GEOMETRY_CONDITION(EnableDistance) ) + if BOOST_GEOMETRY_CONSTEXPR (EnableDistance) { // Some types cannot divide by doubles CT const c6 = 6; @@ -188,20 +187,20 @@ struct vincenty_inverse result.distance = radius_b * A * (sigma - delta_sigma); // (19) } - if ( BOOST_GEOMETRY_CONDITION(CalcAzimuths) ) + if BOOST_GEOMETRY_CONSTEXPR (CalcAzimuths) { - if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcFwdAzimuth) { result.azimuth = atan2(cos_U2 * sin_lambda, cos_U1 * sin_U2 - sin_U1 * cos_U2 * cos_lambda); // (20) } - if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth)) + if BOOST_GEOMETRY_CONSTEXPR (CalcRevAzimuth) { result.reverse_azimuth = atan2(cos_U1 * sin_lambda, -sin_U1 * cos_U2 + cos_U1 * sin_U2 * cos_lambda); // (21) } } - if (BOOST_GEOMETRY_CONDITION(CalcQuantities)) + if BOOST_GEOMETRY_CONSTEXPR (CalcQuantities) { typedef differential_quantities quantities; quantities::apply(lon1, lat1, lon2, lat2, diff --git a/include/boost/geometry/geometries/concepts/box_concept.hpp b/include/boost/geometry/geometries/concepts/box_concept.hpp index c96d39f6..491446a2 100644 --- a/include/boost/geometry/geometries/concepts/box_concept.hpp +++ b/include/boost/geometry/geometries/concepts/box_concept.hpp @@ -34,8 +34,7 @@ template class Box { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; - + using point_type = point_type_t; template < @@ -80,8 +79,8 @@ template class ConstBox { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; - typedef typename coordinate_type::type coordinate_type; + using point_type = point_type_t; + using coordinate_type = coordinate_type_t; template < diff --git a/include/boost/geometry/geometries/concepts/linestring_concept.hpp b/include/boost/geometry/geometries/concepts/linestring_concept.hpp index 49dc8b22..7a322aa5 100644 --- a/include/boost/geometry/geometries/concepts/linestring_concept.hpp +++ b/include/boost/geometry/geometries/concepts/linestring_concept.hpp @@ -39,7 +39,7 @@ template class Linestring { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; + using point_type = point_type_t; BOOST_CONCEPT_ASSERT( (concepts::Point) ); BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); @@ -68,7 +68,7 @@ template class ConstLinestring { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; + using point_type = point_type_t; BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); diff --git a/include/boost/geometry/geometries/concepts/polygon_concept.hpp b/include/boost/geometry/geometries/concepts/polygon_concept.hpp index 7488ab3d..17eeae89 100644 --- a/include/boost/geometry/geometries/concepts/polygon_concept.hpp +++ b/include/boost/geometry/geometries/concepts/polygon_concept.hpp @@ -53,8 +53,8 @@ class Polygon typedef typename traits::interior_const_type::type interior_const_type; typedef typename traits::interior_mutable_type::type interior_mutable_type; - typedef typename point_type::type point_type; - typedef typename ring_type::type ring_type; + using point_type = point_type_t; + using ring_type = ring_type_t; BOOST_CONCEPT_ASSERT( (concepts::Point) ); BOOST_CONCEPT_ASSERT( (concepts::Ring) ); @@ -102,8 +102,8 @@ class ConstPolygon typedef typename traits::ring_const_type::type ring_const_type; typedef typename traits::interior_const_type::type interior_const_type; - typedef typename point_type::type point_type; - typedef typename ring_type::type ring_type; + using point_type = point_type_t; + using ring_type = ring_type_t; BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); BOOST_CONCEPT_ASSERT( (concepts::ConstRing) ); diff --git a/include/boost/geometry/geometries/concepts/ring_concept.hpp b/include/boost/geometry/geometries/concepts/ring_concept.hpp index b4cf961a..ba2cc4ea 100644 --- a/include/boost/geometry/geometries/concepts/ring_concept.hpp +++ b/include/boost/geometry/geometries/concepts/ring_concept.hpp @@ -38,7 +38,7 @@ template class Ring { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; + using point_type = point_type_t; BOOST_CONCEPT_ASSERT( (concepts::Point) ); BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); @@ -67,7 +67,7 @@ template class ConstRing { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; + using point_type = point_type_t; BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); diff --git a/include/boost/geometry/geometries/concepts/segment_concept.hpp b/include/boost/geometry/geometries/concepts/segment_concept.hpp index 7dac9e3e..c2bc332f 100644 --- a/include/boost/geometry/geometries/concepts/segment_concept.hpp +++ b/include/boost/geometry/geometries/concepts/segment_concept.hpp @@ -36,7 +36,7 @@ template class Segment { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; + using point_type = point_type_t; BOOST_CONCEPT_ASSERT( (concepts::Point) ); @@ -80,8 +80,8 @@ template class ConstSegment { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename point_type::type point_type; - typedef typename coordinate_type::type coordinate_type; + using point_type = point_type_t; + using coordinate_type = coordinate_type_t; BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); diff --git a/include/boost/geometry/geometries/helper_geometry.hpp b/include/boost/geometry/geometries/helper_geometry.hpp index 881f143d..6cade972 100644 --- a/include/boost/geometry/geometries/helper_geometry.hpp +++ b/include/boost/geometry/geometries/helper_geometry.hpp @@ -40,7 +40,7 @@ template typename Point, typename NewCoordinateType, typename NewUnits, - typename CS_Tag = typename cs_tag::type + typename CS_Tag = cs_tag_t > struct helper_point { @@ -87,7 +87,7 @@ struct helper_geometry < typename helper_geometry < - typename point_type::type, NewCoordinateType, NewUnits + point_type_t, NewCoordinateType, NewUnits >::type >; }; @@ -100,7 +100,7 @@ struct helper_geometry < typename helper_geometry < - typename point_type::type, NewCoordinateType, NewUnits + point_type_t, NewCoordinateType, NewUnits >::type >; }; @@ -112,7 +112,7 @@ struct helper_geometry < typename helper_geometry < - typename point_type::type, NewCoordinateType, NewUnits + point_type_t, NewCoordinateType, NewUnits >::type, point_order::value != counterclockwise, closure::value != open diff --git a/include/boost/geometry/index/detail/algorithms/bounds.hpp b/include/boost/geometry/index/detail/algorithms/bounds.hpp index 999246d9..61650445 100644 --- a/include/boost/geometry/index/detail/algorithms/bounds.hpp +++ b/include/boost/geometry/index/detail/algorithms/bounds.hpp @@ -186,9 +186,9 @@ struct covered_by_bounds { static inline bool apply(Geometry const& g, Bounds & b) { - typedef typename point_type::type point_type; - typedef geometry::model::box bounds_type; - typedef index::detail::bounded_view view_type; + using point_type = point_type_t; + using bounds_type = geometry::model::box; + using view_type = index::detail::bounded_view; return geometry::covered_by(view_type(g, default_strategy()), b); } @@ -196,9 +196,9 @@ struct covered_by_bounds template static inline bool apply(Geometry const& g, Bounds & b, Strategy const& strategy) { - typedef typename point_type::type point_type; - typedef geometry::model::box bounds_type; - typedef index::detail::bounded_view view_type; + using point_type = point_type_t; + using bounds_type = geometry::model::box; + using view_type = index::detail::bounded_view; return geometry::covered_by(view_type(g, strategy), b, strategy); } diff --git a/include/boost/geometry/index/detail/algorithms/intersection_content.hpp b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp index 1a2cd28b..45e22f4b 100644 --- a/include/boost/geometry/index/detail/algorithms/intersection_content.hpp +++ b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp @@ -4,8 +4,9 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2021. -// Modifications copyright (c) 2019-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2024. +// Modifications copyright (c) 2019-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // // Use, modification and distribution is subject to the Boost Software License, @@ -16,7 +17,7 @@ #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP #include -#include +#include #include @@ -57,7 +58,7 @@ inline typename default_content_result::type intersection_content(Box const bool const ok = geometry::detail::intersection::intersection_box_box < 0, geometry::dimension::value - >::apply(box1, box2, 0, box_intersection, 0); + >::apply(box1, box2, box_intersection, 0); if ( ok ) { return index::detail::content(box_intersection); diff --git a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp index 831efe50..5cf93669 100644 --- a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp +++ b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp @@ -27,6 +27,10 @@ #include #include +#include +#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -48,12 +52,11 @@ struct path_intersection template struct path_intersection { - typedef typename default_distance_result::type>::type comparable_distance_type; + using comparable_distance_type = typename default_distance_result>::type; static inline bool apply(Indexable const& b, Segment const& segment, comparable_distance_type & comparable_distance) { - typedef typename point_type::type point_type; - point_type p1, p2; + point_type_t p1, p2; geometry::detail::assign_point_from_index<0>(segment, p1); geometry::detail::assign_point_from_index<1>(segment, p2); return index::detail::segment_intersection(b, p1, p2, comparable_distance); @@ -63,7 +66,7 @@ struct path_intersection template struct path_intersection { - typedef typename default_length_result::type comparable_distance_type; + using comparable_distance_type = typename default_length_result::type; static inline bool apply(Indexable const& b, Linestring const& path, comparable_distance_type & comparable_distance) { diff --git a/include/boost/geometry/index/detail/bounded_view.hpp b/include/boost/geometry/index/detail/bounded_view.hpp index b3776416..1ba9f37f 100644 --- a/include/boost/geometry/index/detail/bounded_view.hpp +++ b/include/boost/geometry/index/detail/bounded_view.hpp @@ -241,7 +241,7 @@ struct tag< index::detail::bounded_view > template struct point_type< index::detail::bounded_view > { - typedef typename point_type::type type; + using type = point_type_t; }; template diff --git a/include/boost/geometry/index/detail/rtree/node/node.hpp b/include/boost/geometry/index/detail/rtree/node/node.hpp index fba76efb..621b602c 100644 --- a/include/boost/geometry/index/detail/rtree/node/node.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node.hpp @@ -21,6 +21,8 @@ #include +#include + #include #include @@ -36,14 +38,14 @@ #include #include -#include - #include #include #include #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -92,11 +94,10 @@ inline Box values_box(FwdIter first, FwdIter last, Translator const& tr, Box result = elements_box(first, last, tr, strategy); #ifdef BOOST_GEOMETRY_INDEX_EXPERIMENTAL_ENLARGE_BY_EPSILON - if (BOOST_GEOMETRY_CONDITION(( - ! is_bounding_geometry - < - typename indexable_type::type - >::value))) + if BOOST_GEOMETRY_CONSTEXPR (! index::detail::is_bounding_geometry + < + typename indexable_type::type + >::value) { geometry::detail::expand_by_epsilon(result); } diff --git a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp index c545a416..ba0fd7c9 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp @@ -16,8 +16,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP +#include #include #include +#include #include #include #include @@ -184,7 +186,7 @@ class allocators void swap(allocators & a) { - boost::swap(node_allocator(), a.node_allocator()); + boost::core::invoke_swap(node_allocator(), a.node_allocator()); } bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } diff --git a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp index c1612b98..e0150a70 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp @@ -15,6 +15,12 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP +#include +#include +#include +#include +#include + #include #include @@ -146,7 +152,7 @@ class allocators void swap(allocators & a) { - boost::swap(node_allocator(), a.node_allocator()); + boost::core::invoke_swap(node_allocator(), a.node_allocator()); } bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } diff --git a/include/boost/geometry/index/detail/rtree/pack_create.hpp b/include/boost/geometry/index/detail/rtree/pack_create.hpp index 33600a4c..dab7cfdb 100644 --- a/include/boost/geometry/index/detail/rtree/pack_create.hpp +++ b/include/boost/geometry/index/detail/rtree/pack_create.hpp @@ -31,6 +31,8 @@ #include #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace pack_utils { @@ -343,11 +345,10 @@ class pack // NOTE: this is done only if the Indexable is a different kind of Geometry // than the bounds (only Box for now). Spatial predicates are checked // the same way for Geometry of the same kind. - if ( BOOST_GEOMETRY_CONDITION(( - ! index::detail::is_bounding_geometry - < - typename indexable_type::type - >::value )) ) + if BOOST_GEOMETRY_CONSTEXPR (! index::detail::is_bounding_geometry + < + typename indexable_type::type + >::value) { elements_box.expand_by_epsilon(); } diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 2d87e21a..27e62584 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -30,7 +30,7 @@ #include #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -328,12 +328,11 @@ class insert // Enlarge it in case if it's not bounding geometry type. // It's because Points and Segments are compared WRT machine epsilon // This ensures that leafs bounds correspond to the stored elements - if (BOOST_GEOMETRY_CONDITION(( - std::is_same::value - && ! index::detail::is_bounding_geometry - < - typename indexable_type::type - >::value )) ) + if BOOST_GEOMETRY_CONSTEXPR ((std::is_same::value) + && ! index::detail::is_bounding_geometry + < + typename indexable_type::type + >::value) { geometry::detail::expand_by_epsilon(m_element_bounds); } @@ -425,16 +424,16 @@ class insert // Enlarge bounds of a leaf node. // It's because Points and Segments are compared WRT machine epsilon // This ensures that leafs' bounds correspond to the stored elements. - if (BOOST_GEOMETRY_CONDITION(( - std::is_same::value - && ! index::detail::is_bounding_geometry - < - typename indexable_type::type - >::value ))) + if BOOST_GEOMETRY_CONSTEXPR ((std::is_same::value) + && ! index::detail::is_bounding_geometry + < + typename indexable_type::type + >::value) { geometry::detail::expand_by_epsilon(n_box); geometry::detail::expand_by_epsilon(additional_nodes[0].first); } + #endif // node is not the root - just add the new node diff --git a/include/boost/geometry/index/detail/utilities.hpp b/include/boost/geometry/index/detail/utilities.hpp index 9060071b..afe12290 100644 --- a/include/boost/geometry/index/detail/utilities.hpp +++ b/include/boost/geometry/index/detail/utilities.hpp @@ -12,7 +12,7 @@ #include -#include +#include #ifndef BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP @@ -40,7 +40,7 @@ static inline void move_cond(T &, T &, std::false_type) {} template inline void swap_cond(T & l, T & r, std::true_type) { - ::boost::swap(l, r); + ::boost::core::invoke_swap(l, r); } template inline diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index 9911520b..4d010cb8 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -21,7 +21,6 @@ #include #include #include -#include #include // TODO - use std::reverse_iterator and std::iterator_traits @@ -1566,7 +1565,6 @@ class varray { //std::iter_swap(first_sm, first_la); //std::swap(*first_sm, *first_la); // may throw - //boost::swap(*first_sm, *first_la); value_type temp(std::move(*first_sm)); // may throw *first_sm = std::move(*first_la); // may throw *first_la = std::move(temp); // may throw diff --git a/include/boost/geometry/index/equal_to.hpp b/include/boost/geometry/index/equal_to.hpp index 0a360ba3..85fa7e5a 100644 --- a/include/boost/geometry/index/equal_to.hpp +++ b/include/boost/geometry/index/equal_to.hpp @@ -159,6 +159,7 @@ struct equal_to \param l First value. \param r Second value. + \param strategy Strategy to be used. \return true if values are equal. */ template @@ -188,6 +189,7 @@ struct equal_to, false> \param l First value. \param r Second value. + \param strategy Strategy to be used. \return true if values are equal. */ template @@ -219,6 +221,7 @@ struct equal_to, false> \param l First value. \param r Second value. + \param strategy Strategy to be used. \return true if values are equal. */ template @@ -278,6 +281,7 @@ struct equal_to, false> \param l First value. \param r Second value. + \param strategy Strategy to be used. \return true if values are equal. */ template diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 425dae96..584a7762 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -24,6 +24,7 @@ // Boost #include #include +#include // Boost.Geometry #include @@ -657,9 +658,9 @@ class rtree src.m_members.parameters(), std::move(src.m_members.allocators())) { - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); } /*! @@ -683,9 +684,9 @@ class rtree { if ( src.m_members.allocators() == allocator ) { - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); } else { @@ -758,9 +759,9 @@ class rtree m_members.equal_to() = src.m_members.equal_to(); m_members.parameters() = src.m_members.parameters(); - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++ // (allocators stored as base classes of members_holder) @@ -795,9 +796,9 @@ class rtree */ void swap(rtree & other) { - boost::swap(m_members.indexable_getter(), other.m_members.indexable_getter()); - boost::swap(m_members.equal_to(), other.m_members.equal_to()); - boost::swap(m_members.parameters(), other.m_members.parameters()); + boost::core::invoke_swap(m_members.indexable_getter(), other.m_members.indexable_getter()); + boost::core::invoke_swap(m_members.equal_to(), other.m_members.equal_to()); + boost::core::invoke_swap(m_members.parameters(), other.m_members.parameters()); // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++ // (allocators stored as base classes of members_holder) @@ -808,9 +809,9 @@ class rtree > propagate; detail::swap_cond(m_members.allocators(), other.m_members.allocators(), propagate()); - boost::swap(m_members.values_count, other.m_members.values_count); - boost::swap(m_members.leafs_level, other.m_members.leafs_level); - boost::swap(m_members.root, other.m_members.root); + boost::core::invoke_swap(m_members.values_count, other.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, other.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, other.m_members.root); } /*! diff --git a/include/boost/geometry/io/dsv/write.hpp b/include/boost/geometry/io/dsv/write.hpp index 5870d21c..e73cdfb8 100644 --- a/include/boost/geometry/io/dsv/write.hpp +++ b/include/boost/geometry/io/dsv/write.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -225,7 +226,7 @@ struct dsv_poly template struct dsv_per_index { - typedef typename point_type::type point_type; + using type = point_type_t; template static inline void apply(std::basic_ostream& os, @@ -244,7 +245,7 @@ struct dsv_per_index template struct dsv_indexed { - typedef typename point_type::type point_type; + using type = point_type_t; template static inline void apply(std::basic_ostream& os, @@ -325,11 +326,11 @@ class dsv_manipulator { dispatch::dsv < - typename tag_cast + tag_cast_t < - typename tag::type, + tag_t, multi_tag - >::type, + >, Geometry >::apply(os, m.m_geometry, m.m_settings); os.flush(); diff --git a/include/boost/geometry/io/svg/svg_mapper.hpp b/include/boost/geometry/io/svg/svg_mapper.hpp index 76be933c..a81e874e 100644 --- a/include/boost/geometry/io/svg/svg_mapper.hpp +++ b/include/boost/geometry/io/svg/svg_mapper.hpp @@ -186,11 +186,7 @@ struct devarianted_svg_map { svg_map < - typename tag_cast - < - typename tag::type, - multi_tag - >::type, + tag_cast_t, multi_tag>, typename std::remove_const::type, SvgPoint >::apply(stream, style, size, geometry, strategy); @@ -456,7 +452,7 @@ public : << " x=\"" << get<0>(map_point) + offset_x << "\"" << " y=\"" << get<1>(map_point) + offset_y << "\"" << ">"; - if (s.find("\n") == std::string::npos) + if (s.find('\n') == std::string::npos) { m_stream << s; } diff --git a/include/boost/geometry/io/wkt/read.hpp b/include/boost/geometry/io/wkt/read.hpp index a8d0f6a4..1cc294ac 100644 --- a/include/boost/geometry/io/wkt/read.hpp +++ b/include/boost/geometry/io/wkt/read.hpp @@ -96,9 +96,7 @@ struct read_wkt_exception : public geometry::exception complete = message + "' in (" + wkt.substr(0, 100) + ")"; } - virtual ~read_wkt_exception() throw() {} - - virtual const char* what() const throw() + const char* what() const noexcept override { return complete.c_str(); } @@ -788,7 +786,7 @@ struct box_parser BOOST_THROW_EXCEPTION(read_wkt_exception("Should start with 'POLYGON' or 'BOX'", wkt)); } - using point_type = typename point_type::type; + using point_type = point_type_t; std::vector points; container_inserter::apply(it, end, wkt, std::back_inserter(points)); @@ -857,7 +855,7 @@ struct segment_parser BOOST_THROW_EXCEPTION(read_wkt_exception("Should start with 'LINESTRING' or 'SEGMENT'", wkt)); } - using point_type = typename point_type::type; + using point_type = point_type_t; std::vector points; container_inserter::apply(it, end, wkt, std::back_inserter(points)); @@ -1190,10 +1188,10 @@ struct read_wkt #endif // DOXYGEN_NO_DISPATCH /*! -\brief Parses OGC Well-Known Text (\ref WKT) into a geometry (any geometry) +\brief Parses OGC \well_known_text (\wkt) into a geometry (any geometry) \ingroup wkt \tparam Geometry \tparam_geometry -\param wkt string containing \ref WKT +\param wkt string containing \wkt \param geometry \param_geometry output geometry \ingroup wkt \qbk{[include reference/io/read_wkt.qbk]} @@ -1206,10 +1204,10 @@ inline void read_wkt(std::string const& wkt, Geometry& geometry) } /*! -\brief Parses OGC Well-Known Text (\ref WKT) into a geometry (any geometry) and returns it +\brief Parses OGC \well_known_text (\wkt) into a geometry (any geometry) and returns it \ingroup wkt \tparam Geometry \tparam_geometry -\param wkt string containing \ref WKT +\param wkt string containing \wkt \ingroup wkt \qbk{[include reference/io/from_wkt.qbk]} */ diff --git a/include/boost/geometry/io/wkt/write.hpp b/include/boost/geometry/io/wkt/write.hpp index 90f69a54..4b776e02 100644 --- a/include/boost/geometry/io/wkt/write.hpp +++ b/include/boost/geometry/io/wkt/write.hpp @@ -87,7 +87,7 @@ struct stream_coordinate }; /*! -\brief Stream points as \ref WKT +\brief Stream points as \wkt */ template struct wkt_point @@ -254,7 +254,7 @@ struct wkt_multi template struct wkt_box { - using point_type = typename point_type::type; + using point_type = point_type_t; template static inline void apply(std::basic_ostream& os, @@ -298,7 +298,7 @@ struct wkt_box template struct wkt_segment { - using point_type = typename point_type::type; + using point_type = point_type_t; template static inline void apply(std::basic_ostream& os, @@ -510,7 +510,7 @@ struct wkt /*! \brief Generic geometry template manipulator class, takes corresponding output class from traits class \ingroup wkt -\details Stream manipulator, streams geometry classes as \ref WKT streams +\details Stream manipulator, streams geometry classes as \wkt streams \par Example: Small example showing how to use the wkt class \dontinclude doxygen_1.cpp @@ -567,7 +567,6 @@ inline wkt_manipulator wkt(Geometry const& geometry) \brief WKT-string formulating function \tparam Geometry \tparam_geometry \param geometry \param_geometry -\param significant_digits Specifies the no of significant digits to use in the output wkt \ingroup wkt \qbk{[include reference/io/to_wkt.qbk]} */ @@ -579,6 +578,14 @@ inline std::string to_wkt(Geometry const& geometry) return ss.str(); } +/*! +\brief WKT-string formulating function (with significant digits) +\tparam Geometry \tparam_geometry +\param geometry \param_geometry +\param significant_digits Specifies the number of significant digits to use in the output wkt +\ingroup wkt +\qbk{distinguish, with significant digits} +*/ template inline std::string to_wkt(Geometry const& geometry, int significant_digits) { diff --git a/include/boost/geometry/policies/is_valid/failing_reason_policy.hpp b/include/boost/geometry/policies/is_valid/failing_reason_policy.hpp index 701e72c2..89292a47 100644 --- a/include/boost/geometry/policies/is_valid/failing_reason_policy.hpp +++ b/include/boost/geometry/policies/is_valid/failing_reason_policy.hpp @@ -181,12 +181,11 @@ class failing_reason_policy static inline void apply(std::ostringstream& oss, Point const& point) { - if BOOST_GEOMETRY_CONSTEXPR (AllowDuplicates) + if BOOST_GEOMETRY_CONSTEXPR (! AllowDuplicates) { - return; + oss << ". Duplicate points were found near point " + << geometry::dsv(point); } - oss << ". Duplicate points were found near point " - << geometry::dsv(point); } }; diff --git a/include/boost/geometry/policies/relate/direction.hpp b/include/boost/geometry/policies/relate/direction.hpp index 2c903bd7..11c18d6e 100644 --- a/include/boost/geometry/policies/relate/direction.hpp +++ b/include/boost/geometry/policies/relate/direction.hpp @@ -163,6 +163,14 @@ struct segments_direction ; } + template + static inline return_type segments_share_common_point(side_info const& sides, + SegmentIntersectionInfo const& , + Point const&) + { + return segments_crosses(sides, sides, sides, sides); + } + template static inline int arrival_value(Ratio const& r_from, Ratio const& r_to) { diff --git a/include/boost/geometry/policies/relate/intersection_points.hpp b/include/boost/geometry/policies/relate/intersection_points.hpp index 1d7671dd..1b11c59f 100644 --- a/include/boost/geometry/policies/relate/intersection_points.hpp +++ b/include/boost/geometry/policies/relate/intersection_points.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -61,6 +62,21 @@ struct segments_intersection_points return result; } + template + static inline return_type + segments_share_common_point(side_info const&, SegmentIntersectionInfo const& sinfo, + Point const& p) + { + return_type result; + result.count = 1; + boost::geometry::assign(result.intersections[0], p); + + // Temporary - this should go later + result.fractions[0].assign(sinfo); + + return result; + } + template static inline return_type segments_collinear( Segment1 const& a, Segment2 const& b, bool /*opposite*/, diff --git a/include/boost/geometry/policies/relate/intersection_policy.hpp b/include/boost/geometry/policies/relate/intersection_policy.hpp index 6afffc20..6a573f9f 100644 --- a/include/boost/geometry/policies/relate/intersection_policy.hpp +++ b/include/boost/geometry/policies/relate/intersection_policy.hpp @@ -67,6 +67,19 @@ struct segments_intersection_policy ); } + template + static inline return_type + segments_share_common_point(side_info const& sides, + SegmentIntersectionInfo const& sinfo, + Point const& p) + { + return return_type + ( + pts_policy::segments_share_common_point(sides, sinfo, p), + dir_policy::segments_share_common_point(sides, sinfo, p) + ); + } + template static inline return_type segments_collinear( Segment1 const& segment1, diff --git a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp deleted file mode 100644 index 5e1dd5e4..00000000 --- a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp +++ /dev/null @@ -1,415 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2014-2015 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2014-2015 Bruno Lalande, Paris, France. -// Copyright (c) 2014-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2015-2020. -// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. - -// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP - - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// TEMP -#include -#include -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace get_rescale_policy -{ - -template -< - typename Box, - typename Point, - typename RobustPoint, - typename Factor -> -inline void scale_box_to_integer_range(Box const& box, - Point& min_point, - RobustPoint& min_robust_point, - Factor& factor) -{ - // Scale box to integer-range - typedef typename promote_floating_point - < - typename geometry::coordinate_type::type - >::type num_type; - num_type const diff = boost::numeric_cast(detail::get_max_size(box)); - num_type const range = 10000000.0; // Define a large range to get precise integer coordinates - num_type const half = 0.5; - if (math::equals(diff, num_type()) - || diff >= range - || ! boost::math::isfinite(diff)) - { - factor = 1; - } - else - { - factor = boost::numeric_cast( - boost::numeric_cast(half + range / diff)); - BOOST_GEOMETRY_ASSERT(factor >= 1); - } - - // Assign input/output minimal points - detail::assign_point_from_index<0>(box, min_point); - num_type const two = 2; - boost::long_long_type const min_coordinate - = boost::numeric_cast(-range / two); - assign_values(min_robust_point, min_coordinate, min_coordinate); -} - -template -< - typename Point, typename RobustPoint, typename Geometry, - typename Factor, typename Strategy -> -static inline void init_rescale_policy(Geometry const& geometry, - Point& min_point, - RobustPoint& min_robust_point, - Factor& factor, - Strategy const& strategy) -{ - if (geometry::is_empty(geometry)) - { - return; - } - - // Get bounding box - model::box env = geometry::return_envelope - < - model::box - >(geometry, strategy); - - scale_box_to_integer_range(env, min_point, min_robust_point, factor); -} - -// NOTE: Actually it should take 2 separate strategies, one for each geometry -// in case one of them was e.g. a Box -template -< - typename Point, typename RobustPoint, typename Geometry1, typename Geometry2, - typename Factor, typename Strategy1, typename Strategy2 -> -static inline void init_rescale_policy(Geometry1 const& geometry1, - Geometry2 const& geometry2, - Point& min_point, - RobustPoint& min_robust_point, - Factor& factor, - Strategy1 const& strategy1, - Strategy2 const& strategy2) -{ - // Get bounding boxes (when at least one of the geometries is not empty) - bool const is_empty1 = geometry::is_empty(geometry1); - bool const is_empty2 = geometry::is_empty(geometry2); - if (is_empty1 && is_empty2) - { - return; - } - - model::box env; - if (is_empty1) - { - geometry::envelope(geometry2, env, strategy2); - } - else if (is_empty2) - { - geometry::envelope(geometry1, env, strategy1); - } - else - { - // The following approach (envelope + expand) may not give the - // optimal MBR when then two geometries are in the spherical - // equatorial or geographic coordinate systems. - // TODO: implement envelope for two (or possibly more geometries) - geometry::envelope(geometry1, env, strategy1); - model::box env2 = geometry::return_envelope - < - model::box - >(geometry2, strategy2); - geometry::expand(env, env2, strategy1); - } - - scale_box_to_integer_range(env, min_point, min_robust_point, factor); -} - - -template -< - typename Point, - bool IsFloatingPoint -> -struct rescale_policy_type -{ - typedef no_rescale_policy type; -}; - -// We rescale only all FP types -template -< - typename Point -> -struct rescale_policy_type -{ - typedef typename geometry::coordinate_type::type coordinate_type; - typedef model::point - < - typename detail::robust_type::type, - geometry::dimension::value, - typename geometry::coordinate_system::type - > robust_point_type; - typedef typename promote_floating_point::type factor_type; - typedef detail::robust_policy type; -}; - -template -struct get_rescale_policy -{ - template - static inline Policy apply(Geometry const& geometry, - Strategy const& strategy) - { - typedef typename point_type::type point_type; - typedef typename geometry::coordinate_type::type coordinate_type; - typedef typename promote_floating_point::type factor_type; - typedef model::point - < - typename detail::robust_type::type, - geometry::dimension::value, - typename geometry::coordinate_system::type - > robust_point_type; - - point_type min_point; - robust_point_type min_robust_point; - factor_type factor; - init_rescale_policy(geometry, min_point, min_robust_point, - factor, strategy); - - return Policy(min_point, min_robust_point, factor); - } - - template - static inline Policy apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - Strategy1 const& strategy1, - Strategy2 const& strategy2) - { - typedef typename point_type::type point_type; - typedef typename geometry::coordinate_type::type coordinate_type; - typedef typename promote_floating_point::type factor_type; - typedef model::point - < - typename detail::robust_type::type, - geometry::dimension::value, - typename geometry::coordinate_system::type - > robust_point_type; - - point_type min_point; - robust_point_type min_robust_point; - factor_type factor; - init_rescale_policy(geometry1, geometry2, min_point, min_robust_point, - factor, strategy1, strategy2); - - return Policy(min_point, min_robust_point, factor); - } -}; - -// Specialization for no-rescaling -template <> -struct get_rescale_policy -{ - template - static inline no_rescale_policy apply(Geometry const& , EnvelopeStrategy const&) - { - return no_rescale_policy(); - } - - template - static inline no_rescale_policy apply(Geometry1 const& , Geometry2 const& , - EnvelopeStrategy1 const& , EnvelopeStrategy2 const& ) - { - return no_rescale_policy(); - } -}; - - -}} // namespace detail::get_rescale_policy -#endif // DOXYGEN_NO_DETAIL - -template -< - typename Point, - typename CSTag = typename geometry::cs_tag::type -> -struct rescale_policy_type - : public detail::get_rescale_policy::rescale_policy_type - < - Point, -#if defined(BOOST_GEOMETRY_USE_RESCALING) - std::is_floating_point - < - typename geometry::coordinate_type::type - >::type::value - && - std::is_same - < - CSTag, - geometry::cartesian_tag - >::value -#else - false -#endif - > -{ - BOOST_GEOMETRY_STATIC_ASSERT( - (util::is_point::value), - "Point type expected.", - Point); -}; - - -template -< - typename Geometry1, - typename Geometry2, - typename CSTag = typename geometry::cs_tag::type, - typename Tag1 = typename tag_cast - < - typename tag::type, - box_tag, - pointlike_tag, - linear_tag, - areal_tag - >::type, - typename Tag2 = typename tag_cast - < - typename tag::type, - box_tag, - pointlike_tag, - linear_tag, - areal_tag - >::type -> -struct rescale_overlay_policy_type - // Default: no rescaling - : public detail::get_rescale_policy::rescale_policy_type - < - typename geometry::point_type::type, - false - > -{}; - -// Areal/areal: get rescale policy based on coordinate type -template -< - typename Geometry1, - typename Geometry2, - typename CSTag -> -struct rescale_overlay_policy_type - : public rescale_policy_type - < - typename geometry::point_type::type, - CSTag - > -{}; - - -template -inline Policy get_rescale_policy(Geometry const& geometry) -{ - typename geometry::strategies::envelope::services::default_strategy - < - Geometry, - model::box::type> - >::type strategy; - - return detail::get_rescale_policy::get_rescale_policy::apply(geometry, strategy); -} - -template -< - typename Policy, typename Geometry, typename Strategy, - std::enable_if_t::type>::value, int> = 0 -> -inline Policy get_rescale_policy(Geometry const& geometry, Strategy const& strategy) -{ - return detail::get_rescale_policy::get_rescale_policy - < - Policy - >::apply(geometry, strategy); -} - -template -< - typename Policy, typename Geometry1, typename Geometry2, - std::enable_if_t::type>::value, int> = 0 -> -inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2) -{ - typename geometry::strategies::envelope::services::default_strategy - < - Geometry1, - model::box::type> - >::type strategy1; - typename geometry::strategies::envelope::services::default_strategy - < - Geometry2, - model::box::type> - >::type strategy2; - - return detail::get_rescale_policy::get_rescale_policy - < - Policy - >::apply(geometry1, geometry2, strategy1, strategy2); -} - -template -inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2, - Strategy const& strategy) -{ - return detail::get_rescale_policy::get_rescale_policy - < - Policy - >::apply(geometry1, geometry2, strategy, strategy); -} - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP diff --git a/include/boost/geometry/policies/robustness/no_rescale_policy.hpp b/include/boost/geometry/policies/robustness/no_rescale_policy.hpp deleted file mode 100644 index 211c45a1..00000000 --- a/include/boost/geometry/policies/robustness/no_rescale_policy.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2013 Bruno Lalande, Paris, France. -// Copyright (c) 2013 Mateusz Loskot, London, UK. -// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP - -#include - -#include -#include -#include - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -// Redudant later. -struct no_rescale_policy -{ - static bool const enabled = false; - - // We don't rescale but return the reference of the input - template - inline Value const& apply(Value const& value) const - { - return value; - } -}; - -} // namespace detail -#endif - - -// Implement meta-functions for this policy -template -struct robust_point_type -{ - // The point itself - typedef Point type; -}; - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP diff --git a/include/boost/geometry/policies/robustness/rescale_policy.hpp b/include/boost/geometry/policies/robustness/rescale_policy.hpp deleted file mode 100644 index 9394f8d9..00000000 --- a/include/boost/geometry/policies/robustness/rescale_policy.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2014-2015 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2014-2015 Bruno Lalande, Paris, France. -// Copyright (c) 2014-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2015, 2018. -// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates. - -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP - -#include - -#include - -#include -#include - -#include - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -template -struct robust_policy -{ - static bool const enabled = true; - - typedef typename geometry::coordinate_type::type output_ct; - - robust_policy(FpPoint const& fp_min, IntPoint const& int_min, CalculationType const& the_factor) - : m_fp_min(fp_min) - , m_int_min(int_min) - , m_multiplier(the_factor) - { - } - - template - inline output_ct apply(Value const& value) const - { - // a + (v-b)*f - CalculationType const a = static_cast(get(m_int_min)); - CalculationType const b = static_cast(get(m_fp_min)); - CalculationType const result = a + (value - b) * m_multiplier; - - return geometry::math::rounding_cast(result); - } - - FpPoint m_fp_min; - IntPoint m_int_min; - CalculationType m_multiplier; -}; - -} // namespace detail -#endif - - -// Implement meta-functions for this policy - -// Define the IntPoint as a robust-point type -template -struct robust_point_type > -{ - typedef IntPoint type; -}; - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP diff --git a/include/boost/geometry/policies/robustness/rescale_policy_tags.hpp b/include/boost/geometry/policies/robustness/rescale_policy_tags.hpp deleted file mode 100644 index 03f90760..00000000 --- a/include/boost/geometry/policies/robustness/rescale_policy_tags.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Boost.Geometry - -// Copyright (c) 2019-2019 Barend Gehrels, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP - -#include - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -struct no_rescale_policy_tag {}; -struct rescale_policy_tag {}; - -template -struct rescale_policy_type -{ - typedef rescale_policy_tag type; -}; - -// Specialization -template <> -struct rescale_policy_type -{ - typedef no_rescale_policy_tag type; -}; - -} // namespace detail -#endif - - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP diff --git a/include/boost/geometry/policies/robustness/robust_point_type.hpp b/include/boost/geometry/policies/robustness/robust_point_type.hpp deleted file mode 100644 index 25639227..00000000 --- a/include/boost/geometry/policies/robustness/robust_point_type.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2013 Bruno Lalande, Paris, France. -// Copyright (c) 2013 Mateusz Loskot, London, UK. -// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP - -namespace boost { namespace geometry -{ - -// Meta-function to typedef a robust point type for a policy -template -struct robust_point_type -{ - // By default, the point itself is the robust type - typedef Point type; -}; - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP diff --git a/include/boost/geometry/policies/robustness/robust_type.hpp b/include/boost/geometry/policies/robustness/robust_type.hpp deleted file mode 100644 index c2a65ac5..00000000 --- a/include/boost/geometry/policies/robustness/robust_type.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2014 Bruno Lalande, Paris, France. -// Copyright (c) 2014 Mateusz Loskot, London, UK. -// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020, Oracle and/or its affiliates. -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP - - -#include - -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL - -namespace detail_dispatch -{ - -template -struct robust_type -{ -}; - -template -struct robust_type -{ - typedef CoordinateType type; -}; - -template -struct robust_type -{ - typedef boost::long_long_type type; -}; - -} // namespace detail_dispatch - -namespace detail -{ - -template -struct robust_type -{ - typedef typename detail_dispatch::robust_type - < - CoordinateType, - typename std::is_floating_point::type - >::type type; -}; - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP diff --git a/include/boost/geometry/policies/robustness/segment_ratio.hpp b/include/boost/geometry/policies/robustness/segment_ratio.hpp index 9a3914a7..47851a62 100644 --- a/include/boost/geometry/policies/robustness/segment_ratio.hpp +++ b/include/boost/geometry/policies/robustness/segment_ratio.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016-2021. -// Modifications copyright (c) 2016-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2024. +// Modifications copyright (c) 2016-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -21,6 +22,8 @@ #include #include #include +#include + namespace boost { namespace geometry { @@ -153,7 +156,7 @@ class segment_ratio , m_approximation(0) {} - inline segment_ratio(const Type& numerator, const Type& denominator) + inline segment_ratio(Type const& numerator, Type const& denominator) : m_numerator(numerator) , m_denominator(denominator) { @@ -207,7 +210,7 @@ class segment_ratio inline Type const& numerator() const { return m_numerator; } inline Type const& denominator() const { return m_denominator; } - inline void assign(const Type& numerator, const Type& denominator) + inline void assign(Type const& numerator, Type const& denominator) { m_numerator = numerator; m_denominator = denominator; @@ -227,8 +230,8 @@ class segment_ratio m_approximation = m_denominator == zero_instance() ? floating_point_type{0} : ( - boost::numeric_cast(m_numerator) * scale() - / boost::numeric_cast(m_denominator) + util::numeric_cast(m_numerator) * scale() + / util::numeric_cast(m_denominator) ); } @@ -345,6 +348,11 @@ private : } }; +template +struct segment_ratio_type +{ + using type = segment_ratio::type>; +}; }} // namespace boost::geometry diff --git a/include/boost/geometry/policies/robustness/segment_ratio_type.hpp b/include/boost/geometry/policies/robustness/segment_ratio_type.hpp deleted file mode 100644 index 8f4d0096..00000000 --- a/include/boost/geometry/policies/robustness/segment_ratio_type.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2013 Bruno Lalande, Paris, France. -// Copyright (c) 2013 Mateusz Loskot, London, UK. -// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. - -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP -#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP - -#include - -#include - -#include -#include - -namespace boost { namespace geometry { namespace detail -{ - -// Temporary meta-function to access segment-ratio for a policy -template -struct segment_ratio_type -{ - // Type in segment ratio is either the coordinate type, or for - // deprecated robust point types it is a long_long type - typedef std::conditional_t - < - std::is_same - < - typename rescale_policy_type::type, - no_rescale_policy_tag - >::value, - typename geometry::coordinate_type::type, - boost::long_long_type - > coordinate_type; - - // Define segment ratio based on the coordinate type - typedef geometry::segment_ratio type; -}; - - -}}} // namespace boost::geometry::deatil - - -#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP diff --git a/include/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp b/include/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp index 61996348..0cfb0425 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp @@ -85,7 +85,7 @@ inline bool point_in_box_by_side(Point const& point, Box const& box, // Create (counterclockwise) array of points, the fifth one closes it // Every point should be on the LEFT side (=1), or ON the border (=0), // So >= 1 or >= 0 - std::array::type, 5> bp; + std::array, 5> bp; geometry::detail::assign_box_corners_oriented(box, bp); bp[4] = bp[0]; diff --git a/include/boost/geometry/strategies/agnostic/point_in_point.hpp b/include/boost/geometry/strategies/agnostic/point_in_point.hpp index 051b87f4..84cde06a 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_point.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_point.hpp @@ -29,7 +29,7 @@ namespace strategy { namespace within template < typename Point1, typename Point2, - typename CSTag = typename cs_tag::type + typename CSTag = cs_tag_t > struct point_in_point : strategy::within::cartesian_point_point diff --git a/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp b/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp index 07342ae1..b7400d85 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp @@ -45,11 +45,7 @@ template typename Point, typename PointOfSegment, typename CalculationType, - typename CSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CSTag = tag_cast_t, spherical_tag> > struct winding_base_type { @@ -65,7 +61,7 @@ struct winding_base_type < typename strategy::side::services::default_strategy < - typename cs_tag::type + cs_tag_t >::type, CalculationType >; @@ -76,10 +72,7 @@ struct winding_base_type { using type = within::detail::spherical_winding_base < - typename strategy::side::services::default_strategy - < - typename cs_tag::type - >::type, + typename strategy::side::services::default_strategy>::type, CalculationType >; }; diff --git a/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp b/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp index 47ecb22e..fd52eb25 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp @@ -165,7 +165,7 @@ public : return distance; } - //! Returns the piece_type (flat end) + //! Returns the piece_type (round end) static inline piece_type get_piece_type() { return buffered_round_end; diff --git a/include/boost/geometry/strategies/cartesian/centroid_average.hpp b/include/boost/geometry/strategies/cartesian/centroid_average.hpp index 103a1d8a..5b642a7f 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_average.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_average.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2015-2021. // Modifications copyright (c) 2015-2021 Oracle and/or its affiliates. @@ -89,7 +89,8 @@ public : centroid = state.centroid; if ( state.count > 0 ) { - divide_value(centroid, state.count); + using coord_t = typename coordinate_type::type; + divide_value(centroid, static_cast(state.count)); return true; } return false; @@ -117,7 +118,7 @@ struct default_strategy typedef average < Point, - typename point_type::type + point_type_t > type; }; diff --git a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp index d4713da9..8e4c014a 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp @@ -22,13 +22,13 @@ #include #include -#include #include #include #include #include #include +#include #include @@ -48,8 +48,6 @@ namespace strategy { namespace centroid \ingroup strategies \details Calculates centroid using triangulation method published by Bashein / Detmer -\tparam Point point type of centroid to calculate -\tparam PointOfSegment point type of segments, defaults to Point \tparam CalculationType \tparam_calculation \author Adapted from "Centroid of a Polygon" by @@ -190,10 +188,10 @@ public : typedef typename calculation_type::type calc_type; // Get coordinates and promote them to calculation_type - calc_type const x1 = boost::numeric_cast(get<0>(p1)); - calc_type const y1 = boost::numeric_cast(get<1>(p1)); - calc_type const x2 = boost::numeric_cast(get<0>(p2)); - calc_type const y2 = boost::numeric_cast(get<1>(p2)); + calc_type const x1 = util::numeric_cast(get<0>(p1)); + calc_type const y1 = util::numeric_cast(get<1>(p1)); + calc_type const x2 = util::numeric_cast(get<0>(p2)); + calc_type const y2 = util::numeric_cast(get<1>(p2)); calc_type const ai = geometry::detail::determinant(p1, p2); state.count++; state.sum_a2 += ai; @@ -225,9 +223,9 @@ public : // which means that the centroid can still be filled with INF // if e.g. calculation_type is double and centroid contains floats set<0>(centroid, - boost::numeric_cast(state.sum_x / a3)); + util::numeric_cast(state.sum_x / a3)); set<1>(centroid, - boost::numeric_cast(state.sum_y / a3)); + util::numeric_cast(state.sum_y / a3)); return true; } } @@ -249,7 +247,7 @@ struct default_strategy typedef bashein_detmer < Point, - typename point_type::type + point_type_t > type; }; diff --git a/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp b/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp index 477d68b8..6e859588 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp @@ -19,7 +19,6 @@ #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_CENTROID_WEIGHTED_LENGTH_HPP #include -#include #include @@ -32,6 +31,7 @@ #include #include +#include #include @@ -132,7 +132,7 @@ public : typedef typename geometry::coordinate_type::type coordinate_type; geometry::set( centroid, - boost::numeric_cast( + util::numeric_cast( geometry::get(state.average_sum) / state.length ) ); @@ -165,7 +165,7 @@ struct default_strategy typedef weighted_length < Point, - typename point_type::type + point_type_t > type; }; diff --git a/include/boost/geometry/strategies/cartesian/densify.hpp b/include/boost/geometry/strategies/cartesian/densify.hpp index a6bc0a79..4d18e1f0 100644 --- a/include/boost/geometry/strategies/cartesian/densify.hpp +++ b/include/boost/geometry/strategies/cartesian/densify.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -68,8 +69,8 @@ class cartesian // dir01 = p1 - p0 geometry::detail::for_each_dimension([&](auto index) { - calc_t const coord0 = boost::numeric_cast(get(p0)); - calc_t const coord1 = boost::numeric_cast(get(p1)); + calc_t const coord0 = util::numeric_cast(get(p0)); + calc_t const coord1 = util::numeric_cast(get(p1)); set(cp0, coord0); set(dir01, coord1 - coord0); }); @@ -96,7 +97,7 @@ class cartesian // out = p0 + d * dir01 calc_t const coord = get(cp0) + get(dir01) * num / den; - set(out, boost::numeric_cast(coord)); + set(out, util::numeric_cast(coord)); }); policy.apply(out); diff --git a/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp b/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp index d903f210..39ebe395 100644 --- a/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp +++ b/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp @@ -23,11 +23,6 @@ #include #include -#include - -#include -#include - #include #include #include @@ -38,6 +33,9 @@ #include #include +#include +#include +#include namespace boost { namespace geometry { namespace strategy { namespace disjoint { @@ -62,22 +60,22 @@ struct compute_tmin_tmax_per_dim SegmentPoint >::type point_coordinate_type; - RelativeDistance c_p0 = boost::numeric_cast + RelativeDistance c_p0 = util::numeric_cast < point_coordinate_type >( geometry::get(p0) ); - RelativeDistance c_p1 = boost::numeric_cast + RelativeDistance c_p1 = util::numeric_cast < point_coordinate_type >( geometry::get(p1) ); - RelativeDistance c_b_min = boost::numeric_cast + RelativeDistance c_b_min = util::numeric_cast < box_coordinate_type >( geometry::get(box) ); - RelativeDistance c_b_max = boost::numeric_cast + RelativeDistance c_b_max = util::numeric_cast < box_coordinate_type >( geometry::get(box) ); @@ -259,12 +257,12 @@ struct segment_box { assert_dimension_equal(); - typedef typename util::calculation_type::geometric::binary + using relative_distance_type = typename util::calculation_type::geometric::binary < Segment, Box, void - >::type relative_distance_type; + >::type; - typedef typename point_type::type segment_point_type; + using segment_point_type = point_type_t; segment_point_type p0, p1; geometry::detail::assign_point_from_index<0>(segment, p0); geometry::detail::assign_point_from_index<1>(segment, p1); diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp deleted file mode 100644 index d6ad0e0d..00000000 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp +++ /dev/null @@ -1,315 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. -// Copyright (c) 2008-2014 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. - -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014, Oracle and/or its affiliates. - -// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_PROJECTED_POINT_AX_HPP -#define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_PROJECTED_POINT_AX_HPP - - -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -// Helper geometry (projected point on line) -#include - - -namespace boost { namespace geometry -{ - - -namespace strategy { namespace distance -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -template -struct projected_point_ax_result -{ - typedef T value_type; - - projected_point_ax_result(T const& c = T(0)) - : atd(c), xtd(c) - {} - - projected_point_ax_result(T const& a, T const& x) - : atd(a), xtd(x) - {} - - friend inline bool operator<(projected_point_ax_result const& left, - projected_point_ax_result const& right) - { - return left.xtd < right.xtd || left.atd < right.atd; - } - - T atd, xtd; -}; - -// This less-comparator may be used as a parameter of detail::douglas_peucker. -// In this simplify strategy distances are compared in 2 places -// 1. to choose the furthest candidate (md < dist) -// 2. to check if the candidate is further than max_distance (max_distance < md) -template -class projected_point_ax_less -{ -public: - projected_point_ax_less(Distance const& max_distance) - : m_max_distance(max_distance) - {} - - inline bool operator()(Distance const& left, Distance const& right) const - { - //return left.xtd < right.xtd && right.atd < m_max_distance.atd; - - typedef typename Distance::value_type value_type; - - value_type const lx = left.xtd > m_max_distance.xtd ? left.xtd - m_max_distance.xtd : 0; - value_type const rx = right.xtd > m_max_distance.xtd ? right.xtd - m_max_distance.xtd : 0; - value_type const la = left.atd > m_max_distance.atd ? left.atd - m_max_distance.atd : 0; - value_type const ra = right.atd > m_max_distance.atd ? right.atd - m_max_distance.atd : 0; - - value_type const l = (std::max)(lx, la); - value_type const r = (std::max)(rx, ra); - - return l < r; - } -private: - Distance const& m_max_distance; -}; - -// This strategy returns 2-component Point/Segment distance. -// The ATD (along track distance) is parallel to the Segment -// and is a distance between Point projected into a line defined by a Segment and the nearest Segment's endpoint. -// If the projected Point intersects the Segment the ATD is equal to 0. -// The XTD (cross track distance) is perpendicular to the Segment -// and is a distance between input Point and its projection. -// If the Segment has length equal to 0, ATD and XTD has value equal -// to the distance between the input Point and one of the Segment's endpoints. -// -// p3 p4 -// ^ 7 -// | / -// p1<-----e========e----->p2 -// -// p1: atd=D, xtd=0 -// p2: atd=D, xtd=0 -// p3: atd=0, xtd=D -// p4: atd=D/2, xtd=D -template -< - typename CalculationType = void, - typename Strategy = pythagoras -> -class projected_point_ax -{ -public : - template - struct calculation_type - : public projected_point - ::template calculation_type - {}; - - template - struct result_type - { - typedef projected_point_ax_result - < - typename calculation_type::type - > type; - }; - -public : - - template - inline typename result_type::type - apply(Point const& p, PointOfSegment const& p1, PointOfSegment const& p2) const - { - assert_dimension_equal(); - - typedef typename calculation_type::type calculation_type; - - // A projected point of points in Integer coordinates must be able to be - // represented in FP. - typedef model::point - < - calculation_type, - dimension::value, - typename coordinate_system::type - > fp_point_type; - - // For convenience - typedef fp_point_type fp_vector_type; - - /* - Algorithm [p: (px,py), p1: (x1,y1), p2: (x2,y2)] - VECTOR v(x2 - x1, y2 - y1) - VECTOR w(px - x1, py - y1) - c1 = w . v - c2 = v . v - b = c1 / c2 - RETURN POINT(x1 + b * vx, y1 + b * vy) - */ - - // v is multiplied below with a (possibly) FP-value, so should be in FP - // For consistency we define w also in FP - fp_vector_type v, w, projected; - - geometry::convert(p2, v); - geometry::convert(p, w); - geometry::convert(p1, projected); - subtract_point(v, projected); - subtract_point(w, projected); - - Strategy strategy; - boost::ignore_unused(strategy); - - typename result_type::type result; - - calculation_type const zero = calculation_type(); - calculation_type const c2 = dot_product(v, v); - if ( math::equals(c2, zero) ) - { - result.xtd = strategy.apply(p, projected); - // assume that the 0-length segment is perpendicular to the Pt->ProjPt vector - result.atd = 0; - return result; - } - - calculation_type const c1 = dot_product(w, v); - calculation_type const b = c1 / c2; - multiply_value(v, b); - add_point(projected, v); - - result.xtd = strategy.apply(p, projected); - - if (c1 <= zero) - { - result.atd = strategy.apply(p1, projected); - } - else if (c2 <= c1) - { - result.atd = strategy.apply(p2, projected); - } - else - { - result.atd = 0; - } - - return result; - } -}; - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - -#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS -namespace services -{ - - -template -struct tag > -{ - typedef strategy_tag_distance_point_segment type; -}; - - -template -struct return_type, P, PS> -{ - typedef typename detail::projected_point_ax - ::template result_type::type type; -}; - - -template -struct comparable_type > -{ - // Define a projected_point strategy with its underlying point-point-strategy - // being comparable - typedef detail::projected_point_ax - < - CalculationType, - typename comparable_type::type - > type; -}; - - -template -struct get_comparable > -{ - typedef typename comparable_type - < - detail::projected_point_ax - >::type comparable_type; -public : - static inline comparable_type apply(detail::projected_point_ax const& ) - { - return comparable_type(); - } -}; - - -template -struct result_from_distance, P, PS> -{ -private : - typedef typename return_type, P, PS>::type return_type; -public : - template - static inline return_type apply(detail::projected_point_ax const& , T const& value) - { - Strategy s; - return_type ret; - ret.atd = result_from_distance::apply(s, value.atd); - ret.xtd = result_from_distance::apply(s, value.xtd); - return ret; - } -}; - - -} // namespace services -#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS - - -}} // namespace strategy::distance - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_PROJECTED_POINT_AX_HPP diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index 8d8b9543..c7e77bb1 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -26,8 +26,9 @@ #include -#include #include +#include +#include namespace boost { namespace geometry @@ -46,8 +47,8 @@ struct compute_pythagoras template static inline T apply(Point1 const& p1, Point2 const& p2) { - T const c1 = boost::numeric_cast(get(p1)); - T const c2 = boost::numeric_cast(get(p2)); + T const c1 = util::numeric_cast(get(p1)); + T const c2 = util::numeric_cast(get(p2)); T const d = c1 - c2; return d * d + compute_pythagoras::apply(p1, p2); } @@ -59,7 +60,7 @@ struct compute_pythagoras<0, T> template static inline T apply(Point1 const&, Point2 const&) { - return boost::numeric_cast(0); + return util::numeric_cast(0); } }; @@ -163,7 +164,7 @@ public : // The cast is necessary for MSVC which considers sqrt __int64 as an ambiguous call return math::sqrt ( - boost::numeric_cast::type> + util::numeric_cast::type> ( comparable::pythagoras::apply(p1, p2) ) diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp index 96a4ef02..ea8f8d6b 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp @@ -28,9 +28,9 @@ #include -#include #include - +#include +#include namespace boost { namespace geometry @@ -50,14 +50,14 @@ struct compute_pythagoras_box_box static inline void apply(Box1 const& box1, Box2 const& box2, T& result) { T const b1_min_coord = - boost::numeric_cast(geometry::get(box1)); + util::numeric_cast(geometry::get(box1)); T const b1_max_coord = - boost::numeric_cast(geometry::get(box1)); + util::numeric_cast(geometry::get(box1)); T const b2_min_coord = - boost::numeric_cast(geometry::get(box2)); + util::numeric_cast(geometry::get(box2)); T const b2_max_coord = - boost::numeric_cast(geometry::get(box2)); + util::numeric_cast(geometry::get(box2)); if ( b1_max_coord < b2_min_coord ) { @@ -118,9 +118,9 @@ public : apply(Box1 const& box1, Box2 const& box2) { BOOST_CONCEPT_ASSERT - ( (concepts::ConstPoint::type>) ); + ( (concepts::ConstPoint>) ); BOOST_CONCEPT_ASSERT - ( (concepts::ConstPoint::type>) ); + ( (concepts::ConstPoint>) ); // Calculate distance using Pythagoras // (Leave comment above for Doxygen) @@ -187,7 +187,7 @@ public : // The cast is necessary for MSVC which considers sqrt __int64 as an ambiguous call return math::sqrt ( - boost::numeric_cast::type> diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp index 719569d5..9d1b0949 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp @@ -28,9 +28,9 @@ #include -#include #include - +#include +#include namespace boost { namespace geometry @@ -49,11 +49,11 @@ struct compute_pythagoras_point_box template static inline void apply(Point const& point, Box const& box, T& result) { - T const p_coord = boost::numeric_cast(geometry::get(point)); + T const p_coord = util::numeric_cast(geometry::get(point)); T const b_min_coord = - boost::numeric_cast(geometry::get(box)); + util::numeric_cast(geometry::get(box)); T const b_max_coord = - boost::numeric_cast(geometry::get(box)); + util::numeric_cast(geometry::get(box)); if ( p_coord < b_min_coord ) { @@ -115,7 +115,7 @@ public : { BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); BOOST_CONCEPT_ASSERT - ( (concepts::ConstPoint::type>) ); + ( (concepts::ConstPoint>) ); // Calculate distance using Pythagoras // (Leave comment above for Doxygen) @@ -182,7 +182,7 @@ public : // The cast is necessary for MSVC which considers sqrt __int64 as an ambiguous call return math::sqrt ( - boost::numeric_cast::type> diff --git a/include/boost/geometry/strategies/cartesian/intersection.hpp b/include/boost/geometry/strategies/cartesian/intersection.hpp index 94d33401..d6fc5c9b 100644 --- a/include/boost/geometry/strategies/cartesian/intersection.hpp +++ b/include/boost/geometry/strategies/cartesian/intersection.hpp @@ -3,9 +3,9 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014-2021. -// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2024. +// Modifications copyright (c) 2014-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -28,9 +28,9 @@ #include #include #include -#include #include +#include #include #include @@ -51,15 +51,6 @@ #include #include -#include -#include - - -#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) -# include -#endif - - namespace boost { namespace geometry { @@ -156,12 +147,12 @@ struct cartesian_segments template void assign_a(Point& point, Segment1 const& a, Segment2 const& ) const { - assign(point, a, dx_a, dy_a, robust_ra); + assign(point, a, dx_a, dy_a, ra); } template void assign_b(Point& point, Segment1 const& , Segment2 const& b) const { - assign(point, b, dx_b, dy_b, robust_rb); + assign(point, b, dx_b, dy_b, rb); } template @@ -177,17 +168,17 @@ struct cartesian_segments typedef typename promote_integral::type calc_type; calc_type const numerator - = boost::numeric_cast(ratio.numerator()); + = util::numeric_cast(ratio.numerator()); calc_type const denominator - = boost::numeric_cast(ratio.denominator()); - calc_type const dx_calc = boost::numeric_cast(dx); - calc_type const dy_calc = boost::numeric_cast(dy); + = util::numeric_cast(ratio.denominator()); + calc_type const dx_calc = util::numeric_cast(dx); + calc_type const dy_calc = util::numeric_cast(dy); set<0>(point, get<0, 0>(segment) - + boost::numeric_cast( + + util::numeric_cast( math::divide(numerator * dx_calc, denominator))); set<1>(point, get<0, 1>(segment) - + boost::numeric_cast( + + util::numeric_cast( math::divide(numerator * dy_calc, denominator))); } @@ -238,7 +229,7 @@ struct cartesian_segments < std::is_arithmetic::value >::apply(comparable_length_a(), comparable_length_b(), - robust_ra.edge_value(), robust_rb.edge_value()); + ra.edge_value(), rb.edge_value()); if (use_a) { @@ -248,13 +239,10 @@ struct cartesian_segments { assign_b(point, a, b); } - -#ifndef BOOST_GEOMETRY_USE_RESCALING // Verify nearly collinear cases (the threshold is arbitrary // but influences performance). If the intersection is located // outside the segments, then it should be moved. - if (robust_ra.possibly_collinear(1.0e-3) - && robust_rb.possibly_collinear(1.0e-3)) + if (ra.possibly_collinear(1.0e-3) && rb.possibly_collinear(1.0e-3)) { // The segments are nearly collinear and because of the calculation // method with very small denominator, the IP appears outside the @@ -264,13 +252,12 @@ struct cartesian_segments assign_if_exceeds(point, a); assign_if_exceeds(point, b); } -#endif } CoordinateType dx_a, dy_a; CoordinateType dx_b, dy_b; - SegmentRatio robust_ra; - SegmentRatio robust_rb; + SegmentRatio ra; + SegmentRatio rb; }; template @@ -287,38 +274,15 @@ struct cartesian_segments // IntersectionPoint = (x1 + r * dx_a, y1 + r * dy_a) } - // Version for non-rescaled policies template < typename UniqueSubRange1, typename UniqueSubRange2, typename Policy > - static inline typename Policy::return_type - apply(UniqueSubRange1 const& range_p, - UniqueSubRange2 const& range_q, - Policy const& policy) - { - // Pass the same ranges both as normal ranges and as modelled ranges - return apply(range_p, range_q, policy, range_p, range_q); - } - - // Version for non rescaled versions. - // The "modelled" parameter might be rescaled (will be removed later) - template - < - typename UniqueSubRange1, - typename UniqueSubRange2, - typename Policy, - typename ModelledUniqueSubRange1, - typename ModelledUniqueSubRange2 - > - static inline typename Policy::return_type - apply(UniqueSubRange1 const& range_p, - UniqueSubRange2 const& range_q, - Policy const& policy, - ModelledUniqueSubRange1 const& modelled_range_p, - ModelledUniqueSubRange2 const& modelled_range_q) + static inline typename Policy::return_type apply(UniqueSubRange1 const& range_p, + UniqueSubRange2 const& range_q, + Policy const& policy) { typedef typename UniqueSubRange1::point_type point1_type; typedef typename UniqueSubRange2::point_type point2_type; @@ -331,18 +295,13 @@ struct cartesian_segments point2_type const& q1 = range_q.at(0); point2_type const& q2 = range_q.at(1); - // Declare segments, currently necessary for the policies - // (segment_crosses, segment_colinear, degenerate, one_degenerate, etc) - model::referring_segment const p(p1, p2); - model::referring_segment const q(q1, q2); - typedef typename select_most_precise < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type - >::type modelled_coordinate_type; + typename geometry::coordinate_type::type, + typename geometry::coordinate_type::type + >::type coordinate_type; - typedef segment_ratio ratio_type; + typedef segment_ratio ratio_type; segment_intersection_info < typename select_calculation_type::type, @@ -354,7 +313,7 @@ struct cartesian_segments sinfo.dy_a = get<1>(p2) - get<1>(p1); // distance in y-dir sinfo.dy_b = get<1>(q2) - get<1>(q1); - return unified(sinfo, p, q, policy, modelled_range_p, modelled_range_q); + return unified(sinfo, range_p, range_q, policy); } //! Returns true if two segments do not overlap. @@ -388,30 +347,22 @@ struct cartesian_segments return math::smaller(maxp, minq) || math::smaller(maxq, minp); } - // Implementation for either rescaled or non rescaled versions. template < typename RatioType, typename SegmentInfo, - typename Segment1, - typename Segment2, - typename Policy, typename UniqueSubRange1, - typename UniqueSubRange2 + typename UniqueSubRange2, + typename Policy > static inline typename Policy::return_type unified(SegmentInfo& sinfo, - Segment1 const& p, Segment2 const& q, Policy const&, UniqueSubRange1 const& range_p, - UniqueSubRange2 const& range_q) + UniqueSubRange2 const& range_q, + Policy const&) { typedef typename UniqueSubRange1::point_type point1_type; typedef typename UniqueSubRange2::point_type point2_type; - typedef typename select_most_precise - < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type - >::type coordinate_type; point1_type const& p1 = range_p.at(0); point1_type const& p2 = range_p.at(1); @@ -421,6 +372,11 @@ struct cartesian_segments bool const p_is_point = equals_point_point(p1, p2); bool const q_is_point = equals_point_point(q1, q2); + // Declare segments, currently necessary for the policies + // (segment_crosses, segment_colinear, degenerate, one_degenerate, etc) + model::referring_segment const p(p1, p2); + model::referring_segment const q(q1, q2); + if (p_is_point && q_is_point) { return equals_point_point(p1, q2) @@ -459,38 +415,38 @@ struct cartesian_segments bool collinear = sides.collinear(); - // Calculate the differences again - // (for rescaled version, this is different from dx_p etc) - coordinate_type const dx_p = get<0>(p2) - get<0>(p1); - coordinate_type const dx_q = get<0>(q2) - get<0>(q1); - coordinate_type const dy_p = get<1>(p2) - get<1>(p1); - coordinate_type const dy_q = get<1>(q2) - get<1>(q1); - // r: ratio 0-1 where intersection divides A/B // (only calculated for non-collinear segments) if (! collinear) { - coordinate_type denominator_a, nominator_a; - coordinate_type denominator_b, nominator_b; - - cramers_rule(dx_p, dy_p, dx_q, dy_q, + typedef typename select_most_precise + < + typename geometry::coordinate_type::type, + typename geometry::coordinate_type::type + >::type coordinate_type; + + coordinate_type denominator_a; + coordinate_type nominator_a; + coordinate_type denominator_b; + coordinate_type nominator_b; + + cramers_rule(sinfo.dx_a, sinfo.dy_a, sinfo.dx_b, sinfo.dy_b, get<0>(p1) - get<0>(q1), get<1>(p1) - get<1>(q1), nominator_a, denominator_a); - cramers_rule(dx_q, dy_q, dx_p, dy_p, + cramers_rule(sinfo.dx_b, sinfo.dy_b, sinfo.dx_a, sinfo.dy_a, get<0>(q1) - get<0>(p1), get<1>(q1) - get<1>(p1), nominator_b, denominator_b); math::detail::equals_factor_policy - policy(dx_p, dy_p, dx_q, dy_q); + policy(sinfo.dx_a, sinfo.dy_a, sinfo.dx_b, sinfo.dy_b); coordinate_type const zero = 0; if (math::detail::equals_by_policy(denominator_a, zero, policy) || math::detail::equals_by_policy(denominator_b, zero, policy)) { - // If this is the case, no rescaling is done for FP precision. // We set it to collinear, but it indicates a robustness issue. sides.set<0>(0, 0); sides.set<1>(0, 0); @@ -498,18 +454,18 @@ struct cartesian_segments } else { - sinfo.robust_ra.assign(nominator_a, denominator_a); - sinfo.robust_rb.assign(nominator_b, denominator_b); + sinfo.ra.assign(nominator_a, denominator_a); + sinfo.rb.assign(nominator_b, denominator_b); } } if (collinear) { std::pair const collinear_use_first - = is_x_more_significant(geometry::math::abs(dx_p), - geometry::math::abs(dy_p), - geometry::math::abs(dx_q), - geometry::math::abs(dy_q), + = is_x_more_significant(geometry::math::abs(sinfo.dx_a), + geometry::math::abs(sinfo.dy_a), + geometry::math::abs(sinfo.dx_b), + geometry::math::abs(sinfo.dy_b), p_is_point, q_is_point); if (collinear_use_first.second) @@ -533,6 +489,16 @@ struct cartesian_segments } } + if (equals_point_point(p1, q1) || equals_point_point(p1, q2)) + { + return Policy::segments_share_common_point(sides, sinfo, p1); + } + + if (equals_point_point(p2, q1) || equals_point_point(p2, q2)) + { + return Policy::segments_share_common_point(sides, sinfo, p2); + } + return Policy::segments_crosses(sides, sinfo, p, q); } @@ -578,35 +544,35 @@ struct cartesian_segments typename RatioType, typename Segment1, typename Segment2, - typename RobustPoint1, - typename RobustPoint2 + typename Point1, + typename Point2 > static inline typename Policy::return_type relate_collinear(Segment1 const& a, Segment2 const& b, - RobustPoint1 const& robust_a1, RobustPoint1 const& robust_a2, - RobustPoint2 const& robust_b1, RobustPoint2 const& robust_b2, + Point1 const& a1, Point1 const& a2, + Point2 const& b1, Point2 const& b2, bool a_is_point, bool b_is_point) { if (a_is_point) { return relate_one_degenerate(a, - get(robust_a1), - get(robust_b1), get(robust_b2), + get(a1), + get(b1), get(b2), true); } if (b_is_point) { return relate_one_degenerate(b, - get(robust_b1), - get(robust_a1), get(robust_a2), + get(b1), + get(a1), get(a2), false); } return relate_collinear(a, b, - get(robust_a1), - get(robust_a2), - get(robust_b1), - get(robust_b2)); + get(a1), + get(a2), + get(b1), + get(b2)); } /// Relate segments known collinear diff --git a/include/boost/geometry/strategies/cartesian/line_interpolate.hpp b/include/boost/geometry/strategies/cartesian/line_interpolate.hpp index bc55da8f..a63cb854 100644 --- a/include/boost/geometry/strategies/cartesian/line_interpolate.hpp +++ b/include/boost/geometry/strategies/cartesian/line_interpolate.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -67,10 +68,10 @@ class cartesian // NOTE: numeric_cast is a leftover from convert, it could probably be ommited. // NOTE: the order of points is different than in the formula above // this is also a leftover from the previous implementation - calc_t coord0 = boost::numeric_cast(get(p0)); - calc_t coord1 = boost::numeric_cast(get(p1)); + calc_t coord0 = util::numeric_cast(get(p0)); + calc_t coord1 = util::numeric_cast(get(p1)); calc_t result = calc_t(coord1 * fraction) + calc_t(coord0 * one_minus_fraction); - set(p, boost::numeric_cast(result)); + set(p, util::numeric_cast(result)); }); } }; diff --git a/include/boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp b/include/boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp index e8864df2..dda6dc0a 100644 --- a/include/boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp +++ b/include/boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp @@ -34,8 +34,6 @@ namespace strategy { namespace within /*! \brief Within detection using cross counting, \ingroup strategies -\tparam Point \tparam_point -\tparam PointOfSegment \tparam_segment_point \tparam CalculationType \tparam_calculation \see http://tog.acm.org/resources/GraphicsGems/gemsiv/ptpoly_haines/ptinpoly.c \note Does NOT work correctly for point ON border diff --git a/include/boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp b/include/boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp index 2afa7f13..3ca8d241 100644 --- a/include/boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp +++ b/include/boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp @@ -34,8 +34,6 @@ namespace strategy { namespace within /*! \brief Within detection using cross counting \ingroup strategies -\tparam Point \tparam_point -\tparam PointOfSegment \tparam_segment_point \tparam CalculationType \tparam_calculation \author adapted from Randolph Franklin algorithm \author Barend and Maarten, 1995 diff --git a/include/boost/geometry/strategies/cartesian/side_rounded_input.hpp b/include/boost/geometry/strategies/cartesian/side_rounded_input.hpp index fc154300..9283a2b8 100644 --- a/include/boost/geometry/strategies/cartesian/side_rounded_input.hpp +++ b/include/boost/geometry/strategies/cartesian/side_rounded_input.hpp @@ -47,7 +47,7 @@ struct side_rounded_input coor_t const p_x = geometry::get<0>(p); coor_t const p_y = geometry::get<1>(p); - constexpr coor_t eps = std::numeric_limits::epsilon() / 2; + static coor_t const eps = std::numeric_limits::epsilon() / 2; coor_t const det = (p1_x - p_x) * (p2_y - p_y) - (p1_y - p_y) * (p2_x - p_x); coor_t const err_bound = (Coeff1 * eps + Coeff2 * eps * eps) * ( (geometry::math::abs(p1_x) + geometry::math::abs(p_x)) diff --git a/include/boost/geometry/strategies/cartesian/turn_in_ring_winding.hpp b/include/boost/geometry/strategies/cartesian/turn_in_ring_winding.hpp index fcbc03bc..ea06756d 100644 --- a/include/boost/geometry/strategies/cartesian/turn_in_ring_winding.hpp +++ b/include/boost/geometry/strategies/cartesian/turn_in_ring_winding.hpp @@ -77,9 +77,6 @@ class turn_in_ring_winding int count_on_edge{0}; CalculationType edge_min_fraction{(std::numeric_limits::max)()}; -#if defined(BOOST_GEOMETRY_USE_RESCALING) - CalculationType inside_min_measure{(std::numeric_limits::max)()}; -#endif inline bool is_inside() const { @@ -91,9 +88,6 @@ class turn_in_ring_winding return count_on_origin == 0 && (count_on_offsetted > 0 || (count_on_edge > 0 && edge_min_fraction < 1.0e-3) -#if defined(BOOST_GEOMETRY_USE_RESCALING) - || (count < 0 && inside_min_measure < 1.0e-5) -#endif ); } @@ -186,15 +180,6 @@ class turn_in_ring_winding { apply_on_boundary(point, s1, s2, place_on_ring, the_state); } -#if defined(BOOST_GEOMETRY_USE_RESCALING) - else if (side == -1) - { - auto const line = detail::make::make_infinite_line(s1, s2); - auto const value = -arithmetic::side_value(line, point); - if (value > 0 && value < the_state.inside_min_measure) { the_state.inside_min_measure = value; } - - } -#endif } if (in_horizontal_range) diff --git a/include/boost/geometry/strategies/comparable_distance_result.hpp b/include/boost/geometry/strategies/comparable_distance_result.hpp index 42a6b211..46c9550c 100644 --- a/include/boost/geometry/strategies/comparable_distance_result.hpp +++ b/include/boost/geometry/strategies/comparable_distance_result.hpp @@ -78,8 +78,8 @@ struct comparable_distance_result : strategy::distance::services::return_type < typename comparable_distance_strategy_type::type, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t > {}; diff --git a/include/boost/geometry/strategies/compare.hpp b/include/boost/geometry/strategies/compare.hpp index 83de8177..ecfafc43 100644 --- a/include/boost/geometry/strategies/compare.hpp +++ b/include/boost/geometry/strategies/compare.hpp @@ -216,8 +216,8 @@ template typename Point1, typename Point2 = Point1, int Dimension = -1, - typename CSTag1 = typename cs_tag::type, - typename CSTag2 = typename cs_tag::type + typename CSTag1 = cs_tag_t, + typename CSTag2 = cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/concepts/within_concept.hpp b/include/boost/geometry/strategies/concepts/within_concept.hpp index 8775613e..d296fc51 100644 --- a/include/boost/geometry/strategies/concepts/within_concept.hpp +++ b/include/boost/geometry/strategies/concepts/within_concept.hpp @@ -369,9 +369,9 @@ inline void check() < Geometry1, Geometry2, - typename tag::type, - typename tag::type, - typename tag_cast::type, areal_tag>::type, + tag_t, + tag_t, + tag_cast_t, areal_tag>, Strategy > c; boost::ignore_unused(c); diff --git a/include/boost/geometry/strategies/convex_hull.hpp b/include/boost/geometry/strategies/convex_hull.hpp index 8208a4eb..ff1a9ed3 100644 --- a/include/boost/geometry/strategies/convex_hull.hpp +++ b/include/boost/geometry/strategies/convex_hull.hpp @@ -40,7 +40,7 @@ template < typename Geometry1, typename Point, - typename CsTag = typename cs_tag::type + typename CsTag = cs_tag_t > struct strategy_convex_hull { diff --git a/include/boost/geometry/strategies/convex_hull/cartesian.hpp b/include/boost/geometry/strategies/convex_hull/cartesian.hpp index 5bf46f21..62d7a93c 100644 --- a/include/boost/geometry/strategies/convex_hull/cartesian.hpp +++ b/include/boost/geometry/strategies/convex_hull/cartesian.hpp @@ -46,7 +46,7 @@ class cartesian : public strategies::detail::cartesian_base static auto side() { using side_strategy_type - = strategy::side::side_robust; + = strategy::side::side_robust; return side_strategy_type(); } diff --git a/include/boost/geometry/strategies/covered_by.hpp b/include/boost/geometry/strategies/covered_by.hpp index 3c9a0caa..34efeb41 100644 --- a/include/boost/geometry/strategies/covered_by.hpp +++ b/include/boost/geometry/strategies/covered_by.hpp @@ -54,26 +54,26 @@ template typename GeometryContaining, typename TagContained = typename tag::type, typename TagContaining = typename tag::type, - typename CastedTagContained = typename tag_cast + typename CastedTagContained = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CastedTagContaining = typename tag_cast + >, + typename CastedTagContaining = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CsTagContained = typename tag_cast + >, + typename CsTagContained = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type, - typename CsTagContaining = typename tag_cast + >, + typename CsTagContaining = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type + > > struct default_strategy { diff --git a/include/boost/geometry/strategies/disjoint.hpp b/include/boost/geometry/strategies/disjoint.hpp index 9a52f5bc..06869a51 100644 --- a/include/boost/geometry/strategies/disjoint.hpp +++ b/include/boost/geometry/strategies/disjoint.hpp @@ -33,12 +33,12 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, int TopDim1 = geometry::topological_dimension::value, int TopDim2 = geometry::topological_dimension::value, - typename CsTag1 = typename cs_tag::type, - typename CsTag2 = typename cs_tag::type + typename CsTag1 = cs_tag_t, + typename CsTag2 = cs_tag_t > struct default_strategy : relate::services::default_strategy @@ -61,7 +61,7 @@ template struct default_strategy : strategy::covered_by::services::default_strategy < - typename point_type::type, + point_type_t, Box > {}; @@ -70,7 +70,7 @@ template struct default_strategy : strategy::covered_by::services::default_strategy < - typename point_type::type, + point_type_t, Box > {}; diff --git a/include/boost/geometry/strategies/distance.hpp b/include/boost/geometry/strategies/distance.hpp index 9a886376..53b6e29c 100644 --- a/include/boost/geometry/strategies/distance.hpp +++ b/include/boost/geometry/strategies/distance.hpp @@ -94,8 +94,8 @@ template typename GeometryTag2, typename Point1, typename Point2 = Point1, - typename CsTag1 = typename cs_tag::type, - typename CsTag2 = typename cs_tag::type, + typename CsTag1 = cs_tag_t, + typename CsTag2 = cs_tag_t, typename UnderlyingStrategy = void > struct default_strategy diff --git a/include/boost/geometry/strategies/distance_result.hpp b/include/boost/geometry/strategies/distance_result.hpp index 6d6520a2..0e07b28d 100644 --- a/include/boost/geometry/strategies/distance_result.hpp +++ b/include/boost/geometry/strategies/distance_result.hpp @@ -83,8 +83,8 @@ struct distance_result : strategy::distance::services::return_type < typename distance_result_strategy_type::type, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t > {}; diff --git a/include/boost/geometry/strategies/geographic/buffer_end_round.hpp b/include/boost/geometry/strategies/geographic/buffer_end_round.hpp index 1d6c8d19..2191e96e 100644 --- a/include/boost/geometry/strategies/geographic/buffer_end_round.hpp +++ b/include/boost/geometry/strategies/geographic/buffer_end_round.hpp @@ -134,7 +134,7 @@ public : return distance; } - //! Returns the piece_type (flat end) + //! Returns the piece_type (round end) static inline piece_type get_piece_type() { return buffered_round_end; diff --git a/include/boost/geometry/strategies/geographic/disjoint_segment_box.hpp b/include/boost/geometry/strategies/geographic/disjoint_segment_box.hpp index d7ea122a..e62e5a3d 100644 --- a/include/boost/geometry/strategies/geographic/disjoint_segment_box.hpp +++ b/include/boost/geometry/strategies/geographic/disjoint_segment_box.hpp @@ -16,8 +16,6 @@ #include #include -#include - #include #include diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp index 7844cdde..fed9a670 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp @@ -83,8 +83,8 @@ class geographic_cross_track_box_box struct return_type : services::return_type < typename distance_ps_strategy::type, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t > {}; @@ -105,8 +105,8 @@ class geographic_cross_track_box_box (concepts::PointSegmentDistanceStrategy < Strategy, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >) ); #endif @@ -208,8 +208,8 @@ struct result_from_distance result_from_distance < Strategy, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::apply(strategy, distance); } }; diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp index 4709b019..e4dea347 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp @@ -69,7 +69,7 @@ class geographic_cross_track_point_box template struct return_type : services::return_type::type> + Point, point_type_t> {}; //constructor @@ -88,7 +88,7 @@ class geographic_cross_track_point_box ( (concepts::PointSegmentDistanceStrategy < - Strategy, Point, typename point_type::type + Strategy, Point, point_type_t >) ); #endif @@ -190,7 +190,7 @@ struct result_from_distance { result_from_distance < - Strategy, P, typename point_type::type + Strategy, P, point_type_t >::apply(strategy, distance); } }; diff --git a/include/boost/geometry/strategies/geographic/intersection.hpp b/include/boost/geometry/strategies/geographic/intersection.hpp index e6a94a15..3f10ce09 100644 --- a/include/boost/geometry/strategies/geographic/intersection.hpp +++ b/include/boost/geometry/strategies/geographic/intersection.hpp @@ -2,7 +2,8 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2016-2021, Oracle and/or its affiliates. +// Copyright (c) 2016-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -23,7 +24,6 @@ #include #include #include -#include #include #include @@ -114,8 +114,8 @@ struct geographic_segments CoordinateType lon; CoordinateType lat; - SegmentRatio robust_ra; - SegmentRatio robust_rb; + SegmentRatio ra; + SegmentRatio rb; intersection_point_flag ip_flag; }; @@ -489,8 +489,8 @@ struct geographic_segments sinfo.lon = lon; sinfo.lat = lat; - sinfo.robust_ra.assign(dist_a1_i1, dist_a1_a2); - sinfo.robust_rb.assign(dist_b1_i1, dist_b1_b2); + sinfo.ra.assign(dist_a1_i1, dist_a1_a2); + sinfo.rb.assign(dist_b1_i1, dist_b1_b2); sinfo.ip_flag = ip_flag; return Policy::segments_crosses(sides, sinfo, a, b); diff --git a/include/boost/geometry/strategies/intersection_result.hpp b/include/boost/geometry/strategies/intersection_result.hpp index 94aae51d..971dc9f2 100644 --- a/include/boost/geometry/strategies/intersection_result.hpp +++ b/include/boost/geometry/strategies/intersection_result.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015-2021. -// Modifications copyright (c) 2015-2021 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2024. +// Modifications copyright (c) 2015-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -24,8 +25,8 @@ namespace boost { namespace geometry template struct fraction_type { - SegmentRatio robust_ra; // TODO this can be renamed now to "ra" - SegmentRatio robust_rb; + SegmentRatio ra; + SegmentRatio rb; bool initialized; inline fraction_type() @@ -36,15 +37,15 @@ struct fraction_type inline void assign(Info const& info) { initialized = true; - robust_ra = info.robust_ra; - robust_rb = info.robust_rb; + ra = info.ra; + rb = info.rb; } inline void assign(SegmentRatio const& a, SegmentRatio const& b) { initialized = true; - robust_ra = a; - robust_rb = b; + ra = a; + rb = b; } }; diff --git a/include/boost/geometry/strategies/intersection_strategies.hpp b/include/boost/geometry/strategies/intersection_strategies.hpp index e9a17305..781b3984 100644 --- a/include/boost/geometry/strategies/intersection_strategies.hpp +++ b/include/boost/geometry/strategies/intersection_strategies.hpp @@ -2,8 +2,9 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016-2020. -// Modifications copyright (c) 2016-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2024. +// Modifications copyright (c) 2016-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -17,7 +18,6 @@ //#include #include -#include #include #include @@ -41,21 +41,15 @@ template typename Geometry1, typename Geometry2, typename IntersectionPoint, - typename RobustPolicy, typename CalculationType = void > struct intersection_strategies { private : - // for development BOOST_STATIC_ASSERT((! std::is_same::type::value)); - typedef segment_intersection_points < IntersectionPoint, - typename detail::segment_ratio_type - < - IntersectionPoint, RobustPolicy - >::type + typename segment_ratio_type::type > ip_type; public: @@ -69,14 +63,6 @@ private : Tag, CalculationType >::type segment_intersection_strategy_type; - - typedef typename strategy::side::services::default_strategy - < - Tag, - CalculationType - >::type side_strategy_type; - - typedef RobustPolicy rescale_policy_type; }; diff --git a/include/boost/geometry/strategies/normalize.hpp b/include/boost/geometry/strategies/normalize.hpp index a722b1fe..8cfaf952 100644 --- a/include/boost/geometry/strategies/normalize.hpp +++ b/include/boost/geometry/strategies/normalize.hpp @@ -14,8 +14,6 @@ #include #include -#include - #include #include #include @@ -25,6 +23,7 @@ #include #include +#include #include @@ -57,7 +56,7 @@ struct assign_loop PointIn const& point_in, PointOut& point_out) { - geometry::set(point_out, boost::numeric_cast + geometry::set(point_out, util::numeric_cast < typename coordinate_type::type >(geometry::get(point_in))); @@ -90,7 +89,7 @@ struct assign_loop<0, DimensionCount> PointIn const& point_in, PointOut& point_out) { - geometry::set<0>(point_out, boost::numeric_cast + geometry::set<0>(point_out, util::numeric_cast < typename coordinate_type::type >(longitude)); @@ -111,7 +110,7 @@ struct assign_loop<1, DimensionCount> PointIn const& point_in, PointOut& point_out) { - geometry::set<1>(point_out, boost::numeric_cast + geometry::set<1>(point_out, util::numeric_cast < typename coordinate_type::type >(latitude)); @@ -230,11 +229,7 @@ struct spherical_point detail::normalize_point < PointIn, PointOut, - (! std::is_same - < - typename cs_tag::type, - spherical_polar_tag - >::value) + (! std::is_same, spherical_polar_tag>::value) >::apply(point_in, point_out); } }; @@ -247,11 +242,7 @@ struct spherical_box detail::normalize_box < BoxIn, BoxOut, - (! std::is_same - < - typename cs_tag::type, - spherical_polar_tag - >::value) + (! std::is_same, spherical_polar_tag>::value) >::apply(box_in, box_out); } }; diff --git a/include/boost/geometry/strategies/side_info.hpp b/include/boost/geometry/strategies/side_info.hpp index d113eaa8..bd257ed9 100644 --- a/include/boost/geometry/strategies/side_info.hpp +++ b/include/boost/geometry/strategies/side_info.hpp @@ -4,6 +4,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2024. +// Modifications copyright (c) 2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -17,7 +21,7 @@ #include #include -#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) +#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) # include #endif @@ -146,7 +150,7 @@ public : return sides[Which].first == 0 ? 0 : 1; } -#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) +#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) inline void debug() const { std::cout << sides[0].first << " " diff --git a/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp b/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp index aff36314..5790ead7 100644 --- a/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp +++ b/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -16,6 +18,8 @@ #include #include +#include + #include #include #include @@ -85,13 +89,21 @@ class cross_track { using CT = typename calculation_type::type; + model::point + < + CT, + dimension::value, + typename coordinate_system::type + > result; + // http://williams.best.vwh.net/avform.htm#XTE CT d3 = m_strategy.apply(sp1, sp2); if (geometry::math::equals(d3, 0.0)) { // "Degenerate" segment, return either d1 or d2 - return sp1; + geometry::detail::conversion::convert_point_to_point(sp1, result); + return result; } CT d1 = m_strategy.apply(sp1, p); @@ -159,24 +171,18 @@ class cross_track false >(lon1, lat1, s14_sph, a12, srs::sphere(earth_radius)); - model::point - < - CT, - dimension::value, - typename coordinate_system::type - > cp; - - geometry::set_from_radian<0>(cp, res_direct.lon2); - geometry::set_from_radian<1>(cp, res_direct.lat2); + geometry::set_from_radian<0>(result, res_direct.lon2); + geometry::set_from_radian<1>(result, res_direct.lat2); - return cp; + return result; } else { #ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK std::cout << "Projection OUTSIDE the segment" << std::endl; #endif - return d1 < d2 ? sp1 : sp2; + geometry::detail::conversion::convert_point_to_point(d1 < d2 ? sp1 : sp2, result); + return result; } } diff --git a/include/boost/geometry/strategies/spherical/disjoint_segment_box.hpp b/include/boost/geometry/strategies/spherical/disjoint_segment_box.hpp index 29b6bdaf..ac4235f1 100644 --- a/include/boost/geometry/strategies/spherical/disjoint_segment_box.hpp +++ b/include/boost/geometry/strategies/spherical/disjoint_segment_box.hpp @@ -16,11 +16,6 @@ #include #include -#include - -#include -#include - #include #include #include @@ -36,6 +31,9 @@ #include #include +#include +#include + namespace boost { namespace geometry { namespace strategy { namespace disjoint { @@ -56,9 +54,7 @@ struct segment_box_spherical template static inline bool apply(Segment const& segment, Box const& box) { - typedef typename point_type::type segment_point_type; - typedef typename coordinate_type::type CT; - geometry::strategy::azimuth::spherical azimuth_strategy; + geometry::strategy::azimuth::spherical>> azimuth_strategy; return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid < diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp index 9b778a7f..f021cf99 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp @@ -87,8 +87,8 @@ public : // this method assumes that the coordinates of the point and // the box are normalized - typedef typename point_type::type box_point_type1; - typedef typename point_type::type box_point_type2; + using box_point_type1 = point_type_t; + using box_point_type2 = point_type_t; box_point_type1 bottom_left1, bottom_right1, top_left1, top_right1; geometry::detail::assign_box_corners(box1, @@ -277,8 +277,8 @@ class cross_track_box_box template struct return_type : services::return_type::type, - typename point_type::type> + point_type_t, + point_type_t> {}; typedef typename Strategy::radius_type radius_type; @@ -338,8 +338,8 @@ class cross_track_box_box (concepts::PointDistanceStrategy < Strategy, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >) ); #endif @@ -429,8 +429,8 @@ struct result_from_distance return result_from_distance < Strategy, - typename point_type::type, - typename point_type::type + point_type_t, + point_type_t >::apply(s, distance); } }; @@ -455,7 +455,7 @@ struct default_strategy typename default_strategy < point_tag, point_tag, - typename point_type::type, typename point_type::type, + point_type_t, point_type_t, spherical_equatorial_tag, spherical_equatorial_tag >::type, Strategy diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp index 8b5178ca..c4c7fa79 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp @@ -65,7 +65,7 @@ public : // this method assumes that the coordinates of the point and // the box are normalized - typedef typename point_type::type box_point_type; + using box_point_type = point_type_t; box_point_type bottom_left, bottom_right, top_left, top_right; geometry::detail::assign_box_corners(box, @@ -83,7 +83,7 @@ public : ReturnType const pi = math::pi(); ReturnType const two_pi = math::two_pi(); - typedef typename point_type::type box_point_type; + using box_point_type = point_type_t; // First check if the point is within the band defined by the // minimum and maximum longitude of the box; if yes, determine @@ -205,7 +205,7 @@ class cross_track_point_box public: template struct return_type - : services::return_type::type> + : services::return_type> {}; typedef typename Strategy::radius_type radius_type; @@ -266,7 +266,7 @@ class cross_track_point_box ( (concepts::PointDistanceStrategy < - Strategy, Point, typename point_type::type + Strategy, Point, point_type_t >) ); #endif @@ -354,7 +354,7 @@ struct result_from_distance return result_from_distance < - Strategy, P, typename point_type::type + Strategy, P, point_type_t >::apply(s, distance); } }; @@ -379,7 +379,7 @@ struct default_strategy typename default_strategy < point_tag, point_tag, - Point, typename point_type::type, + Point, point_type_t, spherical_equatorial_tag, spherical_equatorial_tag >::type, Strategy diff --git a/include/boost/geometry/strategies/spherical/distance_haversine.hpp b/include/boost/geometry/strategies/spherical/distance_haversine.hpp index 38927725..dc62c60e 100644 --- a/include/boost/geometry/strategies/spherical/distance_haversine.hpp +++ b/include/boost/geometry/strategies/spherical/distance_haversine.hpp @@ -41,6 +41,15 @@ namespace strategy { namespace distance namespace comparable { +// Haversine: +// (from Wiki:) The great circle distance d between two +// points with coordinates {lat1,lon1} and {lat2,lon2} is given by: +// d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2)) +// A mathematically equivalent formula, which is less subject +// to rounding error for short distances is: +// d = 2 * asin(sqrt((sin((lat1-lat2) / 2))^2 +// + cos(lat1)*cos(lat2)*(sin((lon1-lon2) / 2))^2)) +// // Comparable haversine. // To compare distances, we can avoid: // - multiplication with radius and 2.0 @@ -124,13 +133,6 @@ on a perfect sphere using haversine \tparam CalculationType \tparam_calculation \author Adapted from: http://williams.best.vwh.net/avform.htm \see http://en.wikipedia.org/wiki/Great-circle_distance -\note (from Wiki:) The great circle distance d between two -points with coordinates {lat1,lon1} and {lat2,lon2} is given by: - d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2)) -A mathematically equivalent formula, which is less subject - to rounding error for short distances is: - d=2*asin(sqrt((sin((lat1-lat2) / 2))^2 - + cos(lat1)*cos(lat2)*(sin((lon1-lon2) / 2))^2)) \qbk{ [heading See also] [link geometry.reference.algorithms.distance.distance_3_with_strategy distance (with strategy)] diff --git a/include/boost/geometry/strategies/spherical/distance_segment_box.hpp b/include/boost/geometry/strategies/spherical/distance_segment_box.hpp index c48377d7..32ce3bca 100644 --- a/include/boost/geometry/strategies/spherical/distance_segment_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_segment_box.hpp @@ -25,6 +25,9 @@ #include // spherical #include +#include + + namespace boost { namespace geometry { @@ -148,7 +151,7 @@ struct generic_segment_box if (less_equal(geometry::get_as_radian<0>(bottom_left), geometry::get_as_radian<0>(p_max))) { - result = boost::numeric_cast( + result = util::numeric_cast( strategies.distance(bottom_left, seg).apply(bottom_left, p0, p1)); } else diff --git a/include/boost/geometry/strategies/spherical/intersection.hpp b/include/boost/geometry/strategies/spherical/intersection.hpp index fdd44c5d..804efd76 100644 --- a/include/boost/geometry/strategies/spherical/intersection.hpp +++ b/include/boost/geometry/strategies/spherical/intersection.hpp @@ -2,7 +2,8 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2016-2021, Oracle and/or its affiliates. +// Copyright (c) 2016-2024, Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, @@ -23,7 +24,6 @@ #include #include #include -#include #include #include @@ -133,8 +133,8 @@ struct ecef_segments } Vector3d intersection_point; - SegmentRatio robust_ra; - SegmentRatio robust_rb; + SegmentRatio ra; + SegmentRatio rb; intersection_point_flag ip_flag; CalcPolicy const& calc_policy; @@ -424,8 +424,8 @@ struct ecef_segments vec3d_t > sinfo(calc_policy); - sinfo.robust_ra.assign(dist_a1_i1, dist_a1_a2); - sinfo.robust_rb.assign(dist_b1_i1, dist_b1_b2); + sinfo.ra.assign(dist_a1_i1, dist_a1_a2); + sinfo.rb.assign(dist_b1_i1, dist_b1_b2); sinfo.intersection_point = i1; sinfo.ip_flag = ip_flag; diff --git a/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp b/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp index ca61e4fc..a11c3c70 100644 --- a/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp +++ b/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2023. -// Modifications copyright (c) 2013-2023 Oracle and/or its affiliates. +// This file was modified by Oracle on 2013-2024. +// Modifications copyright (c) 2013-2024 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -395,8 +395,13 @@ class spherical_winding_base } calc_t const p = get<0>(point); - calc_t const s1 = get<0>(seg1); - calc_t const s2 = get<0>(seg2); + calc_t s1 = get<0>(seg1); + calc_t s2 = get<0>(seg2); + + // In case of a segment that contains a pole endpoint we need an arbitrary but consistent + // longitude for that endpoint different than p's longitude + if (s1_is_pole) s1 = (p != 0) ? 0 : 1; + if (s2_is_pole) s2 = (p != 0) ? 0 : 1; calc_t const s1_p = math::longitude_distance_signed(s1, p); diff --git a/include/boost/geometry/strategies/spherical/point_order.hpp b/include/boost/geometry/strategies/spherical/point_order.hpp index 52450dc6..3f9eb8ce 100644 --- a/include/boost/geometry/strategies/spherical/point_order.hpp +++ b/include/boost/geometry/strategies/spherical/point_order.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2019-2020, Oracle and/or its affiliates. +// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2019-2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -100,7 +101,7 @@ namespace strategy { namespace point_order // spherical_polar_tag // >::value; // -// if (BOOST_GEOMETRY_CONDITION(is_polar)) +// if BOOST_GEOMETRY_CONSTEXPR (is_polar) // { // CalcT pi_half = math::half_pi(); // lat1 = pi_half - lat1; diff --git a/include/boost/geometry/strategies/strategies.hpp b/include/boost/geometry/strategies/strategies.hpp index d219d005..3c1e3984 100644 --- a/include/boost/geometry/strategies/strategies.hpp +++ b/include/boost/geometry/strategies/strategies.hpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/geometry/strategies/strategy_transform.hpp b/include/boost/geometry/strategies/strategy_transform.hpp index ee2216ac..d095a374 100644 --- a/include/boost/geometry/strategies/strategy_transform.hpp +++ b/include/boost/geometry/strategies/strategy_transform.hpp @@ -23,8 +23,6 @@ #include #include -#include - #include #include #include @@ -34,6 +32,7 @@ #include #include +#include #include namespace boost { namespace geometry @@ -60,7 +59,7 @@ struct transform_coordinates typedef typename select_coordinate_type::type coordinate_type; F function; - set(dest, boost::numeric_cast(function(get(source), value))); + set(dest, util::numeric_cast(function(get(source), value))); transform_coordinates::transform(source, dest, value); } }; diff --git a/include/boost/geometry/strategies/transform/map_transformer.hpp b/include/boost/geometry/strategies/transform/map_transformer.hpp index 01ea6168..101be83f 100644 --- a/include/boost/geometry/strategies/transform/map_transformer.hpp +++ b/include/boost/geometry/strategies/transform/map_transformer.hpp @@ -18,6 +18,8 @@ #include #include +#include + namespace boost { namespace geometry { @@ -117,8 +119,8 @@ private : // Scale is in PIXELS/MAPUNITS (meters) W wdx = wx2 - wx1; W wdy = wy2 - wy1; - type sx = (px2 - px1) / boost::numeric_cast(wdx); - type sy = (py2 - py1) / boost::numeric_cast(wdy); + type sx = (px2 - px1) / util::numeric_cast(wdx); + type sy = (py2 - py1) / util::numeric_cast(wdy); if (SameScale) { diff --git a/include/boost/geometry/strategies/transform/matrix_transformers.hpp b/include/boost/geometry/strategies/transform/matrix_transformers.hpp index 70f11b88..937cc148 100644 --- a/include/boost/geometry/strategies/transform/matrix_transformers.hpp +++ b/include/boost/geometry/strategies/transform/matrix_transformers.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ struct set_point_from_vec static inline void apply(Point & p, Vector const& v) { typedef typename geometry::coordinate_type::type coord_t; - set(p, boost::numeric_cast(qvm::A(v))); + set(p, util::numeric_cast(qvm::A(v))); set_point_from_vec::apply(p, v); } }; @@ -197,8 +198,8 @@ public : ct const& c2 = get<1>(p1); typedef typename geometry::coordinate_type::type ct2; - set<0>(p2, boost::numeric_cast(c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + qvm::A<0,2>(this->m_matrix))); - set<1>(p2, boost::numeric_cast(c1 * qvm::A<1,0>(this->m_matrix) + c2 * qvm::A<1,1>(this->m_matrix) + qvm::A<1,2>(this->m_matrix))); + set<0>(p2, util::numeric_cast(c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + qvm::A<0,2>(this->m_matrix))); + set<1>(p2, util::numeric_cast(c1 * qvm::A<1,0>(this->m_matrix) + c2 * qvm::A<1,1>(this->m_matrix) + qvm::A<1,2>(this->m_matrix))); return true; } @@ -241,9 +242,9 @@ public : typedef typename geometry::coordinate_type::type ct2; - set<0>(p2, boost::numeric_cast( + set<0>(p2, util::numeric_cast( c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + c3 * qvm::A<0,2>(this->m_matrix) + qvm::A<0,3>(this->m_matrix))); - set<1>(p2, boost::numeric_cast( + set<1>(p2, util::numeric_cast( c1 * qvm::A<1,0>(this->m_matrix) + c2 * qvm::A<1,1>(this->m_matrix) + c3 * qvm::A<1,2>(this->m_matrix) + qvm::A<1,3>(this->m_matrix))); return true; @@ -290,11 +291,11 @@ public : typedef typename geometry::coordinate_type::type ct2; - set<0>(p2, boost::numeric_cast( + set<0>(p2, util::numeric_cast( c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + c3 * qvm::A<0,2>(this->m_matrix) + qvm::A<0,3>(this->m_matrix))); - set<1>(p2, boost::numeric_cast( + set<1>(p2, util::numeric_cast( c1 * qvm::A<1,0>(this->m_matrix) + c2 * qvm::A<1,1>(this->m_matrix) + c3 * qvm::A<1,2>(this->m_matrix) + qvm::A<1,3>(this->m_matrix))); - set<2>(p2, boost::numeric_cast( + set<2>(p2, util::numeric_cast( c1 * qvm::A<2,0>(this->m_matrix) + c2 * qvm::A<2,1>(this->m_matrix) + c3 * qvm::A<2,2>(this->m_matrix) + qvm::A<2,3>(this->m_matrix))); return true; diff --git a/include/boost/geometry/strategies/within.hpp b/include/boost/geometry/strategies/within.hpp index 954ceefe..a63ccafc 100644 --- a/include/boost/geometry/strategies/within.hpp +++ b/include/boost/geometry/strategies/within.hpp @@ -52,28 +52,28 @@ template < typename GeometryContained, typename GeometryContaining, - typename TagContained = typename tag::type, - typename TagContaining = typename tag::type, - typename CastedTagContained = typename tag_cast + typename TagContained = tag_t, + typename TagContaining = tag_t, + typename CastedTagContained = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CastedTagContaining = typename tag_cast + >, + typename CastedTagContaining = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CsTagContained = typename tag_cast + >, + typename CsTagContained = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type, - typename CsTagContaining = typename tag_cast + >, + typename CsTagContaining = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type + > > struct default_strategy { diff --git a/include/boost/geometry/strategy/relate.hpp b/include/boost/geometry/strategy/relate.hpp index fa523d84..507d5ad0 100644 --- a/include/boost/geometry/strategy/relate.hpp +++ b/include/boost/geometry/strategy/relate.hpp @@ -90,19 +90,12 @@ namespace detail template struct default_intersection_strategy - : strategy::intersection::services::default_strategy - < - typename cs_tag::type - > + : strategy::intersection::services::default_strategy> {}; template struct default_point_in_geometry_strategy - : point_in_geometry::services::default_strategy - < - typename point_type::type, - Geometry - > + : point_in_geometry::services::default_strategy, Geometry> {}; } // namespace detail diff --git a/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp b/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp index 7302c41b..04936089 100644 --- a/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp @@ -210,8 +210,8 @@ class spherical_multipoint template static inline void apply(MultiPoint const& multipoint, Box& mbr) { - typedef typename point_type::type point_type; - typedef typename coordinate_type::type coordinate_type; + using point_type = point_type_t; + using coordinate_type = coordinate_type_t; typedef math::detail::constants_on_spheroid < coordinate_type, diff --git a/include/boost/geometry/strategy/spherical/envelope_point.hpp b/include/boost/geometry/strategy/spherical/envelope_point.hpp index d11b38b2..9a52d917 100644 --- a/include/boost/geometry/strategy/spherical/envelope_point.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_point.hpp @@ -52,7 +52,7 @@ struct spherical_point Point normalized_point; strategy::normalize::spherical_point::apply(point, normalized_point); - typename point_type::type box_point; + point_type_t box_point; // transform units of input point to units of a box point geometry::detail::envelope::transform_units(normalized_point, box_point); diff --git a/include/boost/geometry/strategy/spherical/envelope_range.hpp b/include/boost/geometry/strategy/spherical/envelope_range.hpp index 8833bd8e..e9f5ba21 100644 --- a/include/boost/geometry/strategy/spherical/envelope_range.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_range.hpp @@ -10,6 +10,8 @@ #ifndef BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_RANGE_HPP #define BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_RANGE_HPP +#include + #include #include #include diff --git a/include/boost/geometry/strategy/spherical/envelope_segment.hpp b/include/boost/geometry/strategy/spherical/envelope_segment.hpp index 428f0f71..75db51a7 100644 --- a/include/boost/geometry/strategy/spherical/envelope_segment.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_segment.hpp @@ -16,7 +16,6 @@ #include #include -#include #include @@ -40,6 +39,7 @@ #include #include +#include namespace boost { namespace geometry { namespace strategy { namespace envelope { @@ -288,22 +288,22 @@ class envelope_segment_impl geometry::set < min_corner, 0 - >(helper_mbr, boost::numeric_cast(lon1)); + >(helper_mbr, util::numeric_cast(lon1)); geometry::set < min_corner, 1 - >(helper_mbr, boost::numeric_cast(lat1)); + >(helper_mbr, util::numeric_cast(lat1)); geometry::set < max_corner, 0 - >(helper_mbr, boost::numeric_cast(lon2)); + >(helper_mbr, util::numeric_cast(lon2)); geometry::set < max_corner, 1 - >(helper_mbr, boost::numeric_cast(lat2)); + >(helper_mbr, util::numeric_cast(lat2)); geometry::detail::envelope::transform_units(helper_mbr, mbr); } @@ -343,7 +343,7 @@ class envelope_segment_impl Box& mbr, Strategy const& strategy) { - typedef envelope_segment_convert_polar::type> convert_polar; + typedef envelope_segment_convert_polar> convert_polar; convert_polar::pre(lat1, lat2); diff --git a/include/boost/geometry/strategy/spherical/expand_box.hpp b/include/boost/geometry/strategy/spherical/expand_box.hpp index 9400f0cc..3e775d30 100644 --- a/include/boost/geometry/strategy/spherical/expand_box.hpp +++ b/include/boost/geometry/strategy/spherical/expand_box.hpp @@ -38,6 +38,8 @@ #include +#include + #include namespace boost { namespace geometry diff --git a/include/boost/geometry/strategy/spherical/expand_point.hpp b/include/boost/geometry/strategy/spherical/expand_point.hpp index 354a4c8c..e3a87935 100644 --- a/include/boost/geometry/strategy/spherical/expand_point.hpp +++ b/include/boost/geometry/strategy/spherical/expand_point.hpp @@ -61,15 +61,14 @@ struct point_loop_on_spheroid template static inline void apply(Box& box, Point const& point) { - typedef typename point_type::type box_point_type; - typedef typename coordinate_type::type box_coordinate_type; - typedef typename geometry::detail::cs_angular_units::type units_type; - - typedef math::detail::constants_on_spheroid + using box_point_type = point_type_t; + using box_coordinate_type = coordinate_type_t; + using units_type = typename geometry::detail::cs_angular_units::type; + using constants = math::detail::constants_on_spheroid < box_coordinate_type, units_type - > constants; + >; // normalize input point and input box Point p_normalized; @@ -189,7 +188,7 @@ struct spherical_point expand::detail::point_loop_on_spheroid < dimension::value, - ! std::is_same::type, spherical_polar_tag>::value + ! std::is_same, spherical_polar_tag>::value >::apply(box, point); } }; diff --git a/include/boost/geometry/util/bounds.hpp b/include/boost/geometry/util/bounds.hpp new file mode 100644 index 00000000..dbd3920f --- /dev/null +++ b/include/boost/geometry/util/bounds.hpp @@ -0,0 +1,28 @@ +// Boost.Geometry + +// Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_UTIL_BOUNDS_HPP +#define BOOST_GEOMETRY_UTIL_BOUNDS_HPP + +#include + +namespace boost { namespace geometry { namespace util +{ + +// Define a boost::geometry::util::bounds +// It might be specialized for other numeric types, for example Boost.Rational +template +struct bounds +{ + static CT lowest () { return boost::numeric::bounds::lowest(); } + static CT highest () { return boost::numeric::bounds::highest(); } +}; + +}}} // namespace boost::geometry::util + +#endif // BOOST_GEOMETRY_UTIL_BOUNDS_HPP diff --git a/include/boost/geometry/util/for_each_with_index.hpp b/include/boost/geometry/util/for_each_with_index.hpp deleted file mode 100644 index 425f2a49..00000000 --- a/include/boost/geometry/util/for_each_with_index.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Boost.Geometry - -// Copyright (c) 2023 Barend Gehrels, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP -#define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP - -#include -#include -#include - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -// Utility function to implement a Kotlin like range based for loop -template -inline void for_each_with_index(Container const& container, Function func) -{ - typename boost::range_size::type index = 0; - for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index) - { - func(index, *it); - } -} - -template -inline void for_each_with_index(Container& container, Function func) -{ - typename boost::range_size::type index = 0; - for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index) - { - func(index, *it); - } -} - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP diff --git a/include/boost/geometry/util/is_inverse_spheroidal_coordinates.hpp b/include/boost/geometry/util/is_inverse_spheroidal_coordinates.hpp index 59746653..3e9e7bd0 100644 --- a/include/boost/geometry/util/is_inverse_spheroidal_coordinates.hpp +++ b/include/boost/geometry/util/is_inverse_spheroidal_coordinates.hpp @@ -16,26 +16,20 @@ #include #include +#include #include namespace boost { namespace geometry { -template -struct bounds -{ - static CT lowest () { return boost::numeric::bounds::lowest(); } - static CT highest () { return boost::numeric::bounds::highest(); } -}; - template bool is_inverse_spheroidal_coordinates(Box const& box) { - typedef typename point_type::type point_type; - typedef typename coordinate_type::type bound_type; + using point_type = point_type_t; + using bound_type = coordinate_type_t; - bound_type high = bounds::highest(); - bound_type low = bounds::lowest(); + bound_type const high = util::bounds::highest(); + bound_type const low = util::bounds::lowest(); return (geometry::get<0, 0>(box) == high) && (geometry::get<0, 1>(box) == high) && diff --git a/include/boost/geometry/util/math.hpp b/include/boost/geometry/util/math.hpp index c88572ed..ed011da7 100644 --- a/include/boost/geometry/util/math.hpp +++ b/include/boost/geometry/util/math.hpp @@ -31,10 +31,10 @@ #include #include //#include -#include #include +#include #include namespace boost { namespace geometry @@ -351,7 +351,7 @@ struct square_root return square_root_for_fundamental_fp < double - >::apply(boost::numeric_cast(value)); + >::apply(util::numeric_cast(value)); } }; @@ -450,7 +450,7 @@ struct define_half_pi template struct relaxed_epsilon { - static inline T apply(const T& factor) + static inline T apply(T const& factor) { return factor * std::numeric_limits::epsilon(); } @@ -499,7 +499,7 @@ struct rounding_cast { static inline Result apply(Source const& v) { - return boost::numeric_cast(v); + return util::numeric_cast(v); } }; @@ -519,7 +519,7 @@ struct rounding_cast { static inline Result apply(Source const& v) { - return boost::numeric_cast(v < Source(0) ? + return util::numeric_cast(v < Source(0) ? v - Source(0.5) : v + Source(0.5)); } diff --git a/include/boost/geometry/util/numeric_cast.hpp b/include/boost/geometry/util/numeric_cast.hpp new file mode 100644 index 00000000..3809ebae --- /dev/null +++ b/include/boost/geometry/util/numeric_cast.hpp @@ -0,0 +1,45 @@ +// Boost.Geometry + +// Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP +#define BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP + +#include + +namespace boost { namespace geometry { namespace util + +{ + +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + +/// brief calls numeric cast +template +struct numeric_caster +{ + static inline Target apply(Source const& source) + { + return boost::numeric_cast(source); + } +}; + +} // namespace detail +#endif + +// Calls either boost::numeric_cast, or functionality specific for Boost.Geometry +// (such as rational_cast for Boost.Rational) +template +inline Target numeric_cast(Source const& source) +{ + return detail::numeric_caster::apply(source); +} + +}}} // namespace boost::geometry::util + +#endif // BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP diff --git a/include/boost/geometry/util/precise_math.hpp b/include/boost/geometry/util/precise_math.hpp index fb1b0784..2d367e55 100644 --- a/include/boost/geometry/util/precise_math.hpp +++ b/include/boost/geometry/util/precise_math.hpp @@ -328,7 +328,7 @@ inline RealNumber orient2dtail(vec2d const& p1, * std::numeric_limits::epsilon(); absolute_bound = C_relative_bound * magnitude + sub_bound * std::abs(det); det += (t1[0] * t2[1] + t2[0] * t1[1]) - (t3[0] * t4[1] + t4[0] * t3[1]); - if (Robustness == 2 || std::abs(det) >= absolute_bound) + if (BOOST_GEOMETRY_CONDITION(Robustness == 2) || std::abs(det) >= absolute_bound) { return det; //C estimate } @@ -457,7 +457,10 @@ RealNumber incircle(std::array const& p1, RealNumber det = A_13 * (A_21_x_A_32[0] - A_31_x_A_22[0]) + A_23 * (A_31_x_A_12[0] - A_11_x_A_32[0]) + A_33 * (A_11_x_A_22[0] - A_21_x_A_12[0]); - if(Robustness == 0) return det; + if (BOOST_GEOMETRY_CONDITION(Robustness == 0)) + { + return det; + } RealNumber magnitude = (std::abs(A_21_x_A_32[0]) + std::abs(A_31_x_A_22[0])) * A_13 @@ -585,7 +588,10 @@ RealNumber incircle(std::array const& p1, det = std::accumulate(det_expansion.begin(), det_expansion.begin() + det_expansion_nz, static_cast(0)); - if(Robustness == 1) return det; + if (BOOST_GEOMETRY_CONDITION(Robustness == 1)) + { + return det; + } RealNumber B_relative_bound = (2 + 12 * std::numeric_limits::epsilon()) * std::numeric_limits::epsilon(); diff --git a/include/boost/geometry/util/series_expansion.hpp b/include/boost/geometry/util/series_expansion.hpp index bdc4d7c6..55c8b8f2 100644 --- a/include/boost/geometry/util/series_expansion.hpp +++ b/include/boost/geometry/util/series_expansion.hpp @@ -30,6 +30,7 @@ #ifndef BOOST_GEOMETRY_UTIL_SERIES_EXPANSION_HPP #define BOOST_GEOMETRY_UTIL_SERIES_EXPANSION_HPP +#include #include #include diff --git a/include/boost/geometry/util/type_traits.hpp b/include/boost/geometry/util/type_traits.hpp index c58b5bad..ef9d1979 100644 --- a/include/boost/geometry/util/type_traits.hpp +++ b/include/boost/geometry/util/type_traits.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2020-2021, Oracle and/or its affiliates. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -26,86 +27,130 @@ namespace util template struct is_geometry - : bool_constant::type>::value> + : bool_constant>::value> {}; template struct is_not_geometry - : std::is_void::type> + : std::is_void> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_geometry_v = is_geometry::value; +template +inline constexpr bool is_not_geometry_v = is_not_geometry::value; +#endif + template struct is_point - : std::is_same::type> + : std::is_same> {}; template struct is_multi_point - : std::is_same::type> + : std::is_same> {}; template struct is_pointlike - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_point_v = is_point::value; +template +inline constexpr bool is_multi_point_v = is_multi_point::value; +template +inline constexpr bool is_pointlike_v = is_pointlike::value; +#endif + template struct is_segment - : std::is_same::type> + : std::is_same> {}; template struct is_linestring - : std::is_same::type> + : std::is_same> {}; template struct is_multi_linestring - : std::is_same::type> + : std::is_same> {}; template struct is_polylinear - : std::is_base_of::type> + : std::is_base_of> {}; template struct is_linear - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_segment_v = is_segment::value; +template +inline constexpr bool is_linestring_v = is_linestring::value; +template +inline constexpr bool is_multi_linestring_v = is_multi_linestring::value; +template +inline constexpr bool is_polylinear_v = is_polylinear::value; +template +inline constexpr bool is_linear_v = is_linear::value; +#endif + template struct is_box - : std::is_same::type> + : std::is_same> {}; template struct is_ring - : std::is_same::type> + : std::is_same> {}; template struct is_polygon - : std::is_same::type> + : std::is_same> {}; template struct is_multi_polygon - : std::is_same::type> + : std::is_same> {}; template struct is_polygonal - : std::is_base_of::type> + : std::is_base_of> {}; template struct is_areal - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_box_v = is_box::value; +template +inline constexpr bool is_ring_v = is_ring::value; +template +inline constexpr bool is_polygon_v = is_polygon::value; +template +inline constexpr bool is_multi_polygon_v = is_multi_polygon::value; +template +inline constexpr bool is_polygonal_v = is_polygonal::value; +template +inline constexpr bool is_areal_v = is_areal::value; +#endif + template struct is_segmental @@ -117,36 +162,48 @@ struct is_polysegmental : bool_constant::value || is_polygonal::value> {}; - template struct is_multi - : std::is_base_of::type> + : std::is_base_of> {}; - template struct is_multi_element : bool_constant::value || is_linestring::value || is_polygon::value> {}; - template struct is_single - : std::is_base_of::type> + : std::is_base_of> {}; - template struct is_geometry_collection - : std::is_same::type> + : std::is_same> {}; - template struct is_dynamic_geometry - : std::is_same::type> + : std::is_same> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_segmental_v = is_segmental::value; +template +inline constexpr bool is_polysegmental_v = is_polysegmental::value; +template +inline constexpr bool is_multi_v = is_multi::value; +template +inline constexpr bool is_multi_element_v = is_multi_element::value; +template +inline constexpr bool is_single_v = is_single::value; +template +inline constexpr bool is_geometry_collection_v = is_geometry_collection::value; +template +inline constexpr bool is_dynamic_geometry_v = is_dynamic_geometry::value; +#endif + template struct enable_if_point @@ -307,7 +364,8 @@ using enable_if_geometry_collection_t = typename enable_if_geometry_collection +using is_areal [[deprecated("Use util::is_areal<> instead.")]] = util::is_areal; }} // namespace boost::geometry diff --git a/include/boost/geometry/util/type_traits_std.hpp b/include/boost/geometry/util/type_traits_std.hpp index ebff13b3..3773feac 100644 --- a/include/boost/geometry/util/type_traits_std.hpp +++ b/include/boost/geometry/util/type_traits_std.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2020, Oracle and/or its affiliates. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -54,6 +55,7 @@ struct conjunction : std::conditional_t, Trait> {}; + // C++17 template struct disjunction @@ -68,6 +70,7 @@ struct disjunction : std::conditional_t> {}; + // C++17 template struct negation @@ -195,22 +198,21 @@ using transcribe_cref_t = typename transcribe_cref::type; \endcode */ template -struct add_const_if_c -{ - typedef std::conditional_t +struct [[deprecated("Use util::transcribe_const<> instead.")]] add_const_if_c + : std::conditional < IsConst, Type const, Type - > type; -}; + > +{}; namespace util { template -using bare_type = remove_cptrref; +using bare_type [[deprecated("Use util::remove_cptrref<> instead.")]] = remove_cptrref; } // namespace util diff --git a/include/boost/geometry/views/detail/boundary_view/implementation.hpp b/include/boost/geometry/views/detail/boundary_view/implementation.hpp index 8a17b760..df9842d1 100644 --- a/include/boost/geometry/views/detail/boundary_view/implementation.hpp +++ b/include/boost/geometry/views/detail/boundary_view/implementation.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/include/boost/geometry/views/enumerate_view.hpp b/include/boost/geometry/views/enumerate_view.hpp new file mode 100644 index 00000000..65f3beed --- /dev/null +++ b/include/boost/geometry/views/enumerate_view.hpp @@ -0,0 +1,159 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_VIEWS_ENUMERATE_VIEW_HPP +#define BOOST_GEOMETRY_VIEWS_ENUMERATE_VIEW_HPP + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { namespace geometry +{ + +namespace util +{ + +// This view is a range of values, each with an index +// It is used to iterate over a range, and to get the index of the value +// It is used in the enumerate function +// The typename Range can either be const or non-const +template +struct enumerated_view +{ + // The return value of the iterator + struct value_with_index + { + using type = util::transcribe_const_t + < + Range, + typename boost::range_value::type + >; + + // Member variable index contains the zero-based index of the value in the range + std::size_t const index; + + // Member variable value contains a const or non-const reference to the value itself + type& value; + }; + +private: + // Iterator implementation, not exposed. + struct enumerating_iterator + : public boost::iterator_facade + < + enumerating_iterator, + value_with_index const, + boost::random_access_traversal_tag, + value_with_index const, + typename boost::range_difference::type + > + { + using reference = value_with_index; + using difference_type = typename boost::range_difference::type; + + // Constructor with the range it handles + explicit inline enumerating_iterator(Range& range) + : m_begin(boost::begin(range)) + , m_end(boost::end(range)) + , m_iterator(boost::begin(range)) + {} + + // Constructor to indicate the end of a range + explicit inline enumerating_iterator(Range& range, bool) + : m_begin(boost::begin(range)) + , m_end(boost::end(range)) + , m_iterator(boost::end(range)) + {} + + // There is no default constructor + enumerating_iterator() = delete; + + inline reference dereference() const + { + constexpr difference_type zero = 0; + const std::size_t index = (std::max)(zero, std::distance(m_begin, m_iterator)); + const value_with_index result{index, *m_iterator}; + return result; + } + + inline difference_type distance_to(enumerating_iterator const& other) const + { + return std::distance(other.m_iterator, m_iterator); + } + + inline bool equal(enumerating_iterator const& other) const + { + return + m_begin == other.m_begin + && m_end == other.m_end + && m_iterator == other.m_iterator; + } + + inline void increment() + { + ++m_iterator; + } + + inline void decrement() + { + --m_iterator; + } + + inline void advance(difference_type n) + { + std::advance(m_iterator, n); + } + + const typename boost::range_iterator::type m_begin; + const typename boost::range_iterator::type m_end; + + typename boost::range_iterator::type m_iterator; + }; + +public: + using iterator = enumerating_iterator; + using const_iterator = enumerating_iterator; + + explicit inline enumerated_view(Range& range) + : m_begin(range) + , m_end(range, true) + {} + + inline iterator begin() const { return m_begin; } + inline iterator end() const { return m_end; } + +private: + const iterator m_begin; + const iterator m_end; +}; + +// Helper function to create the enumerated view, for a const range +template +inline auto enumerate(Range const& range) +{ + return util::enumerated_view(range); +} + +// Helper function to create the enumerated view, for a non-const range +template +inline auto enumerate(Range& range) +{ + return util::enumerated_view(range); +} + +}}} // boost::geometry::util + + +#endif // BOOST_GEOMETRY_VIEWS_ENUMERATE_VIEW_HPP diff --git a/include/boost/integer/common_factor_rt.hpp b/include/boost/integer/common_factor_rt.hpp index b8339c7d..817682f2 100644 --- a/include/boost/integer/common_factor_rt.hpp +++ b/include/boost/integer/common_factor_rt.hpp @@ -51,19 +51,20 @@ namespace boost { // // some helper functions which really should be constexpr already, but sadly aren't: // -#ifndef BOOST_NO_CXX14_CONSTEXPR template - inline constexpr T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T) + inline BOOST_CONSTEXPR T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T) { return a < b ? a : b; } + +#ifndef BOOST_NO_CXX14_CONSTEXPR template - inline constexpr auto constexpr_swap(T&a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b)) + inline constexpr auto constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b)) { return a.swap(b); } template - inline constexpr void constexpr_swap(T&a, U& b...) BOOST_GCD_NOEXCEPT(T) + inline constexpr void constexpr_swap(T& a, U& b, ...) BOOST_GCD_NOEXCEPT(T) { T t(static_cast(a)); a = static_cast(b); @@ -71,12 +72,7 @@ namespace boost { } #else template - inline T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T) - { - return a < b ? a : b; - } - template - inline void constexpr_swap(T&a, T& b) BOOST_GCD_NOEXCEPT(T) + inline void constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) { using std::swap; swap(a, b); diff --git a/include/boost/intrusive/detail/algorithm.hpp b/include/boost/intrusive/detail/algorithm.hpp index d2421ffa..f20c9d10 100644 --- a/include/boost/intrusive/detail/algorithm.hpp +++ b/include/boost/intrusive/detail/algorithm.hpp @@ -26,15 +26,15 @@ namespace intrusive { struct algo_pred_equal { - template - bool operator()(const T &x, const T &y) const + template + bool operator()(const T &x, const T2 &y) const { return x == y; } }; struct algo_pred_less { - template - bool operator()(const T &x, const T &y) const + template + bool operator()(const T &x, const T2 &y) const { return x < y; } }; @@ -49,10 +49,6 @@ bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPredicat return true; } -template -bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) -{ return (algo_equal)(first1, last1, first2, algo_pred_equal()); } - template bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinaryPredicate pred) { @@ -62,6 +58,10 @@ bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2 return first1 == last1 && first2 == last2; } +template +bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) +{ return (algo_equal)(first1, last1, first2, algo_pred_equal()); } + template bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) { return (algo_equal)(first1, last1, first2, last2, algo_pred_equal()); } diff --git a/include/boost/intrusive/detail/iterator.hpp b/include/boost/intrusive/detail/iterator.hpp index ec91cd4f..d0ca41c3 100644 --- a/include/boost/intrusive/detail/iterator.hpp +++ b/include/boost/intrusive/detail/iterator.hpp @@ -181,7 +181,7 @@ struct iterator_disable_if_tag_difference_type //////////////////// template -BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type +inline typename iterator_enable_if_tag::type iterator_advance(InputIt& it, typename iter_difference::type n) { while(n--) @@ -197,7 +197,7 @@ typename iterator_enable_if_tag::type } template -BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type +inline typename iterator_enable_if_tag::type iterator_advance(InputIt& it, typename iter_difference::type n) { for (; 0 < n; --n) @@ -207,14 +207,14 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag -BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type +inline typename iterator_enable_if_tag::type iterator_advance(InputIt& it, Distance n) { it += n; } template -BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type +inline typename iterator_enable_if_tag::type make_iterator_advance(InputIt it, Distance n) { (iterator_advance)(it, n); @@ -222,14 +222,14 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag -BOOST_INTRUSIVE_FORCEINLINE +inline void iterator_uadvance(It& it, typename iter_size::type n) { (iterator_advance)(it, (typename iterator_traits::difference_type)n); } template -BOOST_INTRUSIVE_FORCEINLINE +inline It make_iterator_uadvance(It it, typename iter_size::type n) { (iterator_uadvance)(it, n); @@ -253,7 +253,7 @@ typename iterator_disable_if_tag_difference_type } template -BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag_difference_type +inline typename iterator_enable_if_tag_difference_type ::type iterator_distance(InputIt first, InputIt last) { @@ -266,7 +266,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag_difference_type //////////////////////////////////////// template -BOOST_INTRUSIVE_FORCEINLINE typename iter_size::type +inline typename iter_size::type iterator_udistance(It first, It last) { return (typename iter_size::type)(iterator_distance)(first, last); @@ -277,14 +277,14 @@ BOOST_INTRUSIVE_FORCEINLINE typename iter_size::type //////////////////////////////////////// template -BOOST_INTRUSIVE_FORCEINLINE InputIt iterator_next(InputIt it, typename iter_difference::type n) +inline InputIt iterator_next(InputIt it, typename iter_difference::type n) { (iterator_advance)(it, n); return it; } template -BOOST_INTRUSIVE_FORCEINLINE InputIt iterator_unext(InputIt it, typename iterator_traits::size_type n) +inline InputIt iterator_unext(InputIt it, typename iterator_traits::size_type n) { (iterator_uadvance)(it, n); return it; @@ -295,11 +295,11 @@ BOOST_INTRUSIVE_FORCEINLINE InputIt iterator_unext(InputIt it, typename iterator //////////////////////////////////////// template -BOOST_INTRUSIVE_FORCEINLINE typename iterator_traits::pointer iterator_arrow_result(const I &i) +inline typename iterator_traits::pointer iterator_arrow_result(const I &i) { return i.operator->(); } template -BOOST_INTRUSIVE_FORCEINLINE T * iterator_arrow_result(T *p) +inline T * iterator_arrow_result(T *p) { return p; } } //namespace intrusive diff --git a/include/boost/intrusive/detail/mpl.hpp b/include/boost/intrusive/detail/mpl.hpp index d86fa4f3..cf6c7455 100644 --- a/include/boost/intrusive/detail/mpl.hpp +++ b/include/boost/intrusive/detail/mpl.hpp @@ -66,6 +66,12 @@ using boost::move_detail::eval_if_c; using boost::move_detail::eval_if; using boost::move_detail::unvoid_ref; using boost::move_detail::add_const_if_c; +using boost::move_detail::is_integral; +using boost::move_detail::make_unsigned; +using boost::move_detail::is_enum; +using boost::move_detail::is_floating_point; +using boost::move_detail::is_scalar; +using boost::move_detail::is_unsigned; template struct ls_zeros diff --git a/include/boost/intrusive/detail/workaround.hpp b/include/boost/intrusive/detail/workaround.hpp index 0011fb5b..f797b10f 100644 --- a/include/boost/intrusive/detail/workaround.hpp +++ b/include/boost/intrusive/detail/workaround.hpp @@ -48,8 +48,11 @@ #elif defined(BOOST_MSVC) && (_MSC_VER < 1900 || defined(_DEBUG)) //"__forceinline" and MSVC seems to have some bugs in old versions and in debug mode #define BOOST_INTRUSIVE_FORCEINLINE inline -#elif defined(BOOST_GCC) && ((__GNUC__ <= 5) || defined(__MINGW32__)) +#elif defined(BOOST_CLANG) || (defined(BOOST_GCC) && ((__GNUC__ <= 5) || defined(__MINGW32__))) //Older GCCs have problems with forceinline + //Clang can have code bloat issues with forceinline, see + //https://lists.boost.org/boost-users/2023/04/91445.php and + //https://github.com/llvm/llvm-project/issues/62202 #define BOOST_INTRUSIVE_FORCEINLINE inline #else #define BOOST_INTRUSIVE_FORCEINLINE BOOST_FORCEINLINE @@ -81,4 +84,42 @@ # define BOOST_INTRUSIVE_CATCH_END } #endif +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_INTRUSIVE_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__) +# else +# define BOOST_INTRUSIVE_STATIC_ASSERT( B ) static_assert(B, #B) +# endif +#else +namespace boost { +namespace intrusive { +namespace detail { + +template +struct STATIC_ASSERTION_FAILURE; + +template<> +struct STATIC_ASSERTION_FAILURE{}; + +template struct static_assert_test {}; + +}}} + +#define BOOST_INTRUSIVE_STATIC_ASSERT(B) \ + typedef ::boost::intrusive::detail::static_assert_test<\ + (unsigned)sizeof(::boost::intrusive::detail::STATIC_ASSERTION_FAILURE)>\ + BOOST_JOIN(boost_intrusive_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED + +#endif //BOOST_NO_CXX11_STATIC_ASSERT + + +//GCC has some false positives with some functions returning references. +//This silences this warning in selected functions +#if defined(BOOST_GCC) && (BOOST_GCC >= 140000) +# define BOOST_INTRUSIVE_NO_DANGLING __attribute__((no_dangling)) +#else +# define BOOST_INTRUSIVE_NO_DANGLING +#endif + + #endif //#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP diff --git a/include/boost/intrusive/pack_options.hpp b/include/boost/intrusive/pack_options.hpp index 66761d76..20e093e9 100644 --- a/include/boost/intrusive/pack_options.hpp +++ b/include/boost/intrusive/pack_options.hpp @@ -14,7 +14,7 @@ #define BOOST_INTRUSIVE_PACK_OPTIONS_HPP #include - +#include #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -338,7 +338,7 @@ struct pack_options //! //! typedef pack_options< empty_default, typename my_pointer >::type::my_pointer_type type; //! -//! BOOST_STATIC_ASSERT(( boost::is_same::value )); +//! BOOST_INTRUSIVE_STATIC_ASSERT(( boost::is_same::value )); //! //! \endcode #define BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME) @@ -368,7 +368,7 @@ struct pack_options //! //! const bool is_incremental = pack_options< empty_default, incremental >::type::is_incremental; //! -//! BOOST_STATIC_ASSERT(( is_incremental == true )); +//! BOOST_INTRUSIVE_STATIC_ASSERT(( is_incremental == true )); //! //! \endcode #define BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 2c8b7739..1984e81f 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,29 +23,12 @@ # pragma once #endif -#include -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ - defined(BOOST_NO_CXX11_FINAL) || \ - defined(BOOST_NO_CXX11_ALIGNOF) || \ - defined(BOOST_NO_CXX11_STATIC_ASSERT) || \ - defined(BOOST_NO_CXX11_SMART_PTR) || \ - defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \ - defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.LexicalCast 1.82 and will be removed in Boost.LexicalCast 1.84.") - -#endif - #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) #define BOOST_LCAST_NO_WCHAR_T #endif -#include +#include + #include #include @@ -67,7 +50,7 @@ namespace boost inline Target lexical_cast(const char* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } @@ -75,7 +58,7 @@ namespace boost inline Target lexical_cast(const unsigned char* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } @@ -83,7 +66,7 @@ namespace boost inline Target lexical_cast(const signed char* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } @@ -92,28 +75,24 @@ namespace boost inline Target lexical_cast(const wchar_t* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } #endif -#ifndef BOOST_NO_CXX11_CHAR16_T template inline Target lexical_cast(const char16_t* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } -#endif -#ifndef BOOST_NO_CXX11_CHAR32_T template inline Target lexical_cast(const char32_t* chars, std::size_t count) { return ::boost::lexical_cast( - ::boost::iterator_range(chars, chars + count) + ::boost::conversion::detail::make_buffer_view(chars, chars + count) ); } -#endif } // namespace boost diff --git a/include/boost/lexical_cast/bad_lexical_cast.hpp b/include/boost/lexical_cast/bad_lexical_cast.hpp index 2dfc77ab..10d1b525 100644 --- a/include/boost/lexical_cast/bad_lexical_cast.hpp +++ b/include/boost/lexical_cast/bad_lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -37,15 +37,9 @@ namespace boost #else public std::bad_cast #endif - -#if defined(BOOST_BORLANDC) && BOOST_WORKAROUND( BOOST_BORLANDC, < 0x560 ) - // under bcc32 5.5.1 bad_cast doesn't derive from exception - , public std::exception -#endif - { public: - bad_lexical_cast() BOOST_NOEXCEPT + bad_lexical_cast() noexcept #ifndef BOOST_NO_TYPEID : source(&typeid(void)), target(&typeid(void)) #endif @@ -56,8 +50,8 @@ namespace boost "source type value could not be interpreted as target"; } - ~bad_lexical_cast() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - {} + bad_lexical_cast(const bad_lexical_cast&) = default; + bad_lexical_cast& operator=(const bad_lexical_cast&) = default; #ifndef BOOST_NO_TYPEID private: @@ -69,15 +63,15 @@ namespace boost public: bad_lexical_cast( const type_info_t &source_type_arg, - const type_info_t &target_type_arg) BOOST_NOEXCEPT + const type_info_t &target_type_arg) noexcept : source(&source_type_arg), target(&target_type_arg) {} - const type_info_t &source_type() const BOOST_NOEXCEPT { + const type_info_t &source_type() const noexcept { return *source; } - const type_info_t &target_type() const BOOST_NOEXCEPT { + const type_info_t &target_type() const noexcept { return *target; } diff --git a/include/boost/lexical_cast/detail/buffer_view.hpp b/include/boost/lexical_cast/detail/buffer_view.hpp new file mode 100644 index 00000000..9b1c6827 --- /dev/null +++ b/include/boost/lexical_cast/detail/buffer_view.hpp @@ -0,0 +1,59 @@ +// Copyright Antony Polukhin, 2011-2024. +// +// Distributed under the 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_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP +#define BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP + +#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#include + +namespace boost { namespace conversion { namespace detail { + + template < typename CharT > + struct buffer_view { + const CharT* begin; + const CharT* end; + }; + + template < typename CharT > + buffer_view make_buffer_view(const CharT* begin, const CharT* end) { + return buffer_view{begin, end}; + } + + inline buffer_view make_buffer_view(const signed char* begin, const signed char* end) { + return buffer_view{ + reinterpret_cast(begin), + reinterpret_cast(end) + }; + } + + inline buffer_view make_buffer_view(const unsigned char* begin, const unsigned char* end) { + return buffer_view{ + reinterpret_cast(begin), + reinterpret_cast(end) + }; + } + + template< typename CharT, typename Elem, typename Traits > + std::basic_ostream& operator<<( + std::basic_ostream& os, + buffer_view r) + { + while (r.begin != r.end) { + os << r.begin[0]; + ++r.begin; + } + return os; + } + +}}} // namespace boost::conversion::detail + +#endif // BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP + diff --git a/include/boost/lexical_cast/detail/converter_lexical.hpp b/include/boost/lexical_cast/detail/converter_lexical.hpp index 39b2bbf2..cd9f76f5 100644 --- a/include/boost/lexical_cast/detail/converter_lexical.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -35,26 +35,33 @@ #include #include #include -#include -#include -#include #include #include #include -#ifndef BOOST_NO_CXX11_HDR_ARRAY #include + +#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW +#include #endif -#include -#include +#include #include #include namespace boost { + // Forward declaration + template + class array; + template + class iterator_range; + + // Forward declaration of boost::basic_string_view from Utility + template class basic_string_view; + namespace detail // normalize_single_byte_char { // Converts signed/unsigned char to char @@ -110,6 +117,12 @@ namespace boost { boost::detail::deduce_character_type_later< const Char* > > {}; + template < typename Char > + struct stream_char_common< boost::conversion::detail::buffer_view< Char > > + { + typedef Char type; + }; + template < typename Char > struct stream_char_common< boost::iterator_range< Char* > >: public boost::conditional< boost::detail::is_character< Char >::value, @@ -166,6 +179,19 @@ namespace boost { > {}; #endif +#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW + template < class Char, class Traits > + struct stream_char_common< std::basic_string_view< Char, Traits > > + { + typedef Char type; + }; +#endif + template < class Char, class Traits > + struct stream_char_common< boost::basic_string_view< Char, Traits > > + { + typedef Char type; + }; + #ifdef BOOST_HAS_INT128 template <> struct stream_char_common< boost::int128_type >: public boost::type_identity< char > {}; template <> struct stream_char_common< boost::uint128_type >: public boost::type_identity< char > {}; @@ -183,33 +209,42 @@ namespace boost { namespace detail // deduce_source_char_impl { // If type T is `deduce_character_type_later` type, then tries to deduce - // character type using boost::has_left_shift metafunction. + // character type using streaming metafunctions. // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char. // Executed at Stage 2 (See deduce_source_char and deduce_target_char) template < class Char > struct deduce_source_char_impl { - typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; + typedef typename boost::detail::normalize_single_byte_char< Char >::type type; }; template < class T > struct deduce_source_char_impl< deduce_character_type_later< T > > { - typedef boost::has_left_shift< std::basic_ostream< char >, T > result_t; + template + static auto left_shift_type(long) + -> decltype( std::declval&>() << std::declval(), char{}); + +#if !defined(BOOST_LCAST_NO_WCHAR_T) + template + static auto left_shift_type(int) + -> decltype( std::declval&>() << std::declval(), wchar_t{}); +#endif + + template + static void left_shift_type(...); + + using type = decltype(left_shift_type(1L)); + static_assert(!std::is_same::value, #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), - "Source type is not std::ostream`able and std::wostream`s are not supported by your STL implementation"); - typedef char type; + "Source type is not std::ostream`able and std::wostream`s are " + "not supported by your STL implementation" #else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - result_t::value, char, wchar_t - >::type type; - - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value), - "Source type is neither std::ostream`able nor std::wostream`able"); + "Source type is neither std::ostream`able nor std::wostream`able" #endif + ); }; } @@ -223,26 +258,35 @@ namespace boost { template < class Char > struct deduce_target_char_impl { - typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; + typedef typename normalize_single_byte_char< Char >::type type; }; template < class T > struct deduce_target_char_impl< deduce_character_type_later > { - typedef boost::has_right_shift, T > result_t; + template + static auto right_shift_type(long) + -> decltype( std::declval&>() >> std::declval(), char{}); + +#if !defined(BOOST_LCAST_NO_WCHAR_T) + template + static auto right_shift_type(int) + -> decltype( std::declval&>() >> std::declval(), wchar_t{}); +#endif + + template + static void right_shift_type(...); + + using type = decltype(right_shift_type(1L)); + static_assert(!std::is_same::value, #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), - "Target type is not std::istream`able and std::wistream`s are not supported by your STL implementation"); - typedef char type; + "Target type is not std::istream`able and std::wistream`s are " + "not supported by your STL implementation" #else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - result_t::value, char, wchar_t - >::type type; - - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift, T >::value), - "Target type is neither std::istream`able nor std::wistream`able"); + "Target type is neither std::istream`able nor std::wistream`able" #endif + ); }; } @@ -266,45 +310,15 @@ namespace boost { template < class T > struct deduce_target_char { - typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type; - typedef BOOST_DEDUCED_TYPENAME deduce_target_char_impl< stage1_type >::type stage2_type; - - typedef stage2_type type; + typedef typename stream_char_common< T >::type stage1_type; + typedef typename deduce_target_char_impl< stage1_type >::type type; }; template < class T > struct deduce_source_char { - typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type; - typedef BOOST_DEDUCED_TYPENAME deduce_source_char_impl< stage1_type >::type stage2_type; - - typedef stage2_type type; - }; - } - - namespace detail // extract_char_traits template - { - // We are attempting to get char_traits<> from T - // template parameter. Otherwise we'll be using std::char_traits - template < class Char, class T > - struct extract_char_traits - : boost::false_type - { - typedef std::char_traits< Char > trait_t; - }; - - template < class Char, class Traits, class Alloc > - struct extract_char_traits< Char, std::basic_string< Char, Traits, Alloc > > - : boost::true_type - { - typedef Traits trait_t; - }; - - template < class Char, class Traits, class Alloc> - struct extract_char_traits< Char, boost::container::basic_string< Char, Traits, Alloc > > - : boost::true_type - { - typedef Traits trait_t; + typedef typename stream_char_common< T >::type stage1_type; + typedef typename deduce_source_char_impl< stage1_type >::type type; }; } @@ -349,19 +363,14 @@ namespace boost { // When is_specialized is false, the whole expression is 0. template struct lcast_src_length< - Source, BOOST_DEDUCED_TYPENAME boost::enable_if >::type + Source, typename boost::enable_if >::type > { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_CONSTANT(std::size_t, value = std::numeric_limits::is_signed + std::numeric_limits::is_specialized + /* == 1 */ std::numeric_limits::digits10 * 2 ); -#else - BOOST_STATIC_CONSTANT(std::size_t, value = 156); - BOOST_STATIC_ASSERT(sizeof(Source) * CHAR_BIT <= 256); -#endif }; // Helper for floating point types. @@ -376,22 +385,17 @@ namespace boost { // sign + leading digit + decimal point + "e" + exponent sign == 5 template struct lcast_src_length< - Source, BOOST_DEDUCED_TYPENAME boost::enable_if >::type + Source, typename boost::enable_if >::type > { - -#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION - BOOST_STATIC_ASSERT( + static_assert( std::numeric_limits::max_exponent10 <= 999999L && std::numeric_limits::min_exponent10 >= -999999L - ); + , ""); BOOST_STATIC_CONSTANT(std::size_t, value = 5 + lcast_precision::value + 6 ); -#else // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION - BOOST_STATIC_CONSTANT(std::size_t, value = 156); -#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION }; } @@ -399,55 +403,29 @@ namespace boost { { template struct lexical_cast_stream_traits { - typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cv_src; + typedef typename boost::detail::array_to_pointer_decay::type src; + typedef typename boost::remove_cv::type no_cv_src; typedef boost::detail::deduce_source_char deduce_src_char_metafunc; - typedef BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::type src_char_t; - typedef BOOST_DEDUCED_TYPENAME boost::detail::deduce_target_char::type target_char_t; + typedef typename deduce_src_char_metafunc::type src_char_t; + typedef typename boost::detail::deduce_target_char::type target_char_t; - typedef BOOST_DEDUCED_TYPENAME boost::detail::widest_char< + typedef typename boost::detail::widest_char< target_char_t, src_char_t >::type char_type; #if !defined(BOOST_NO_CXX11_CHAR16_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) - BOOST_STATIC_ASSERT_MSG(( !boost::is_same::value - && !boost::is_same::value), + static_assert(!boost::is_same::value + && !boost::is_same::value, "Your compiler does not have full support for char16_t" ); #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) - BOOST_STATIC_ASSERT_MSG(( !boost::is_same::value - && !boost::is_same::value), + static_assert(!boost::is_same::value + && !boost::is_same::value, "Your compiler does not have full support for char32_t" ); #endif - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::detail::extract_char_traits::value, - BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits, - BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits - >::type::trait_t traits; - - typedef boost::integral_constant< - bool, - boost::is_same::value && // source is not a wide character based type - (sizeof(char) != sizeof(target_char_t)) && // target type is based on wide character - (!(boost::detail::is_character::value)) - > is_string_widening_required_t; - - typedef boost::integral_constant< - bool, - !(boost::is_integral::value || - boost::detail::is_character< - BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::stage1_type // if we did not get character type at stage1 - >::value // then we have no optimization for that type - ) - > is_source_input_not_optimized_t; - - // If we have an optimized conversion for - // Source, we do not need to construct stringbuf. - BOOST_STATIC_CONSTANT(bool, requires_stringbuf = - (is_string_widening_required_t::value || is_source_input_not_optimized_t::value) - ); + typedef std::char_traits traits; typedef boost::detail::lcast_src_length len_t; }; @@ -460,29 +438,33 @@ namespace boost { { typedef lexical_cast_stream_traits stream_trait; - typedef detail::lexical_istream_limited_src< - BOOST_DEDUCED_TYPENAME stream_trait::char_type, - BOOST_DEDUCED_TYPENAME stream_trait::traits, - stream_trait::requires_stringbuf, + typedef detail::lcast::optimized_src_stream< + typename stream_trait::char_type, + typename stream_trait::traits, stream_trait::len_t::value + 1 - > i_interpreter_type; + > optimized_src_stream; + + template + static auto detect_type(int) + -> decltype(std::declval().stream_in(std::declval>()), optimized_src_stream{}); - typedef detail::lexical_ostream_limited_src< - BOOST_DEDUCED_TYPENAME stream_trait::char_type, - BOOST_DEDUCED_TYPENAME stream_trait::traits - > o_interpreter_type; + template + static lcast::ios_src_stream detect_type(...); - static inline bool try_convert(const Source& arg, Target& result) { - i_interpreter_type i_interpreter; + using from_src_stream = decltype(detect_type(1)); - // Disabling ADL, by directly specifying operators. - if (!(i_interpreter.operator <<(arg))) - return false; + typedef detail::lcast::to_target_stream< + typename stream_trait::char_type, + typename stream_trait::traits + > to_target_stream; - o_interpreter_type out(i_interpreter.cbegin(), i_interpreter.cend()); + static inline bool try_convert(const Source& arg, Target& result) { + from_src_stream src_stream; + if (!src_stream.stream_in(lcast::exact{arg})) + return false; - // Disabling ADL, by directly specifying operators. - if(!(out.operator >>(result))) + to_target_stream out(src_stream.cbegin(), src_stream.cend()); + if (!out.stream_out(result)) return false; return true; diff --git a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp index 04383bf3..4e35a727 100644 --- a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -34,10 +34,12 @@ #include #include #include +#include +#include +#include #include -#include #include -#include +#include #include #ifndef BOOST_NO_STD_LOCALE @@ -59,715 +61,696 @@ #include #endif +#include #include #include +#include #include #include -#ifndef BOOST_NO_CXX11_HDR_ARRAY #include -#endif -#include #include #include #include -#include +#include +#include #include -#include -#include -#include +#include #ifndef BOOST_NO_CWCHAR # include #endif +// Forward declarations namespace boost { - - namespace detail // basic_unlockedbuf - { - // acts as a stream buffer which wraps around a pair of pointers - // and gives acces to internals - template - class basic_unlockedbuf : public basic_pointerbuf { - public: - typedef basic_pointerbuf base_type; - typedef BOOST_DEDUCED_TYPENAME base_type::streamsize streamsize; - -#ifndef BOOST_NO_USING_TEMPLATE - using base_type::pptr; - using base_type::pbase; - using base_type::setbuf; -#else - charT* pptr() const { return base_type::pptr(); } - charT* pbase() const { return base_type::pbase(); } - BufferType* setbuf(char_type* s, streamsize n) { return base_type::setbuf(s, n); } -#endif - }; - } - - namespace detail - { - struct do_not_construct_out_buffer_t{}; - struct do_not_construct_out_stream_t{ - do_not_construct_out_stream_t(do_not_construct_out_buffer_t*){} - }; - - template - struct out_stream_helper_trait { -#if defined(BOOST_NO_STRINGSTREAM) - typedef std::ostream out_stream_t; - typedef basic_unlockedbuf stringbuffer_t; -#elif defined(BOOST_NO_STD_LOCALE) - typedef std::ostream out_stream_t; - typedef basic_unlockedbuf stringbuffer_t; - typedef basic_unlockedbuf buffer_t; -#else - typedef std::basic_ostream out_stream_t; - typedef basic_unlockedbuf, CharT> stringbuffer_t; - typedef basic_unlockedbuf, CharT> buffer_t; -#endif - }; - } - - namespace detail // optimized stream wrappers - { - template< class CharT // a result of widest_char transformation - , class Traits - , bool RequiresStringbuffer - , std::size_t CharacterBufferSize - > - class lexical_istream_limited_src: boost::noncopyable { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - RequiresStringbuffer, - BOOST_DEDUCED_TYPENAME out_stream_helper_trait::out_stream_t, - do_not_construct_out_stream_t - >::type deduced_out_stream_t; - - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - RequiresStringbuffer, - BOOST_DEDUCED_TYPENAME out_stream_helper_trait::stringbuffer_t, - do_not_construct_out_buffer_t - >::type deduced_out_buffer_t; - - deduced_out_buffer_t out_buffer; - deduced_out_stream_t out_stream; - CharT buffer[CharacterBufferSize]; - - // After the `operator <<` finishes, `[start, finish)` is - // the range to output by `operator >>` - const CharT* start; - const CharT* finish; - - public: - lexical_istream_limited_src() BOOST_NOEXCEPT - : out_buffer() - , out_stream(&out_buffer) - , start(buffer) - , finish(buffer + CharacterBufferSize) - {} - - const CharT* cbegin() const BOOST_NOEXCEPT { - return start; - } - - const CharT* cend() const BOOST_NOEXCEPT { - return finish; - } - - private: -/************************************ HELPER FUNCTIONS FOR OPERATORS << ( ... ) ********************************/ - bool shl_char(CharT ch) BOOST_NOEXCEPT { - Traits::assign(buffer[0], ch); - finish = start + 1; - return true; - } + template + class array; + template + class iterator_range; + + // forward declaration of boost::basic_string_view from Utility + template class basic_string_view; +} + +namespace boost { namespace detail { namespace lcast { + + template + struct exact { + static_assert(!boost::is_const::value, ""); + static_assert(!boost::is_reference::value, ""); + + const T& payload; + }; + + template< class CharT // a result of widest_char transformation + , class Traits + , std::size_t CharacterBufferSize + > + class optimized_src_stream { + CharT buffer[CharacterBufferSize]; + + // After the `stream_in(` finishes, `[start, finish)` is + // the range to output by `operator >>` + const CharT* start; + const CharT* finish; + public: + optimized_src_stream(optimized_src_stream&&) = delete; + optimized_src_stream(const optimized_src_stream&) = delete; + optimized_src_stream& operator=(optimized_src_stream&&) = delete; + optimized_src_stream& operator=(const optimized_src_stream&) = delete; + + optimized_src_stream() noexcept + : start(buffer) + , finish(buffer + CharacterBufferSize) + {} + + const CharT* cbegin() const noexcept { + return start; + } + + const CharT* cend() const noexcept { + return finish; + } + + private: + bool shl_char(CharT ch) noexcept { + Traits::assign(buffer[0], ch); + finish = start + 1; + return true; + } #ifndef BOOST_LCAST_NO_WCHAR_T - template - bool shl_char(T ch) { - BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)) , - "boost::lexical_cast does not support narrowing of char types." - "Use boost::locale instead" ); + template + bool shl_char(T ch) { + static_assert(sizeof(T) <= sizeof(CharT), + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - std::locale loc; - CharT const w = BOOST_USE_FACET(std::ctype, loc).widen(ch); + std::locale loc; + CharT const w = BOOST_USE_FACET(std::ctype, loc).widen(ch); #else - CharT const w = static_cast(ch); -#endif - Traits::assign(buffer[0], w); - finish = start + 1; - return true; - } -#endif - - bool shl_char_array(CharT const* str_value) BOOST_NOEXCEPT { - start = str_value; - finish = start + Traits::length(str_value); - return true; - } + CharT const w = static_cast(ch); +#endif + Traits::assign(buffer[0], w); + finish = start + 1; + return true; + } +#endif + + bool shl_char_array(CharT const* str_value) noexcept { + start = str_value; + finish = start + Traits::length(str_value); + return true; + } + + bool shl_char_array_limited(CharT const* str, std::size_t max_size) noexcept { + start = str; + finish = start; + const auto zero = Traits::to_char_type(0); + while (finish < start + max_size && zero != *finish) { + ++ finish; + } + return true; + } + + template + inline bool shl_unsigned(const T n) { + CharT* tmp_finish = buffer + CharacterBufferSize; + start = lcast_put_unsigned(n, tmp_finish).convert(); + finish = tmp_finish; + return true; + } + + template + inline bool shl_signed(const T n) { + CharT* tmp_finish = buffer + CharacterBufferSize; + typedef typename boost::make_unsigned::type utype; + CharT* tmp_start = lcast_put_unsigned(lcast_to_unsigned(n), tmp_finish).convert(); + if (n < 0) { + --tmp_start; + CharT const minus = lcast_char_constants::minus; + Traits::assign(*tmp_start, minus); + } + start = tmp_start; + finish = tmp_finish; + return true; + } + + bool shl_real_type(float val, char* begin) { + const double val_as_double = val; + finish = start + + boost::core::snprintf(begin, CharacterBufferSize, + "%.*g", static_cast(boost::detail::lcast_precision::value), val_as_double); + return finish > start; + } + + bool shl_real_type(double val, char* begin) { + finish = start + + boost::core::snprintf(begin, CharacterBufferSize, + "%.*g", static_cast(boost::detail::lcast_precision::value), val); + return finish > start; + } - template - bool shl_char_array(T const* str_value) { - BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)), - "boost::lexical_cast does not support narrowing of char types." - "Use boost::locale instead" ); - return shl_input_streamable(str_value); - } +#ifndef __MINGW32__ + bool shl_real_type(long double val, char* begin) { + finish = start + + boost::core::snprintf(begin, CharacterBufferSize, + "%.*Lg", static_cast(boost::detail::lcast_precision::value), val ); + return finish > start; + } +#else + bool shl_real_type(long double val, char* begin) { + return shl_real_type(static_cast(val), begin); + } +#endif - bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT { - start = str; - finish = std::find(start, start + max_size, Traits::to_char_type(0)); +#if !defined(BOOST_LCAST_NO_WCHAR_T) + bool shl_real_type(float val, wchar_t* begin) { + const double val_as_double = val; + finish = start + boost::core::swprintf( + begin, CharacterBufferSize, L"%.*g", + static_cast(boost::detail::lcast_precision::value), + val_as_double + ); + return finish > start; + } + + bool shl_real_type(double val, wchar_t* begin) { + finish = start + boost::core::swprintf( + begin, CharacterBufferSize, L"%.*g", + static_cast(boost::detail::lcast_precision::value), + val + ); + return finish > start; + } + + bool shl_real_type(long double val, wchar_t* begin) { + finish = start + boost::core::swprintf( + begin, CharacterBufferSize, L"%.*Lg", + static_cast(boost::detail::lcast_precision::value), + val + ); + return finish > start; + } +#endif + public: + template + using enable_if_compatible_char_t = typename boost::enable_if_c< + boost::is_same::value || ( + boost::is_same::value && ( + boost::is_same::value || + boost::is_same::value + ) + ), bool + >::type; + + template + bool stream_in(lcast::exact> x) noexcept { + start = x.payload.data(); + finish = start + x.payload.length(); + return true; + } + + template + bool stream_in(lcast::exact> x) noexcept { + start = x.payload.data(); + finish = start + x.payload.length(); + return true; + } + + bool stream_in(lcast::exact x) noexcept { + CharT const czero = lcast_char_constants::zero; + Traits::assign(buffer[0], Traits::to_char_type(czero + x.payload)); + finish = start + 1; + return true; + } + + bool stream_in(lcast::exact> x) noexcept { + start = x.payload.begin; + finish = x.payload.end; + return true; + } + + template + enable_if_compatible_char_t + stream_in(lcast::exact> x) noexcept { + auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end()); + return stream_in(lcast::exact{buf}); + } + + bool stream_in(lcast::exact x) { return shl_char(x.payload); } + bool stream_in(lcast::exact x) { return shl_char(static_cast(x.payload)); } + bool stream_in(lcast::exact x) { return shl_char(static_cast(x.payload)); } + + template + typename boost::enable_if_c::value, bool>::type + stream_in(lcast::exact x) { return shl_char(x.payload); } + + template + enable_if_compatible_char_t + stream_in(lcast::exact x) { return shl_char_array(reinterpret_cast(x.payload)); } + + template + typename boost::enable_if_c::value && !boost::is_enum::value, bool>::type + stream_in(lcast::exact x) { return shl_signed(x.payload); } + + template + typename boost::enable_if_c::value && !boost::is_enum::value, bool>::type + stream_in(lcast::exact x) { return shl_unsigned(x.payload); } + + template + auto stream_in(lcast::exact x) -> decltype(shl_real_type(x.payload, buffer)) { + const CharT* inf_nan = detail::get_inf_nan(x.payload, CharT()); + if (inf_nan) { + start = inf_nan; + finish = start + Traits::length(inf_nan); return true; } - - template - bool shl_input_streamable(InputStreamable& input) { + return shl_real_type(x.payload, buffer); + } + + template + enable_if_compatible_char_t + stream_in(lcast::exact> x) noexcept { + return shl_char_array_limited(reinterpret_cast(x.payload.data()), N); + } + + template + enable_if_compatible_char_t + stream_in(lcast::exact> x) noexcept { + return shl_char_array_limited(reinterpret_cast(x.payload.data()), N); + } + +#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW + template + enable_if_compatible_char_t + stream_in(lcast::exact> x) noexcept { + start = reinterpret_cast(x.payload.data()); + finish = start + x.payload.size(); + return true; + } +#endif + template + enable_if_compatible_char_t + stream_in(lcast::exact> x) noexcept { + start = reinterpret_cast(x.payload.data()); + finish = start + x.payload.size(); + return true; + } + }; + + + template + class ios_src_stream { + typedef detail::lcast::out_stream_t deduced_out_stream_t; + typedef detail::lcast::stringbuffer_t deduced_out_buffer_t; + + deduced_out_buffer_t out_buffer; + deduced_out_stream_t out_stream; + + const CharT* start = nullptr; + const CharT* finish = nullptr; + public: + ios_src_stream(ios_src_stream&&) = delete; + ios_src_stream(const ios_src_stream&) = delete; + ios_src_stream& operator=(ios_src_stream&&) = delete; + ios_src_stream& operator=(const ios_src_stream&) = delete; + + ios_src_stream(): out_buffer(), out_stream(&out_buffer) {} + + const CharT* cbegin() const noexcept { + return start; + } + + const CharT* cend() const noexcept { + return finish; + } + private: + const deduced_out_buffer_t* get_rdbuf() const { + return static_cast( + out_stream.rdbuf() + ); + } + + template + bool shl_input_streamable(InputStreamable& input) { #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) - // If you have compilation error at this point, than your STL library - // does not support such conversions. Try updating it. - BOOST_STATIC_ASSERT((boost::is_same::value)); + // If you have compilation error at this point, than your STL library + // does not support such conversions. Try updating it. + static_assert(boost::is_same::value, ""); #endif #ifndef BOOST_NO_EXCEPTIONS - out_stream.exceptions(std::ios::badbit); - try { -#endif - bool const result = !(out_stream << input).fail(); - const deduced_out_buffer_t* const p = static_cast( - out_stream.rdbuf() - ); - start = p->pbase(); - finish = p->pptr(); - return result; + out_stream.exceptions(std::ios::badbit); + try { +#endif + bool const result = !(out_stream << input).fail(); + const auto* const p = get_rdbuf(); + start = p->pbase(); + finish = p->pptr(); + return result; #ifndef BOOST_NO_EXCEPTIONS - } catch (const ::std::ios_base::failure& /*f*/) { - return false; - } -#endif - } - - template - inline bool shl_unsigned(const T n) { - CharT* tmp_finish = buffer + CharacterBufferSize; - start = lcast_put_unsigned(n, tmp_finish).convert(); - finish = tmp_finish; + } catch (const ::std::ios_base::failure& /*f*/) { + return false; + } +#endif + } + + template + bool shl_char_array(T const* str_value) { + static_assert(sizeof(T) <= sizeof(CharT), + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); + return shl_input_streamable(str_value); + } + + template + bool shl_real(T val) { + const CharT* inf_nan = detail::get_inf_nan(val, CharT()); + if (inf_nan) { + start = inf_nan; + finish = start + Traits::length(inf_nan); return true; } - template - inline bool shl_signed(const T n) { - CharT* tmp_finish = buffer + CharacterBufferSize; - typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned::type utype; - CharT* tmp_start = lcast_put_unsigned(lcast_to_unsigned(n), tmp_finish).convert(); - if (n < 0) { - --tmp_start; - CharT const minus = lcast_char_constants::minus; - Traits::assign(*tmp_start, minus); - } - start = tmp_start; - finish = tmp_finish; - return true; - } + lcast_set_precision(out_stream, &val); + return shl_input_streamable(val); + } - template - bool shl_real_type(const T& val, SomeCharT* /*begin*/) { - lcast_set_precision(out_stream, &val); - return shl_input_streamable(val); - } + public: + template + typename boost::enable_if_c::value && sizeof(char) == sizeof(Type), bool>::type + stream_in(lcast::exact x) { return shl_char_array(reinterpret_cast(x.payload)); } - bool shl_real_type(float val, char* begin) { - using namespace std; - const double val_as_double = val; - finish = start + - boost::core::snprintf(begin, CharacterBufferSize, - "%.*g", static_cast(boost::detail::lcast_get_precision()), val_as_double); - return finish > start; - } - - bool shl_real_type(double val, char* begin) { - using namespace std; - finish = start + - boost::core::snprintf(begin, CharacterBufferSize, - "%.*g", static_cast(boost::detail::lcast_get_precision()), val); - return finish > start; - } + template + typename boost::enable_if_c::value && sizeof(char) != sizeof(Type), bool>::type + stream_in(lcast::exact x) { return shl_char_array(x.payload); } + bool stream_in(lcast::exact x) { return shl_real(x.payload); } + bool stream_in(lcast::exact x) { return shl_real(x.payload); } + bool stream_in(lcast::exact x) { #ifndef __MINGW32__ - bool shl_real_type(long double val, char* begin) { - using namespace std; - finish = start + - boost::core::snprintf(begin, CharacterBufferSize, - "%.*Lg", static_cast(boost::detail::lcast_get_precision()), val ); - return finish > start; - } -#endif - - -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__) - bool shl_real_type(float val, wchar_t* begin) { - using namespace std; - const double val_as_double = val; - finish = start + swprintf(begin, CharacterBufferSize, - L"%.*g", - static_cast(boost::detail::lcast_get_precision()), - val_as_double ); - return finish > start; - } - - bool shl_real_type(double val, wchar_t* begin) { - using namespace std; - finish = start + swprintf(begin, CharacterBufferSize, - L"%.*g", static_cast(boost::detail::lcast_get_precision()), val ); - return finish > start; - } - - bool shl_real_type(long double val, wchar_t* begin) { - using namespace std; - finish = start + swprintf(begin, CharacterBufferSize, - L"%.*Lg", static_cast(boost::detail::lcast_get_precision()), val ); - return finish > start; - } -#endif - template - bool shl_real(T val) { - CharT* tmp_finish = buffer + CharacterBufferSize; - if (put_inf_nan(buffer, tmp_finish, val)) { - finish = tmp_finish; - return true; - } - - return shl_real_type(val, static_cast(buffer)); - } - -/************************************ OPERATORS << ( ... ) ********************************/ - public: - template - bool operator<<(std::basic_string const& str) BOOST_NOEXCEPT { - start = str.data(); - finish = start + str.length(); - return true; - } - - template - bool operator<<(boost::container::basic_string const& str) BOOST_NOEXCEPT { - start = str.data(); - finish = start + str.length(); - return true; - } - - bool operator<<(bool value) BOOST_NOEXCEPT { - CharT const czero = lcast_char_constants::zero; - Traits::assign(buffer[0], Traits::to_char_type(czero + value)); - finish = start + 1; - return true; - } - - template - BOOST_DEDUCED_TYPENAME boost::disable_if, bool>::type - operator<<(const iterator_range& rng) BOOST_NOEXCEPT { - return (*this) << iterator_range(rng.begin(), rng.end()); - } - - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { - start = rng.begin(); - finish = rng.end(); - return true; - } - - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { - return (*this) << iterator_range( - reinterpret_cast(rng.begin()), - reinterpret_cast(rng.end()) - ); - } - - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { - return (*this) << iterator_range( - reinterpret_cast(rng.begin()), - reinterpret_cast(rng.end()) - ); - } - - bool operator<<(char ch) { return shl_char(ch); } - bool operator<<(unsigned char ch) { return ((*this) << static_cast(ch)); } - bool operator<<(signed char ch) { return ((*this) << static_cast(ch)); } -#if !defined(BOOST_LCAST_NO_WCHAR_T) - bool operator<<(wchar_t const* str) { return shl_char_array(str); } - bool operator<<(wchar_t * str) { return shl_char_array(str); } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T - bool operator<<(wchar_t ch) { return shl_char(ch); } -#endif -#endif -#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) - bool operator<<(char16_t ch) { return shl_char(ch); } - bool operator<<(char16_t * str) { return shl_char_array(str); } - bool operator<<(char16_t const * str) { return shl_char_array(str); } -#endif -#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) - bool operator<<(char32_t ch) { return shl_char(ch); } - bool operator<<(char32_t * str) { return shl_char_array(str); } - bool operator<<(char32_t const * str) { return shl_char_array(str); } -#endif - bool operator<<(unsigned char const* ch) { return ((*this) << reinterpret_cast(ch)); } - bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast(ch)); } - bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast(ch)); } - bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast(ch)); } - bool operator<<(char const* str_value) { return shl_char_array(str_value); } - bool operator<<(char* str_value) { return shl_char_array(str_value); } - bool operator<<(short n) { return shl_signed(n); } - bool operator<<(int n) { return shl_signed(n); } - bool operator<<(long n) { return shl_signed(n); } - bool operator<<(unsigned short n) { return shl_unsigned(n); } - bool operator<<(unsigned int n) { return shl_unsigned(n); } - bool operator<<(unsigned long n) { return shl_unsigned(n); } - -#if defined(BOOST_HAS_LONG_LONG) - bool operator<<(boost::ulong_long_type n) { return shl_unsigned(n); } - bool operator<<(boost::long_long_type n) { return shl_signed(n); } -#elif defined(BOOST_HAS_MS_INT64) - bool operator<<(unsigned __int64 n) { return shl_unsigned(n); } - bool operator<<( __int64 n) { return shl_signed(n); } -#endif - -#ifdef BOOST_HAS_INT128 - bool operator<<(const boost::uint128_type& n) { return shl_unsigned(n); } - bool operator<<(const boost::int128_type& n) { return shl_signed(n); } -#endif - bool operator<<(float val) { return shl_real(val); } - bool operator<<(double val) { return shl_real(val); } - bool operator<<(long double val) { -#ifndef __MINGW32__ - return shl_real(val); + return shl_real(x.payload); #else - return shl_real(static_cast(val)); -#endif - } - - // Adding constness to characters. Constness does not change layout - template - BOOST_DEDUCED_TYPENAME boost::disable_if, bool>::type - operator<<(boost::array const& input) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(boost::array) == sizeof(boost::array)), - "boost::array and boost::array must have exactly the same layout." - ); - return ((*this) << reinterpret_cast const& >(input)); - } - - template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { - return shl_char_array_limited(input.data(), N); - } - - template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { - return ((*this) << reinterpret_cast const& >(input)); - } - - template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { - return ((*this) << reinterpret_cast const& >(input)); - } - -#ifndef BOOST_NO_CXX11_HDR_ARRAY - // Making a Boost.Array from std::array - template - bool operator<<(std::array const& input) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(std::array) == sizeof(boost::array)), - "std::array and boost::array must have exactly the same layout. " - "Bug in implementation of std::array or boost::array." - ); - return ((*this) << reinterpret_cast const& >(input)); - } -#endif - template - bool operator<<(const InStreamable& input) { return shl_input_streamable(input); } - }; - - - template - class lexical_ostream_limited_src: boost::noncopyable { - //`[start, finish)` is the range to output by `operator >>` - const CharT* start; - const CharT* const finish; - - public: - lexical_ostream_limited_src(const CharT* begin, const CharT* end) BOOST_NOEXCEPT - : start(begin) - , finish(end) - {} - -/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/ - private: - template - bool shr_unsigned(Type& output) { - if (start == finish) return false; - CharT const minus = lcast_char_constants::minus; - CharT const plus = lcast_char_constants::plus; - bool const has_minus = Traits::eq(minus, *start); - - /* We won`t use `start' any more, so no need in decrementing it after */ - if (has_minus || Traits::eq(plus, *start)) { - ++start; - } - - bool const succeed = lcast_ret_unsigned(output, start, finish).convert(); - - if (has_minus) { - output = static_cast(0u - output); - } - - return succeed; - } - - template - bool shr_signed(Type& output) { - if (start == finish) return false; - CharT const minus = lcast_char_constants::minus; - CharT const plus = lcast_char_constants::plus; - typedef BOOST_DEDUCED_TYPENAME make_unsigned::type utype; - utype out_tmp = 0; - bool const has_minus = Traits::eq(minus, *start); - - /* We won`t use `start' any more, so no need in decrementing it after */ - if (has_minus || Traits::eq(plus, *start)) { - ++start; - } - - bool succeed = lcast_ret_unsigned(out_tmp, start, finish).convert(); - if (has_minus) { - utype const comp_val = (static_cast(1) << std::numeric_limits::digits); - succeed = succeed && out_tmp<=comp_val; - output = static_cast(0u - out_tmp); - } else { - utype const comp_val = static_cast((std::numeric_limits::max)()); - succeed = succeed && out_tmp<=comp_val; - output = static_cast(out_tmp); - } - return succeed; - } - - template - bool shr_using_base_class(InputStreamable& output) - { - BOOST_STATIC_ASSERT_MSG( - (!boost::is_pointer::value), - "boost::lexical_cast can not convert to pointers" - ); + return shl_real(static_cast(x.payload)); +#endif + } + + template + typename boost::enable_if_c::value, bool>::type + stream_in(lcast::exact> x) noexcept { + auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end()); + return stream_in(lcast::exact{buf}); + } + + template + typename boost::enable_if_c::value, bool>::type + stream_in(lcast::exact> x) noexcept { + auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end()); + return stream_in(lcast::exact{buf}); + } + + template + bool stream_in(lcast::exact x) { return shl_input_streamable(x.payload); } + }; + + + template + class to_target_stream { + //`[start, finish)` is the range to output by `operator >>` + const CharT* start; + const CharT* const finish; + + public: + to_target_stream(to_target_stream&&) = delete; + to_target_stream(const to_target_stream&) = delete; + to_target_stream& operator=(to_target_stream&&) = delete; + to_target_stream& operator=(const to_target_stream&) = delete; + + to_target_stream(const CharT* begin, const CharT* end) noexcept + : start(begin) + , finish(end) + {} + + private: + template +#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif + bool shr_unsigned(Type& output) { + if (start == finish) return false; + CharT const minus = lcast_char_constants::minus; + CharT const plus = lcast_char_constants::plus; + bool const has_minus = Traits::eq(minus, *start); + + /* We won`t use `start' any more, so no need in decrementing it after */ + if (has_minus || Traits::eq(plus, *start)) { + ++start; + } + + bool const succeed = lcast_ret_unsigned(output, start, finish).convert(); + + if (has_minus) { + output = static_cast(0u - output); + } + + return succeed; + } + + template +#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif + bool shr_signed(Type& output) { + if (start == finish) return false; + CharT const minus = lcast_char_constants::minus; + CharT const plus = lcast_char_constants::plus; + typedef typename make_unsigned::type utype; + utype out_tmp = 0; + bool const has_minus = Traits::eq(minus, *start); + + /* We won`t use `start' any more, so no need in decrementing it after */ + if (has_minus || Traits::eq(plus, *start)) { + ++start; + } + + bool succeed = lcast_ret_unsigned(out_tmp, start, finish).convert(); + if (has_minus) { + utype const comp_val = (static_cast(1) << std::numeric_limits::digits); + succeed = succeed && out_tmp<=comp_val; + output = static_cast(0u - out_tmp); + } else { + utype const comp_val = static_cast((std::numeric_limits::max)()); + succeed = succeed && out_tmp<=comp_val; + output = static_cast(out_tmp); + } + return succeed; + } + + template + bool shr_using_base_class(InputStreamable& output) + { + static_assert( + !boost::is_pointer::value, + "boost::lexical_cast can not convert to pointers" + ); #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) - BOOST_STATIC_ASSERT_MSG((boost::is_same::value), - "boost::lexical_cast can not convert, because your STL library does not " - "support such conversions. Try updating it." - ); + static_assert(boost::is_same::value, + "boost::lexical_cast can not convert, because your STL library does not " + "support such conversions. Try updating it." + ); #endif #if defined(BOOST_NO_STRINGSTREAM) - std::istrstream stream(start, static_cast(finish - start)); + std::istrstream stream(start, static_cast(finish - start)); #else - typedef BOOST_DEDUCED_TYPENAME out_stream_helper_trait::buffer_t buffer_t; - buffer_t buf; - // Usually `istream` and `basic_istream` do not modify - // content of buffer; `buffer_t` assures that this is true - buf.setbuf(const_cast(start), static_cast(finish - start)); + typedef detail::lcast::buffer_t buffer_t; + buffer_t buf; + // Usually `istream` and `basic_istream` do not modify + // content of buffer; `buffer_t` assures that this is true + buf.setbuf(const_cast(start), static_cast(finish - start)); #if defined(BOOST_NO_STD_LOCALE) - std::istream stream(&buf); + std::istream stream(&buf); #else - std::basic_istream stream(&buf); + std::basic_istream stream(&buf); #endif // BOOST_NO_STD_LOCALE #endif // BOOST_NO_STRINGSTREAM #ifndef BOOST_NO_EXCEPTIONS - stream.exceptions(std::ios::badbit); - try { + stream.exceptions(std::ios::badbit); + try { #endif - stream.unsetf(std::ios::skipws); - lcast_set_precision(stream, static_cast(0)); + stream.unsetf(std::ios::skipws); + lcast_set_precision(stream, static_cast(0)); - return (stream >> output) - && (stream.get() == Traits::eof()); + return (stream >> output) + && (stream.get() == Traits::eof()); #ifndef BOOST_NO_EXCEPTIONS - } catch (const ::std::ios_base::failure& /*f*/) { - return false; - } -#endif - } - - template - inline bool shr_xchar(T& output) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG(( sizeof(CharT) == sizeof(T) ), - "boost::lexical_cast does not support narrowing of character types." - "Use boost::locale instead" ); - bool const ok = (finish - start == 1); - if (ok) { - CharT out; - Traits::assign(out, *start); - output = static_cast(out); - } - return ok; - } - - template - bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT { - using namespace std; - const std::size_t size = static_cast(finish - start); - if (size > N - 1) { // `-1` because we need to store \0 at the end - return false; - } - - memcpy(&output[0], start, size * sizeof(CharT)); - output[size] = Traits::to_char_type(0); - return true; - } - -/************************************ OPERATORS >> ( ... ) ********************************/ - public: - bool operator>>(unsigned short& output) { return shr_unsigned(output); } - bool operator>>(unsigned int& output) { return shr_unsigned(output); } - bool operator>>(unsigned long int& output) { return shr_unsigned(output); } - bool operator>>(short& output) { return shr_signed(output); } - bool operator>>(int& output) { return shr_signed(output); } - bool operator>>(long int& output) { return shr_signed(output); } + } catch (const ::std::ios_base::failure& /*f*/) { + return false; + } +#endif + } + + template + inline bool shr_xchar(T& output) noexcept { + static_assert(sizeof(CharT) == sizeof(T), + "boost::lexical_cast does not support narrowing of character types." + "Use boost::locale instead" ); + bool const ok = (finish - start == 1); + if (ok) { + CharT out; + Traits::assign(out, *start); + output = static_cast(out); + } + return ok; + } + + template + bool shr_std_array(ArrayT& output) noexcept { + const std::size_t size = static_cast(finish - start); + if (size > N - 1) { // `-1` because we need to store \0 at the end + return false; + } + + std::memcpy(&output[0], start, size * sizeof(CharT)); + output[size] = Traits::to_char_type(0); + return true; + } + + public: + bool stream_out(unsigned short& output) { return shr_unsigned(output); } + bool stream_out(unsigned int& output) { return shr_unsigned(output); } + bool stream_out(unsigned long int& output) { return shr_unsigned(output); } + bool stream_out(short& output) { return shr_signed(output); } + bool stream_out(int& output) { return shr_signed(output); } + bool stream_out(long int& output) { return shr_signed(output); } #if defined(BOOST_HAS_LONG_LONG) - bool operator>>(boost::ulong_long_type& output) { return shr_unsigned(output); } - bool operator>>(boost::long_long_type& output) { return shr_signed(output); } + bool stream_out(boost::ulong_long_type& output) { return shr_unsigned(output); } + bool stream_out(boost::long_long_type& output) { return shr_signed(output); } #elif defined(BOOST_HAS_MS_INT64) - bool operator>>(unsigned __int64& output) { return shr_unsigned(output); } - bool operator>>(__int64& output) { return shr_signed(output); } + bool stream_out(unsigned __int64& output) { return shr_unsigned(output); } + bool stream_out(__int64& output) { return shr_signed(output); } #endif #ifdef BOOST_HAS_INT128 - bool operator>>(boost::uint128_type& output) { return shr_unsigned(output); } - bool operator>>(boost::int128_type& output) { return shr_signed(output); } + bool stream_out(boost::uint128_type& output) { return shr_unsigned(output); } + bool stream_out(boost::int128_type& output) { return shr_signed(output); } #endif - bool operator>>(char& output) { return shr_xchar(output); } - bool operator>>(unsigned char& output) { return shr_xchar(output); } - bool operator>>(signed char& output) { return shr_xchar(output); } + bool stream_out(char& output) { return shr_xchar(output); } + bool stream_out(unsigned char& output) { return shr_xchar(output); } + bool stream_out(signed char& output) { return shr_xchar(output); } #if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - bool operator>>(wchar_t& output) { return shr_xchar(output); } + bool stream_out(wchar_t& output) { return shr_xchar(output); } #endif #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) - bool operator>>(char16_t& output) { return shr_xchar(output); } + bool stream_out(char16_t& output) { return shr_xchar(output); } #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) - bool operator>>(char32_t& output) { return shr_xchar(output); } + bool stream_out(char32_t& output) { return shr_xchar(output); } #endif - template - bool operator>>(std::basic_string& str) { - str.assign(start, finish); return true; - } + template + bool stream_out(std::basic_string& str) { + str.assign(start, finish); return true; + } - template - bool operator>>(boost::container::basic_string& str) { - str.assign(start, finish); return true; - } + template + bool stream_out(boost::container::basic_string& str) { + str.assign(start, finish); return true; + } - template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { - return shr_std_array(output); - } + template + bool stream_out(std::array& output) noexcept { + static_assert(sizeof(C) == sizeof(CharT), ""); + return shr_std_array(output); + } - template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast& >(output)); - } + template + bool stream_out(boost::array& output) noexcept { + static_assert(sizeof(C) == sizeof(CharT), ""); + return shr_std_array(output); + } - template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast& >(output)); - } + bool stream_out(bool& output) noexcept { + output = false; // Suppress warning about uninitalized variable -#ifndef BOOST_NO_CXX11_HDR_ARRAY - template - bool operator>>(std::array& output) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(std::array) == sizeof(boost::array)), - "std::array and boost::array must have exactly the same layout." - ); - return ((*this) >> reinterpret_cast& >(output)); - } -#endif - - bool operator>>(bool& output) BOOST_NOEXCEPT { - output = false; // Suppress warning about uninitalized variable - - if (start == finish) return false; - CharT const zero = lcast_char_constants::zero; - CharT const plus = lcast_char_constants::plus; - CharT const minus = lcast_char_constants::minus; - - const CharT* const dec_finish = finish - 1; - output = Traits::eq(*dec_finish, zero + 1); - if (!output && !Traits::eq(*dec_finish, zero)) { - return false; // Does not ends on '0' or '1' - } - - if (start == dec_finish) return true; - - // We may have sign at the beginning - if (Traits::eq(plus, *start) || (Traits::eq(minus, *start) && !output)) { - ++ start; - } - - // Skipping zeros - while (start != dec_finish) { - if (!Traits::eq(zero, *start)) { - return false; // Not a zero => error - } + if (start == finish) return false; + CharT const zero = lcast_char_constants::zero; + CharT const plus = lcast_char_constants::plus; + CharT const minus = lcast_char_constants::minus; - ++ start; - } - - return true; + const CharT* const dec_finish = finish - 1; + output = Traits::eq(*dec_finish, zero + 1); + if (!output && !Traits::eq(*dec_finish, zero)) { + return false; // Does not ends on '0' or '1' } - private: - // Not optimised converter - template - bool float_types_converter_internal(T& output) { - if (parse_inf_nan(start, finish, output)) return true; - bool const return_value = shr_using_base_class(output); - - /* Some compilers and libraries successfully - * parse 'inf', 'INFINITY', '1.0E', '1.0E-'... - * We are trying to provide a unified behaviour, - * so we just forbid such conversions (as some - * of the most popular compilers/libraries do) - * */ - CharT const minus = lcast_char_constants::minus; - CharT const plus = lcast_char_constants::plus; - CharT const capital_e = lcast_char_constants::capital_e; - CharT const lowercase_e = lcast_char_constants::lowercase_e; - if ( return_value && - ( - Traits::eq(*(finish-1), lowercase_e) // 1.0e - || Traits::eq(*(finish-1), capital_e) // 1.0E - || Traits::eq(*(finish-1), minus) // 1.0e- or 1.0E- - || Traits::eq(*(finish-1), plus) // 1.0e+ or 1.0E+ - ) - ) return false; - - return return_value; + if (start == dec_finish) return true; + + // We may have sign at the beginning + if (Traits::eq(plus, *start) || (Traits::eq(minus, *start) && !output)) { + ++ start; } - public: - bool operator>>(float& output) { return float_types_converter_internal(output); } - bool operator>>(double& output) { return float_types_converter_internal(output); } - bool operator>>(long double& output) { return float_types_converter_internal(output); } + // Skipping zeros + while (start != dec_finish) { + if (!Traits::eq(zero, *start)) { + return false; // Not a zero => error + } - // Generic istream-based algorithm. - // lcast_streambuf_for_target::value is true. - template - bool operator>>(InputStreamable& output) { - return shr_using_base_class(output); - } - }; - } -} // namespace boost + ++ start; + } + + return true; + } + + private: + // Not optimised converter + template + bool float_types_converter_internal(T& output) { + if (parse_inf_nan(start, finish, output)) return true; + bool const return_value = shr_using_base_class(output); + + /* Some compilers and libraries successfully + * parse 'inf', 'INFINITY', '1.0E', '1.0E-'... + * We are trying to provide a unified behaviour, + * so we just forbid such conversions (as some + * of the most popular compilers/libraries do) + * */ + CharT const minus = lcast_char_constants::minus; + CharT const plus = lcast_char_constants::plus; + CharT const capital_e = lcast_char_constants::capital_e; + CharT const lowercase_e = lcast_char_constants::lowercase_e; + if ( return_value && + ( + Traits::eq(*(finish-1), lowercase_e) // 1.0e + || Traits::eq(*(finish-1), capital_e) // 1.0E + || Traits::eq(*(finish-1), minus) // 1.0e- or 1.0E- + || Traits::eq(*(finish-1), plus) // 1.0e+ or 1.0E+ + ) + ) return false; + + return return_value; + } + + public: + bool stream_out(float& output) { return float_types_converter_internal(output); } + bool stream_out(double& output) { return float_types_converter_internal(output); } + bool stream_out(long double& output) { return float_types_converter_internal(output); } + + // Generic istream-based algorithm. + // lcast_streambuf_for_target::value is true. + template + bool stream_out(InputStreamable& output) { + return shr_using_base_class(output); + } + }; + +}}} // namespace boost::detail::lcast #undef BOOST_LCAST_NO_WCHAR_T diff --git a/include/boost/lexical_cast/detail/converter_numeric.hpp b/include/boost/lexical_cast/detail/converter_numeric.hpp index 853e254f..167473b3 100644 --- a/include/boost/lexical_cast/detail/converter_numeric.hpp +++ b/include/boost/lexical_cast/detail/converter_numeric.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,120 +23,128 @@ # pragma once #endif +#include +#include #include #include #include #include #include -#include #include -#include #include -#include - -#include namespace boost { namespace detail { -template -struct detect_precision_loss -{ - typedef Source source_type; - typedef boost::numeric::Trunc Rounder; - typedef BOOST_DEDUCED_TYPENAME conditional< - boost::is_arithmetic::value, Source, Source const& - >::type argument_type ; - - static inline source_type nearbyint(argument_type s, bool& is_ok) BOOST_NOEXCEPT { - const source_type near_int = Rounder::nearbyint(s); - if (near_int && is_ok) { - const source_type orig_div_round = s / near_int; - const source_type eps = std::numeric_limits::epsilon(); - - is_ok = !((orig_div_round > 1 ? orig_div_round - 1 : 1 - orig_div_round) > eps); - } +template +bool ios_numeric_comparer_float(Source x, Source y) noexcept { + return x == y + || (boost::core::isnan(x) && boost::core::isnan(y)) + || (x < (std::numeric_limits::min)()) + ; +} + +template +constexpr bool is_out_of_range_for(T value) noexcept { + return value > static_cast((std::numeric_limits::max)()) + || value < static_cast((std::numeric_limits::min)()); +} + - return s; +// integral -> integral +template +typename boost::enable_if_c< + !boost::is_floating_point::value && !boost::is_floating_point::value, bool +>::type noexcept_numeric_convert(Source arg, Target& result) noexcept { + const Target target_tmp = static_cast(arg); + const Source arg_restored = static_cast(target_tmp); + if (arg == arg_restored) { + result = target_tmp; + return true; } + return false; +} - typedef typename Rounder::round_style round_style; -}; +// integral -> floating point +template +typename boost::enable_if_c< + !boost::is_floating_point::value && boost::is_floating_point::value, bool +>::type noexcept_numeric_convert(Source arg, Target& result) noexcept { + const Target target_tmp = static_cast(arg); + result = target_tmp; + return true; +} -template -struct fake_precision_loss: public Base -{ - typedef Source source_type ; - typedef BOOST_DEDUCED_TYPENAME conditional< - boost::is_arithmetic::value, Source, Source const& - >::type argument_type ; - static inline source_type nearbyint(argument_type s, bool& /*is_ok*/) BOOST_NOEXCEPT { - return s; +// floating point -> floating point +template +typename boost::enable_if_c< + boost::is_floating_point::value && boost::is_floating_point::value, bool +>::type noexcept_numeric_convert(Source arg, Target& result) noexcept { + const Target target_tmp = static_cast(arg); + const Source arg_restored = static_cast(target_tmp); + if (detail::ios_numeric_comparer_float(arg, arg_restored)) { + result = target_tmp; + return true; } -}; -struct nothrow_overflow_handler -{ - inline bool operator() ( boost::numeric::range_check_result r ) const BOOST_NOEXCEPT { - return (r == boost::numeric::cInRange); - } -}; + return false; +} +// floating point -> integral template -inline bool noexcept_numeric_convert(const Source& arg, Target& result) BOOST_NOEXCEPT { - typedef boost::numeric::converter< - Target, - Source, - boost::numeric::conversion_traits, - nothrow_overflow_handler, - detect_precision_loss - > converter_orig_t; - - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_base_of< detect_precision_loss, converter_orig_t >::value, - converter_orig_t, - fake_precision_loss - >::type converter_t; - - bool res = nothrow_overflow_handler()(converter_t::out_of_range(arg)); - if (res) { - result = converter_t::low_level_convert(converter_t::nearbyint(arg, res)); +typename boost::enable_if_c< + boost::is_floating_point::value && !boost::is_floating_point::value, bool +>::type noexcept_numeric_convert(Source arg, Target& result) noexcept { + if (detail::is_out_of_range_for(arg)) { + return false; } - return res; + const Target target_tmp = static_cast(arg); + const Source arg_restored = static_cast(target_tmp); + if (detail::ios_numeric_comparer_float(arg, arg_restored)) { + result = target_tmp; + return true; + } + + return false; } -template struct lexical_cast_dynamic_num_not_ignoring_minus { - static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT { - return noexcept_numeric_convert(arg, result); + template + static inline bool try_convert(Source arg, Target& result) noexcept { + return boost::detail::noexcept_numeric_convert(arg, result); } }; -template struct lexical_cast_dynamic_num_ignoring_minus { - static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + template +#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif + static inline bool try_convert(Source arg, Target& result) noexcept { + typedef typename boost::conditional< boost::is_float::value, boost::type_identity, boost::make_unsigned >::type usource_lazy_t; - typedef BOOST_DEDUCED_TYPENAME usource_lazy_t::type usource_t; + typedef typename usource_lazy_t::type usource_t; if (arg < 0) { - const bool res = noexcept_numeric_convert(0u - arg, result); + const bool res = boost::detail::noexcept_numeric_convert( + static_cast(0u - static_cast(arg)), result + ); result = static_cast(0u - result); return res; } else { - return noexcept_numeric_convert(arg, result); + return boost::detail::noexcept_numeric_convert(arg, result); } } }; /* - * lexical_cast_dynamic_num follows the rules: + * dynamic_num_converter_impl follows the rules: * 1) If Source can be converted to Target without precision loss and * without overflows, then assign Source to Target and return * @@ -156,16 +164,14 @@ struct lexical_cast_dynamic_num_ignoring_minus template struct dynamic_num_converter_impl { - typedef BOOST_DEDUCED_TYPENAME boost::remove_volatile::type source_type; - - static inline bool try_convert(source_type arg, Target& result) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + static inline bool try_convert(Source arg, Target& result) noexcept { + typedef typename boost::conditional< boost::is_unsigned::value && - (boost::is_signed::value || boost::is_float::value) && - !(boost::is_same::value) && + (boost::is_signed::value || boost::is_float::value) && + !(boost::is_same::value) && !(boost::is_same::value), - lexical_cast_dynamic_num_ignoring_minus, - lexical_cast_dynamic_num_not_ignoring_minus + lexical_cast_dynamic_num_ignoring_minus, + lexical_cast_dynamic_num_not_ignoring_minus >::type caster_type; return caster_type::try_convert(arg, result); diff --git a/include/boost/lexical_cast/detail/inf_nan.hpp b/include/boost/lexical_cast/detail/inf_nan.hpp index ef53e524..c543e47a 100644 --- a/include/boost/lexical_cast/detail/inf_nan.hpp +++ b/include/boost/lexical_cast/detail/inf_nan.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -28,7 +28,7 @@ #endif #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ namespace boost { namespace detail { template - bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT { + bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) noexcept { for( unsigned int i=0; i < len; ++i ) { if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false; } @@ -52,7 +52,7 @@ namespace boost { inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value , const CharT* lc_NAN, const CharT* lc_nan , const CharT* lc_INFINITY, const CharT* lc_infinity - , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT + , const CharT opening_brace, const CharT closing_brace) noexcept { if (begin == end) return false; const CharT minus = lcast_char_constants::minus; @@ -100,38 +100,31 @@ namespace boost { } template - bool put_inf_nan_impl(CharT* begin, CharT*& end, const T& value + const CharT* get_inf_nan_impl(T value , const CharT* lc_nan - , const CharT* lc_infinity) BOOST_NOEXCEPT + , const CharT* lc_minus_nan + , const CharT* lc_infinity + , const CharT* lc_minus_infinity) noexcept { - const CharT minus = lcast_char_constants::minus; if (boost::core::isnan(value)) { if (boost::core::signbit(value)) { - *begin = minus; - ++ begin; + return lc_minus_nan; } - - std::memcpy(begin, lc_nan, 3 * sizeof(CharT)); - end = begin + 3; - return true; + return lc_nan; } else if (boost::core::isinf(value)) { if (boost::core::signbit(value)) { - *begin = minus; - ++ begin; + return lc_minus_infinity; } - - std::memcpy(begin, lc_infinity, 3 * sizeof(CharT)); - end = begin + 3; - return true; + return lc_infinity; } - return false; + return nullptr; } #ifndef BOOST_LCAST_NO_WCHAR_T template - bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , L"NAN", L"nan" , L"INFINITY", L"infinity" @@ -139,14 +132,14 @@ namespace boost { } template - bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) BOOST_NOEXCEPT { - return put_inf_nan_impl(begin, end, value, L"nan", L"infinity"); + const wchar_t* get_inf_nan(T value, wchar_t) noexcept { + return detail::get_inf_nan_impl(value, L"nan", L"-nan", L"inf", L"-inf"); } #endif #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) template - bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , u"NAN", u"nan" , u"INFINITY", u"infinity" @@ -154,13 +147,13 @@ namespace boost { } template - bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) BOOST_NOEXCEPT { - return put_inf_nan_impl(begin, end, value, u"nan", u"infinity"); + const char16_t* get_inf_nan(T value, char16_t) noexcept { + return detail::get_inf_nan_impl(value, u"nan", u"-nan", u"inf", u"-inf"); } #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) template - bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , U"NAN", U"nan" , U"INFINITY", U"infinity" @@ -168,22 +161,22 @@ namespace boost { } template - bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) BOOST_NOEXCEPT { - return put_inf_nan_impl(begin, end, value, U"nan", U"infinity"); + const char32_t* get_inf_nan(T value, char32_t) noexcept { + return detail::get_inf_nan_impl(value, U"nan", U"-nan", U"inf", U"-inf"); } #endif template - bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , "NAN", "nan" , "INFINITY", "infinity" , '(', ')'); } - template - bool put_inf_nan(CharT* begin, CharT*& end, const T& value) BOOST_NOEXCEPT { - return put_inf_nan_impl(begin, end, value, "nan", "infinity"); + template + const char* get_inf_nan(T value, char) noexcept { + return detail::get_inf_nan_impl(value, "nan", "-nan", "inf", "-inf"); } } } // namespace boost diff --git a/include/boost/lexical_cast/detail/is_character.hpp b/include/boost/lexical_cast/detail/is_character.hpp index 176dd3dc..f9b22345 100644 --- a/include/boost/lexical_cast/detail/is_character.hpp +++ b/include/boost/lexical_cast/detail/is_character.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -26,34 +26,27 @@ #include #include -namespace boost { - - namespace detail // is_character<...> - { - // returns true, if T is one of the character types - template < typename T > - struct is_character - { - typedef BOOST_DEDUCED_TYPENAME boost::integral_constant< - bool, - boost::is_same< T, char >::value || - #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) - boost::is_same< T, wchar_t >::value || - #endif - #ifndef BOOST_NO_CXX11_CHAR16_T - boost::is_same< T, char16_t >::value || - #endif - #ifndef BOOST_NO_CXX11_CHAR32_T - boost::is_same< T, char32_t >::value || - #endif - boost::is_same< T, unsigned char >::value || - boost::is_same< T, signed char >::value - > type; - - BOOST_STATIC_CONSTANT(bool, value = (type::value) ); - }; - } -} +namespace boost { namespace detail { + +// returns true, if T is one of the character types +template < typename T > +using is_character = boost::integral_constant< + bool, + boost::is_same< T, char >::value || +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) + boost::is_same< T, wchar_t >::value || +#endif +#ifndef BOOST_NO_CXX11_CHAR16_T + boost::is_same< T, char16_t >::value || +#endif +#ifndef BOOST_NO_CXX11_CHAR32_T + boost::is_same< T, char32_t >::value || +#endif + boost::is_same< T, unsigned char >::value || + boost::is_same< T, signed char >::value +>; + +}} #endif // BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP diff --git a/include/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp b/include/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp new file mode 100644 index 00000000..18168c5d --- /dev/null +++ b/include/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp @@ -0,0 +1,73 @@ +// Copyright Kevlin Henney, 2000-2005. +// Copyright Alexander Nasonov, 2006-2010. +// Copyright Antony Polukhin, 2011-2024. +// +// Distributed under the 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_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP +#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP + +#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + + +#ifdef BOOST_NO_STRINGSTREAM +#include +#else +#include +#endif + +#include +#ifndef BOOST_NO_CWCHAR +# include +#endif + +namespace boost { namespace detail { namespace lcast { + + // acts as a stream buffer which wraps around a pair of pointers + // and gives acces to internals + template + class basic_unlockedbuf : public basic_pointerbuf { + public: + typedef basic_pointerbuf base_type; + typedef typename base_type::streamsize streamsize; + + using base_type::pptr; + using base_type::pbase; + using base_type::setbuf; + }; + +#if defined(BOOST_NO_STRINGSTREAM) + template + using out_stream_t = std::ostream; + + template + using stringbuffer_t = basic_unlockedbuf; +#elif defined(BOOST_NO_STD_LOCALE) + template + using out_stream_t = std::ostream; + + template + using stringbuffer_t = basic_unlockedbuf; + + template + using buffer_t = basic_unlockedbuf; +#else + template + using out_stream_t = std::basic_ostream; + + template + using stringbuffer_t = basic_unlockedbuf, CharT>; + + template + using buffer_t = basic_unlockedbuf, CharT>; +#endif + +}}} // namespace boost::detail::lcast + +#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP + diff --git a/include/boost/lexical_cast/detail/lcast_char_constants.hpp b/include/boost/lexical_cast/detail/lcast_char_constants.hpp index e2069a56..8be09dc3 100644 --- a/include/boost/lexical_cast/detail/lcast_char_constants.hpp +++ b/include/boost/lexical_cast/detail/lcast_char_constants.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp index e4a581ea..a899b267 100644 --- a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +++ b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -30,8 +30,7 @@ #include #include #include -#include -#include +#include #ifndef BOOST_NO_STD_LOCALE @@ -57,9 +56,12 @@ namespace boost namespace detail // lcast_to_unsigned { template +#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif inline - BOOST_DEDUCED_TYPENAME boost::make_unsigned::type lcast_to_unsigned(const T value) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned::type result_type; + typename boost::make_unsigned::type lcast_to_unsigned(const T value) noexcept { + typedef typename boost::make_unsigned::type result_type; return value < 0 ? static_cast(0u - static_cast(value)) : static_cast(value); @@ -70,8 +72,8 @@ namespace boost { template class lcast_put_unsigned: boost::noncopyable { - typedef BOOST_DEDUCED_TYPENAME Traits::int_type int_type; - BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename Traits::int_type int_type; + typename boost::conditional< (sizeof(unsigned) > sizeof(T)) , unsigned , T @@ -81,12 +83,12 @@ namespace boost int_type const m_zero; public: - lcast_put_unsigned(const T n_param, CharT* finish) BOOST_NOEXCEPT + lcast_put_unsigned(const T n_param, CharT* finish) noexcept : m_value(n_param), m_finish(finish) , m_czero(lcast_char_constants::zero), m_zero(Traits::to_int_type(m_czero)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + static_assert(!std::numeric_limits::is_signed, ""); #endif } @@ -108,7 +110,7 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS // Check that ulimited group is unreachable: - BOOST_STATIC_ASSERT(std::numeric_limits::digits10 < CHAR_MAX); + static_assert(std::numeric_limits::digits10 < CHAR_MAX, ""); #endif CharT const thousands_sep = np.thousands_sep(); std::string::size_type group = 0; // current group number @@ -138,7 +140,7 @@ namespace boost } private: - inline bool main_convert_iteration() BOOST_NOEXCEPT { + inline bool main_convert_iteration() noexcept { --m_finish; int_type const digit = static_cast(m_value % 10U); Traits::assign(*m_finish, Traits::to_char_type(m_zero + digit)); @@ -146,7 +148,7 @@ namespace boost return !!m_value; // suppressing warnings } - inline CharT* main_convert_loop() BOOST_NOEXCEPT { + inline CharT* main_convert_loop() noexcept { while (main_convert_iteration()); return m_finish; } @@ -164,18 +166,18 @@ namespace boost const CharT* m_end; public: - lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) BOOST_NOEXCEPT + lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) noexcept : m_multiplier_overflowed(false), m_multiplier(1), m_value(value), m_begin(begin), m_end(end) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + static_assert(!std::numeric_limits::is_signed, ""); // GCC when used with flag -std=c++0x may not have std::numeric_limits // specializations for __int128 and unsigned __int128 types. // Try compilation with -std=gnu++0x or -std=gnu++11. // // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856 - BOOST_STATIC_ASSERT_MSG(std::numeric_limits::is_specialized, + static_assert(std::numeric_limits::is_specialized, "std::numeric_limits are not specialized for integral type passed to boost::lexical_cast" ); #endif @@ -252,7 +254,10 @@ namespace boost private: // Iteration that does not care about grouping/separators and assumes that all // input characters are digits - inline bool main_convert_iteration() BOOST_NOEXCEPT { +#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif + inline bool main_convert_iteration() noexcept { CharT const czero = lcast_char_constants::zero; T const maxv = (std::numeric_limits::max)(); @@ -277,7 +282,7 @@ namespace boost return true; } - bool main_convert_loop() BOOST_NOEXCEPT { + bool main_convert_loop() noexcept { for ( ; m_end >= m_begin; --m_end) { if (!main_convert_iteration()) { return false; diff --git a/include/boost/lexical_cast/detail/widest_char.hpp b/include/boost/lexical_cast/detail/widest_char.hpp index ca1e39d6..2db928c5 100644 --- a/include/boost/lexical_cast/detail/widest_char.hpp +++ b/include/boost/lexical_cast/detail/widest_char.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -28,14 +28,12 @@ namespace boost { namespace detail { - template - struct widest_char { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - (sizeof(TargetChar) > sizeof(SourceChar)) - , TargetChar - , SourceChar - >::type type; - }; +template +using widest_char = boost::conditional< + (sizeof(TargetChar) > sizeof(SourceChar)) + , TargetChar + , SourceChar +>; }} // namespace boost::detail diff --git a/include/boost/lexical_cast/try_lexical_convert.hpp b/include/boost/lexical_cast/try_lexical_convert.hpp index d326f121..35cc6870 100644 --- a/include/boost/lexical_cast/try_lexical_convert.hpp +++ b/include/boost/lexical_cast/try_lexical_convert.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2023. +// Copyright Antony Polukhin, 2011-2024. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,140 +23,25 @@ # pragma once #endif -#if defined(__clang__) || (defined(__GNUC__) && \ - !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - - -#include -#include -#include #include -#include #include +#include #include #include #include -#include -#include - namespace boost { namespace detail { - template - struct is_stdstring - : boost::false_type - {}; - - template - struct is_stdstring< std::basic_string > - : boost::true_type - {}; - - // Sun Studio has problem with partial specialization of templates differing only in namespace. - // We workaround that by making `is_booststring` trait, instead of specializing `is_stdstring` for `boost::container::basic_string`. - template - struct is_booststring - : boost::false_type - {}; - - template - struct is_booststring< boost::container::basic_string > - : boost::true_type - {}; - - template - struct is_arithmetic_and_not_xchars - { - typedef boost::integral_constant< - bool, - !(boost::detail::is_character::value) && - !(boost::detail::is_character::value) && - boost::is_arithmetic::value && - boost::is_arithmetic::value - > type; - - BOOST_STATIC_CONSTANT(bool, value = ( - type::value - )); - }; - - /* - * is_xchar_to_xchar::value is true, - * Target and Souce are char types of the same size 1 (char, signed char, unsigned char). - */ - template - struct is_xchar_to_xchar - { - typedef boost::integral_constant< - bool, - sizeof(Source) == sizeof(Target) && - sizeof(Source) == sizeof(char) && - boost::detail::is_character::value && - boost::detail::is_character::value - > type; - - BOOST_STATIC_CONSTANT(bool, value = ( - type::value - )); - }; - - template - struct is_char_array_to_stdstring - : boost::false_type - {}; - - template - struct is_char_array_to_stdstring< std::basic_string, CharT* > - : boost::true_type - {}; - - template - struct is_char_array_to_stdstring< std::basic_string, const CharT* > - : boost::true_type - {}; - - // Sun Studio has problem with partial specialization of templates differing only in namespace. - // We workaround that by making `is_char_array_to_booststring` trait, instead of specializing `is_char_array_to_stdstring` for `boost::container::basic_string`. template - struct is_char_array_to_booststring - : boost::false_type - {}; - - template - struct is_char_array_to_booststring< boost::container::basic_string, CharT* > - : boost::true_type - {}; - - template - struct is_char_array_to_booststring< boost::container::basic_string, const CharT* > - : boost::true_type - {}; - - template - struct copy_converter_impl - { -// MSVC fail to forward an array (DevDiv#555157 "SILENT BAD CODEGEN triggered by perfect forwarding", -// fixed in 2013 RTM). -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined(BOOST_MSVC) || BOOST_MSVC >= 1800) - template - static inline bool try_convert(T&& arg, Target& result) { - result = static_cast(arg); // eqaul to `result = std::forward(arg);` - return true; - } -#else - static inline bool try_convert(const Source& arg, Target& result) { - result = arg; - return true; - } -#endif - }; + using is_arithmetic_and_not_xchars = boost::integral_constant< + bool, + !(boost::detail::is_character::value) && + !(boost::detail::is_character::value) && + boost::is_arithmetic::value && + boost::is_arithmetic::value + >; } namespace conversion { namespace detail { @@ -164,39 +49,20 @@ namespace boost { template inline bool try_lexical_convert(const Source& arg, Target& result) { - typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; - - typedef boost::integral_constant< - bool, - boost::detail::is_xchar_to_xchar::value || - boost::detail::is_char_array_to_stdstring::value || - boost::detail::is_char_array_to_booststring::value || - ( - boost::is_same::value && - (boost::detail::is_stdstring::value || boost::detail::is_booststring::value) - ) || - ( - boost::is_same::value && - boost::detail::is_character::value - ) - > shall_we_copy_t; + static_assert( + !boost::is_volatile::value, + "Boost.LexicalCast does not support volatile input"); + + typedef typename boost::detail::array_to_pointer_decay::type src; typedef boost::detail::is_arithmetic_and_not_xchars shall_we_copy_with_dynamic_check_t; - // We do evaluate second `if_` lazily to avoid unnecessary instantiations - // of `shall_we_copy_with_dynamic_check_t` and improve compilation times. - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - shall_we_copy_t::value, - boost::type_identity >, - boost::conditional< - shall_we_copy_with_dynamic_check_t::value, - boost::detail::dynamic_num_converter_impl, - boost::detail::lexical_converter_impl - > - >::type caster_type_lazy; - - typedef BOOST_DEDUCED_TYPENAME caster_type_lazy::type caster_type; + typedef typename boost::conditional< + shall_we_copy_with_dynamic_check_t::value, + boost::detail::dynamic_num_converter_impl, + boost::detail::lexical_converter_impl + >::type caster_type; return caster_type::try_convert(arg, result); } @@ -204,12 +70,13 @@ namespace boost { template inline bool try_lexical_convert(const CharacterT* chars, std::size_t count, Target& result) { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::detail::is_character::value, "This overload of try_lexical_convert is meant to be used only with arrays of characters." ); return ::boost::conversion::detail::try_lexical_convert( - ::boost::iterator_range(chars, chars + count), result + ::boost::conversion::detail::make_buffer_view(chars, chars + count), + result ); } @@ -222,11 +89,5 @@ namespace boost { } // namespace boost -#if defined(__clang__) || (defined(__GNUC__) && \ - !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) -#pragma GCC diagnostic pop -#endif - #endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP diff --git a/include/boost/math/ccmath/abs.hpp b/include/boost/math/ccmath/abs.hpp index 84e01fba..db59502a 100644 --- a/include/boost/math/ccmath/abs.hpp +++ b/include/boost/math/ccmath/abs.hpp @@ -8,22 +8,16 @@ #ifndef BOOST_MATH_CCMATH_ABS #define BOOST_MATH_CCMATH_ABS -#include -#include -#include -#include +#include + +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." +#endif + #include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif -#endif - namespace boost::math::ccmath { namespace detail { diff --git a/include/boost/math/ccmath/detail/config.hpp b/include/boost/math/ccmath/detail/config.hpp new file mode 100644 index 00000000..097d69a1 --- /dev/null +++ b/include/boost/math/ccmath/detail/config.hpp @@ -0,0 +1,52 @@ +// (C) Copyright John Maddock 2023. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Core configuration for ccmath functions, basically will they work or not? + +#ifndef BOOST_MATH_CCMATH_DETAIL_CONFIG +#define BOOST_MATH_CCMATH_DETAIL_CONFIG + +#include +#include +#include +#include +#include + +#ifndef BOOST_MATH_STANDALONE + +#include +#ifdef BOOST_MATH_NO_CXX17_IF_CONSTEXPR +# define BOOST_MATH_NO_CCMATH +#endif + +#else // BOOST_MATH_STANDALONE + +#if defined(_MSC_VER) + +#if defined(_MSVC_LANG) && (_MSVC_LANG < 201703) +# define BOOST_MATH_NO_CCMATH +#endif + +#else // _MSC_VER + +#if (__cplusplus < 201703) +# define BOOST_MATH_NO_CCMATH +#endif + +#endif + +#endif + +#ifndef _MSC_VER +// +// Don't check here for msvc as they didn't get std lib configuration macros at the same time as C++17 +// +#if (defined(__cpp_lib_bool_constant) && __cpp_lib_bool_constant < 201505L) && !defined(BOOST_MATH_NO_CCMATH) +# define BOOST_MATH_NO_CCMATH +#endif +#endif + + +#endif diff --git a/include/boost/math/ccmath/isinf.hpp b/include/boost/math/ccmath/isinf.hpp index 7b942dcf..ecf0d620 100644 --- a/include/boost/math/ccmath/isinf.hpp +++ b/include/boost/math/ccmath/isinf.hpp @@ -6,30 +6,30 @@ #ifndef BOOST_MATH_CCMATH_ISINF #define BOOST_MATH_CCMATH_ISINF -#include -#include -#include -#include #include +#include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { template -constexpr bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(T x) noexcept +constexpr bool isinf BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) { if constexpr (std::numeric_limits::is_signed) { +#if defined(__clang_major__) && __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif return x == std::numeric_limits::infinity() || -x == std::numeric_limits::infinity(); +#if defined(__clang_major__) && __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif } else { @@ -39,7 +39,7 @@ constexpr bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(T x) noexcept else { using boost::math::isinf; - + if constexpr (!std::is_integral_v) { return (isinf)(x); diff --git a/include/boost/math/ccmath/isnan.hpp b/include/boost/math/ccmath/isnan.hpp index a5e121a9..753f2079 100644 --- a/include/boost/math/ccmath/isnan.hpp +++ b/include/boost/math/ccmath/isnan.hpp @@ -6,23 +6,17 @@ #ifndef BOOST_MATH_CCMATH_ISNAN #define BOOST_MATH_CCMATH_ISNAN -#include -#include -#include #include +#include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { template -inline constexpr bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(T x) +inline constexpr bool isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) { diff --git a/include/boost/math/ccmath/ldexp.hpp b/include/boost/math/ccmath/ldexp.hpp index 31730b26..3e2cd361 100644 --- a/include/boost/math/ccmath/ldexp.hpp +++ b/include/boost/math/ccmath/ldexp.hpp @@ -7,11 +7,13 @@ #ifndef BOOST_MATH_CCMATH_LDEXP_HPP #define BOOST_MATH_CCMATH_LDEXP_HPP -#include -#include -#include +#include + +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." +#endif + #include -#include #include #include #include diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 730256c6..df702bf8 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -1,5 +1,6 @@ // Copyright John Maddock 2005-2006, 2011. // Copyright Paul A. Bristow 2006-2011. +// Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -8,6 +9,9 @@ #define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED #include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include #include @@ -94,10 +98,10 @@ namespace boost{ namespace math >; }; -#ifdef BOOST_HAS_THREADS +#ifdef BOOST_MATH_HAS_THREADS #define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix) \ boost::once_flag f = BOOST_ONCE_INIT;\ - boost::call_once(f, &BOOST_JOIN(BOOST_JOIN(string_, get_), name)); + boost::call_once(f, &BOOST_MATH_JOIN(BOOST_MATH_JOIN(string_, get_), name)); #else #define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix) #endif @@ -162,20 +166,20 @@ namespace boost{ namespace math #ifdef BOOST_MATH_USE_FLOAT128 # define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ static inline constexpr T get(const std::integral_constant&) noexcept\ - { return BOOST_JOIN(x, Q); } + { return BOOST_MATH_JOIN(x, Q); } #else # define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) #endif -#ifdef BOOST_NO_CXX11_THREAD_LOCAL -# define BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name) constant_initializer::get_from_variable_precision>::force_instantiate(); +#ifdef BOOST_MATH_NO_CXX11_THREAD_LOCAL +# define BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name) constant_initializer::get_from_variable_precision>::force_instantiate(); #else # define BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name) #endif #define BOOST_DEFINE_MATH_CONSTANT(name, x, y)\ namespace detail{\ - template struct BOOST_JOIN(constant_, name){\ + template struct BOOST_MATH_JOIN(constant_, name){\ private:\ /* The default implementations come next: */ \ static inline const T& get_from_string()\ @@ -206,19 +210,19 @@ namespace boost{ namespace math public:\ static inline const T& get(const std::integral_constant&)\ {\ - constant_initializer::get_from_string >::force_instantiate();\ + constant_initializer::get_from_string >::force_instantiate();\ return get_from_string();\ }\ - static inline constexpr T get(const std::integral_constant) noexcept\ - { return BOOST_JOIN(x, F); }\ - static inline constexpr T get(const std::integral_constant&) noexcept\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant) noexcept\ + { return BOOST_MATH_JOIN(x, F); }\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant&) noexcept\ { return x; }\ - static inline constexpr T get(const std::integral_constant&) noexcept\ - { return BOOST_JOIN(x, L); }\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant&) noexcept\ + { return BOOST_MATH_JOIN(x, L); }\ BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ template static inline const T& get(const std::integral_constant&)\ {\ - constant_initializer2::template get_from_compute >::force_instantiate();\ + constant_initializer2::template get_from_compute >::force_instantiate();\ return get_from_compute(); \ }\ /* This one is for true arbitrary precision, which may well vary at runtime: */ \ @@ -231,18 +235,28 @@ namespace boost{ namespace math \ \ /* The actual forwarding function: */ \ - template inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ - { return detail:: BOOST_JOIN(constant_, name)::get(typename construction_traits::type()); }\ - template inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ + template BOOST_MATH_GPU_ENABLED inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ + { return detail:: BOOST_MATH_JOIN(constant_, name)::get(typename construction_traits::type()); }\ + template BOOST_MATH_GPU_ENABLED inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ { return name >(); }\ \ \ /* Now the namespace specific versions: */ \ - } namespace float_constants{ static constexpr float name = BOOST_JOIN(x, F); }\ + } namespace float_constants{ static constexpr float name = BOOST_MATH_JOIN(x, F); }\ namespace double_constants{ static constexpr double name = x; } \ - namespace long_double_constants{ static constexpr long double name = BOOST_JOIN(x, L); }\ + namespace long_double_constants{ static constexpr long double name = BOOST_MATH_JOIN(x, L); }\ namespace constants{ +#else // NVRTC simplified macro definition + +#define BOOST_DEFINE_MATH_CONSTANT(name, value, str_value) template BOOST_MATH_GPU_ENABLED constexpr T name() noexcept { return static_cast(value); } + +namespace boost { +namespace math { +namespace constants { + +#endif + BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01") BOOST_DEFINE_MATH_CONSTANT(third, 3.333333333333333333333333333333333333e-01, "3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333e-01") BOOST_DEFINE_MATH_CONSTANT(twothirds, 6.666666666666666666666666666666666666e-01, "6.66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667e-01") @@ -318,17 +332,15 @@ namespace boost{ namespace math BOOST_DEFINE_MATH_CONSTANT(one_div_pi, 0.3183098861837906715377675267450287240689192, "0.31830988618379067153776752674502872406891929148091289749533468811779359526845307018022760553250617191214568545351") BOOST_DEFINE_MATH_CONSTANT(two_div_root_pi, 1.12837916709551257389615890312154517168810125, "1.12837916709551257389615890312154517168810125865799771368817144342128493688298682897348732040421472688605669581272") -#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900) BOOST_DEFINE_MATH_CONSTANT(first_feigenbaum, 4.66920160910299067185320382046620161725818557747576863274, "4.6692016091029906718532038204662016172581855774757686327456513430041343302113147371386897440239480138171") BOOST_DEFINE_MATH_CONSTANT(plastic, 1.324717957244746025960908854478097340734404056901733364534, "1.32471795724474602596090885447809734073440405690173336453401505030282785124554759405469934798178728032991") BOOST_DEFINE_MATH_CONSTANT(gauss, 0.834626841674073186281429732799046808993993013490347002449, "0.83462684167407318628142973279904680899399301349034700244982737010368199270952641186969116035127532412906785") BOOST_DEFINE_MATH_CONSTANT(dottie, 0.739085133215160641655312087673873404013411758900757464965, "0.739085133215160641655312087673873404013411758900757464965680635773284654883547594599376106931766531849801246") BOOST_DEFINE_MATH_CONSTANT(reciprocal_fibonacci, 3.35988566624317755317201130291892717968890513, "3.35988566624317755317201130291892717968890513373196848649555381532513031899668338361541621645679008729704") BOOST_DEFINE_MATH_CONSTANT(laplace_limit, 0.662743419349181580974742097109252907056233549115022417, "0.66274341934918158097474209710925290705623354911502241752039253499097185308651127724965480259895818168") -#endif template -inline constexpr T tau() { return two_pi(); } +BOOST_MATH_GPU_ENABLED inline constexpr T tau() { return two_pi(); } } // namespace constants } // namespace math @@ -338,7 +350,11 @@ inline constexpr T tau() { return two_pi(); } // We deliberately include this *after* all the declarations above, // that way the calculation routines can call on other constants above: // +// NVRTC will not have a type that needs runtime calculation +// +#ifndef BOOST_MATH_HAS_NVRTC #include +#endif #endif // BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED diff --git a/include/boost/math/cstdfloat/cstdfloat_cmath.hpp b/include/boost/math/cstdfloat/cstdfloat_cmath.hpp index 049ac409..47ac751b 100644 --- a/include/boost/math/cstdfloat/cstdfloat_cmath.hpp +++ b/include/boost/math/cstdfloat/cstdfloat_cmath.hpp @@ -703,9 +703,9 @@ namespace boost { inline boost::math::cstdfloat::detail::float_internal128_t logb(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOGB(x); } inline boost::math::cstdfloat::detail::float_internal128_t nextafter(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(x, y); } inline boost::math::cstdfloat::detail::float_internal128_t nexttoward(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return -(::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(-x, -y)); } - inline boost::math::cstdfloat::detail::float_internal128_t copysign BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(x, y); } - inline bool signbit BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(x); } - inline int fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) + inline boost::math::cstdfloat::detail::float_internal128_t copysign BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(x, y); } + inline bool signbit BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(x); } + inline int fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { if (::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x)) return FP_NAN; @@ -719,16 +719,16 @@ namespace boost { else return FP_NORMAL; } - inline bool isfinite BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) + inline bool isfinite BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return !::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) && !::BOOST_CSTDFLOAT_FLOAT128_ISINF(x); } - inline bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISINF(x); } - inline bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x); } - inline bool isnormal BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return boost::math::cstdfloat::detail::fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION(x) == FP_NORMAL; } - inline bool isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) + inline bool isinf BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISINF(x); } + inline bool isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x); } + inline bool isnormal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return boost::math::cstdfloat::detail::fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) == FP_NORMAL; } + inline bool isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { - if (isnan BOOST_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_PREVENT_MACRO_SUBSTITUTION(y)) + if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y)) return false; return x > y; } @@ -736,16 +736,16 @@ namespace boost { inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreater BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } - inline bool isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) + inline bool isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { - if (isnan BOOST_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_PREVENT_MACRO_SUBSTITUTION(y)) + if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y)) return false; return x >= y; } @@ -753,16 +753,16 @@ namespace boost { inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } - inline bool isless BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) + inline bool isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { - if (isnan BOOST_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_PREVENT_MACRO_SUBSTITUTION(y)) + if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y)) return false; return x < y; } @@ -770,17 +770,17 @@ namespace boost { inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isless BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isless BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isless BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isless BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } - inline bool islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) + inline bool islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { - if (isnan BOOST_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_PREVENT_MACRO_SUBSTITUTION(y)) + if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y)) return false; return x <= y; } @@ -788,17 +788,17 @@ namespace boost { inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessequal BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } - inline bool islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) + inline bool islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { - if (isnan BOOST_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_PREVENT_MACRO_SUBSTITUTION(y)) + if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y)) return false; return (x < y) || (x > y); } @@ -806,25 +806,25 @@ namespace boost { inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } - inline bool isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) || ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(y); } + inline bool isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) || ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } + isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); } template inline typename std::enable_if< std::is_convertible::value && !std::is_same::value, boost::math::cstdfloat::detail::float_internal128_t>::type - isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isunordered BOOST_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } + isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); } // end more functions @@ -918,62 +918,6 @@ namespace std using boost::math::cstdfloat::detail::isunordered; // end more functions - // - // Very basic iostream operator: - // - inline std::ostream& operator << (std::ostream& os, __float128 m_value) - { - std::streamsize digits = os.precision(); - std::ios_base::fmtflags f = os.flags(); - std::string s; - - char buf[100]; - std::unique_ptr buf2; - std::string format = "%"; - if (f & std::ios_base::showpos) - format += "+"; - if (f & std::ios_base::showpoint) - format += "#"; - format += ".*"; - if (digits == 0) - digits = 36; - format += "Q"; - if (f & std::ios_base::scientific) - format += "e"; - else if (f & std::ios_base::fixed) - format += "f"; - else - format += "g"; - - int v = quadmath_snprintf(buf, 100, format.c_str(), digits, m_value); - - if ((v < 0) || (v >= 99)) - { - int v_max = v; - buf2.reset(new char[v + 3]); - v = quadmath_snprintf(&buf2[0], v_max + 3, format.c_str(), digits, m_value); - if (v >= v_max + 3) - { - BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Formatting of float128_type failed.")); - } - s = &buf2[0]; - } - else - s = buf; - std::streamsize ss = os.width(); - if (ss > static_cast(s.size())) - { - char fill = os.fill(); - if ((os.flags() & std::ios_base::left) == std::ios_base::left) - s.append(static_cast(ss - s.size()), fill); - else - s.insert(static_cast(0), static_cast(ss - s.size()), fill); - } - - return os << s; - } - - } // namespace std // We will now remove the preprocessor symbols representing quadruple-precision diff --git a/include/boost/math/cstdfloat/cstdfloat_iostream.hpp b/include/boost/math/cstdfloat/cstdfloat_iostream.hpp index c01c236f..2ae2aea3 100644 --- a/include/boost/math/cstdfloat/cstdfloat_iostream.hpp +++ b/include/boost/math/cstdfloat/cstdfloat_iostream.hpp @@ -32,8 +32,55 @@ #include #include -// #if (0) - #if defined(__GNUC__) +namespace boost { + namespace math { + namespace detail { + // + // What follows is the input streaming code: this is not "proper" iostream code at all + // but that's hard to write. + // For now just pull in all the characters that could possibly form the number + // and let libquadmath's string parser make use of it. This fixes most use cases + // including CSV type formats such as those used by the Random lib. + // + inline std::string read_string_while(std::istream& is, std::string const& permitted_chars) + { + std::ios_base::iostate state = std::ios_base::goodbit; + const std::istream::sentry sentry_check(is); + std::string result; + + if (sentry_check) + { + int c = is.rdbuf()->sgetc(); + + for (;; c = is.rdbuf()->snextc()) + if (std::istream::traits_type::eq_int_type(std::istream::traits_type::eof(), c)) + { // end of file: + state |= std::ios_base::eofbit; + break; + } + else if (permitted_chars.find_first_of(std::istream::traits_type::to_char_type(c)) == std::string::npos) + { + // Invalid numeric character, stop reading: + //is.rdbuf()->sputbackc(static_cast(c)); + break; + } + else + { + result.append(1, std::istream::traits_type::to_char_type(c)); + } + } + + if (!result.size()) + state |= std::ios_base::failbit; + is.setstate(state); + return result; + } + + } + } +} + +#if defined(__GNUC__) && !defined(BOOST_MATH_TEST_IO_AS_INTEL_QUAD) // Forward declarations of quadruple-precision string functions. extern "C" int quadmath_snprintf(char *str, size_t size, const char *format, ...) BOOST_MATH_NOTHROW; @@ -96,14 +143,14 @@ // So we have to use dynamic memory allocation for the output // string buffer. - char* my_buffer2 = static_cast(0U); + char* my_buffer2 = nullptr; -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS try { #endif my_buffer2 = new char[v + 3]; -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS } catch(const std::bad_alloc&) { @@ -136,9 +183,7 @@ template inline std::basic_istream& operator>>(std::basic_istream& is, boost::math::cstdfloat::detail::float_internal128_t& x) { - std::string str; - - static_cast(is >> str); + std::string str = boost::math::detail::read_string_while(is, "+-eE.0123456789infINFnanNANinfinityINFINITY"); char* p_end; @@ -160,8 +205,7 @@ } } -// #elif defined(__GNUC__) - #elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) || defined(BOOST_MATH_TEST_IO_AS_INTEL_QUAD) // The section for I/O stream support for the ICC compiler is particularly // long, because these functions must be painstakingly synthesized from @@ -172,6 +216,7 @@ // used in Boost.Multiprecision by John Maddock and Christopher Kormanyos. // This methodology has been slightly modified here for boost::float128_t. + #include #include @@ -266,7 +311,7 @@ { // Pad out the end with zero's if we need to. - int chars = static_cast(str.size()); + std::ptrdiff_t chars = static_cast(str.size()); chars = digits - chars; if(scientific) @@ -442,7 +487,7 @@ if(isneg) { x = -x; } float_type t; - float_type ten = 10; + constexpr float_type ten = 10; eval_log10(t, x); eval_floor(t, t); @@ -507,6 +552,8 @@ eval_subtract(t, digit); eval_multiply(t, ten); } + if (result.size() == 0) + result = "0"; // Possibly round the result. if(digits >= 0) @@ -522,11 +569,13 @@ if((static_cast(*result.rbegin() - '0') & 1) != 0) { round_string_up_at(result, static_cast(result.size() - 1U), expon); + if (digits == 0) digits = 1; } } else if(cdigit >= 5) { - round_string_up_at(result, static_cast(result.size() - 1), expon); + round_string_up_at(result, static_cast(result.size() - 1u), expon); + if (digits == 0) digits = 1; } } } @@ -569,9 +618,9 @@ { value = 0; - if((p == static_cast(0U)) || (*p == static_cast(0))) + if((p == nullptr) || (*p == '\0')) { - return; + return false; } bool is_neg = false; @@ -584,11 +633,11 @@ constexpr int max_digits = std::numeric_limits::max_digits10 + 1; - if(*p == static_cast('+')) + if(*p == '+') { ++p; } - else if(*p == static_cast('-')) + else if(*p == '-') { is_neg = true; ++p; @@ -632,7 +681,7 @@ ++digits_seen; } - if(*p == static_cast('.')) + if(*p == '.') { // Grab everything after the point, stop when we've seen // enough digits, even if there are actually more available. @@ -659,15 +708,15 @@ } // Parse the exponent. - if((*p == static_cast('e')) || (*p == static_cast('E'))) + if((*p == 'e') || (*p == 'E')) { ++p; - if(*p == static_cast('+')) + if(*p == '+') { ++p; } - else if(*p == static_cast('-')) + else if(*p == '-') { is_neg_expon = true; ++p; @@ -718,7 +767,7 @@ value = -value; } - return (*p == static_cast(0)); + return (*p == '\0'); } } } } } // boost::math::cstdfloat::detail @@ -746,9 +795,7 @@ template inline std::basic_istream& operator>>(std::basic_istream& is, boost::math::cstdfloat::detail::float_internal128_t& x) { - std::string str; - - static_cast(is >> str); + std::string str = boost::math::detail::read_string_while(is, "+-eE.0123456789infINFnanNANinfinityINFINITY"); const bool conversion_is_ok = boost::math::cstdfloat::detail::convert_from_string(x, str.c_str()); diff --git a/include/boost/math/cstdfloat/cstdfloat_limits.hpp b/include/boost/math/cstdfloat/cstdfloat_limits.hpp index 9661ab65..ae306c5b 100644 --- a/include/boost/math/cstdfloat/cstdfloat_limits.hpp +++ b/include/boost/math/cstdfloat/cstdfloat_limits.hpp @@ -24,7 +24,7 @@ #pragma GCC system_header #endif - #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) && (!defined(__GNUC__) || (defined(__GNUC__) && __GNUC__ < 14)) + #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) && (!defined(_GLIBCXX_RELEASE) || (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 14)) #include #include diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index d5e30c08..0a22dffa 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -1,6 +1,6 @@ // Copyright John Maddock 2007. // Copyright Paul A. Bristow 2007. - +// Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -9,19 +9,26 @@ #define BOOST_MATH_POLICY_ERROR_HANDLING_HPP #include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include #include -#ifndef BOOST_NO_RTTI +#ifndef BOOST_MATH_NO_RTTI #include #endif #include #include #include #include -#include -#include -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS #include #include #endif @@ -40,7 +47,7 @@ namespace boost{ namespace math{ -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS class evaluation_error : public std::runtime_error { @@ -122,7 +129,7 @@ inline void replace_all_in_string(std::string& result, const char* what, const c template inline const char* name_of() { -#ifndef BOOST_NO_RTTI +#ifndef BOOST_MATH_NO_RTTI return typeid(T).name(); #else return "unknown"; @@ -140,7 +147,7 @@ inline const char* name_of() } #endif -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS template void raise_error(const char* pfunction, const char* message) { @@ -155,7 +162,7 @@ void raise_error(const char* pfunction, const char* message) std::string function(pfunction); std::string msg("Error in function "); -#ifndef BOOST_NO_RTTI +#ifndef BOOST_MATH_NO_RTTI replace_all_in_string(function, "%1%", boost::math::policies::detail::name_of()); #else replace_all_in_string(function, "%1%", "Unknown"); @@ -182,7 +189,7 @@ void raise_error(const char* pfunction, const char* pmessage, const T& val) std::string function(pfunction); std::string message(pmessage); std::string msg("Error in function "); -#ifndef BOOST_NO_RTTI +#ifndef BOOST_MATH_NO_RTTI replace_all_in_string(function, "%1%", boost::math::policies::detail::name_of()); #else replace_all_in_string(function, "%1%", "Unknown"); @@ -199,23 +206,23 @@ void raise_error(const char* pfunction, const char* pmessage, const T& val) #endif template -inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, const T& val, const ::boost::math::policies::domain_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message, val); // we never get here: - return std::numeric_limits::quiet_NaN(); + return boost::math::numeric_limits::quiet_NaN(); #endif } template -inline constexpr T raise_domain_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( const char* , const char* , const T& , @@ -223,11 +230,11 @@ inline constexpr T raise_domain_error( { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - return std::numeric_limits::quiet_NaN(); + return boost::math::numeric_limits::quiet_NaN(); } template -inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* , const char* , const T& , @@ -236,11 +243,11 @@ inline T raise_domain_error( errno = EDOM; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - return std::numeric_limits::quiet_NaN(); + return boost::math::numeric_limits::quiet_NaN(); } template -inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, const T& val, @@ -250,21 +257,21 @@ inline T raise_domain_error( } template -inline T raise_pole_error( +BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, const T& val, const ::boost::math::policies::pole_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else return boost::math::policies::detail::raise_domain_error(function, message, val, ::boost::math::policies::domain_error< ::boost::math::policies::throw_on_error>()); #endif } template -inline constexpr T raise_pole_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -274,7 +281,7 @@ inline constexpr T raise_pole_error( } template -inline constexpr T raise_pole_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -284,7 +291,7 @@ inline constexpr T raise_pole_error( } template -inline T raise_pole_error( +BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, const T& val, @@ -294,49 +301,49 @@ inline T raise_pole_error( } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message ? message : "numeric overflow"); // We should never get here: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); #endif } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const T& val, const ::boost::math::policies::overflow_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message ? message : "numeric overflow", val); // We should never get here: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); #endif } template -inline constexpr T raise_overflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } template -inline constexpr T raise_overflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , const T&, @@ -344,11 +351,11 @@ inline constexpr T raise_overflow_error( { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -356,11 +363,11 @@ inline T raise_overflow_error( errno = ERANGE; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , const T&, @@ -369,20 +376,20 @@ inline T raise_overflow_error( errno = ERANGE; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::user_error>&) { - return user_overflow_error(function, message, std::numeric_limits::infinity()); + return user_overflow_error(function, message, boost::math::numeric_limits::infinity()); } template -inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const T& val, @@ -392,17 +399,17 @@ inline T raise_overflow_error( std::string sval = prec_format(val); replace_all_in_string(m, "%1%", sval.c_str()); - return user_overflow_error(function, m.c_str(), std::numeric_limits::infinity()); + return user_overflow_error(function, m.c_str(), boost::math::numeric_limits::infinity()); } template -inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message ? message : "numeric underflow"); // We should never get here: @@ -411,7 +418,7 @@ inline T raise_underflow_error( } template -inline constexpr T raise_underflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( const char* , const char* , const ::boost::math::policies::underflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) @@ -422,7 +429,7 @@ inline constexpr T raise_underflow_error( } template -inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* /* function */, const char* /* message */, const ::boost::math::policies::underflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -434,7 +441,7 @@ inline T raise_underflow_error( } template -inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::user_error>&) @@ -443,14 +450,14 @@ inline T raise_underflow_error( } template -inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, const T& /* val */, const ::boost::math::policies::denorm_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message ? message : "denormalised result"); // we never get here: @@ -459,7 +466,7 @@ inline T raise_denorm_error( } template -inline constexpr T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( const char* , const char* , const T& val, @@ -471,7 +478,7 @@ inline constexpr T raise_denorm_error( } template -inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* , const char* , const T& val, @@ -484,7 +491,7 @@ inline T raise_denorm_error( } template -inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, const T& val, @@ -494,14 +501,14 @@ inline T raise_denorm_error( } template -inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, const T& val, const ::boost::math::policies::evaluation_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message, val); // we never get here: @@ -510,7 +517,7 @@ inline T raise_evaluation_error( } template -inline constexpr T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( const char* , const char* , const T& val, @@ -522,7 +529,7 @@ inline constexpr T raise_evaluation_error( } template -inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* , const char* , const T& val, @@ -535,7 +542,7 @@ inline T raise_evaluation_error( } template -inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, const T& val, @@ -545,15 +552,15 @@ inline T raise_evaluation_error( } template -inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, const TargetType&, const ::boost::math::policies::rounding_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message, val); // we never get here: @@ -562,7 +569,7 @@ inline TargetType raise_rounding_error( } template -inline constexpr TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -571,12 +578,12 @@ inline constexpr TargetType raise_rounding_error( { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); - return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); + static_assert(boost::math::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); + return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); } template -inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -586,11 +593,11 @@ inline TargetType raise_rounding_error( errno = ERANGE; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); - return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); + static_assert(boost::math::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); + return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); } template -inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, @@ -601,24 +608,24 @@ inline TargetType raise_rounding_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, const R& , const ::boost::math::policies::indeterminate_result_error< ::boost::math::policies::throw_on_error>&) { -#ifdef BOOST_NO_EXCEPTIONS - static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_NO_EXCEPTIONS set."); +#ifdef BOOST_MATH_NO_EXCEPTIONS + static_assert(sizeof(T) == 0, "Error handler called with throw_on_error and BOOST_MATH_NO_EXCEPTIONS set."); #else raise_error(function, message, val); // we never get here: - return std::numeric_limits::quiet_NaN(); + return boost::math::numeric_limits::quiet_NaN(); #endif } template -inline constexpr T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -631,7 +638,7 @@ inline constexpr T raise_indeterminate_result_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -645,7 +652,7 @@ inline T raise_indeterminate_result_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, @@ -658,7 +665,7 @@ inline T raise_indeterminate_result_error( } // namespace detail template -inline constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::domain_error_type policy_type; return detail::raise_domain_error( @@ -667,7 +674,7 @@ inline constexpr T raise_domain_error(const char* function, const char* message, } template -inline constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::pole_error_type policy_type; return detail::raise_pole_error( @@ -676,7 +683,7 @@ inline constexpr T raise_pole_error(const char* function, const char* message, c } template -inline constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -685,7 +692,7 @@ inline constexpr T raise_overflow_error(const char* function, const char* messag } template -inline constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -694,7 +701,7 @@ inline constexpr T raise_overflow_error(const char* function, const char* messag } template -inline constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::underflow_error_type policy_type; return detail::raise_underflow_error( @@ -703,7 +710,7 @@ inline constexpr T raise_underflow_error(const char* function, const char* messa } template -inline constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::denorm_error_type policy_type; return detail::raise_denorm_error( @@ -713,7 +720,7 @@ inline constexpr T raise_denorm_error(const char* function, const char* message, } template -inline constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::evaluation_error_type policy_type; return detail::raise_evaluation_error( @@ -722,7 +729,7 @@ inline constexpr T raise_evaluation_error(const char* function, const char* mess } template -inline constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::rounding_error_type policy_type; return detail::raise_rounding_error( @@ -731,7 +738,7 @@ inline constexpr TargetType raise_rounding_error(const char* function, const cha } template -inline constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::indeterminate_result_error_type policy_type; return detail::raise_indeterminate_result_error( @@ -746,7 +753,7 @@ namespace detail { template -BOOST_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if(fabs(val) > tools::max_value()) @@ -758,7 +765,7 @@ BOOST_FORCEINLINE bool check_overflow(T val, R* result, const char* function, co return false; } template -BOOST_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -768,7 +775,7 @@ BOOST_FORCEINLINE bool check_overflow(std::complex val, R* result, const char return r; } template -BOOST_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { if((val != 0) && (static_cast(val) == 0)) { @@ -778,7 +785,7 @@ BOOST_FORCEINLINE bool check_underflow(T val, R* result, const char* function, c return false; } template -BOOST_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -788,7 +795,7 @@ BOOST_FORCEINLINE bool check_underflow(std::complex val, R* result, const cha return r; } template -BOOST_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if((fabs(val) < static_cast(tools::min_value())) && (static_cast(val) != 0)) @@ -799,7 +806,7 @@ BOOST_FORCEINLINE bool check_denorm(T val, R* result, const char* function, cons return false; } template -BOOST_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -811,28 +818,28 @@ BOOST_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* // Default instantiations with ignore_error policy. template -BOOST_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } } // namespace detail template -BOOST_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { typedef typename Policy::overflow_error_type overflow_type; typedef typename Policy::underflow_error_type underflow_type; @@ -852,7 +859,7 @@ BOOST_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept } template -inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_series_iterations()) raise_evaluation_error( @@ -861,7 +868,7 @@ inline void check_series_iterations(const char* function, std::uintmax_t max_ite } template -inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_root_iterations()) raise_evaluation_error( @@ -871,25 +878,169 @@ inline void check_root_iterations(const char* function, std::uintmax_t max_iter, } //namespace policies -namespace detail{ +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +}} // namespaces boost/math + +#else // Special values for NVRTC + +namespace boost { +namespace math { +namespace policies { + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( + const char* , + const char* , + const T& , + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return boost::math::numeric_limits::quiet_NaN(); +} + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( + const char* function, + const char* message, + const T& val, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + return boost::math::numeric_limits::quiet_NaN(); +} + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( + const char* , + const char* , + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : (boost::math::numeric_limits::max)(); +} + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( + const char* , + const char* , + const T&, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : (boost::math::numeric_limits::max)(); +} + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( + const char* , + const char* , + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return static_cast(0); +} + +template +BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( + const char* , + const char* , + const T& val, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return val; +} + +template +BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( + const char* , + const char* , + const T& val, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return val; +} + +template +BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( + const char* , + const char* , + const T& val, + const TargetType&, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + static_assert(boost::math::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); + return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); +} + +template +BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( + const char* , + const char* , + const T& , + const R& result, + const Policy&) BOOST_MATH_NOEXCEPT(T) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return result; +} + +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(boost::math::is_floating_point_v && boost::math::is_floating_point_v) +{ + // We only have ignore error policy so no reason to check + return static_cast(val); +} + +template +BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, boost::math::uintmax_t max_iter, const Policy& pol) noexcept(boost::math::is_floating_point_v) +{ + if(max_iter >= policies::get_max_series_iterations()) + raise_evaluation_error( + function, + "Series evaluation exceeded %1% iterations, giving up now.", static_cast(static_cast(max_iter)), pol); +} + +template +BOOST_MATH_GPU_ENABLED inline void check_root_iterations(const char* function, boost::math::uintmax_t max_iter, const Policy& pol) noexcept(boost::math::is_floating_point_v) +{ + if(max_iter >= policies::get_max_root_iterations()) + raise_evaluation_error( + function, + "Root finding evaluation exceeded %1% iterations, giving up now.", static_cast(static_cast(max_iter)), pol); +} + +} // namespace policies +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + +namespace boost { namespace math { namespace detail { // // Simple helper function to assist in returning a pair from a single value, // that value usually comes from one of the error handlers above: // template -std::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED boost::math::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) { - return std::make_pair(val, val); + return boost::math::make_pair(val, val); } -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -}} // namespaces boost/math +}}} // boost::math::detail #endif // BOOST_MATH_POLICY_ERROR_HANDLING_HPP diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index 6daebaa6..ec7b36f2 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -9,11 +9,9 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include namespace boost{ namespace math{ @@ -22,9 +20,9 @@ namespace mp = tools::meta_programming; namespace tools{ template -constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; +BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; template -constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); +BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value); } @@ -33,9 +31,36 @@ namespace policies{ // // Define macros for our default policies, if they're not defined already: // + + +// +// Generic support for GPUs +// +#ifdef BOOST_MATH_HAS_GPU_SUPPORT +# ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY +# define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_PROMOTE_DOUBLE_POLICY +# define BOOST_MATH_PROMOTE_DOUBLE_POLICY false +# endif +# ifndef BOOST_MATH_DOMAIN_ERROR_POLICY +# define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_POLE_ERROR_POLICY +# define BOOST_MATH_POLE_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_EVALUATION_ERROR_POLICY +# define BOOST_MATH_EVALUATION_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_ROUNDING_ERROR_POLICY +# define BOOST_MATH_ROUNDING_ERROR_POLICY ignore_error +# endif +#endif + +// // Special cases for exceptions disabled first: // -#ifdef BOOST_NO_EXCEPTIONS +#ifdef BOOST_MATH_NO_EXCEPTIONS # ifndef BOOST_MATH_DOMAIN_ERROR_POLICY # define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error # endif @@ -107,20 +132,20 @@ namespace policies{ #define BOOST_MATH_META_INT(Type, name, Default) \ template \ - class name : public std::integral_constant{}; \ + class name : public boost::math::integral_constant{}; \ \ namespace detail{ \ template \ - char test_is_valid_arg(const name* = nullptr); \ - char test_is_default_arg(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED char test_is_valid_arg(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED char test_is_default_arg(const name* = nullptr); \ \ template \ class is_##name##_imp \ { \ private: \ template \ - static char test(const name* = nullptr); \ - static double test(...); \ + BOOST_MATH_GPU_ENABLED static char test(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED static double test(...); \ public: \ static constexpr bool value = sizeof(test(static_cast(nullptr))) == sizeof(char); \ }; \ @@ -131,27 +156,27 @@ namespace policies{ { \ public: \ static constexpr bool value = boost::math::policies::detail::is_##name##_imp::value; \ - using type = std::integral_constant; \ + using type = boost::math::integral_constant; \ }; #define BOOST_MATH_META_BOOL(name, Default) \ template \ - class name : public std::integral_constant{}; \ + class name : public boost::math::integral_constant{}; \ \ namespace detail{ \ template \ - char test_is_valid_arg(const name* = nullptr); \ - char test_is_default_arg(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED char test_is_valid_arg(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED char test_is_default_arg(const name* = nullptr); \ \ template \ class is_##name##_imp \ { \ private: \ template \ - static char test(const name* = nullptr); \ - static double test(...); \ + BOOST_MATH_GPU_ENABLED static char test(const name* = nullptr); \ + BOOST_MATH_GPU_ENABLED static double test(...); \ public: \ - static constexpr bool value = sizeof(test(static_cast(nullptr))) == sizeof(char); \ + static constexpr bool value = sizeof(test(static_cast(nullptr))) == sizeof(char); \ }; \ } \ \ @@ -160,7 +185,7 @@ namespace policies{ { \ public: \ static constexpr bool value = boost::math::policies::detail::is_##name##_imp::value; \ - using type = std::integral_constant; \ + using type = boost::math::integral_constant; \ }; // @@ -232,27 +257,27 @@ struct precision // // Now work out the precision: // - using digits2_type = typename std::conditional< + using digits2_type = typename boost::math::conditional< (Digits10::value == 0), digits2<0>, digits2<((Digits10::value + 1) * 1000L) / 301L> >::type; public: #ifdef BOOST_BORLANDC - using type = typename std::conditional< + using type = typename boost::math::conditional< (Digits2::value > ::boost::math::policies::detail::precision::digits2_type::value), Digits2, digits2_type>::type; #else - using type = typename std::conditional< + using type = typename boost::math::conditional< (Digits2::value > digits2_type::value), Digits2, digits2_type>::type; #endif }; -double test_is_valid_arg(...); -double test_is_default_arg(...); -char test_is_valid_arg(const default_policy*); -char test_is_default_arg(const default_policy*); +BOOST_MATH_GPU_ENABLED double test_is_valid_arg(...); +BOOST_MATH_GPU_ENABLED double test_is_default_arg(...); +BOOST_MATH_GPU_ENABLED char test_is_valid_arg(const default_policy*); +BOOST_MATH_GPU_ENABLED char test_is_default_arg(const default_policy*); template class is_valid_policy_imp @@ -280,7 +305,7 @@ class is_default_policy { public: static constexpr bool value = boost::math::policies::detail::is_default_policy_imp::value; - using type = std::integral_constant; + using type = boost::math::integral_constant; template struct apply @@ -289,7 +314,7 @@ class is_default_policy }; }; -template +template struct append_N { using type = typename append_N, T, N-1>::type; @@ -378,7 +403,7 @@ class policy // Typelist of the arguments: // using arg_list = mp::mp_list; - static constexpr std::size_t arg_list_size = mp::mp_size::value; + static constexpr boost::math::size_t arg_list_size = mp::mp_size::value; template struct pick_arg @@ -509,7 +534,7 @@ class normalise { private: using arg_list = mp::mp_list; - static constexpr std::size_t arg_list_size = mp::mp_size::value; + static constexpr boost::math::size_t arg_list_size = mp::mp_size::value; template struct pick_arg @@ -640,81 +665,81 @@ struct normalise, using type = policy; }; -inline constexpr policy<> make_policy() noexcept +BOOST_MATH_GPU_ENABLED constexpr policy<> make_policy() noexcept { return {}; } template -inline constexpr typename normalise, A1>::type make_policy(const A1&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1>::type make_policy(const A1&) noexcept { typedef typename normalise, A1>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept { typedef typename normalise, A1, A2>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept { typedef typename normalise, A1, A2, A3>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept { typedef typename normalise, A1, A2, A3, A4>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type; return result_type(); @@ -732,47 +757,47 @@ struct evaluation template struct evaluation { - using type = typename std::conditional::type; + using type = typename boost::math::conditional::type; }; template struct evaluation { - using type = typename std::conditional::type; + using type = typename boost::math::conditional::type; }; template struct precision { - static_assert((std::numeric_limits::radix == 2) || ((std::numeric_limits::is_specialized == 0) || (std::numeric_limits::digits == 0)), - "(std::numeric_limits::radix == 2) || ((std::numeric_limits::is_specialized == 0) || (std::numeric_limits::digits == 0))"); + static_assert((boost::math::numeric_limits::radix == 2) || ((boost::math::numeric_limits::is_specialized == 0) || (boost::math::numeric_limits::digits == 0)), + "(boost::math::numeric_limits::radix == 2) || ((boost::math::numeric_limits::is_specialized == 0) || (boost::math::numeric_limits::digits == 0))"); #ifndef BOOST_BORLANDC using precision_type = typename Policy::precision_type; - using type = typename std::conditional< - ((std::numeric_limits::is_specialized == 0) || (std::numeric_limits::digits == 0)), + using type = typename boost::math::conditional< + ((boost::math::numeric_limits::is_specialized == 0) || (boost::math::numeric_limits::digits == 0)), // Possibly unknown precision: precision_type, - typename std::conditional< - ((std::numeric_limits::digits <= precision_type::value) + typename boost::math::conditional< + ((boost::math::numeric_limits::digits <= precision_type::value) || (Policy::precision_type::value <= 0)), // Default case, full precision for RealType: - digits2< std::numeric_limits::digits>, + digits2< boost::math::numeric_limits::digits>, // User customised precision: precision_type >::type >::type; #else using precision_type = typename Policy::precision_type; - using digits_t = std::integral_constant::digits>; - using spec_t = std::integral_constant::is_specialized>; - using type = typename std::conditional< - (spec_t::value == true std::true_type || digits_t::value == 0), + using digits_t = boost::math::integral_constant::digits>; + using spec_t = boost::math::integral_constant::is_specialized>; + using type = typename boost::math::conditional< + (spec_t::value == true boost::math::true_type || digits_t::value == 0), // Possibly unknown precision: precision_type, - typename std::conditional< + typename boost::math::conditional< (digits_t::value <= precision_type::value || precision_type::value <= 0), // Default case, full precision for RealType: - digits2< std::numeric_limits::digits>, + digits2< boost::math::numeric_limits::digits>, // User customised precision: precision_type >::type @@ -785,7 +810,7 @@ struct precision template struct precision { - typedef std::integral_constant type; + typedef boost::math::integral_constant type; }; #endif @@ -793,15 +818,15 @@ struct precision namespace detail{ template -inline constexpr int digits_imp(std::true_type const&) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_imp(boost::math::true_type const&) noexcept { - static_assert( std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); + static_assert( boost::math::numeric_limits::is_specialized, "boost::math::numeric_limits::is_specialized"); typedef typename boost::math::policies::precision::type p_t; return p_t::value; } template -inline constexpr int digits_imp(std::false_type const&) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_imp(boost::math::false_type const&) noexcept { return tools::digits(); } @@ -809,26 +834,26 @@ inline constexpr int digits_imp(std::false_type const&) noexcept } // namespace detail template -inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { - typedef std::integral_constant::is_specialized > tag_type; + typedef boost::math::integral_constant::is_specialized > tag_type; return detail::digits_imp(tag_type()); } template -inline constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { return boost::math::policies::digits() * 301 / 1000L; } template -inline constexpr unsigned long get_max_series_iterations() noexcept +BOOST_MATH_GPU_ENABLED constexpr unsigned long get_max_series_iterations() noexcept { typedef typename Policy::max_series_iterations_type iter_type; return iter_type::value; } template -inline constexpr unsigned long get_max_root_iterations() noexcept +BOOST_MATH_GPU_ENABLED constexpr unsigned long get_max_root_iterations() noexcept { typedef typename Policy::max_root_iterations_type iter_type; return iter_type::value; @@ -839,51 +864,51 @@ namespace detail{ template struct series_factor_calc { - static T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static T get() noexcept(boost::math::is_floating_point::value) { return ldexp(T(1.0), 1 - Digits::value); } }; template -struct series_factor_calc +struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(boost::math::is_floating_point::value) { return boost::math::tools::epsilon(); } }; template -struct series_factor_calc +struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(boost::math::is_floating_point::value) { - return 1 / static_cast(static_cast(1u) << (Digits::value - 1)); + return 1 / static_cast(static_cast(1u) << (Digits::value - 1)); } }; template -struct series_factor_calc +struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(boost::math::is_floating_point::value) { return boost::math::tools::epsilon(); } }; template -inline constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon_imp(boost::math::true_type const&) noexcept(boost::math::is_floating_point::value) { - static_assert(std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); - static_assert(std::numeric_limits::radix == 2, "std::numeric_limits::radix == 2"); + static_assert(boost::math::numeric_limits::is_specialized, "boost::math::numeric_limits::is_specialized"); + static_assert(boost::math::numeric_limits::radix == 2, "boost::math::numeric_limits::radix == 2"); typedef typename boost::math::policies::precision::type p_t; - typedef std::integral_constant::digits> is_small_int; - typedef std::integral_constant= std::numeric_limits::digits> is_default_value; + typedef boost::math::integral_constant::digits> is_small_int; + typedef boost::math::integral_constant= boost::math::numeric_limits::digits> is_default_value; return series_factor_calc::get(); } template -inline constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon_imp(boost::math::false_type const&) noexcept(boost::math::is_floating_point::value) { return tools::epsilon(); } @@ -891,9 +916,9 @@ inline constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floa } // namespace detail template -inline constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { - typedef std::integral_constant::is_specialized && (std::numeric_limits::radix == 2)) > tag_type; + typedef boost::math::integral_constant::is_specialized && (boost::math::numeric_limits::radix == 2)) > tag_type; return detail::get_epsilon_imp(tag_type()); } @@ -910,8 +935,8 @@ template -char test_is_policy(const policy*); -double test_is_policy(...); +BOOST_MATH_GPU_ENABLED char test_is_policy(const policy*); +BOOST_MATH_GPU_ENABLED double test_is_policy(...); template class is_policy_imp @@ -927,7 +952,7 @@ class is_policy { public: static constexpr bool value = boost::math::policies::detail::is_policy_imp

::value; - using type = std::integral_constant; + using type = boost::math::integral_constant; }; // @@ -937,20 +962,20 @@ template struct constructor_error_check { using domain_error_type = typename Policy::domain_error_type; - using type = typename std::conditional< + using type = typename boost::math::conditional< (domain_error_type::value == throw_on_error) || (domain_error_type::value == user_error) || (domain_error_type::value == errno_on_error), - std::true_type, - std::false_type>::type; + boost::math::true_type, + boost::math::false_type>::type; }; template struct method_error_check { using domain_error_type = typename Policy::domain_error_type; - using type = typename std::conditional< + using type = typename boost::math::conditional< (domain_error_type::value == throw_on_error), - std::false_type, - std::true_type>::type; + boost::math::false_type, + boost::math::true_type>::type; }; // // Does the Policy ever throw on error? diff --git a/include/boost/math/special_functions/acosh.hpp b/include/boost/math/special_functions/acosh.hpp index c601960f..63e8e2df 100644 --- a/include/boost/math/special_functions/acosh.hpp +++ b/include/boost/math/special_functions/acosh.hpp @@ -38,9 +38,7 @@ namespace boost if((x < 1) || (boost::math::isnan)(x)) { - return policies::raise_domain_error( - "boost::math::acosh<%1%>(%1%)", - "acosh requires x >= 1, but got x = %1%.", x, pol); + return policies::raise_domain_error("boost::math::acosh<%1%>(%1%)", "acosh requires x >= 1, but got x = %1%.", x, pol); } else if ((x - 1) >= tools::root_epsilon()) { diff --git a/include/boost/math/special_functions/asinh.hpp b/include/boost/math/special_functions/asinh.hpp index d66551e4..52362dd2 100644 --- a/include/boost/math/special_functions/asinh.hpp +++ b/include/boost/math/special_functions/asinh.hpp @@ -38,9 +38,7 @@ namespace boost if((boost::math::isnan)(x)) { - return policies::raise_domain_error( - "boost::math::asinh<%1%>(%1%)", - "asinh requires a finite argument, but got x = %1%.", x, pol); + return policies::raise_domain_error("boost::math::asinh<%1%>(%1%)", "asinh requires a finite argument, but got x = %1%.", x, pol); } if (x >= tools::forth_root_epsilon()) { diff --git a/include/boost/math/special_functions/atanh.hpp b/include/boost/math/special_functions/atanh.hpp index 6204dc43..9d73e568 100644 --- a/include/boost/math/special_functions/atanh.hpp +++ b/include/boost/math/special_functions/atanh.hpp @@ -15,7 +15,7 @@ #pragma once #endif -#include +#include #include #include #include @@ -33,28 +33,22 @@ namespace boost // This is the main fare template - inline T atanh_imp(const T x, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline T atanh_imp(const T x, const Policy& pol) { BOOST_MATH_STD_USING - static const char* function = "boost::math::atanh<%1%>(%1%)"; + constexpr auto function = "boost::math::atanh<%1%>(%1%)"; if(x < -1) { - return policies::raise_domain_error( - function, - "atanh requires x >= -1, but got x = %1%.", x, pol); + return policies::raise_domain_error(function, "atanh requires x >= -1, but got x = %1%.", x, pol); } else if(x > 1) { - return policies::raise_domain_error( - function, - "atanh requires x <= 1, but got x = %1%.", x, pol); + return policies::raise_domain_error(function, "atanh requires x <= 1, but got x = %1%.", x, pol); } else if((boost::math::isnan)(x)) { - return policies::raise_domain_error( - function, - "atanh requires -1 <= x <= 1, but got x = %1%.", x, pol); + return policies::raise_domain_error(function, "atanh requires -1 <= x <= 1, but got x = %1%.", x, pol); } else if(x < -1 + tools::epsilon()) { @@ -93,7 +87,7 @@ namespace boost } template - inline typename tools::promote_args::type atanh(T x, const Policy&) + BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type atanh(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -108,7 +102,7 @@ namespace boost "boost::math::atanh<%1%>(%1%)"); } template - inline typename tools::promote_args::type atanh(T x) + BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type atanh(T x) { return boost::math::atanh(x, policies::policy<>()); } diff --git a/include/boost/math/special_functions/bernoulli.hpp b/include/boost/math/special_functions/bernoulli.hpp index d77a5208..102b4939 100644 --- a/include/boost/math/special_functions/bernoulli.hpp +++ b/include/boost/math/special_functions/bernoulli.hpp @@ -88,7 +88,7 @@ inline OutputIterator bernoulli_b2n(const int start_index, if(start_index < 0) { *out_it = policies::raise_domain_error("boost::math::bernoulli_b2n<%1%>", "Index should be >= 0 but got %1%", T(start_index), pol); - return ++out_it; + return ++out_it; // LCOV_EXCL_LINE we don't reach here, previous line throws. } return boost::math::detail::bernoulli_number_imp(out_it, start_index, number_of_bernoullis_b2n, pol, tag_type()); @@ -130,7 +130,7 @@ inline OutputIterator tangent_t2n(const int start_index, if(start_index < 0) { *out_it = policies::raise_domain_error("boost::math::tangent_t2n<%1%>", "Index should be >= 0 but got %1%", T(start_index), pol); - return ++out_it; + return ++out_it; // LCOV_EXCL_LINE we don't reach here, previous line throws. } return boost::math::detail::get_bernoulli_numbers_cache().copy_tangent_numbers(out_it, start_index, number_of_tangent_t2n, pol); diff --git a/include/boost/math/special_functions/cbrt.hpp b/include/boost/math/special_functions/cbrt.hpp index 77cd5f0a..7fdf78d0 100644 --- a/include/boost/math/special_functions/cbrt.hpp +++ b/include/boost/math/special_functions/cbrt.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,12 +11,16 @@ #pragma once #endif +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include +#include +#include #include #include #include -#include -#include namespace boost{ namespace math{ @@ -38,7 +43,7 @@ struct largest_cbrt_int_type }; template -T cbrt_imp(T z, const Policy& pol) +BOOST_MATH_GPU_ENABLED T cbrt_imp(T z, const Policy& pol) { BOOST_MATH_STD_USING // @@ -51,7 +56,7 @@ T cbrt_imp(T z, const Policy& pol) // Expected Error Term: -1.231e-006 // Maximum Relative Change in Control Points: 5.982e-004 // - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(0.37568269008611818), static_cast(1.3304968705558024), static_cast(-1.4897101632445036), @@ -59,7 +64,7 @@ T cbrt_imp(T z, const Policy& pol) static_cast(-0.6398703759826468), static_cast(0.13584489959258635), }; - static const T correction[] = { + BOOST_MATH_STATIC const T correction[] = { static_cast(0.62996052494743658238360530363911), // 2^-2/3 static_cast(0.79370052598409973737585281963615), // 2^-1/3 static_cast(1), @@ -154,7 +159,7 @@ T cbrt_imp(T z, const Policy& pol) } // namespace detail template -inline typename tools::promote_args::type cbrt(T z, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z, const Policy& pol) { using result_type = typename tools::promote_args::type; using value_type = typename policies::evaluation::type; @@ -162,7 +167,7 @@ inline typename tools::promote_args::type cbrt(T z, const Policy& pol) } template -inline typename tools::promote_args::type cbrt(T z) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z) { return cbrt(z, policies::policy<>()); } @@ -170,6 +175,39 @@ inline typename tools::promote_args::type cbrt(T z) } // namespace math } // namespace boost +#else // Special NVRTC handling + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED double cbrt(T x) +{ + return ::cbrt(x); +} + +BOOST_MATH_GPU_ENABLED inline float cbrt(float x) +{ + return ::cbrtf(x); +} + +template +BOOST_MATH_GPU_ENABLED double cbrt(T x, const Policy&) +{ + return ::cbrt(x); +} + +template +BOOST_MATH_GPU_ENABLED float cbrt(float x, const Policy&) +{ + return ::cbrtf(x); +} + +} // namespace math +} // namespace boost + +#endif // NVRTC + #endif // BOOST_MATH_SF_CBRT_HPP diff --git a/include/boost/math/special_functions/cos_pi.hpp b/include/boost/math/special_functions/cos_pi.hpp index e09700ec..7c33614d 100644 --- a/include/boost/math/special_functions/cos_pi.hpp +++ b/include/boost/math/special_functions/cos_pi.hpp @@ -1,4 +1,5 @@ // Copyright (c) 2007 John Maddock +// Copyright (c) 2024 Matt Borland // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,10 +11,14 @@ #pragma once #endif +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include +#include #include -#include #include #include #include @@ -21,7 +26,7 @@ namespace boost{ namespace math{ namespace detail{ template -T cos_pi_imp(T x, const Policy&) +BOOST_MATH_GPU_ENABLED T cos_pi_imp(T x, const Policy&) { BOOST_MATH_STD_USING // ADL of std names // cos of pi*x: @@ -34,7 +39,7 @@ T cos_pi_imp(T x, const Policy&) x = -x; } T rem = floor(x); - if(abs(floor(rem/2)*2 - rem) > std::numeric_limits::epsilon()) + if(abs(floor(rem/2)*2 - rem) > boost::math::numeric_limits::epsilon()) { invert = !invert; } @@ -60,7 +65,7 @@ T cos_pi_imp(T x, const Policy&) } // namespace detail template -inline typename tools::promote_args::type cos_pi(T x, const Policy&) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -77,12 +82,47 @@ inline typename tools::promote_args::type cos_pi(T x, const Policy&) } template -inline typename tools::promote_args::type cos_pi(T x) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x) { return boost::math::cos_pi(x, policies::policy<>()); } } // namespace math } // namespace boost + +#else // Special handling for NVRTC + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED auto cos_pi(T x) +{ + return ::cospi(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto cos_pi(float x) +{ + return ::cospif(x); +} + +template +BOOST_MATH_GPU_ENABLED auto cos_pi(T x, const Policy&) +{ + return ::cospi(x); +} + +template +BOOST_MATH_GPU_ENABLED auto cos_pi(float x, const Policy&) +{ + return ::cospif(x); +} + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + #endif diff --git a/include/boost/math/special_functions/detail/bernoulli_details.hpp b/include/boost/math/special_functions/detail/bernoulli_details.hpp index c1754db1..419ddddb 100644 --- a/include/boost/math/special_functions/detail/bernoulli_details.hpp +++ b/include/boost/math/special_functions/detail/bernoulli_details.hpp @@ -16,7 +16,7 @@ #include #include -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_MATH_NO_ATOMIC_INT) +#if defined(BOOST_MATH_HAS_THREADS) && !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_MATH_NO_ATOMIC_INT) #include #else # define BOOST_MATH_BERNOULLI_NOTHREADS @@ -196,7 +196,7 @@ struct fixed_vector : private std::allocator { if(n > m_capacity) { -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Exhausted storage for Bernoulli numbers.")); #else return false; @@ -351,7 +351,7 @@ class bernoulli_numbers_cache // // There are basically 3 thread safety options: // - // 1) There are no threads (BOOST_HAS_THREADS is not defined). + // 1) There are no threads (BOOST_MATH_HAS_THREADS is not defined). // 2) There are threads, but we do not have a true atomic integer type, // in this case we just use a mutex to guard against race conditions. // 3) There are threads, and we have an atomic integer: in this case we can @@ -384,7 +384,7 @@ class bernoulli_numbers_cache return out; } - #if defined(BOOST_HAS_THREADS) && defined(BOOST_MATH_BERNOULLI_NOTHREADS) && !defined(BOOST_MATH_BERNOULLI_UNTHREADED) + #if defined(BOOST_MATH_HAS_THREADS) && defined(BOOST_MATH_BERNOULLI_NOTHREADS) && !defined(BOOST_MATH_BERNOULLI_UNTHREADED) // Add a static_assert on instantiation if we have threads, but no C++11 threading support. static_assert(sizeof(T) == 1, "Unsupported configuration: your platform appears to have either no atomic integers, or no std::mutex. If you are happy with thread-unsafe code, then you may define BOOST_MATH_BERNOULLI_UNTHREADED to suppress this error."); #elif defined(BOOST_MATH_BERNOULLI_NOTHREADS) @@ -451,7 +451,7 @@ class bernoulli_numbers_cache ++out; } - #endif // BOOST_HAS_THREADS + #endif // BOOST_MATH_HAS_THREADS return out; } @@ -461,7 +461,7 @@ class bernoulli_numbers_cache // // There are basically 3 thread safety options: // - // 1) There are no threads (BOOST_HAS_THREADS is not defined). + // 1) There are no threads (BOOST_MATH_HAS_THREADS is not defined). // 2) There are threads, but we do not have a true atomic integer type, // in this case we just use a mutex to guard against race conditions. // 3) There are threads, and we have an atomic integer: in this case we can @@ -575,7 +575,7 @@ class bernoulli_numbers_cache ++out; } - #endif // BOOST_HAS_THREADS + #endif // BOOST_MATH_HAS_THREADS return out; } @@ -596,7 +596,7 @@ class bernoulli_numbers_cache #else int m_counter; int m_current_precision; - #endif // BOOST_HAS_THREADS + #endif // BOOST_MATH_HAS_THREADS }; template diff --git a/include/boost/math/special_functions/detail/erf_inv.hpp b/include/boost/math/special_functions/detail/erf_inv.hpp index ad6843e2..cb65cffb 100644 --- a/include/boost/math/special_functions/detail/erf_inv.hpp +++ b/include/boost/math/special_functions/detail/erf_inv.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -13,6 +14,10 @@ #pragma warning(disable:4702) // Unreachable code: optimization warning #endif +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include namespace boost{ namespace math{ @@ -23,7 +28,7 @@ namespace detail{ // this version is for 80-bit long double's and smaller: // template -T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constant*) +BOOST_MATH_GPU_ENABLED T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constant&) { BOOST_MATH_STD_USING // for ADL of std names. @@ -43,8 +48,9 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan // long double: Max error found: 1.017064e-20 // Maximum Deviation Found (actual error term at infinite precision) 8.030e-21 // - static const float Y = 0.0891314744949340820313f; - static const T P[] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.0891314744949340820313f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.000508781949658280665617), BOOST_MATH_BIG_CONSTANT(T, 64, -0.00836874819741736770379), BOOST_MATH_BIG_CONSTANT(T, 64, 0.0334806625409744615033), @@ -54,7 +60,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.00822687874676915743155), BOOST_MATH_BIG_CONSTANT(T, 64, -0.00538772965071242932965) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, -0.970005043303290640362), BOOST_MATH_BIG_CONSTANT(T, 64, -1.56574558234175846809), @@ -66,6 +72,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, -0.00233393759374190016776), BOOST_MATH_BIG_CONSTANT(T, 64, 0.000886216390456424707504) }; + // LCOV_EXCL_STOP T g = p * (p + 10); T r = tools::evaluate_polynomial(P, p) / tools::evaluate_polynomial(Q, p); result = g * Y + g * r; @@ -84,8 +91,9 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan // long double : Max error found: 6.084616e-20 // Maximum Deviation Found (error term) 4.811e-20 // - static const float Y = 2.249481201171875f; - static const T P[] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 2.249481201171875f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.202433508355938759655), BOOST_MATH_BIG_CONSTANT(T, 64, 0.105264680699391713268), BOOST_MATH_BIG_CONSTANT(T, 64, 8.37050328343119927838), @@ -96,7 +104,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 21.1294655448340526258), BOOST_MATH_BIG_CONSTANT(T, 64, -3.67192254707729348546) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 6.24264124854247537712), BOOST_MATH_BIG_CONSTANT(T, 64, 3.9713437953343869095), @@ -107,6 +115,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, -22.6436933413139721736), BOOST_MATH_BIG_CONSTANT(T, 64, 1.72114765761200282724) }; + // LCOV_EXCL_STOP T g = sqrt(-2 * log(q)); T xs = q - 0.25f; T r = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); @@ -136,9 +145,10 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan T x = sqrt(-log(q)); if(x < 3) { + // LCOV_EXCL_START // Max error found: 1.089051e-20 - static const float Y = 0.807220458984375f; - static const T P[] = { + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.807220458984375f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.131102781679951906451), BOOST_MATH_BIG_CONSTANT(T, 64, -0.163794047193317060787), BOOST_MATH_BIG_CONSTANT(T, 64, 0.117030156341995252019), @@ -151,7 +161,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.285225331782217055858e-7), BOOST_MATH_BIG_CONSTANT(T, 64, -0.681149956853776992068e-9) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 3.46625407242567245975), BOOST_MATH_BIG_CONSTANT(T, 64, 5.38168345707006855425), @@ -161,15 +171,17 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.152264338295331783612), BOOST_MATH_BIG_CONSTANT(T, 64, 0.01105924229346489121) }; + // LCOV_EXCL_STOP T xs = x - 1.125f; T R = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); result = Y * x + R * x; } else if(x < 6) { + // LCOV_EXCL_START // Max error found: 8.389174e-21 - static const float Y = 0.93995571136474609375f; - static const T P[] = { + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.93995571136474609375f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.0350353787183177984712), BOOST_MATH_BIG_CONSTANT(T, 64, -0.00222426529213447927281), BOOST_MATH_BIG_CONSTANT(T, 64, 0.0185573306514231072324), @@ -180,7 +192,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, -0.230404776911882601748e-9), BOOST_MATH_BIG_CONSTANT(T, 64, 0.266339227425782031962e-11) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 1.3653349817554063097), BOOST_MATH_BIG_CONSTANT(T, 64, 0.762059164553623404043), @@ -189,15 +201,17 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.00263861676657015992959), BOOST_MATH_BIG_CONSTANT(T, 64, 0.764675292302794483503e-4) }; + // LCOV_EXCL_STOP T xs = x - 3; T R = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); result = Y * x + R * x; } else if(x < 18) { + // LCOV_EXCL_START // Max error found: 1.481312e-19 - static const float Y = 0.98362827301025390625f; - static const T P[] = { + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.98362827301025390625f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.0167431005076633737133), BOOST_MATH_BIG_CONSTANT(T, 64, -0.00112951438745580278863), BOOST_MATH_BIG_CONSTANT(T, 64, 0.00105628862152492910091), @@ -208,7 +222,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, -0.281128735628831791805e-13), BOOST_MATH_BIG_CONSTANT(T, 64, 0.99055709973310326855e-16) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 0.591429344886417493481), BOOST_MATH_BIG_CONSTANT(T, 64, 0.138151865749083321638), @@ -217,15 +231,17 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.275335474764726041141e-4), BOOST_MATH_BIG_CONSTANT(T, 64, 0.282243172016108031869e-6) }; + // LCOV_EXCL_STOP T xs = x - 6; T R = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); result = Y * x + R * x; } else if(x < 44) { + // LCOV_EXCL_START // Max error found: 5.697761e-20 - static const float Y = 0.99714565277099609375f; - static const T P[] = { + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.99714565277099609375f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.0024978212791898131227), BOOST_MATH_BIG_CONSTANT(T, 64, -0.779190719229053954292e-5), BOOST_MATH_BIG_CONSTANT(T, 64, 0.254723037413027451751e-4), @@ -235,7 +251,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.145596286718675035587e-11), BOOST_MATH_BIG_CONSTANT(T, 64, -0.116765012397184275695e-17) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 0.207123112214422517181), BOOST_MATH_BIG_CONSTANT(T, 64, 0.0169410838120975906478), @@ -244,15 +260,17 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.144437756628144157666e-6), BOOST_MATH_BIG_CONSTANT(T, 64, 0.509761276599778486139e-9) }; + // LCOV_EXCL_STOP T xs = x - 18; T R = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); result = Y * x + R * x; } else { + // LCOV_EXCL_START // Max error found: 1.279746e-20 - static const float Y = 0.99941349029541015625f; - static const T P[] = { + BOOST_MATH_STATIC_LOCAL_VARIABLE const float Y = 0.99941349029541015625f; + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.000539042911019078575891), BOOST_MATH_BIG_CONSTANT(T, 64, -0.28398759004727721098e-6), BOOST_MATH_BIG_CONSTANT(T, 64, 0.899465114892291446442e-6), @@ -262,7 +280,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.135880130108924861008e-14), BOOST_MATH_BIG_CONSTANT(T, 64, -0.348890393399948882918e-21) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 0.0845746234001899436914), BOOST_MATH_BIG_CONSTANT(T, 64, 0.00282092984726264681981), @@ -271,6 +289,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan BOOST_MATH_BIG_CONSTANT(T, 64, 0.161809290887904476097e-8), BOOST_MATH_BIG_CONSTANT(T, 64, 0.231558608310259605225e-11) }; + // LCOV_EXCL_STOP T xs = x - 44; T R = tools::evaluate_polynomial(P, xs) / tools::evaluate_polynomial(Q, xs); result = Y * x + R * x; @@ -296,12 +315,13 @@ struct erf_roots }; template -T erf_inv_imp(const T& p, const T& q, const Policy& pol, const std::integral_constant*) +T erf_inv_imp(const T& p, const T& q, const Policy& pol, const std::integral_constant&) { // // Generic version, get a guess that's accurate to 64-bits (10^-19) // - T guess = erf_inv_imp(p, q, pol, static_cast const*>(nullptr)); + using tag_type = std::integral_constant; + T guess = erf_inv_imp(p, q, pol, tag_type()); T result; // // If T has more bit's than 64 in it's mantissa then we need to iterate, @@ -327,82 +347,17 @@ T erf_inv_imp(const T& p, const T& q, const Policy& pol, const std::integral_con return result; } -template -struct erf_inv_initializer -{ - struct init - { - init() - { - do_init(); - } - static bool is_value_non_zero(T); - static void do_init() - { - // If std::numeric_limits::digits is zero, we must not call - // our initialization code here as the precision presumably - // varies at runtime, and will not have been set yet. - if(std::numeric_limits::digits) - { - boost::math::erf_inv(static_cast(0.25), Policy()); - boost::math::erf_inv(static_cast(0.55), Policy()); - boost::math::erf_inv(static_cast(0.95), Policy()); - boost::math::erfc_inv(static_cast(1e-15), Policy()); - // These following initializations must not be called if - // type T can not hold the relevant values without - // underflow to zero. We check this at runtime because - // some tools such as valgrind silently change the precision - // of T at runtime, and numeric_limits basically lies! - if(is_value_non_zero(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)))) - boost::math::erfc_inv(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)), Policy()); - - // Some compilers choke on constants that would underflow, even in code that isn't instantiated - // so try and filter these cases out in the preprocessor: -#if LDBL_MAX_10_EXP >= 800 - if(is_value_non_zero(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)))) - boost::math::erfc_inv(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy()); - if(is_value_non_zero(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)))) - boost::math::erfc_inv(static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy()); -#else - if(is_value_non_zero(static_cast(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-800)))) - boost::math::erfc_inv(static_cast(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-800)), Policy()); - if(is_value_non_zero(static_cast(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-900)))) - boost::math::erfc_inv(static_cast(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-900)), Policy()); -#endif - } - } - void force_instantiate()const{} - }; - static const init initializer; - static void force_instantiate() - { - initializer.force_instantiate(); - } -}; - -template -const typename erf_inv_initializer::init erf_inv_initializer::initializer; - -template -BOOST_NOINLINE bool erf_inv_initializer::init::is_value_non_zero(T v) -{ - // This needs to be non-inline to detect whether v is non zero at runtime - // rather than at compile time, only relevant when running under valgrind - // which changes long double's to double's on the fly. - return v != 0; -} - } // namespace detail template -typename tools::promote_args::type erfc_inv(T z, const Policy& pol) +BOOST_MATH_GPU_ENABLED typename tools::promote_args::type erfc_inv(T z, const Policy& pol) { typedef typename tools::promote_args::type result_type; // // Begin by testing for domain errors, and other special cases: // - static const char* function = "boost::math::erfc_inv<%1%>(%1%, %1%)"; + constexpr auto function = "boost::math::erfc_inv<%1%>(%1%, %1%)"; if((z < 0) || (z > 2)) return policies::raise_domain_error(function, "Argument outside range [0,2] in inverse erfc function (got p=%1%).", z, pol); if(z == 0) @@ -448,24 +403,22 @@ typename tools::promote_args::type erfc_inv(T z, const Policy& pol) policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - detail::erf_inv_initializer::force_instantiate(); - // // And get the result, negating where required: // return s * policies::checked_narrowing_cast( - detail::erf_inv_imp(static_cast(p), static_cast(q), forwarding_policy(), static_cast(nullptr)), function); + detail::erf_inv_imp(static_cast(p), static_cast(q), forwarding_policy(), tag_type()), function); } template -typename tools::promote_args::type erf_inv(T z, const Policy& pol) +BOOST_MATH_GPU_ENABLED typename tools::promote_args::type erf_inv(T z, const Policy& pol) { typedef typename tools::promote_args::type result_type; // // Begin by testing for domain errors, and other special cases: // - static const char* function = "boost::math::erf_inv<%1%>(%1%, %1%)"; + constexpr auto function = "boost::math::erf_inv<%1%>(%1%, %1%)"; if((z < -1) || (z > 1)) return policies::raise_domain_error(function, "Argument outside range [-1, 1] in inverse erf function (got p=%1%).", z, pol); if(z == 1) @@ -518,22 +471,21 @@ typename tools::promote_args::type erf_inv(T z, const Policy& pol) // typedef typename policies::evaluation::type eval_type; - detail::erf_inv_initializer::force_instantiate(); // // And get the result, negating where required: // return s * policies::checked_narrowing_cast( - detail::erf_inv_imp(static_cast(p), static_cast(q), forwarding_policy(), static_cast(nullptr)), function); + detail::erf_inv_imp(static_cast(p), static_cast(q), forwarding_policy(), tag_type()), function); } template -inline typename tools::promote_args::type erfc_inv(T z) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc_inv(T z) { return erfc_inv(z, policies::policy<>()); } template -inline typename tools::promote_args::type erf_inv(T z) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf_inv(T z) { return erf_inv(z, policies::policy<>()); } @@ -541,6 +493,64 @@ inline typename tools::promote_args::type erf_inv(T z) } // namespace math } // namespace boost +#else // Special handling for NVRTC + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED auto erf_inv(T x) +{ + return ::erfinv(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto erf_inv(float x) +{ + return ::erfinvf(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erf_inv(T x, const Policy&) +{ + return ::erfinv(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erf_inv(float x, const Policy&) +{ + return ::erfinvf(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc_inv(T x) +{ + return ::erfcinv(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto erfc_inv(float x) +{ + return ::erfcinvf(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc_inv(T x, const Policy&) +{ + return ::erfcinv(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc_inv(float x, const Policy&) +{ + return ::erfcinvf(x); +} + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_HAS_NVRTV + #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/include/boost/math/special_functions/detail/fp_traits.hpp b/include/boost/math/special_functions/detail/fp_traits.hpp index 975052b5..015ea9cd 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -4,6 +4,7 @@ #define BOOST_MATH_FP_TRAITS_HPP // Copyright (c) 2006 Johan Rade +// Copyright (c) 2024 Matt Borland // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt @@ -24,6 +25,7 @@ With these techniques, the code could be simplified. #include #include #include +#include #include #include @@ -34,16 +36,6 @@ With these techniques, the code could be simplified. #define BOOST_MATH_ENDIAN_BIG_BYTE BOOST_ENDIAN_BIG_BYTE #define BOOST_MATH_ENDIAN_LITTLE_BYTE BOOST_ENDIAN_LITTLE_BYTE -#elif (__cplusplus >= 202002L || _MSVC_LANG >= 202002L) - -#if __has_include() -#include -#define BOOST_MATH_ENDIAN_BIG_BYTE (std::endian::native == std::endian::big) -#define BOOST_MATH_ENDIAN_LITTLE_BYTE (std::endian::native == std::endian::little) -#else -#error Missing header. Please disable standalone mode, and file an issue at https://github.com/boostorg/math -#endif - #elif defined(_WIN32) #define BOOST_MATH_ENDIAN_BIG_BYTE 0 @@ -212,14 +204,14 @@ template<> struct fp_traits_non_native { typedef ieee_copy_all_bits_tag method; - static constexpr uint32_t sign = 0x80000000u; - static constexpr uint32_t exponent = 0x7f800000; - static constexpr uint32_t flag = 0x00000000; - static constexpr uint32_t significand = 0x007fffff; + BOOST_MATH_STATIC constexpr uint32_t sign = 0x80000000u; + BOOST_MATH_STATIC constexpr uint32_t exponent = 0x7f800000; + BOOST_MATH_STATIC constexpr uint32_t flag = 0x00000000; + BOOST_MATH_STATIC constexpr uint32_t significand = 0x007fffff; typedef uint32_t bits; - static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); } - static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); } + BOOST_MATH_GPU_ENABLED static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); } + BOOST_MATH_GPU_ENABLED static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); } }; // ieee_tag version, double (64 bits) ---------------------------------------------- @@ -260,15 +252,15 @@ template<> struct fp_traits_non_native { typedef ieee_copy_all_bits_tag method; - static constexpr uint64_t sign = static_cast(0x80000000u) << 32; - static constexpr uint64_t exponent = static_cast(0x7ff00000) << 32; - static constexpr uint64_t flag = 0; - static constexpr uint64_t significand + BOOST_MATH_STATIC constexpr uint64_t sign = static_cast(0x80000000u) << 32; + BOOST_MATH_STATIC constexpr uint64_t exponent = static_cast(0x7ff00000) << 32; + BOOST_MATH_STATIC constexpr uint64_t flag = 0; + BOOST_MATH_STATIC constexpr uint64_t significand = (static_cast(0x000fffff) << 32) + static_cast(0xffffffffu); typedef uint64_t bits; - static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); } - static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); } + BOOST_MATH_GPU_ENABLED static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + BOOST_MATH_GPU_ENABLED static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); } }; #endif @@ -340,10 +332,10 @@ struct fp_traits_non_native { typedef ieee_copy_leading_bits_tag method; - static constexpr uint32_t sign = 0x80000000u; - static constexpr uint32_t exponent = 0x7fff0000; - static constexpr uint32_t flag = 0x00008000; - static constexpr uint32_t significand = 0x00007fff; + BOOST_MATH_STATIC constexpr uint32_t sign = 0x80000000u; + BOOST_MATH_STATIC constexpr uint32_t exponent = 0x7fff0000; + BOOST_MATH_STATIC constexpr uint32_t flag = 0x00008000; + BOOST_MATH_STATIC constexpr uint32_t significand = 0x00007fff; typedef uint32_t bits; @@ -391,10 +383,10 @@ struct fp_traits_non_native { typedef ieee_copy_leading_bits_tag method; - static constexpr uint32_t sign = 0x80000000u; - static constexpr uint32_t exponent = 0x7ff00000; - static constexpr uint32_t flag = 0x00000000; - static constexpr uint32_t significand = 0x000fffff; + BOOST_MATH_STATIC constexpr uint32_t sign = 0x80000000u; + BOOST_MATH_STATIC constexpr uint32_t exponent = 0x7ff00000; + BOOST_MATH_STATIC constexpr uint32_t flag = 0x00000000; + BOOST_MATH_STATIC constexpr uint32_t significand = 0x000fffff; typedef uint32_t bits; @@ -409,7 +401,7 @@ struct fp_traits_non_native } private: - static constexpr int offset_ = BOOST_MATH_ENDIAN_BIG_BYTE ? 0 : 12; + BOOST_MATH_STATIC constexpr int offset_ = BOOST_MATH_ENDIAN_BIG_BYTE ? 0 : 12; }; @@ -429,10 +421,10 @@ struct fp_traits_non_native { typedef ieee_copy_leading_bits_tag method; - static constexpr uint32_t sign = 0x80000000u; - static constexpr uint32_t exponent = 0x7fff0000; - static constexpr uint32_t flag = 0x00008000; - static constexpr uint32_t significand = 0x00007fff; + BOOST_MATH_STATIC constexpr uint32_t sign = 0x80000000u; + BOOST_MATH_STATIC constexpr uint32_t exponent = 0x7fff0000; + BOOST_MATH_STATIC constexpr uint32_t flag = 0x00008000; + BOOST_MATH_STATIC constexpr uint32_t significand = 0x00007fff; // copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding. @@ -465,10 +457,10 @@ struct fp_traits_non_native { typedef ieee_copy_leading_bits_tag method; - static constexpr uint32_t sign = 0x80000000u; - static constexpr uint32_t exponent = 0x7fff0000; - static constexpr uint32_t flag = 0x00000000; - static constexpr uint32_t significand = 0x0000ffff; + BOOST_MATH_STATIC constexpr uint32_t sign = 0x80000000u; + BOOST_MATH_STATIC constexpr uint32_t exponent = 0x7fff0000; + BOOST_MATH_STATIC constexpr uint32_t flag = 0x00000000; + BOOST_MATH_STATIC constexpr uint32_t significand = 0x0000ffff; typedef uint32_t bits; @@ -483,7 +475,7 @@ struct fp_traits_non_native } private: - static constexpr int offset_ = BOOST_MATH_ENDIAN_BIG_BYTE ? 0 : 12; + BOOST_MATH_STATIC constexpr int offset_ = BOOST_MATH_ENDIAN_BIG_BYTE ? 0 : 12; }; #endif @@ -563,7 +555,8 @@ struct select_native && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)\ && !defined(__INTEL_COMPILER)\ && !defined(sun)\ - && !defined(__VXWORKS__) + && !defined(__VXWORKS__)\ + && !defined(BOOST_MATH_HAS_GPU_SUPPORT) # define BOOST_MATH_USE_STD_FPCLASSIFY #endif diff --git a/include/boost/math/special_functions/detail/gamma_inva.hpp b/include/boost/math/special_functions/detail/gamma_inva.hpp index 75ac89e4..8c3be8ef 100644 --- a/include/boost/math/special_functions/detail/gamma_inva.hpp +++ b/include/boost/math/special_functions/detail/gamma_inva.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -17,16 +18,23 @@ #pragma once #endif -#include +#include #include -namespace boost{ namespace math{ namespace detail{ +namespace boost{ namespace math{ + +#ifdef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED auto erfc_inv(T x, const Policy&); +#endif + +namespace detail{ template struct gamma_inva_t { - gamma_inva_t(T z_, T p_, bool invert_) : z(z_), p(p_), invert(invert_) {} - T operator()(T a) + BOOST_MATH_GPU_ENABLED gamma_inva_t(T z_, T p_, bool invert_) : z(z_), p(p_), invert(invert_) {} + BOOST_MATH_GPU_ENABLED T operator()(T a) { return invert ? p - boost::math::gamma_q(a, z, Policy()) : boost::math::gamma_p(a, z, Policy()) - p; } @@ -36,7 +44,7 @@ struct gamma_inva_t }; template -T inverse_poisson_cornish_fisher(T lambda, T p, T q, const Policy& pol) +BOOST_MATH_GPU_ENABLED T inverse_poisson_cornish_fisher(T lambda, T p, T q, const Policy& pol) { BOOST_MATH_STD_USING // mean: @@ -67,7 +75,7 @@ T inverse_poisson_cornish_fisher(T lambda, T p, T q, const Policy& pol) } template -T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol) +BOOST_MATH_GPU_ENABLED T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol) { BOOST_MATH_STD_USING // for ADL of std lib math functions // @@ -151,7 +159,7 @@ T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol) } // namespace detail template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_p_inva(T1 x, T2 p, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -181,7 +189,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_q_inva(T1 x, T2 q, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -211,14 +219,14 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_p_inva(T1 x, T2 p) { return boost::math::gamma_p_inva(x, p, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_q_inva(T1 x, T2 q) { return boost::math::gamma_q_inva(x, q, policies::policy<>()); diff --git a/include/boost/math/special_functions/detail/igamma_inverse.hpp b/include/boost/math/special_functions/detail/igamma_inverse.hpp index f6bbcd72..4efd4f78 100644 --- a/include/boost/math/special_functions/detail/igamma_inverse.hpp +++ b/include/boost/math/special_functions/detail/igamma_inverse.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,6 +11,8 @@ #pragma once #endif +#include +#include #include #include #include @@ -21,7 +24,7 @@ namespace boost{ namespace math{ namespace detail{ template -T find_inverse_s(T p, T q) +BOOST_MATH_GPU_ENABLED T find_inverse_s(T p, T q) { // // Computation of the Incomplete Gamma Function Ratios and their Inverse @@ -41,8 +44,8 @@ T find_inverse_s(T p, T q) { t = sqrt(-2 * log(q)); } - static const double a[4] = { 3.31125922108741, 11.6616720288968, 4.28342155967104, 0.213623493715853 }; - static const double b[5] = { 1, 6.61053765625462, 6.40691597760039, 1.27364489782223, 0.3611708101884203e-1 }; + BOOST_MATH_STATIC const double a[4] = { 3.31125922108741, 11.6616720288968, 4.28342155967104, 0.213623493715853 }; + BOOST_MATH_STATIC const double b[5] = { 1, 6.61053765625462, 6.40691597760039, 1.27364489782223, 0.3611708101884203e-1 }; T s = t - tools::evaluate_polynomial(a, t) / tools::evaluate_polynomial(b, t); if(p < T(0.5)) s = -s; @@ -50,7 +53,7 @@ T find_inverse_s(T p, T q) } template -T didonato_SN(T a, T x, unsigned N, T tolerance = 0) +BOOST_MATH_GPU_ENABLED T didonato_SN(T a, T x, unsigned N, T tolerance = 0) { // // Computation of the Incomplete Gamma Function Ratios and their Inverse @@ -77,7 +80,7 @@ T didonato_SN(T a, T x, unsigned N, T tolerance = 0) } template -inline T didonato_FN(T p, T a, T x, unsigned N, T tolerance, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline T didonato_FN(T p, T a, T x, unsigned N, T tolerance, const Policy& pol) { // // Computation of the Incomplete Gamma Function Ratios and their Inverse @@ -93,7 +96,7 @@ inline T didonato_FN(T p, T a, T x, unsigned N, T tolerance, const Policy& pol) } template -T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) +BOOST_MATH_GPU_ENABLED T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) { // // In order to understand what's going on here, you will @@ -233,7 +236,7 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) } else { - T D = (std::max)(T(2), T(a * (a - 1))); + T D = BOOST_MATH_GPU_SAFE_MAX(T(2), T(a * (a - 1))); T lg = boost::math::lgamma(a, pol); T lb = log(q) + lg; if(lb < -D * T(2.3)) @@ -315,7 +318,7 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) template struct gamma_p_inverse_func { - gamma_p_inverse_func(T a_, T p_, bool inv) : a(a_), p(p_), invert(inv) + BOOST_MATH_GPU_ENABLED gamma_p_inverse_func(T a_, T p_, bool inv) : a(a_), p(p_), invert(inv) { // // If p is too near 1 then P(x) - p suffers from cancellation @@ -333,7 +336,7 @@ struct gamma_p_inverse_func } } - boost::math::tuple operator()(const T& x)const + BOOST_MATH_GPU_ENABLED boost::math::tuple operator()(const T& x)const { BOOST_FPU_EXCEPTION_GUARD // @@ -395,11 +398,11 @@ struct gamma_p_inverse_func }; template -T gamma_p_inv_imp(T a, T p, const Policy& pol) +BOOST_MATH_GPU_ENABLED T gamma_p_inv_imp(T a, T p, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std functions. - static const char* function = "boost::math::gamma_p_inv<%1%>(%1%, %1%)"; + constexpr auto function = "boost::math::gamma_p_inv<%1%>(%1%, %1%)"; BOOST_MATH_INSTRUMENT_VARIABLE(a); BOOST_MATH_INSTRUMENT_VARIABLE(p); @@ -442,7 +445,9 @@ T gamma_p_inv_imp(T a, T p, const Policy& pol) // // Go ahead and iterate: // - std::uintmax_t max_iter = policies::get_max_root_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_root_iterations(); + + #ifndef BOOST_MATH_HAS_GPU_SUPPORT guess = tools::halley_iterate( detail::gamma_p_inverse_func(a, p, false), guess, @@ -450,6 +455,16 @@ T gamma_p_inv_imp(T a, T p, const Policy& pol) tools::max_value(), digits, max_iter); + #else + guess = tools::newton_raphson_iterate( + detail::gamma_p_inverse_func(a, p, false), + guess, + lower, + tools::max_value(), + digits, + max_iter); + #endif + policies::check_root_iterations(function, max_iter, pol); BOOST_MATH_INSTRUMENT_VARIABLE(guess); if(guess == lower) @@ -458,11 +473,11 @@ T gamma_p_inv_imp(T a, T p, const Policy& pol) } template -T gamma_q_inv_imp(T a, T q, const Policy& pol) +BOOST_MATH_GPU_ENABLED T gamma_q_inv_imp(T a, T q, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std functions. - static const char* function = "boost::math::gamma_q_inv<%1%>(%1%, %1%)"; + constexpr auto function = "boost::math::gamma_q_inv<%1%>(%1%, %1%)"; if(a <= 0) return policies::raise_domain_error(function, "Argument a in the incomplete gamma function inverse must be >= 0 (got a=%1%).", a, pol); @@ -501,7 +516,9 @@ T gamma_q_inv_imp(T a, T q, const Policy& pol) // // Go ahead and iterate: // - std::uintmax_t max_iter = policies::get_max_root_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_root_iterations(); + + #ifndef BOOST_MATH_HAS_GPU_SUPPORT guess = tools::halley_iterate( detail::gamma_p_inverse_func(a, q, true), guess, @@ -509,6 +526,16 @@ T gamma_q_inv_imp(T a, T q, const Policy& pol) tools::max_value(), digits, max_iter); + #else + guess = tools::newton_raphson_iterate( + detail::gamma_p_inverse_func(a, q, true), + guess, + lower, + tools::max_value(), + digits, + max_iter); + #endif + policies::check_root_iterations(function, max_iter, pol); if(guess == lower) guess = policies::raise_underflow_error(function, "Expected result known to be non-zero, but is smaller than the smallest available number.", pol); @@ -518,7 +545,7 @@ T gamma_q_inv_imp(T a, T q, const Policy& pol) } // namespace detail template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_p_inv(T1 a, T2 p, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -528,7 +555,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_q_inv(T1 a, T2 p, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -538,14 +565,14 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_p_inv(T1 a, T2 p) { return gamma_p_inv(a, p, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type gamma_q_inv(T1 a, T2 p) { return gamma_q_inv(a, p, policies::policy<>()); diff --git a/include/boost/math/special_functions/detail/igamma_large.hpp b/include/boost/math/special_functions/detail/igamma_large.hpp index 5483b53f..8e0ad1b0 100644 --- a/include/boost/math/special_functions/detail/igamma_large.hpp +++ b/include/boost/math/special_functions/detail/igamma_large.hpp @@ -1,4 +1,5 @@ // Copyright John Maddock 2006. +// Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -59,13 +60,16 @@ #pragma GCC system_header #endif +#include +#include + namespace boost{ namespace math{ namespace detail{ // This version will never be called (at runtime), it's a stub used // when T is unsuitable to be passed to these routines: // template -inline T igamma_temme_large(T, T, const Policy& /* pol */, std::integral_constant const *) +BOOST_MATH_GPU_ENABLED inline T igamma_temme_large(T, T, const Policy& /* pol */, const boost::math::integral_constant&) { // stub function, should never actually be called BOOST_MATH_ASSERT(0); @@ -75,8 +79,11 @@ inline T igamma_temme_large(T, T, const Policy& /* pol */, std::integral_constan // This version is accurate for up to 64-bit mantissa's, // (80-bit long double, or 10^-20). // + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + template -T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant const *) +BOOST_MATH_GPU_ENABLED T igamma_temme_large(T a, T x, const Policy& pol, const boost::math::integral_constant&) { BOOST_MATH_STD_USING // ADL of std functions T sigma = (x - a) / a; @@ -88,7 +95,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant -T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant const *) +BOOST_MATH_GPU_ENABLED T igamma_temme_large(T a, T x, const Policy& pol, const boost::math::integral_constant&) { BOOST_MATH_STD_USING // ADL of std functions T sigma = (x - a) / a; @@ -293,7 +303,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.33333333333333333L), static_cast(0.083333333333333333L), static_cast(-0.014814814814814815L), @@ -312,7 +322,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.0018518518518518519L), static_cast(-0.0034722222222222222L), static_cast(0.0026455026455026455L), @@ -329,7 +339,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(0.0041335978835978836L), static_cast(-0.0026813271604938272L), static_cast(0.00077160493827160494L), @@ -344,7 +354,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(0.00064943415637860082L), static_cast(0.00022947209362139918L), static_cast(-0.00046918949439525571L), @@ -357,7 +367,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.0008618882909167117L), static_cast(0.00078403922172006663L), static_cast(-0.00029907248030319018L), @@ -368,7 +378,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.00033679855336635815L), static_cast(-0.69728137583658578e-4L), static_cast(0.00027727532449593921L), @@ -381,7 +391,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(0.00053130793646399222L), static_cast(-0.00059216643735369388L), static_cast(0.00027087820967180448L), @@ -392,7 +402,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(0.00034436760689237767L), static_cast(0.51717909082605922e-4L), static_cast(-0.00033493161081142236L), @@ -401,7 +411,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.00065262391859530942L), static_cast(0.00083949872067208728L), static_cast(-0.00043829709854172101L), @@ -414,7 +424,18 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant) + { + result += ::erfcf(::sqrtf(y)) / 2; + } + else + { + result += ::erfc(::sqrt(y)) / 2; + } + #else result += boost::math::erfc(sqrt(y), pol) / 2; + #endif return result; } @@ -423,7 +444,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant -T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant const *) +BOOST_MATH_GPU_ENABLED T igamma_temme_large(T a, T x, const Policy& pol, const boost::math::integral_constant&) { BOOST_MATH_STD_USING // ADL of std functions T sigma = (x - a) / a; @@ -435,7 +456,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.333333333L), static_cast(0.0833333333L), static_cast(-0.0148148148L), @@ -446,7 +467,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(-0.00185185185L), static_cast(-0.00347222222L), static_cast(0.00264550265L), @@ -455,7 +476,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant(0.00413359788L), static_cast(-0.00268132716L), static_cast(0.000771604938L), @@ -467,7 +488,18 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant) + { + result += ::erfcf(::sqrtf(y)) / 2; + } + else + { + result += ::erfc(::sqrt(y)) / 2; + } + #else result += boost::math::erfc(sqrt(y), pol) / 2; + #endif return result; } @@ -478,8 +510,10 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant -T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant const *) +BOOST_MATH_GPU_ENABLED T igamma_temme_large(T a, T x, const Policy& pol, const boost::math::integral_constant&) { BOOST_MATH_STD_USING // ADL of std functions T sigma = (x - a) / a; @@ -491,7 +525,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, std::integral_constant #include +#include +#include +#include #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -28,15 +33,15 @@ namespace boost{ namespace math{ namespace detail{ // These need forward declaring to keep GCC happy: // template -T gamma_imp(T z, const Policy& pol, const Lanczos& l); +BOOST_MATH_GPU_ENABLED T gamma_imp(T z, const Policy& pol, const Lanczos& l); template -T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos& l); +BOOST_MATH_GPU_ENABLED T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos& l); // // lgamma for small arguments: // template -T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, const Policy& /* l */, const Lanczos&) +BOOST_MATH_GPU_ENABLED T lgamma_small_imp(T z, T zm1, T zm2, const boost::math::integral_constant&, const Policy& /* l */, const Lanczos&) { // This version uses rational approximations for small // values of z accurate enough for 64-bit mantissas @@ -87,7 +92,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co // At long double: Max error found: 1.987e-21 // Maximum Deviation Found (approximation error): 5.900e-24 // - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.180355685678449379109e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.25126649619989678683e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.494103151567532234274e-1)), @@ -96,7 +101,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.541009869215204396339e-3)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.324588649825948492091e-4)) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.196202987197795200688e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.148019669424231326694e1)), @@ -107,7 +112,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.223352763208617092964e-6)) }; - static const float Y = 0.158963680267333984375e0f; + constexpr float Y = 0.158963680267333984375e0f; T r = zm2 * (z + 1); T R = tools::evaluate_polynomial(P, zm2); @@ -152,9 +157,9 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co // Expected Error Term: 3.139e-021 // - static const float Y = 0.52815341949462890625f; + constexpr float Y = 0.52815341949462890625f; - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.490622454069039543534e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.969117530159521214579e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.414983358359495381969e0)), @@ -163,7 +168,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.240149820648571559892e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.100346687696279557415e-2)) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.302349829846463038743e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.348739585360723852576e1)), @@ -197,9 +202,9 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co // Maximum Deviation Found: 2.151e-021 // Expected Error Term: 2.150e-021 // - static const float Y = 0.452017307281494140625f; + constexpr float Y = 0.452017307281494140625f; - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.292329721830270012337e-1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.144216267757192309184e0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.142440390738631274135e0)), @@ -207,7 +212,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.850535976868336437746e-2)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.431171342679297331241e-3)) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.150169356054485044494e1)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.846973248876495016101e0)), @@ -224,8 +229,10 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, co } return result; } + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT template -T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, const Policy& /* l */, const Lanczos&) +T lgamma_small_imp(T z, T zm1, T zm2, const boost::math::integral_constant&, const Policy& /* l */, const Lanczos&) { // // This version uses rational approximations for small @@ -482,7 +489,7 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, c return result; } template -T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, const Policy& pol, const Lanczos& l) +BOOST_MATH_GPU_ENABLED T lgamma_small_imp(T z, T zm1, T zm2, const boost::math::integral_constant&, const Policy& pol, const Lanczos& l) { // // No rational approximations are available because either @@ -526,6 +533,8 @@ T lgamma_small_imp(T z, T zm1, T zm2, const std::integral_constant&, con return result; } +#endif // BOOST_MATH_HAS_GPU_SUPPORT + }}} // namespaces #endif // BOOST_MATH_SPECIAL_FUNCTIONS_DETAIL_LGAMMA_SMALL diff --git a/include/boost/math/special_functions/detail/polygamma.hpp b/include/boost/math/special_functions/detail/polygamma.hpp index 8c11f40a..8ca36631 100644 --- a/include/boost/math/special_functions/detail/polygamma.hpp +++ b/include/boost/math/special_functions/detail/polygamma.hpp @@ -25,7 +25,7 @@ #include #include -#ifdef BOOST_HAS_THREADS +#ifdef BOOST_MATH_HAS_THREADS #include #endif @@ -406,7 +406,7 @@ namespace boost { namespace math { namespace detail{ // if((unsigned)n / 2u > policies::get_max_series_iterations()) return policies::raise_evaluation_error(function, "The value of n is so large that we're unable to compute the result in reasonable time, best guess is %1%", 0, pol); -#ifdef BOOST_HAS_THREADS +#ifdef BOOST_MATH_HAS_THREADS static std::mutex m; std::lock_guard l(m); #endif diff --git a/include/boost/math/special_functions/detail/round_fwd.hpp b/include/boost/math/special_functions/detail/round_fwd.hpp index c58459e3..7d69f8b9 100644 --- a/include/boost/math/special_functions/detail/round_fwd.hpp +++ b/include/boost/math/special_functions/detail/round_fwd.hpp @@ -1,4 +1,5 @@ // Copyright John Maddock 2008. +// Copyright Matt Borland 2024 // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. @@ -21,53 +22,53 @@ namespace boost { template - typename tools::promote_args::type trunc(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename tools::promote_args::type trunc(const T& v, const Policy& pol); template - typename tools::promote_args::type trunc(const T& v); + BOOST_MATH_GPU_ENABLED typename tools::promote_args::type trunc(const T& v); template - int itrunc(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED int itrunc(const T& v, const Policy& pol); template - int itrunc(const T& v); + BOOST_MATH_GPU_ENABLED int itrunc(const T& v); template - long ltrunc(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED long ltrunc(const T& v, const Policy& pol); template - long ltrunc(const T& v); + BOOST_MATH_GPU_ENABLED long ltrunc(const T& v); template - long long lltrunc(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED long long lltrunc(const T& v, const Policy& pol); template - long long lltrunc(const T& v); + BOOST_MATH_GPU_ENABLED long long lltrunc(const T& v); template - typename tools::promote_args::type round(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename tools::promote_args::type round(const T& v, const Policy& pol); template - typename tools::promote_args::type round(const T& v); + BOOST_MATH_GPU_ENABLED typename tools::promote_args::type round(const T& v); template - int iround(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED int iround(const T& v, const Policy& pol); template - int iround(const T& v); + BOOST_MATH_GPU_ENABLED int iround(const T& v); template - long lround(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED long lround(const T& v, const Policy& pol); template - long lround(const T& v); + BOOST_MATH_GPU_ENABLED long lround(const T& v); template - long long llround(const T& v, const Policy& pol); + BOOST_MATH_GPU_ENABLED long long llround(const T& v, const Policy& pol); template - long long llround(const T& v); + BOOST_MATH_GPU_ENABLED long long llround(const T& v); template - T modf(const T& v, T* ipart, const Policy& pol); + BOOST_MATH_GPU_ENABLED T modf(const T& v, T* ipart, const Policy& pol); template - T modf(const T& v, T* ipart); + BOOST_MATH_GPU_ENABLED T modf(const T& v, T* ipart); template - T modf(const T& v, int* ipart, const Policy& pol); + BOOST_MATH_GPU_ENABLED T modf(const T& v, int* ipart, const Policy& pol); template - T modf(const T& v, int* ipart); + BOOST_MATH_GPU_ENABLED T modf(const T& v, int* ipart); template - T modf(const T& v, long* ipart, const Policy& pol); + BOOST_MATH_GPU_ENABLED T modf(const T& v, long* ipart, const Policy& pol); template - T modf(const T& v, long* ipart); + BOOST_MATH_GPU_ENABLED T modf(const T& v, long* ipart); template - T modf(const T& v, long long* ipart, const Policy& pol); + BOOST_MATH_GPU_ENABLED T modf(const T& v, long long* ipart, const Policy& pol); template - T modf(const T& v, long long* ipart); + BOOST_MATH_GPU_ENABLED T modf(const T& v, long long* ipart); } } diff --git a/include/boost/math/special_functions/detail/unchecked_factorial.hpp b/include/boost/math/special_functions/detail/unchecked_factorial.hpp index b528a24f..92481f2c 100644 --- a/include/boost/math/special_functions/detail/unchecked_factorial.hpp +++ b/include/boost/math/special_functions/detail/unchecked_factorial.hpp @@ -10,19 +10,23 @@ #pragma once #endif -#ifdef _MSC_VER -#pragma warning(push) // Temporary until lexical cast fixed. -#pragma warning(disable: 4127 4701) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#include +#include +#include +#include +#include #include -#include -#include -#include + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +# ifdef _MSC_VER +# pragma warning(push) // Temporary until lexical cast fixed. +# pragma warning(disable: 4127 4701) +# endif +# include +# ifdef _MSC_VER +# pragma warning(pop) +# endif +#endif + #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -46,11 +50,21 @@ struct max_factorial; template struct unchecked_factorial_data; +#ifdef BOOST_MATH_HAS_NVRTC + +// Need fwd decl +template +BOOST_MATH_GPU_ENABLED inline T unchecked_factorial(unsigned i); + +#endif + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + template struct unchecked_factorial_data { #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - static constexpr std::array factorials = { { + static constexpr boost::math::array factorials = { { 1.0F, 1.0F, 2.0F, @@ -88,15 +102,15 @@ struct unchecked_factorial_data 0.29523279903960414084761860964352e39F, }}; #else - static const std::array factorials; + static const boost::math::array factorials; #endif }; template #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - constexpr std::array unchecked_factorial_data::factorials; + constexpr boost::math::array unchecked_factorial_data::factorials; #else - const std::array unchecked_factorial_data::factorials = {{ + const boost::math::array unchecked_factorial_data::factorials = {{ 1.0F, 1.0F, 2.0F, @@ -137,22 +151,72 @@ template // Definitions: template <> -inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float)) +BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float)) { return unchecked_factorial_data::factorials[i]; } +#else + +template <> +BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float)) +{ + constexpr float factorials[] = { + 1.0F, + 1.0F, + 2.0F, + 6.0F, + 24.0F, + 120.0F, + 720.0F, + 5040.0F, + 40320.0F, + 362880.0F, + 3628800.0F, + 39916800.0F, + 479001600.0F, + 6227020800.0F, + 87178291200.0F, + 1307674368000.0F, + 20922789888000.0F, + 355687428096000.0F, + 6402373705728000.0F, + 121645100408832000.0F, + 0.243290200817664e19F, + 0.5109094217170944e20F, + 0.112400072777760768e22F, + 0.2585201673888497664e23F, + 0.62044840173323943936e24F, + 0.15511210043330985984e26F, + 0.403291461126605635584e27F, + 0.10888869450418352160768e29F, + 0.304888344611713860501504e30F, + 0.8841761993739701954543616e31F, + 0.26525285981219105863630848e33F, + 0.822283865417792281772556288e34F, + 0.26313083693369353016721801216e36F, + 0.868331761881188649551819440128e37F, + 0.29523279903960414084761860964352e39F, + }; + + return factorials[i]; +} + +#endif + template <> struct max_factorial { static constexpr unsigned value = 34; }; +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + template struct unchecked_factorial_data { #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - static constexpr std::array factorials = { { + static constexpr boost::math::array factorials = { { 1.0, 1.0, 2.0, @@ -326,15 +390,15 @@ struct unchecked_factorial_data 0.7257415615307998967396728211129263114717e307, }}; #else - static const std::array factorials; + static const boost::math::array factorials; #endif }; template #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - constexpr std::array unchecked_factorial_data::factorials; + constexpr boost::math::array unchecked_factorial_data::factorials; #else - const std::array unchecked_factorial_data::factorials = {{ + const boost::math::array unchecked_factorial_data::factorials = {{ 1.0, 1.0, 2.0, @@ -510,7 +574,7 @@ template #endif template <> -inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double)) +BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double)) { return unchecked_factorial_data::factorials[i]; } @@ -521,11 +585,67 @@ struct max_factorial static constexpr unsigned value = 170; }; +#else + +template <> +BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double)) +{ + constexpr double factorials[] = { + 1, + 1, + 2, + 6, + 24, + 120, + 720, + 5040, + 40320, + 362880.0, + 3628800.0, + 39916800.0, + 479001600.0, + 6227020800.0, + 87178291200.0, + 1307674368000.0, + 20922789888000.0, + 355687428096000.0, + 6402373705728000.0, + 121645100408832000.0, + 0.243290200817664e19, + 0.5109094217170944e20, + 0.112400072777760768e22, + 0.2585201673888497664e23, + 0.62044840173323943936e24, + 0.15511210043330985984e26, + 0.403291461126605635584e27, + 0.10888869450418352160768e29, + 0.304888344611713860501504e30, + 0.8841761993739701954543616e31, + 0.26525285981219105863630848e33, + 0.822283865417792281772556288e34, + 0.26313083693369353016721801216e36, + 0.868331761881188649551819440128e37, + 0.29523279903960414084761860964352e39, + }; + + return factorials[i]; +} + +template <> +struct max_factorial +{ + static constexpr unsigned value = 34; +}; + +#endif + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + template struct unchecked_factorial_data { #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - static constexpr std::array factorials = { { + static constexpr boost::math::array factorials = { { 1L, 1L, 2L, @@ -699,15 +819,15 @@ struct unchecked_factorial_data 0.7257415615307998967396728211129263114717e307L, }}; #else - static const std::array factorials; + static const boost::math::array factorials; #endif }; template #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - constexpr std::array unchecked_factorial_data::factorials; + constexpr boost::math::array unchecked_factorial_data::factorials; #else - const std::array unchecked_factorial_data::factorials = {{ + const boost::math::array unchecked_factorial_data::factorials = {{ 1L, 1L, 2L, @@ -900,7 +1020,7 @@ template struct unchecked_factorial_data { #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES - static constexpr std::array factorials = { { + static constexpr boost::math::array factorials = { { 1, 1, 2, @@ -1074,15 +1194,15 @@ struct unchecked_factorial_data 0.7257415615307998967396728211129263114717e307Q, } }; #else - static const std::array factorials; + static const boost::math::array factorials; #endif }; template #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES -constexpr std::array unchecked_factorial_data::factorials; +constexpr boost::math::array unchecked_factorial_data::factorials; #else -const std::array unchecked_factorial_data::factorials = { { +const boost::math::array unchecked_factorial_data::factorials = { { 1, 1, 2, @@ -1294,7 +1414,7 @@ const typename unchecked_factorial_initializer::init unchecked_factorial_init template -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant&) +inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant&) { // // If you're foolish enough to instantiate factorial @@ -1308,10 +1428,10 @@ inline T unchecked_factorial_imp(unsigned i, const std::integral_constant(factorial(n)); // See factorial documentation for more detail. // - static_assert(!std::is_integral::value && !std::numeric_limits::is_integer, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value && !boost::math::numeric_limits::is_integer, "Type T must not be an integral type"); // We rely on C++11 thread safe initialization here: - static const std::array factorials = {{ + static const boost::math::array factorials = {{ T(boost::math::tools::convert_from_string("1")), T(boost::math::tools::convert_from_string("1")), T(boost::math::tools::convert_from_string("2")), @@ -1419,7 +1539,7 @@ inline T unchecked_factorial_imp(unsigned i, const std::integral_constant -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant&) +inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant&) { // // If you're foolish enough to instantiate factorial @@ -1433,7 +1553,7 @@ inline T unchecked_factorial_imp(unsigned i, const std::integral_constant(factorial(n)); // See factorial documentation for more detail. // - static_assert(!std::is_integral::value && !std::numeric_limits::is_integer, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value && !boost::math::numeric_limits::is_integer, "Type T must not be an integral type"); static const char* const factorial_strings[] = { "1", @@ -1556,42 +1676,48 @@ inline T unchecked_factorial_imp(unsigned i, const std::integral_constant -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant::digits>&) +BOOST_MATH_GPU_ENABLED inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant::digits>&) { return unchecked_factorial(i); } template -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant::digits>&) +BOOST_MATH_GPU_ENABLED inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant::digits>&) { return unchecked_factorial(i); } +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + #if DBL_MANT_DIG != LDBL_MANT_DIG template -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant&) +inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant&) { return unchecked_factorial(i); } #endif #ifdef BOOST_MATH_USE_FLOAT128 template -inline T unchecked_factorial_imp(unsigned i, const std::integral_constant&) +inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constant&) { return unchecked_factorial(i); } #endif +#endif // BOOST_MATH_HAS_GPU_SUPPORT + template -inline T unchecked_factorial(unsigned i) +BOOST_MATH_GPU_ENABLED inline T unchecked_factorial(unsigned i) { typedef typename boost::math::policies::precision >::type tag_type; return unchecked_factorial_imp(i, tag_type()); } #ifdef BOOST_MATH_USE_FLOAT128 -#define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL : std::numeric_limits::digits == 113 ? max_factorial::value +#define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL : boost::math::numeric_limits::digits == 113 ? max_factorial::value #else #define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL #endif @@ -1600,10 +1726,12 @@ template struct max_factorial { static constexpr unsigned value = - std::numeric_limits::digits == std::numeric_limits::digits ? max_factorial::value - : std::numeric_limits::digits == std::numeric_limits::digits ? max_factorial::value - : std::numeric_limits::digits == std::numeric_limits::digits ? max_factorial::value + boost::math::numeric_limits::digits == boost::math::numeric_limits::digits ? max_factorial::value + : boost::math::numeric_limits::digits == boost::math::numeric_limits::digits ? max_factorial::value + #ifndef BOOST_MATH_GPU_ENABLED + : boost::math::numeric_limits::digits == boost::math::numeric_limits::digits ? max_factorial::value BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL + #endif : 100; }; diff --git a/include/boost/math/special_functions/digamma.hpp b/include/boost/math/special_functions/digamma.hpp index 86d5e2ff..382ad0d6 100644 --- a/include/boost/math/special_functions/digamma.hpp +++ b/include/boost/math/special_functions/digamma.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,13 +13,21 @@ #pragma warning(disable:4702) // Unreachable code (release mode only warning) #endif -#include +#include +#include #include -#include #include +#include +#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC +#include +#include #include #include #include +#endif #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -37,11 +46,11 @@ namespace detail{ // Begin by defining the smallest value for which it is safe to // use the asymptotic expansion for digamma: // -inline unsigned digamma_large_lim(const std::integral_constant*) +BOOST_MATH_GPU_ENABLED inline unsigned digamma_large_lim(const boost::math::integral_constant*) { return 20; } -inline unsigned digamma_large_lim(const std::integral_constant*) +BOOST_MATH_GPU_ENABLED inline unsigned digamma_large_lim(const boost::math::integral_constant*) { return 20; } -inline unsigned digamma_large_lim(const void*) +BOOST_MATH_GPU_ENABLED inline unsigned digamma_large_lim(const void*) { return 10; } // // Implementations of the asymptotic expansion come next, @@ -53,8 +62,10 @@ inline unsigned digamma_large_lim(const void*) // // This first one gives 34-digit precision for x >= 20: // + +#ifndef BOOST_MATH_HAS_NVRTC template -inline T digamma_imp_large(T x, const std::integral_constant*) +inline T digamma_imp_large(T x, const boost::math::integral_constant*) { BOOST_MATH_STD_USING // ADL of std functions. static const T P[] = { @@ -87,7 +98,7 @@ inline T digamma_imp_large(T x, const std::integral_constant*) // 19-digit precision for x >= 10: // template -inline T digamma_imp_large(T x, const std::integral_constant*) +inline T digamma_imp_large(T x, const boost::math::integral_constant*) { BOOST_MATH_STD_USING // ADL of std functions. static const T P[] = { @@ -110,22 +121,23 @@ inline T digamma_imp_large(T x, const std::integral_constant*) result -= z * tools::evaluate_polynomial(P, z); return result; } +#endif // // 17-digit precision for x >= 10: // template -inline T digamma_imp_large(T x, const std::integral_constant*) +BOOST_MATH_GPU_ENABLED inline T digamma_imp_large(T x, const boost::math::integral_constant*) { BOOST_MATH_STD_USING // ADL of std functions. - static const T P[] = { - BOOST_MATH_BIG_CONSTANT(T, 53, 0.083333333333333333333333333333333333333333333333333), - BOOST_MATH_BIG_CONSTANT(T, 53, -0.0083333333333333333333333333333333333333333333333333), - BOOST_MATH_BIG_CONSTANT(T, 53, 0.003968253968253968253968253968253968253968253968254), - BOOST_MATH_BIG_CONSTANT(T, 53, -0.0041666666666666666666666666666666666666666666666667), - BOOST_MATH_BIG_CONSTANT(T, 53, 0.0075757575757575757575757575757575757575757575757576), - BOOST_MATH_BIG_CONSTANT(T, 53, -0.021092796092796092796092796092796092796092796092796), - BOOST_MATH_BIG_CONSTANT(T, 53, 0.083333333333333333333333333333333333333333333333333), - BOOST_MATH_BIG_CONSTANT(T, 53, -0.44325980392156862745098039215686274509803921568627) + BOOST_MATH_STATIC const T P[] = { + 0.083333333333333333333333333333333333333333333333333, + -0.0083333333333333333333333333333333333333333333333333, + 0.003968253968253968253968253968253968253968253968254, + -0.0041666666666666666666666666666666666666666666666667, + 0.0075757575757575757575757575757575757575757575757576, + -0.021092796092796092796092796092796092796092796092796, + 0.083333333333333333333333333333333333333333333333333, + -0.44325980392156862745098039215686274509803921568627 }; x -= 1; T result = log(x); @@ -138,13 +150,13 @@ inline T digamma_imp_large(T x, const std::integral_constant*) // 9-digit precision for x >= 10: // template -inline T digamma_imp_large(T x, const std::integral_constant*) +BOOST_MATH_GPU_ENABLED inline T digamma_imp_large(T x, const boost::math::integral_constant*) { BOOST_MATH_STD_USING // ADL of std functions. - static const T P[] = { - BOOST_MATH_BIG_CONSTANT(T, 24, 0.083333333333333333333333333333333333333333333333333), - BOOST_MATH_BIG_CONSTANT(T, 24, -0.0083333333333333333333333333333333333333333333333333), - BOOST_MATH_BIG_CONSTANT(T, 24, 0.003968253968253968253968253968253968253968253968254) + BOOST_MATH_STATIC const T P[] = { + 0.083333333333333333333333333333333333333333333333333f, + -0.0083333333333333333333333333333333333333333333333333f, + 0.003968253968253968253968253968253968253968253968254f }; x -= 1; T result = log(x); @@ -153,6 +165,8 @@ inline T digamma_imp_large(T x, const std::integral_constant*) result -= z * tools::evaluate_polynomial(P, z); return result; } + +#ifndef BOOST_MATH_HAS_NVRTC // // Fully generic asymptotic expansion in terms of Bernoulli numbers, see: // http://functions.wolfram.com/06.14.06.0012.01 @@ -177,7 +191,7 @@ struct digamma_series_func }; template -inline T digamma_imp_large(T x, const Policy& pol, const std::integral_constant*) +inline T digamma_imp_large(T x, const Policy& pol, const boost::math::integral_constant*) { BOOST_MATH_STD_USING digamma_series_func s(x); @@ -194,7 +208,7 @@ inline T digamma_imp_large(T x, const Policy& pol, const std::integral_constant< // 35-digit precision: // template -T digamma_imp_1_2(T x, const std::integral_constant*) +T digamma_imp_1_2(T x, const boost::math::integral_constant*) { // // Now the approximation, we use the form: @@ -208,6 +222,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) // Max error found at 128-bit long double precision: 5.541e-35 // Maximum Deviation Found (approximation error): 1.965e-35 // + // LCOV_EXCL_START static const float Y = 0.99558162689208984375F; static const T root1 = T(1569415565) / 1073741824uL; @@ -242,6 +257,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) BOOST_MATH_BIG_CONSTANT(T, 113, -0.90745971844439990284514121823069162795e-11), BOOST_MATH_BIG_CONSTANT(T, 113, 0.48857673606545846774761343500033283272e-13), }; + // LCOV_EXCL_STOP T g = x - root1; g -= root2; g -= root3; @@ -256,7 +272,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) // 19-digit precision: // template -T digamma_imp_1_2(T x, const std::integral_constant*) +T digamma_imp_1_2(T x, const boost::math::integral_constant*) { // // Now the approximation, we use the form: @@ -270,6 +286,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) // Max error found at 80-bit long double precision: 5.016e-20 // Maximum Deviation Found (approximation error): 3.575e-20 // + // LCOV_EXCL_START static const float Y = 0.99558162689208984375F; static const T root1 = T(1569415565) / 1073741824uL; @@ -294,6 +311,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) BOOST_MATH_BIG_CONSTANT(T, 64, -0.165079794012604905639e-5), BOOST_MATH_BIG_CONSTANT(T, 64, 0.317940243105952177571e-7) }; + // LCOV_EXCL_STOP T g = x - root1; g -= root2; g -= root3; @@ -302,11 +320,13 @@ T digamma_imp_1_2(T x, const std::integral_constant*) return result; } + +#endif // // 18-digit precision: // template -T digamma_imp_1_2(T x, const std::integral_constant*) +BOOST_MATH_GPU_ENABLED T digamma_imp_1_2(T x, const boost::math::integral_constant*) { // // Now the approximation, we use the form: @@ -320,13 +340,14 @@ T digamma_imp_1_2(T x, const std::integral_constant*) // Maximum Deviation Found: 1.466e-18 // At double precision, max error found: 2.452e-17 // - static const float Y = 0.99558162689208984F; + // LCOV_EXCL_START + BOOST_MATH_STATIC const float Y = 0.99558162689208984F; - static const T root1 = T(1569415565) / 1073741824uL; - static const T root2 = (T(381566830) / 1073741824uL) / 1073741824uL; - static const T root3 = BOOST_MATH_BIG_CONSTANT(T, 53, 0.9016312093258695918615325266959189453125e-19); + BOOST_MATH_STATIC const T root1 = T(1569415565) / 1073741824uL; + BOOST_MATH_STATIC const T root2 = (T(381566830) / 1073741824uL) / 1073741824uL; + BOOST_MATH_STATIC const T root3 = BOOST_MATH_BIG_CONSTANT(T, 53, 0.9016312093258695918615325266959189453125e-19); - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 53, 0.25479851061131551), BOOST_MATH_BIG_CONSTANT(T, 53, -0.32555031186804491), BOOST_MATH_BIG_CONSTANT(T, 53, -0.65031853770896507), @@ -334,7 +355,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) BOOST_MATH_BIG_CONSTANT(T, 53, -0.045251321448739056), BOOST_MATH_BIG_CONSTANT(T, 53, -0.0020713321167745952) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 53, 1.0), BOOST_MATH_BIG_CONSTANT(T, 53, 2.0767117023730469), BOOST_MATH_BIG_CONSTANT(T, 53, 1.4606242909763515), @@ -343,6 +364,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) BOOST_MATH_BIG_CONSTANT(T, 53, 0.0021284987017821144), BOOST_MATH_BIG_CONSTANT(T, 53, -0.55789841321675513e-6) }; + // LCOV_EXCL_STOP T g = x - root1; g -= root2; g -= root3; @@ -355,7 +377,7 @@ T digamma_imp_1_2(T x, const std::integral_constant*) // 9-digit precision: // template -inline T digamma_imp_1_2(T x, const std::integral_constant*) +BOOST_MATH_GPU_ENABLED inline T digamma_imp_1_2(T x, const boost::math::integral_constant*) { // // Now the approximation, we use the form: @@ -369,21 +391,23 @@ inline T digamma_imp_1_2(T x, const std::integral_constant*) // Maximum Deviation Found: 3.388e-010 // At float precision, max error found: 2.008725e-008 // - static const float Y = 0.99558162689208984f; - static const T root = 1532632.0f / 1048576; - static const T root_minor = static_cast(0.3700660185912626595423257213284682051735604e-6L); - static const T P[] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const float Y = 0.99558162689208984f; + BOOST_MATH_STATIC const T root = 1532632.0f / 1048576; + BOOST_MATH_STATIC const T root_minor = static_cast(0.3700660185912626595423257213284682051735604e-6L); + BOOST_MATH_STATIC const T P[] = { 0.25479851023250261e0f, -0.44981331915268368e0f, -0.43916936919946835e0f, -0.61041765350579073e-1f }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { 0.1e1f, 0.15890202430554952e1f, 0.65341249856146947e0f, 0.63851690523355715e-1f }; + // LCOV_EXCL_STOP T g = x - root; g -= root_minor; T r = tools::evaluate_polynomial(P, T(x-1)) / tools::evaluate_polynomial(Q, T(x-1)); @@ -393,7 +417,7 @@ inline T digamma_imp_1_2(T x, const std::integral_constant*) } template -T digamma_imp(T x, const Tag* t, const Policy& pol) +BOOST_MATH_GPU_ENABLED T digamma_imp(T x, const Tag* t, const Policy& pol) { // // This handles reflection of negative arguments, and all our @@ -431,11 +455,13 @@ T digamma_imp(T x, const Tag* t, const Policy& pol) // If we're above the lower-limit for the // asymptotic expansion then use it: // + #ifndef BOOST_MATH_HAS_NVRTC if(x >= digamma_large_lim(t)) { result += digamma_imp_large(x, t); } else + #endif { // // If x > 2 reduce to the interval [1,2]: @@ -458,13 +484,19 @@ T digamma_imp(T x, const Tag* t, const Policy& pol) return result; } +#ifndef BOOST_MATH_HAS_NVRTC + template -T digamma_imp(T x, const std::integral_constant* t, const Policy& pol) +T digamma_imp(T x, const boost::math::integral_constant* t, const Policy& pol) { // // This handles reflection of negative arguments, and all our // error handling, then forwards to the T-specific approximation. // + // This is covered by our real_concept tests, but these are disabled for + // code coverage runs for performance reasons. + // LCOV_EXCL_START + // BOOST_MATH_STD_USING // ADL of std functions. T result = 0; @@ -549,48 +581,21 @@ T digamma_imp(T x, const std::integral_constant* t, const Policy& pol) result += digamma_imp_large(x, pol, t); } return result; + // LCOV_EXCL_STOP } -// -// Initializer: ensure all our constants are initialized prior to the first call of main: -// -template -struct digamma_initializer -{ - struct init - { - init() - { - typedef typename policies::precision::type precision_type; - do_init(std::integral_constant()); - } - void do_init(const std::true_type&) - { - boost::math::digamma(T(1.5), Policy()); - boost::math::digamma(T(500), Policy()); - } - void do_init(const std::false_type&){} - void force_instantiate()const{} - }; - static const init initializer; - static void force_instantiate() - { - initializer.force_instantiate(); - } -}; -template -const typename digamma_initializer::init digamma_initializer::initializer; +#endif } // namespace detail template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type digamma(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; typedef typename policies::precision::type precision_type; - typedef std::integral_constant 113) ? 0 : precision_type::value <= 24 ? 24 : precision_type::value <= 53 ? 53 : @@ -603,16 +608,13 @@ inline typename tools::promote_args::type policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - // Force initialization of constants: - detail::digamma_initializer::force_instantiate(); - return policies::checked_narrowing_cast(detail::digamma_imp( static_cast(x), static_cast(nullptr), forwarding_policy()), "boost::math::digamma<%1%>(%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type digamma(T x) { return digamma(x, policies::policy<>()); diff --git a/include/boost/math/special_functions/erf.hpp b/include/boost/math/special_functions/erf.hpp index 5cc322ae..9f0da928 100644 --- a/include/boost/math/special_functions/erf.hpp +++ b/include/boost/math/special_functions/erf.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,8 +11,11 @@ #pragma once #endif -#include #include + +#ifndef BOOST_MATH_HAS_NVRTC + +#include #include #include #include @@ -38,7 +42,8 @@ namespace detail template struct erf_asympt_series_t { - erf_asympt_series_t(T z) : xx(2 * -z * z), tk(1) + // LCOV_EXCL_START multiprecision case only, excluded from coverage analysis + BOOST_MATH_GPU_ENABLED erf_asympt_series_t(T z) : xx(2 * -z * z), tk(1) { BOOST_MATH_STD_USING result = -exp(-z * z) / sqrt(boost::math::constants::pi()); @@ -47,7 +52,7 @@ struct erf_asympt_series_t typedef T result_type; - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { BOOST_MATH_STD_USING T r = result; @@ -57,6 +62,7 @@ struct erf_asympt_series_t result = 0; return r; } + // LCOV_EXCL_STOP private: T result; T xx; @@ -66,33 +72,33 @@ struct erf_asympt_series_t // How large z has to be in order to ensure that the series converges: // template -inline float erf_asymptotic_limit_N(const T&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const T&) { return (std::numeric_limits::max)(); } -inline float erf_asymptotic_limit_N(const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const std::integral_constant&) { return 2.8F; } -inline float erf_asymptotic_limit_N(const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const std::integral_constant&) { return 4.3F; } -inline float erf_asymptotic_limit_N(const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const std::integral_constant&) { return 4.8F; } -inline float erf_asymptotic_limit_N(const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const std::integral_constant&) { return 6.5F; } -inline float erf_asymptotic_limit_N(const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline float erf_asymptotic_limit_N(const std::integral_constant&) { return 6.8F; } template -inline T erf_asymptotic_limit() +BOOST_MATH_GPU_ENABLED inline T erf_asymptotic_limit() { typedef typename policies::precision::type precision_type; typedef std::integral_constant T erf_imp(T z, bool invert, const Policy& pol, const Tag& t) { + // LCOV_EXCL_START multiprecision case only, excluded from coverage analysis BOOST_MATH_STD_USING BOOST_MATH_INSTRUMENT_CODE("Generic erf_imp called"); + if ((boost::math::isnan)(z)) + return policies::raise_domain_error("boost::math::erf<%1%>(%1%)", "Expected a finite argument but got %1%", z, pol); + if(z < 0) { if(!invert) @@ -188,26 +198,43 @@ T erf_imp(T z, bool invert, const Policy& pol, const Tag& t) if(invert) result = 1 - result; return result; + // LCOV_EXCL_STOP } template -T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant& t) +BOOST_MATH_GPU_ENABLED T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant&) { BOOST_MATH_STD_USING BOOST_MATH_INSTRUMENT_CODE("53-bit precision erf_imp called"); if ((boost::math::isnan)(z)) - return policies::raise_denorm_error("boost::math::erf<%1%>(%1%)", "Expected a finite argument but got %1%", z, pol); + return policies::raise_domain_error("boost::math::erf<%1%>(%1%)", "Expected a finite argument but got %1%", z, pol); + + int prefix_multiplier = 1; + int prefix_adder = 0; if(z < 0) { + // Recursion is logically simpler here, but confuses static analyzers that need to be + // able to calculate the maximimum program stack size at compile time (ie CUDA). + z = -z; if(!invert) - return -erf_imp(T(-z), invert, pol, t); + { + prefix_multiplier = -1; + // return -erf_imp(T(-z), invert, pol, t); + } else if(z < T(-0.5)) - return 2 - erf_imp(T(-z), invert, pol, t); + { + prefix_adder = 2; + // return 2 - erf_imp(T(-z), invert, pol, t); + } else - return 1 + erf_imp(T(-z), false, pol, t); + { + invert = false; + prefix_adder = 1; + // return 1 + erf_imp(T(-z), false, pol, t); + } } T result; @@ -230,7 +257,7 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant(z * 1.125f + z * c); } } @@ -240,22 +267,23 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constantT erf_imp(T z, bool invert, const Lanczos& l, const std::integral_constant& t) @@ -426,6 +463,9 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant(%1%)", "Expected a finite argument but got %1%", z, pol); + if(z < 0) { if(!invert) @@ -454,7 +494,7 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant(%1%)", "Expected a finite argument but got %1%", z, pol); + if(z < 0) { - if(!invert) - return -erf_imp(T(-z), invert, pol, t); + if (!invert) + return -erf_imp(T(-z), invert, pol, t); // LCOV_EXCL_LINE confirmed as covered, not sure why lcov does see it. else if(z < -0.5) return 2 - erf_imp(T(-z), invert, pol, t); else @@ -688,8 +741,8 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constantT erf_imp(T z, bool invert, const Lanczos& l, const std::integral_constant& t) -template -struct erf_initializer -{ - struct init - { - init() - { - do_init(tag()); - } - static void do_init(const std::integral_constant&){} - static void do_init(const std::integral_constant&) - { - boost::math::erf(static_cast(1e-12), Policy()); - boost::math::erf(static_cast(0.25), Policy()); - boost::math::erf(static_cast(1.25), Policy()); - boost::math::erf(static_cast(2.25), Policy()); - boost::math::erf(static_cast(4.25), Policy()); - boost::math::erf(static_cast(5.25), Policy()); - } - static void do_init(const std::integral_constant&) - { - boost::math::erf(static_cast(1e-12), Policy()); - boost::math::erf(static_cast(0.25), Policy()); - boost::math::erf(static_cast(1.25), Policy()); - boost::math::erf(static_cast(2.25), Policy()); - boost::math::erf(static_cast(4.25), Policy()); - boost::math::erf(static_cast(5.25), Policy()); - } - static void do_init(const std::integral_constant&) - { - boost::math::erf(static_cast(1e-22), Policy()); - boost::math::erf(static_cast(0.25), Policy()); - boost::math::erf(static_cast(1.25), Policy()); - boost::math::erf(static_cast(2.125), Policy()); - boost::math::erf(static_cast(2.75), Policy()); - boost::math::erf(static_cast(3.25), Policy()); - boost::math::erf(static_cast(5.25), Policy()); - boost::math::erf(static_cast(7.25), Policy()); - boost::math::erf(static_cast(11.25), Policy()); - boost::math::erf(static_cast(12.5), Policy()); - } - void force_instantiate()const{} - }; - static const init initializer; - static void force_instantiate() - { - initializer.force_instantiate(); - } -}; - -template -const typename erf_initializer::init erf_initializer::initializer; - } // namespace detail template -inline typename tools::promote_args::type erf(T z, const Policy& /* pol */) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf(T z, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -1201,8 +1221,6 @@ inline typename tools::promote_args::type erf(T z, const Policy& /* pol */) BOOST_MATH_INSTRUMENT_CODE("tag_type = " << typeid(tag_type).name()); - detail::erf_initializer::force_instantiate(); // Force constants to be initialized before main - return policies::checked_narrowing_cast(detail::erf_imp( static_cast(z), false, @@ -1211,7 +1229,7 @@ inline typename tools::promote_args::type erf(T z, const Policy& /* pol */) } template -inline typename tools::promote_args::type erfc(T z, const Policy& /* pol */) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -1236,8 +1254,6 @@ inline typename tools::promote_args::type erfc(T z, const Policy& /* pol */) BOOST_MATH_INSTRUMENT_CODE("tag_type = " << typeid(tag_type).name()); - detail::erf_initializer::force_instantiate(); // Force constants to be initialized before main - return policies::checked_narrowing_cast(detail::erf_imp( static_cast(z), true, @@ -1246,13 +1262,13 @@ inline typename tools::promote_args::type erfc(T z, const Policy& /* pol */) } template -inline typename tools::promote_args::type erf(T z) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf(T z) { return boost::math::erf(z, policies::policy<>()); } template -inline typename tools::promote_args::type erfc(T z) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z) { return boost::math::erfc(z, policies::policy<>()); } @@ -1260,6 +1276,64 @@ inline typename tools::promote_args::type erfc(T z) } // namespace math } // namespace boost +#else // Special handling for NVRTC platform + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED auto erf(T x) +{ + return ::erf(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto erf(float x) +{ + return ::erff(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erf(T x, const Policy&) +{ + return ::erf(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erf(float x, const Policy&) +{ + return ::erff(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc(T x) +{ + return ::erfc(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto erfc(float x) +{ + return ::erfcf(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc(T x, const Policy&) +{ + return ::erfc(x); +} + +template +BOOST_MATH_GPU_ENABLED auto erfc(float x, const Policy&) +{ + return ::erfcf(x); +} + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + #include #endif // BOOST_MATH_SPECIAL_ERF_HPP diff --git a/include/boost/math/special_functions/expm1.hpp b/include/boost/math/special_functions/expm1.hpp index eec63560..5e61ca20 100644 --- a/include/boost/math/special_functions/expm1.hpp +++ b/include/boost/math/special_functions/expm1.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,10 +11,10 @@ #pragma once #endif -#include -#include -#include #include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include #include @@ -21,6 +22,9 @@ #include #include #include +#include +#include +#include #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -45,10 +49,10 @@ namespace detail { typedef T result_type; - expm1_series(T x) + BOOST_MATH_GPU_ENABLED expm1_series(T x) : k(0), m_x(x), m_term(1) {} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { ++k; m_term *= m_x; @@ -56,7 +60,7 @@ namespace detail return m_term; } - int count()const + BOOST_MATH_GPU_ENABLED int count()const { return k; } @@ -74,26 +78,28 @@ struct expm1_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { do_init(tag()); } template - static void do_init(const std::integral_constant&){} - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&){} + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { expm1(T(0.5)); } - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { expm1(T(0.5)); } - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; - static const init initializer; - static void force_instantiate() + BOOST_MATH_STATIC const init initializer; + BOOST_MATH_GPU_ENABLED static void force_instantiate() { + #ifndef BOOST_MATH_HAS_GPU_SUPPORT initializer.force_instantiate(); + #endif } }; @@ -106,7 +112,7 @@ const typename expm1_initializer::init expm1_initializer |x| > epsilon. // template -T expm1_imp(T x, const std::integral_constant&, const Policy& pol) +T expm1_imp(T x, const boost::math::integral_constant&, const Policy& pol) { BOOST_MATH_STD_USING @@ -128,7 +134,7 @@ T expm1_imp(T x, const std::integral_constant&, const Policy& pol) if(a < tools::epsilon()) return x; detail::expm1_series s(x); - std::uintmax_t max_iter = policies::get_max_series_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_series_iterations(); T result = tools::sum_series(s, policies::get_epsilon(), max_iter); @@ -137,7 +143,7 @@ T expm1_imp(T x, const std::integral_constant&, const Policy& pol) } template -T expm1_imp(T x, const std::integral_constant&, const P& pol) +BOOST_MATH_GPU_ENABLED T expm1_imp(T x, const boost::math::integral_constant&, const P& pol) { BOOST_MATH_STD_USING @@ -155,16 +161,16 @@ T expm1_imp(T x, const std::integral_constant&, const P& pol) if(a < tools::epsilon()) return x; - static const float Y = 0.10281276702880859e1f; - static const T n[] = { static_cast(-0.28127670288085937e-1), static_cast(0.51278186299064534e0), static_cast(-0.6310029069350198e-1), static_cast(0.11638457975729296e-1), static_cast(-0.52143390687521003e-3), static_cast(0.21491399776965688e-4) }; - static const T d[] = { 1, static_cast(-0.45442309511354755e0), static_cast(0.90850389570911714e-1), static_cast(-0.10088963629815502e-1), static_cast(0.63003407478692265e-3), static_cast(-0.17976570003654402e-4) }; + BOOST_MATH_STATIC const float Y = 0.10281276702880859e1f; + BOOST_MATH_STATIC const T n[] = { static_cast(-0.28127670288085937e-1), static_cast(0.51278186299064534e0), static_cast(-0.6310029069350198e-1), static_cast(0.11638457975729296e-1), static_cast(-0.52143390687521003e-3), static_cast(0.21491399776965688e-4) }; + BOOST_MATH_STATIC const T d[] = { 1, static_cast(-0.45442309511354755e0), static_cast(0.90850389570911714e-1), static_cast(-0.10088963629815502e-1), static_cast(0.63003407478692265e-3), static_cast(-0.17976570003654402e-4) }; T result = x * Y + x * tools::evaluate_polynomial(n, x) / tools::evaluate_polynomial(d, x); return result; } template -T expm1_imp(T x, const std::integral_constant&, const P& pol) +BOOST_MATH_GPU_ENABLED T expm1_imp(T x, const boost::math::integral_constant&, const P& pol) { BOOST_MATH_STD_USING @@ -182,8 +188,8 @@ T expm1_imp(T x, const std::integral_constant&, const P& pol) if(a < tools::epsilon()) return x; - static const float Y = 0.10281276702880859375e1f; - static const T n[] = { + BOOST_MATH_STATIC const float Y = 0.10281276702880859375e1f; + BOOST_MATH_STATIC const T n[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.281276702880859375e-1), BOOST_MATH_BIG_CONSTANT(T, 64, 0.512980290285154286358e0), BOOST_MATH_BIG_CONSTANT(T, 64, -0.667758794592881019644e-1), @@ -192,7 +198,7 @@ T expm1_imp(T x, const std::integral_constant&, const P& pol) BOOST_MATH_BIG_CONSTANT(T, 64, 0.447441185192951335042e-4), BOOST_MATH_BIG_CONSTANT(T, 64, -0.714539134024984593011e-6) }; - static const T d[] = { + BOOST_MATH_STATIC const T d[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, -0.461477618025562520389e0), BOOST_MATH_BIG_CONSTANT(T, 64, 0.961237488025708540713e-1), @@ -207,7 +213,7 @@ T expm1_imp(T x, const std::integral_constant&, const P& pol) } template -T expm1_imp(T x, const std::integral_constant&, const P& pol) +BOOST_MATH_GPU_ENABLED T expm1_imp(T x, const boost::math::integral_constant&, const P& pol) { BOOST_MATH_STD_USING @@ -259,7 +265,7 @@ T expm1_imp(T x, const std::integral_constant&, const P& pol) } // namespace detail template -inline typename tools::promote_args::type expm1(T x, const Policy& /* pol */) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expm1(T x, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -271,7 +277,7 @@ inline typename tools::promote_args::type expm1(T x, const Policy& /* pol */) policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - typedef std::integral_constant::type expm1(T x, const Policy& /* pol */) #if defined(BOOST_HAS_EXPM1) && !(defined(__osf__) && defined(__DECCXX_VER)) # ifdef BOOST_MATH_USE_C99 -inline float expm1(float x, const policies::policy<>&){ return ::expm1f(x); } +BOOST_MATH_GPU_ENABLED inline float expm1(float x, const policies::policy<>&){ return ::expm1f(x); } # ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS inline long double expm1(long double x, const policies::policy<>&){ return ::expm1l(x); } # endif # else inline float expm1(float x, const policies::policy<>&){ return static_cast(::expm1(x)); } # endif -inline double expm1(double x, const policies::policy<>&){ return ::expm1(x); } +BOOST_MATH_GPU_ENABLED inline double expm1(double x, const policies::policy<>&){ return ::expm1(x); } #endif template -inline typename tools::promote_args::type expm1(T x) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expm1(T x) { return expm1(x, policies::policy<>()); } @@ -313,6 +319,40 @@ inline typename tools::promote_args::type expm1(T x) } // namespace math } // namespace boost +#else // Special handling for NVRTC + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED auto expm1(T x) +{ + return ::expm1(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto expm1(float x) +{ + return ::expm1f(x); +} + +template +BOOST_MATH_GPU_ENABLED auto expm1(T x, const Policy&) +{ + return ::expm1(x); +} + +template +BOOST_MATH_GPU_ENABLED auto expm1(float x, const Policy&) +{ + return ::expm1f(x); +} + +} // Namespace math +} // Namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + #endif // BOOST_MATH_HYPOT_INCLUDED diff --git a/include/boost/math/special_functions/factorials.hpp b/include/boost/math/special_functions/factorials.hpp index 7229635c..ec6978bd 100644 --- a/include/boost/math/special_functions/factorials.hpp +++ b/include/boost/math/special_functions/factorials.hpp @@ -10,10 +10,14 @@ #pragma once #endif -#include +#include +#include +#include +#include #include #include -#include +#include + #ifdef _MSC_VER #pragma warning(push) // Temporary until lexical cast fixed. #pragma warning(disable: 4127 4701) @@ -21,16 +25,14 @@ #ifdef _MSC_VER #pragma warning(pop) #endif -#include -#include namespace boost { namespace math { template -inline T factorial(unsigned i, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline T factorial(unsigned i, const Policy& pol) { - static_assert(!std::is_integral::value, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); // factorial(n) is not implemented // because it would overflow integral type T for too small n // to be useful. Use instead a floating-point type, @@ -49,7 +51,7 @@ inline T factorial(unsigned i, const Policy& pol) } template -inline T factorial(unsigned i) +BOOST_MATH_GPU_ENABLED inline T factorial(unsigned i) { return factorial(i, policies::policy<>()); } @@ -72,9 +74,9 @@ inline double factorial(unsigned i) } */ template -T double_factorial(unsigned i, const Policy& pol) +BOOST_MATH_GPU_ENABLED T double_factorial(unsigned i, const Policy& pol) { - static_assert(!std::is_integral::value, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); BOOST_MATH_STD_USING // ADL lookup of std names if(i & 1) { @@ -107,17 +109,20 @@ T double_factorial(unsigned i, const Policy& pol) } template -inline T double_factorial(unsigned i) +BOOST_MATH_GPU_ENABLED inline T double_factorial(unsigned i) { return double_factorial(i, policies::policy<>()); } +// TODO(mborland): We do not currently have support for tgamma_delta_ratio +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + namespace detail{ template T rising_factorial_imp(T x, int n, const Policy& pol) { - static_assert(!std::is_integral::value, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); if(x < 0) { // @@ -165,7 +170,7 @@ T rising_factorial_imp(T x, int n, const Policy& pol) template inline T falling_factorial_imp(T x, unsigned n, const Policy& pol) { - static_assert(!std::is_integral::value, "Type T must not be an integral type"); + static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); BOOST_MATH_STD_USING // ADL of std names if(x == 0) return 0; @@ -262,6 +267,8 @@ inline typename tools::promote_args::type static_cast(x), n, pol); } +#endif // BOOST_MATH_HAS_GPU_SUPPORT + } // namespace math } // namespace boost diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index 2c504d7a..0ac9470f 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -1,5 +1,6 @@ // Copyright John Maddock 2005-2008. // Copyright (c) 2006-2008 Johan Rade +// Copyright (c) 2024 Matt Borland // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -11,12 +12,17 @@ #pragma once #endif -#include -#include -#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include #include +#include +#include +#include + /*! \file fpclassify.hpp \brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN. @@ -76,6 +82,80 @@ is used. */ +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +namespace boost { namespace math { + +template<> inline BOOST_MATH_GPU_ENABLED bool (isnan)(float x) { return x != x; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isnan)(double x) { return x != x; } + +template<> inline BOOST_MATH_GPU_ENABLED bool (isinf)(float x) { return x > FLT_MAX || x < -FLT_MAX; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isinf)(double x) { return x > DBL_MAX || x < -DBL_MAX; } + +template<> inline BOOST_MATH_GPU_ENABLED bool (isfinite)(float x) { return !isnan(x) && !isinf(x); } +template<> inline BOOST_MATH_GPU_ENABLED bool (isfinite)(double x) { return !isnan(x) && !isinf(x); } + +template<> inline BOOST_MATH_GPU_ENABLED bool (isnormal)(float x) +{ + if(x < 0) x = -x; + return (x >= FLT_MIN) && (x <= FLT_MAX); +} +template<> inline BOOST_MATH_GPU_ENABLED bool (isnormal)(double x) +{ + if(x < 0) x = -x; + return (x >= DBL_MIN) && (x <= DBL_MAX); +} + +template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(float t) +{ + if((boost::math::isnan)(t)) + return FP_NAN; + // std::fabs broken on a few systems especially for long long!!!! + float at = (t < 0.0f) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= FLT_MAX) + { + if(at >= FLT_MIN) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > FLT_MAX) + return FP_INFINITE; + return FP_NAN; +} + +template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(double t) +{ + if((boost::math::isnan)(t)) + return FP_NAN; + // std::fabs broken on a few systems especially for long long!!!! + double at = (t < 0.0) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= DBL_MAX) + { + if(at >= DBL_MIN) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > DBL_MAX) + return FP_INFINITE; + return FP_NAN; +} + +#else + #if defined(_MSC_VER) || defined(BOOST_BORLANDC) #include #endif @@ -632,7 +712,86 @@ inline bool (isnan)(__float128 x) } #endif +#endif + } // namespace math } // namespace boost + +#else // Special handling generally using the CUDA library + +#include + +namespace boost { +namespace math { + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isnan(T x) +{ + return false; +} + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isnan(T x) +{ + return ::isnan(x); +} + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isinf(T x) +{ + return false; +} + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isinf(T x) +{ + return ::isinf(x); +} + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isfinite(T x) +{ + return true; +} + +template , bool> = true> +inline BOOST_MATH_GPU_ENABLED bool isfinite(T x) +{ + return ::isfinite(x); +} + +template +inline BOOST_MATH_GPU_ENABLED bool isnormal(T x) +{ + return x != static_cast(0) && x != static_cast(-0) && + !boost::math::isnan(x) && + !boost::math::isinf(x); +} + +// We skip the check for FP_SUBNORMAL since they are not supported on these platforms +template +inline BOOST_MATH_GPU_ENABLED int fpclassify(T x) +{ + if (boost::math::isnan(x)) + { + return BOOST_MATH_FP_NAN; + } + else if (boost::math::isinf(x)) + { + return BOOST_MATH_FP_INFINITE; + } + else if (x == static_cast(0) || x == static_cast(-0)) + { + return BOOST_MATH_FP_ZERO; + } + + return BOOST_MATH_FP_NORMAL; +} + +} // Namespace math +} // Namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + #endif // BOOST_MATH_FPCLASSIFY_HPP diff --git a/include/boost/math/special_functions/gamma.hpp b/include/boost/math/special_functions/gamma.hpp index 4af2ebdc..4a15782c 100644 --- a/include/boost/math/special_functions/gamma.hpp +++ b/include/boost/math/special_functions/gamma.hpp @@ -1,8 +1,8 @@ // Copyright John Maddock 2006-7, 2013-20. // Copyright Paul A. Bristow 2007, 2013-14. // Copyright Nikhar Agrawal 2013-14 -// Copyright Christopher Kormanyos 2013-14, 2020 - +// Copyright Christopher Kormanyos 2013-14, 2020, 2024 +// Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -14,12 +14,15 @@ #pragma once #endif +#include #include #include #include #include +#include +#include +#include #include -#include #include #include #include @@ -32,12 +35,12 @@ #include #include #include + +// Only needed for types larger than double +#ifndef BOOST_MATH_HAS_GPU_SUPPORT #include #include - -#include -#include -#include +#endif #ifdef _MSC_VER # pragma warning(push) @@ -56,13 +59,13 @@ namespace boost{ namespace math{ namespace detail{ template -inline bool is_odd(T v, const std::true_type&) +BOOST_MATH_GPU_ENABLED inline bool is_odd(T v, const boost::math::true_type&) { int i = static_cast(v); return i&1; } template -inline bool is_odd(T v, const std::false_type&) +BOOST_MATH_GPU_ENABLED inline bool is_odd(T v, const boost::math::false_type&) { // Oh dear can't cast T to int! BOOST_MATH_STD_USING @@ -70,13 +73,13 @@ inline bool is_odd(T v, const std::false_type&) return static_cast(modulus != 0); } template -inline bool is_odd(T v) +BOOST_MATH_GPU_ENABLED inline bool is_odd(T v) { - return is_odd(v, ::std::is_convertible()); + return is_odd(v, ::boost::math::is_convertible()); } template -T sinpx(T z) +BOOST_MATH_GPU_ENABLED T sinpx(T z) { // Ad hoc function calculates x * sin(pi * x), // taking extra care near when x is near a whole number. @@ -108,7 +111,7 @@ T sinpx(T z) // tgamma(z), with Lanczos support: // template -T gamma_imp(T z, const Policy& pol, const Lanczos& l) +BOOST_MATH_GPU_ENABLED T gamma_imp_final(T z, const Policy& pol, const Lanczos&) { BOOST_MATH_STD_USING @@ -122,25 +125,13 @@ T gamma_imp(T z, const Policy& pol, const Lanczos& l) b = true; } #endif - static const char* function = "boost::math::tgamma<%1%>(%1%)"; + constexpr auto function = "boost::math::tgamma<%1%>(%1%)"; if(z <= 0) { if(floor(z) == z) - return policies::raise_pole_error(function, "Evaluation of tgamma at a negative integer %1%.", z, pol); - if(z <= -20) { - result = gamma_imp(T(-z), pol, l) * sinpx(z); - BOOST_MATH_INSTRUMENT_VARIABLE(result); - if((fabs(result) < 1) && (tools::max_value() * fabs(result) < boost::math::constants::pi())) - return -boost::math::sign(result) * policies::raise_overflow_error(function, "Result of tgamma is too large to represent.", pol); - result = -boost::math::constants::pi() / result; - if(result == 0) - return policies::raise_underflow_error(function, "Result of tgamma is too small to represent.", pol); - if((boost::math::fpclassify)(result) == (int)FP_SUBNORMAL) - return policies::raise_denorm_error(function, "Result of tgamma is denormalized.", result, pol); - BOOST_MATH_INSTRUMENT_VARIABLE(result); - return result; + return policies::raise_pole_error(function, "Evaluation of tgamma at a negative integer %1%.", z, pol); } // shift z to > 1: @@ -195,11 +186,52 @@ T gamma_imp(T z, const Policy& pol, const Lanczos& l) } return result; } + +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_suppress 2190 +#endif + +// SYCL compilers can not support recursion so we extract it into a dispatch function +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE T gamma_imp(T z, const Policy& pol, const Lanczos& l) +{ + BOOST_MATH_STD_USING + + T result = 1; + constexpr auto function = "boost::math::tgamma<%1%>(%1%)"; + + if(z <= 0) + { + if(floor(z) == z) + return policies::raise_pole_error(function, "Evaluation of tgamma at a negative integer %1%.", z, pol); + if(z <= -20) + { + result = gamma_imp_final(T(-z), pol, l) * sinpx(z); + BOOST_MATH_INSTRUMENT_VARIABLE(result); + if((fabs(result) < 1) && (tools::max_value() * fabs(result) < boost::math::constants::pi())) + return -boost::math::sign(result) * policies::raise_overflow_error(function, "Result of tgamma is too large to represent.", pol); + result = -boost::math::constants::pi() / result; + if(result == 0) + return policies::raise_underflow_error(function, "Result of tgamma is too small to represent.", pol); + if((boost::math::fpclassify)(result) == BOOST_MATH_FP_SUBNORMAL) + return policies::raise_denorm_error(function, "Result of tgamma is denormalized.", result, pol); + BOOST_MATH_INSTRUMENT_VARIABLE(result); + return result; + } + } + + return gamma_imp_final(T(z), pol, l); +} + +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_default 2190 +#endif + // // lgamma(z) with Lanczos support: // template -T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) +BOOST_MATH_GPU_ENABLED T lgamma_imp_final(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) { #ifdef BOOST_MATH_INSTRUMENT static bool b = false; @@ -212,29 +244,12 @@ T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) BOOST_MATH_STD_USING - static const char* function = "boost::math::lgamma<%1%>(%1%)"; + constexpr auto function = "boost::math::lgamma<%1%>(%1%)"; T result = 0; int sresult = 1; - if(z <= -tools::root_epsilon()) - { - // reflection formula: - if(floor(z) == z) - return policies::raise_pole_error(function, "Evaluation of lgamma at a negative integer %1%.", z, pol); - - T t = sinpx(z); - z = -z; - if(t < 0) - { - t = -t; - } - else - { - sresult = -sresult; - } - result = log(boost::math::constants::pi()) - lgamma_imp(z, pol, l) - log(t); - } - else if (z < tools::root_epsilon()) + + if (z < tools::root_epsilon()) { if (0 == z) return policies::raise_pole_error(function, "Evaluation of lgamma at %1%.", z, pol); @@ -248,7 +263,7 @@ T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) else if(z < 15) { typedef typename policies::precision::type precision_type; - typedef std::integral_constant(z, T(z - 1), T(z - 2), tag_type(), pol, l); } - else if((z >= 3) && (z < 100) && (std::numeric_limits::max_exponent >= 1024)) + else if((z >= 3) && (z < 100) && (boost::math::numeric_limits::max_exponent >= 1024)) { // taking the log of tgamma reduces the error, no danger of overflow here: result = log(gamma_imp(z, pol, l)); @@ -279,6 +294,55 @@ T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) return result; } +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_suppress 2190 +#endif + +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = nullptr) +{ + BOOST_MATH_STD_USING + + if(z <= -tools::root_epsilon()) + { + constexpr auto function = "boost::math::lgamma<%1%>(%1%)"; + + T result = 0; + int sresult = 1; + + // reflection formula: + if(floor(z) == z) + return policies::raise_pole_error(function, "Evaluation of lgamma at a negative integer %1%.", z, pol); + + T t = sinpx(z); + z = -z; + if(t < 0) + { + t = -t; + } + else + { + sresult = -sresult; + } + result = log(boost::math::constants::pi()) - lgamma_imp_final(T(z), pol, l) - log(t); + + if(sign) + { + *sign = sresult; + } + + return result; + } + else + { + return lgamma_imp_final(T(z), pol, l, sign); + } +} + +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_default 2190 +#endif + // // Incomplete gamma functions follow: // @@ -289,14 +353,14 @@ struct upper_incomplete_gamma_fract T z, a; int k; public: - typedef std::pair result_type; + typedef boost::math::pair result_type; - upper_incomplete_gamma_fract(T a1, T z1) + BOOST_MATH_GPU_ENABLED upper_incomplete_gamma_fract(T a1, T z1) : z(z1-a1+1), a(a1), k(0) { } - result_type operator()() + BOOST_MATH_GPU_ENABLED result_type operator()() { ++k; z += 2; @@ -305,7 +369,7 @@ struct upper_incomplete_gamma_fract }; template -inline T upper_gamma_fraction(T a, T z, T eps) +BOOST_MATH_GPU_ENABLED inline T upper_gamma_fraction(T a, T z, T eps) { // Multiply result by z^a * e^-z to get the full // upper incomplete integral. Divide by tgamma(z) @@ -321,9 +385,9 @@ struct lower_incomplete_gamma_series T a, z, result; public: typedef T result_type; - lower_incomplete_gamma_series(T a1, T z1) : a(a1), z(z1), result(1){} + BOOST_MATH_GPU_ENABLED lower_incomplete_gamma_series(T a1, T z1) : a(a1), z(z1), result(1){} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { T r = result; a += 1; @@ -333,32 +397,34 @@ struct lower_incomplete_gamma_series }; template -inline T lower_gamma_series(T a, T z, const Policy& pol, T init_value = 0) +BOOST_MATH_GPU_ENABLED inline T lower_gamma_series(T a, T z, const Policy& pol, T init_value = 0) { // Multiply result by ((z^a) * (e^-z) / a) to get the full // lower incomplete integral. Then divide by tgamma(a) // to get the normalised value. lower_incomplete_gamma_series s(a, z); - std::uintmax_t max_iter = policies::get_max_series_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_series_iterations(); T factor = policies::get_epsilon(); T result = boost::math::tools::sum_series(s, factor, max_iter, init_value); policies::check_series_iterations("boost::math::detail::lower_gamma_series<%1%>(%1%)", max_iter, pol); return result; } +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + // // Fully generic tgamma and lgamma use Stirling's approximation // with Bernoulli numbers. // template -std::size_t highest_bernoulli_index() +boost::math::size_t highest_bernoulli_index() { - const float digits10_of_type = (std::numeric_limits::is_specialized - ? static_cast(std::numeric_limits::digits10) + const float digits10_of_type = (boost::math::numeric_limits::is_specialized + ? static_cast(boost::math::numeric_limits::digits10) : static_cast(boost::math::tools::digits() * 0.301F)); // Find the high index n for Bn to produce the desired precision in Stirling's calculation. - return static_cast(18.0F + (0.6F * digits10_of_type)); + return static_cast(18.0F + (0.6F * digits10_of_type)); } template @@ -366,8 +432,8 @@ int minimum_argument_for_bernoulli_recursion() { BOOST_MATH_STD_USING - const float digits10_of_type = (std::numeric_limits::is_specialized - ? (float) std::numeric_limits::digits10 + const float digits10_of_type = (boost::math::numeric_limits::is_specialized + ? (float) boost::math::numeric_limits::digits10 : (float) (boost::math::tools::digits() * 0.301F)); int min_arg = (int) (digits10_of_type * 1.7F); @@ -389,7 +455,7 @@ int minimum_argument_for_bernoulli_recursion() const float d2_minus_one = ((digits10_of_type / 0.301F) - 1.0F); const float limit = ceil(exp((d2_minus_one * log(2.0F)) / 20.0F)); - min_arg = (int) ((std::min)(digits10_of_type * 1.7F, limit)); + min_arg = (int) (BOOST_MATH_GPU_SAFE_MIN(digits10_of_type * 1.7F, limit)); } return min_arg; @@ -408,7 +474,7 @@ T scaled_tgamma_no_lanczos(const T& z, const Policy& pol, bool islog = false) // Perform the Bernoulli series expansion of Stirling's approximation. - const std::size_t number_of_bernoullis_b2n = policies::get_max_series_iterations(); + const boost::math::size_t number_of_bernoullis_b2n = policies::get_max_series_iterations(); T one_over_x_pow_two_n_minus_one = 1 / z; const T one_over_x2 = one_over_x_pow_two_n_minus_one * one_over_x_pow_two_n_minus_one; @@ -417,11 +483,11 @@ T scaled_tgamma_no_lanczos(const T& z, const Policy& pol, bool islog = false) const T half_ln_two_pi_over_z = sqrt(boost::math::constants::two_pi() / z); T last_term = 2 * sum; - for (std::size_t n = 2U;; ++n) + for (boost::math::size_t n = 2U;; ++n) { one_over_x_pow_two_n_minus_one *= one_over_x2; - const std::size_t n2 = static_cast(n * 2U); + const boost::math::size_t n2 = static_cast(n * 2U); const T term = (boost::math::bernoulli_b2n(static_cast(n)) * one_over_x_pow_two_n_minus_one) / (n2 * (n2 - 1U)); @@ -460,7 +526,7 @@ T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&) { BOOST_MATH_STD_USING - static const char* function = "boost::math::tgamma<%1%>(%1%)"; + constexpr auto function = "boost::math::tgamma<%1%>(%1%)"; // Check if the argument of tgamma is identically zero. const bool is_at_zero = (z == 0); @@ -569,7 +635,7 @@ T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&) if(gamma_value == 0) return policies::raise_underflow_error(function, "Result of tgamma is too small to represent.", pol); - if((boost::math::fpclassify)(gamma_value) == static_cast(FP_SUBNORMAL)) + if((boost::math::fpclassify)(gamma_value) == static_cast(BOOST_MATH_FP_SUBNORMAL)) return policies::raise_denorm_error(function, "Result of tgamma is denormalized.", gamma_value, pol); } @@ -610,7 +676,7 @@ T lgamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&, int* sig { BOOST_MATH_STD_USING - static const char* function = "boost::math::lgamma<%1%>(%1%)"; + constexpr auto function = "boost::math::lgamma<%1%>(%1%)"; // Check if the argument of lgamma is identically zero. const bool is_at_zero = (z == 0); @@ -715,18 +781,33 @@ T lgamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&, int* sig return log_gamma_value; } +#endif // BOOST_MATH_HAS_GPU_SUPPORT + +// In order for tgammap1m1_imp to compile we need a forward decl of boost::math::tgamma +// The rub is that we can't just use math_fwd so we provide one here only in that circumstance +#ifdef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT z); + +template +BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z); + +template +BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z, const Policy& pol); +#endif + // // This helper calculates tgamma(dz+1)-1 without cancellation errors, // used by the upper incomplete gamma with z < 1: // template -T tgammap1m1_imp(T dz, Policy const& pol, const Lanczos& l) +BOOST_MATH_GPU_ENABLED T tgammap1m1_imp(T dz, Policy const& pol, const Lanczos& l) { BOOST_MATH_STD_USING typedef typename policies::precision::type precision_type; - typedef std::integral_constant inline T tgammap1m1_imp(T z, Policy const& pol, const ::boost::math::lanczos::undefined_lanczos&) @@ -781,6 +872,8 @@ inline T tgammap1m1_imp(T z, Policy const& pol, return boost::math::expm1(boost::math::lgamma(1 + z, pol)); } +#endif // BOOST_MATH_HAS_GPU_SUPPORT + // // Series representation for upper fraction when z is small: // @@ -789,9 +882,9 @@ struct small_gamma2_series { typedef T result_type; - small_gamma2_series(T a_, T x_) : result(-x_), x(-x_), apn(a_+1), n(1){} + BOOST_MATH_GPU_ENABLED small_gamma2_series(T a_, T x_) : result(-x_), x(-x_), apn(a_+1), n(1){} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { T r = result / (apn); result *= x; @@ -809,15 +902,17 @@ struct small_gamma2_series // incomplete gammas: // template -T full_igamma_prefix(T a, T z, const Policy& pol) +BOOST_MATH_GPU_ENABLED T full_igamma_prefix(T a, T z, const Policy& pol) { BOOST_MATH_STD_USING - T prefix; if (z > tools::max_value()) return 0; + T alz = a * log(z); + T prefix { }; + if(z >= 1) { if((alz < tools::log_max_value()) && (-z > tools::log_min_value())) @@ -852,7 +947,7 @@ T full_igamma_prefix(T a, T z, const Policy& pol) // This error handling isn't very good: it happens after the fact // rather than before it... // - if((boost::math::fpclassify)(prefix) == (int)FP_INFINITE) + if((boost::math::fpclassify)(prefix) == (int)BOOST_MATH_FP_INFINITE) return policies::raise_overflow_error("boost::math::detail::full_igamma_prefix<%1%>(%1%, %1%)", "Result of incomplete gamma function is too large to represent.", pol); return prefix; @@ -862,7 +957,7 @@ T full_igamma_prefix(T a, T z, const Policy& pol) // most if the error occurs in this function: // template -T regularised_gamma_prefix(T a, T z, const Policy& pol, const Lanczos& l) +BOOST_MATH_GPU_ENABLED T regularised_gamma_prefix(T a, T z, const Policy& pol, const Lanczos& l) { BOOST_MATH_STD_USING if (z >= tools::max_value()) @@ -909,16 +1004,16 @@ T regularised_gamma_prefix(T a, T z, const Policy& pol, const Lanczos& l) // T alz = a * log(z / agh); T amz = a - z; - if(((std::min)(alz, amz) <= tools::log_min_value()) || ((std::max)(alz, amz) >= tools::log_max_value())) + if((BOOST_MATH_GPU_SAFE_MIN(alz, amz) <= tools::log_min_value()) || (BOOST_MATH_GPU_SAFE_MAX(alz, amz) >= tools::log_max_value())) { T amza = amz / a; - if(((std::min)(alz, amz)/2 > tools::log_min_value()) && ((std::max)(alz, amz)/2 < tools::log_max_value())) + if((BOOST_MATH_GPU_SAFE_MIN(alz, amz)/2 > tools::log_min_value()) && (BOOST_MATH_GPU_SAFE_MAX(alz, amz)/2 < tools::log_max_value())) { // compute square root of the result and then square it: T sq = pow(z / agh, a / 2) * exp(amz / 2); prefix = sq * sq; } - else if(((std::min)(alz, amz)/4 > tools::log_min_value()) && ((std::max)(alz, amz)/4 < tools::log_max_value()) && (z > a)) + else if((BOOST_MATH_GPU_SAFE_MIN(alz, amz)/4 > tools::log_min_value()) && (BOOST_MATH_GPU_SAFE_MAX(alz, amz)/4 < tools::log_max_value()) && (z > a)) { // compute the 4th root of the result then square it twice: T sq = pow(z / agh, a / 4) * exp(amz / 4); @@ -942,6 +1037,9 @@ T regularised_gamma_prefix(T a, T z, const Policy& pol, const Lanczos& l) prefix *= sqrt(agh / boost::math::constants::e()) / Lanczos::lanczos_sum_expG_scaled(a); return prefix; } + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + // // And again, without Lanczos support: // @@ -1011,25 +1109,36 @@ T regularised_gamma_prefix(T a, T z, const Policy& pol, const lanczos::undefined } } } + +#endif // BOOST_MATH_HAS_GPU_SUPPORT + // // Upper gamma fraction for very small a: // template -inline T tgamma_small_upper_part(T a, T x, const Policy& pol, T* pgam = 0, bool invert = false, T* pderivative = 0) +BOOST_MATH_GPU_ENABLED inline T tgamma_small_upper_part(T a, T x, const Policy& pol, T* pgam = 0, bool invert = false, T* pderivative = 0) { BOOST_MATH_STD_USING // ADL of std functions. // // Compute the full upper fraction (Q) when a is very small: // - T result; - result = boost::math::tgamma1pm1(a, pol); + + #ifdef BOOST_MATH_HAS_NVRTC + typedef typename tools::promote_args::type result_type; + typedef typename policies::evaluation::type value_type; + typedef typename lanczos::lanczos::type evaluation_type; + T result {detail::tgammap1m1_imp(static_cast(a), pol, evaluation_type())}; + #else + T result { boost::math::tgamma1pm1(a, pol) }; + #endif + if(pgam) *pgam = (result + 1) / a; T p = boost::math::powm1(x, a, pol); result -= p; result /= a; detail::small_gamma2_series s(a, x); - std::uintmax_t max_iter = policies::get_max_series_iterations() - 10; + boost::math::uintmax_t max_iter = policies::get_max_series_iterations() - 10; p += 1; if(pderivative) *pderivative = p / (*pgam * exp(x)); @@ -1044,7 +1153,7 @@ inline T tgamma_small_upper_part(T a, T x, const Policy& pol, T* pgam = 0, bool // Upper gamma fraction for integer a: // template -inline T finite_gamma_q(T a, T x, Policy const& pol, T* pderivative = 0) +BOOST_MATH_GPU_ENABLED inline T finite_gamma_q(T a, T x, Policy const& pol, T* pderivative = 0) { // // Calculates normalised Q when a is an integer: @@ -1072,13 +1181,27 @@ inline T finite_gamma_q(T a, T x, Policy const& pol, T* pderivative = 0) // Upper gamma fraction for half integer a: // template -T finite_half_gamma_q(T a, T x, T* p_derivative, const Policy& pol) +BOOST_MATH_GPU_ENABLED T finite_half_gamma_q(T a, T x, T* p_derivative, const Policy& pol) { // // Calculates normalised Q when a is a half-integer: // BOOST_MATH_STD_USING + + #ifdef BOOST_MATH_HAS_NVRTC + T e; + if (boost::math::is_same_v) + { + e = ::erfcf(::sqrtf(x)); + } + else + { + e = ::erfc(::sqrt(x)); + } + #else T e = boost::math::erfc(sqrt(x), pol); + #endif + if((e != 0) && (a > 1)) { T term = exp(-x) / sqrt(constants::pi() * x); @@ -1112,9 +1235,9 @@ template struct incomplete_tgamma_large_x_series { typedef T result_type; - incomplete_tgamma_large_x_series(const T& a, const T& x) + BOOST_MATH_GPU_ENABLED incomplete_tgamma_large_x_series(const T& a, const T& x) : a_poch(a - 1), z(x), term(1) {} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { T result = term; term *= a_poch / z; @@ -1125,11 +1248,11 @@ struct incomplete_tgamma_large_x_series }; template -T incomplete_tgamma_large_x(const T& a, const T& x, const Policy& pol) +BOOST_MATH_GPU_ENABLED T incomplete_tgamma_large_x(const T& a, const T& x, const Policy& pol) { BOOST_MATH_STD_USING incomplete_tgamma_large_x_series s(a, x); - std::uintmax_t max_iter = boost::math::policies::get_max_series_iterations(); + boost::math::uintmax_t max_iter = boost::math::policies::get_max_series_iterations(); T result = boost::math::tools::sum_series(s, boost::math::policies::get_epsilon(), max_iter); boost::math::policies::check_series_iterations("boost::math::tgamma<%1%>(%1%,%1%)", max_iter, pol); return result; @@ -1140,10 +1263,10 @@ T incomplete_tgamma_large_x(const T& a, const T& x, const Policy& pol) // Main incomplete gamma entry point, handles all four incomplete gamma's: // template -T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, +BOOST_MATH_GPU_ENABLED T gamma_incomplete_imp_final(T a, T x, bool normalised, bool invert, const Policy& pol, T* p_derivative) { - static const char* function = "boost::math::gamma_p<%1%>(%1%, %1%)"; + constexpr auto function = "boost::math::gamma_p<%1%>(%1%, %1%)"; if(a <= 0) return policies::raise_domain_error(function, "Argument a to the incomplete gamma function must be greater than zero (got a=%1%).", a, pol); if(x < 0) @@ -1155,70 +1278,6 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, T result = 0; // Just to avoid warning C4701: potentially uninitialized local variable 'result' used - if(a >= max_factorial::value && !normalised) - { - // - // When we're computing the non-normalized incomplete gamma - // and a is large the result is rather hard to compute unless - // we use logs. There are really two options - if x is a long - // way from a in value then we can reliably use methods 2 and 4 - // below in logarithmic form and go straight to the result. - // Otherwise we let the regularized gamma take the strain - // (the result is unlikely to underflow in the central region anyway) - // and combine with lgamma in the hopes that we get a finite result. - // - if(invert && (a * 4 < x)) - { - // This is method 4 below, done in logs: - result = a * log(x) - x; - if(p_derivative) - *p_derivative = exp(result); - result += log(upper_gamma_fraction(a, x, policies::get_epsilon())); - } - else if(!invert && (a > 4 * x)) - { - // This is method 2 below, done in logs: - result = a * log(x) - x; - if(p_derivative) - *p_derivative = exp(result); - T init_value = 0; - result += log(detail::lower_gamma_series(a, x, pol, init_value) / a); - } - else - { - result = gamma_incomplete_imp(a, x, true, invert, pol, p_derivative); - if(result == 0) - { - if(invert) - { - // Try http://functions.wolfram.com/06.06.06.0039.01 - result = 1 + 1 / (12 * a) + 1 / (288 * a * a); - result = log(result) - a + (a - 0.5f) * log(a) + log(boost::math::constants::root_two_pi()); - if(p_derivative) - *p_derivative = exp(a * log(x) - x); - } - else - { - // This is method 2 below, done in logs, we're really outside the - // range of this method, but since the result is almost certainly - // infinite, we should probably be OK: - result = a * log(x) - x; - if(p_derivative) - *p_derivative = exp(result); - T init_value = 0; - result += log(detail::lower_gamma_series(a, x, pol, init_value) / a); - } - } - else - { - result = log(result) + boost::math::lgamma(a, pol); - } - } - if(result > tools::log_max_value()) - return policies::raise_overflow_error(function, nullptr, pol); - return exp(result); - } - BOOST_MATH_ASSERT((p_derivative == nullptr) || normalised); bool is_int, is_half_int; @@ -1294,7 +1353,7 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, // series and continued fractions are slow to converge: // bool use_temme = false; - if(normalised && std::numeric_limits::is_specialized && (a > 20)) + if(normalised && boost::math::numeric_limits::is_specialized && (a > 20)) { T sigma = fabs((x-a)/a); if((a > 200) && (policies::digits() <= 113)) @@ -1351,14 +1410,40 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, { result = finite_gamma_q(a, x, pol, p_derivative); if(!normalised) + { + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + result *= ::tgammaf(a); + } + else + { + result *= ::tgamma(a); + } + #else result *= boost::math::tgamma(a, pol); + #endif + } break; } case 1: { result = finite_half_gamma_q(a, x, p_derivative, pol); if(!normalised) + { + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + result *= ::tgammaf(a); + } + else + { + result *= ::tgamma(a); + } + #else result *= boost::math::tgamma(a, pol); + #endif + } if(p_derivative && (*p_derivative == 0)) *p_derivative = regularised_gamma_prefix(a, x, pol, lanczos_type()); break; @@ -1387,7 +1472,19 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, bool optimised_invert = false; if(invert) { + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + init_value = (normalised ? 1 : ::tgammaf(a)); + } + else + { + init_value = (normalised ? 1 : ::tgamma(a)); + } + #else init_value = (normalised ? 1 : boost::math::tgamma(a, pol)); + #endif + if(normalised || (result >= 1) || (tools::max_value() * result > init_value)) { init_value /= result; @@ -1444,14 +1541,14 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, // typedef typename policies::precision::type precision_type; - typedef std::integral_constant tag_type; - result = igamma_temme_large(a, x, pol, static_cast(nullptr)); + result = igamma_temme_large(a, x, pol, tag_type()); if(x >= a) invert = !invert; if(p_derivative) @@ -1466,12 +1563,23 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, result = pow(x, a) / (a); else { -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS try { #endif + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + result = ::powf(x, a) / ::tgammaf(a + 1); + } + else + { + result = ::pow(x, a) / ::tgamma(a + 1); + } + #else result = pow(x, a) / boost::math::tgamma(a + 1, pol); -#ifndef BOOST_NO_EXCEPTIONS + #endif +#ifndef BOOST_MATH_NO_EXCEPTIONS } catch (const std::overflow_error&) { @@ -1502,7 +1610,19 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, result = 1; if(invert) { + #ifdef BOOST_MATH_HAS_NVRTC + T gam; + if (boost::math::is_same_v) + { + gam = normalised ? 1 : ::tgammaf(a); + } + else + { + gam = normalised ? 1 : ::tgamma(a); + } + #else T gam = normalised ? 1 : boost::math::tgamma(a, pol); + #endif result = gam - result; } if(p_derivative) @@ -1522,36 +1642,109 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, return result; } -// -// Ratios of two gamma functions: -// -template -T tgamma_delta_ratio_imp_lanczos(T z, T delta, const Policy& pol, const Lanczos& l) +// Need to implement this dispatch to avoid recursion for device compilers +template +BOOST_MATH_GPU_ENABLED T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, + const Policy& pol, T* p_derivative) { + constexpr auto function = "boost::math::gamma_p<%1%>(%1%, %1%)"; + if(a <= 0) + return policies::raise_domain_error(function, "Argument a to the incomplete gamma function must be greater than zero (got a=%1%).", a, pol); + if(x < 0) + return policies::raise_domain_error(function, "Argument x to the incomplete gamma function must be >= 0 (got x=%1%).", x, pol); + BOOST_MATH_STD_USING - if(z < tools::epsilon()) + + + T result = 0; // Just to avoid warning C4701: potentially uninitialized local variable 'result' used + + if(a >= max_factorial::value && !normalised) { // - // We get spurious numeric overflow unless we're very careful, this - // can occur either inside Lanczos::lanczos_sum(z) or in the - // final combination of terms, to avoid this, split the product up - // into 2 (or 3) parts: - // - // G(z) / G(L) = 1 / (z * G(L)) ; z < eps, L = z + delta = delta - // z * G(L) = z * G(lim) * (G(L)/G(lim)) ; lim = largest factorial + // When we're computing the non-normalized incomplete gamma + // and a is large the result is rather hard to compute unless + // we use logs. There are really two options - if x is a long + // way from a in value then we can reliably use methods 2 and 4 + // below in logarithmic form and go straight to the result. + // Otherwise we let the regularized gamma take the strain + // (the result is unlikely to underflow in the central region anyway) + // and combine with lgamma in the hopes that we get a finite result. // - if(boost::math::max_factorial::value < delta) + if(invert && (a * 4 < x)) { - T ratio = tgamma_delta_ratio_imp_lanczos(delta, T(boost::math::max_factorial::value - delta), pol, l); - ratio *= z; - ratio *= boost::math::unchecked_factorial(boost::math::max_factorial::value - 1); - return 1 / ratio; + // This is method 4 below, done in logs: + result = a * log(x) - x; + if(p_derivative) + *p_derivative = exp(result); + result += log(upper_gamma_fraction(a, x, policies::get_epsilon())); + } + else if(!invert && (a > 4 * x)) + { + // This is method 2 below, done in logs: + result = a * log(x) - x; + if(p_derivative) + *p_derivative = exp(result); + T init_value = 0; + result += log(detail::lower_gamma_series(a, x, pol, init_value) / a); } else { - return 1 / (z * boost::math::tgamma(z + delta, pol)); + result = gamma_incomplete_imp_final(T(a), T(x), true, invert, pol, p_derivative); + if(result == 0) + { + if(invert) + { + // Try http://functions.wolfram.com/06.06.06.0039.01 + result = 1 + 1 / (12 * a) + 1 / (288 * a * a); + result = log(result) - a + (a - 0.5f) * log(a) + log(boost::math::constants::root_two_pi()); + if(p_derivative) + *p_derivative = exp(a * log(x) - x); + } + else + { + // This is method 2 below, done in logs, we're really outside the + // range of this method, but since the result is almost certainly + // infinite, we should probably be OK: + result = a * log(x) - x; + if(p_derivative) + *p_derivative = exp(result); + T init_value = 0; + result += log(detail::lower_gamma_series(a, x, pol, init_value) / a); + } + } + else + { + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + result = ::logf(result) + ::lgammaf(a); + } + else + { + result = ::log(result) + ::lgamma(a); + } + #else + result = log(result) + boost::math::lgamma(a, pol); + #endif + } } + if(result > tools::log_max_value()) + return policies::raise_overflow_error(function, nullptr, pol); + return exp(result); } + + // If no special handling is required then we proceeds as normal + return gamma_incomplete_imp_final(T(a), T(x), normalised, invert, pol, p_derivative); +} + +// +// Ratios of two gamma functions: +// +template +BOOST_MATH_GPU_ENABLED T tgamma_delta_ratio_imp_lanczos_final(T z, T delta, const Policy& pol, const Lanczos&) +{ + BOOST_MATH_STD_USING + T zgh = static_cast(z + T(Lanczos::g()) - constants::half()); T result; if(z + delta == z) @@ -1585,9 +1778,55 @@ T tgamma_delta_ratio_imp_lanczos(T z, T delta, const Policy& pol, const Lanczos& result *= pow(T(constants::e() / (zgh + delta)), delta); return result; } + +template +BOOST_MATH_GPU_ENABLED T tgamma_delta_ratio_imp_lanczos(T z, T delta, const Policy& pol, const Lanczos& l) +{ + BOOST_MATH_STD_USING + + if(z < tools::epsilon()) + { + // + // We get spurious numeric overflow unless we're very careful, this + // can occur either inside Lanczos::lanczos_sum(z) or in the + // final combination of terms, to avoid this, split the product up + // into 2 (or 3) parts: + // + // G(z) / G(L) = 1 / (z * G(L)) ; z < eps, L = z + delta = delta + // z * G(L) = z * G(lim) * (G(L)/G(lim)) ; lim = largest factorial + // + if(boost::math::max_factorial::value < delta) + { + T ratio = tgamma_delta_ratio_imp_lanczos_final(T(delta), T(boost::math::max_factorial::value - delta), pol, l); + ratio *= z; + ratio *= boost::math::unchecked_factorial(boost::math::max_factorial::value - 1); + return 1 / ratio; + } + else + { + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return 1 / (z * ::tgammaf(z + delta)); + } + else + { + return 1 / (z * ::tgamma(z + delta)); + } + #else + return 1 / (z * boost::math::tgamma(z + delta, pol)); + #endif + } + } + + return tgamma_delta_ratio_imp_lanczos_final(T(z), T(delta), pol, l); +} + // // And again without Lanczos support this time: // +#ifndef BOOST_MATH_HAS_GPU_SUPPORT + template T tgamma_delta_ratio_imp_lanczos(T z, T delta, const Policy& pol, const lanczos::undefined_lanczos& l) { @@ -1644,15 +1883,28 @@ T tgamma_delta_ratio_imp_lanczos(T z, T delta, const Policy& pol, const lanczos: return ratio; } +#endif + template -T tgamma_delta_ratio_imp(T z, T delta, const Policy& pol) +BOOST_MATH_GPU_ENABLED T tgamma_delta_ratio_imp(T z, T delta, const Policy& pol) { BOOST_MATH_STD_USING if((z <= 0) || (z + delta <= 0)) { // This isn't very sophisticated, or accurate, but it does work: + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return ::tgammaf(z) / ::tgammaf(z + delta); + } + else + { + return ::tgamma(z) / ::tgamma(z + delta); + } + #else return boost::math::tgamma(z, pol) / boost::math::tgamma(z + delta, pol); + #endif } if(floor(delta) == delta) @@ -1703,7 +1955,7 @@ T tgamma_delta_ratio_imp(T z, T delta, const Policy& pol) } template -T tgamma_ratio_imp(T x, T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED T tgamma_ratio_imp(T x, T y, const Policy& pol) { BOOST_MATH_STD_USING @@ -1712,17 +1964,32 @@ T tgamma_ratio_imp(T x, T y, const Policy& pol) if((y <= 0) || (boost::math::isinf)(y)) return policies::raise_domain_error("boost::math::tgamma_ratio<%1%>(%1%, %1%)", "Gamma function ratios only implemented for positive arguments (got b=%1%).", y, pol); + // We don't need to worry about the denorm case on device + // And this has the added bonus of removing recursion + #ifndef BOOST_MATH_HAS_GPU_SUPPORT if(x <= tools::min_value()) { // Special case for denorms...Ugh. T shift = ldexp(T(1), tools::digits()); return shift * tgamma_ratio_imp(T(x * shift), y, pol); } + #endif if((x < max_factorial::value) && (y < max_factorial::value)) { // Rather than subtracting values, lets just call the gamma functions directly: + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return ::tgammaf(x) / ::tgammaf(y); + } + else + { + return ::tgamma(x) / ::tgamma(y); + } + #else return boost::math::tgamma(x, pol) / boost::math::tgamma(y, pol); + #endif } T prefix = 1; if(x < 1) @@ -1738,12 +2005,35 @@ T tgamma_ratio_imp(T x, T y, const Policy& pol) y -= 1; prefix /= y; } + + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return prefix * ::tgammaf(x) / ::tgammaf(y); + } + else + { + return prefix * ::tgamma(x) / ::tgamma(y); + } + #else return prefix * boost::math::tgamma(x, pol) / boost::math::tgamma(y, pol); + #endif } // // result is almost certainly going to underflow to zero, try logs just in case: // + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return ::expf(::lgammaf(x) - ::lgammaf(y)); + } + else + { + return ::exp(::lgamma(x) - ::lgamma(y)); + } + #else return exp(boost::math::lgamma(x, pol) - boost::math::lgamma(y, pol)); + #endif } if(y < 1) { @@ -1758,21 +2048,48 @@ T tgamma_ratio_imp(T x, T y, const Policy& pol) x -= 1; prefix *= x; } + + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return prefix * ::tgammaf(x) / ::tgammaf(y); + } + else + { + return prefix * ::tgamma(x) / ::tgamma(y); + } + #else return prefix * boost::math::tgamma(x, pol) / boost::math::tgamma(y, pol); + #endif } // // Result will almost certainly overflow, try logs just in case: // + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + return ::expf(::lgammaf(x) - ::lgammaf(y)); + } + else + { + return ::exp(::lgamma(x) - ::lgamma(y)); + } + #else return exp(boost::math::lgamma(x, pol) - boost::math::lgamma(y, pol)); + #endif } // // Regular case, x and y both large and similar in magnitude: // + #ifdef BOOST_MATH_HAS_NVRTC + return detail::tgamma_delta_ratio_imp(x, y - x, pol); + #else return boost::math::tgamma_delta_ratio(x, y - x, pol); + #endif } template -T gamma_p_derivative_imp(T a, T x, const Policy& pol) +BOOST_MATH_GPU_ENABLED T gamma_p_derivative_imp(T a, T x, const Policy& pol) { BOOST_MATH_STD_USING // @@ -1803,7 +2120,18 @@ T gamma_p_derivative_imp(T a, T x, const Policy& pol) if(f1 == 0) { // Underflow in calculation, use logs instead: + #ifdef BOOST_MATH_HAS_NVRTC + if (boost::math::is_same_v) + { + f1 = a * ::logf(x) - x - ::lgammaf(a) - ::logf(x); + } + else + { + f1 = a * ::log(x) - x - ::lgamma(a) - ::log(x); + } + #else f1 = a * log(x) - x - lgamma(a, pol) - log(x); + #endif f1 = exp(f1); } else @@ -1813,8 +2141,8 @@ T gamma_p_derivative_imp(T a, T x, const Policy& pol) } template -inline typename tools::promote_args::type - tgamma(T z, const Policy& /* pol */, const std::true_type) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type + tgamma(T z, const Policy& /* pol */, const boost::math::true_type) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -1834,11 +2162,11 @@ struct igamma_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { typedef typename policies::precision::type precision_type; - typedef std::integral_constant - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { // If std::numeric_limits::digits is zero, we must not call // our initialization code here as the precision presumably // varies at runtime, and will not have been set yet. Plus the // code requiring initialization isn't called when digits == 0. - if(std::numeric_limits::digits) + if (boost::math::numeric_limits::digits) { boost::math::gamma_p(static_cast(400), static_cast(400), Policy()); } } - static void do_init(const std::integral_constant&){} - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&){} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; - static const init initializer; - static void force_instantiate() + BOOST_MATH_STATIC const init initializer; + BOOST_MATH_GPU_ENABLED static void force_instantiate() { + #ifndef BOOST_MATH_HAS_GPU_SUPPORT initializer.force_instantiate(); + #endif } }; @@ -1877,10 +2207,10 @@ struct lgamma_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { typedef typename policies::precision::type precision_type; - typedef std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { boost::math::lgamma(static_cast(2.5), Policy()); boost::math::lgamma(static_cast(1.25), Policy()); boost::math::lgamma(static_cast(1.75), Policy()); } - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { boost::math::lgamma(static_cast(2.5), Policy()); boost::math::lgamma(static_cast(1.25), Policy()); boost::math::lgamma(static_cast(1.5), Policy()); boost::math::lgamma(static_cast(1.75), Policy()); } - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { } - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; - static const init initializer; - static void force_instantiate() + BOOST_MATH_STATIC const init initializer; + BOOST_MATH_GPU_ENABLED static void force_instantiate() { + #ifndef BOOST_MATH_HAS_GPU_SUPPORT initializer.force_instantiate(); + #endif } }; @@ -1917,8 +2249,8 @@ template const typename lgamma_initializer::init lgamma_initializer::initializer; template -inline tools::promote_args_t - tgamma(T1 a, T2 z, const Policy&, const std::false_type) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t + tgamma(T1 a, T2 z, const Policy&, const boost::math::false_type) { BOOST_FPU_EXCEPTION_GUARD typedef tools::promote_args_t result_type; @@ -1940,8 +2272,8 @@ inline tools::promote_args_t } template -inline tools::promote_args_t - tgamma(T1 a, T2 z, const std::false_type& tag) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t + tgamma(T1 a, T2 z, const boost::math::false_type& tag) { return tgamma(a, z, policies::policy<>(), tag); } @@ -1949,15 +2281,8 @@ inline tools::promote_args_t } // namespace detail -template -inline typename tools::promote_args::type - tgamma(T z) -{ - return tgamma(z, policies::policy<>()); -} - template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T z, int* sign, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1977,28 +2302,28 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T z, int* sign) { return lgamma(z, sign, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T x, const Policy& pol) { return ::boost::math::lgamma(x, nullptr, pol); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T x) { return ::boost::math::lgamma(x, nullptr, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tgamma1pm1(T z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -2012,11 +2337,11 @@ inline typename tools::promote_args::type policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - return policies::checked_narrowing_cast::type, forwarding_policy>(detail::tgammap1m1_imp(static_cast(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma1pm1<%!%>(%1%)"); + return policies::checked_narrowing_cast::type, forwarding_policy>(detail::tgammap1m1_imp(static_cast(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma1pm1<%!%>(%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tgamma1pm1(T z) { return tgamma1pm1(z, policies::policy<>()); @@ -2026,7 +2351,7 @@ inline typename tools::promote_args::type // Full upper incomplete gamma: // template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma(T1 a, T2 z) { // @@ -2038,17 +2363,23 @@ inline tools::promote_args_t return static_cast(detail::tgamma(a, z, maybe_policy())); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma(T1 a, T2 z, const Policy& pol) { using result_type = tools::promote_args_t; - return static_cast(detail::tgamma(a, z, pol, std::false_type())); + return static_cast(detail::tgamma(a, z, pol, boost::math::false_type())); +} +template +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type + tgamma(T z) +{ + return tgamma(z, policies::policy<>()); } // // Full lower incomplete gamma: // template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_lower(T1 a, T2 z, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -2070,7 +2401,7 @@ inline tools::promote_args_t forwarding_policy(), static_cast(nullptr)), "tgamma_lower<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_lower(T1 a, T2 z) { return tgamma_lower(a, z, policies::policy<>()); @@ -2079,7 +2410,7 @@ inline tools::promote_args_t // Regularised upper incomplete gamma: // template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_q(T1 a, T2 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -2101,7 +2432,7 @@ inline tools::promote_args_t forwarding_policy(), static_cast(nullptr)), "gamma_q<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_q(T1 a, T2 z) { return gamma_q(a, z, policies::policy<>()); @@ -2110,7 +2441,7 @@ inline tools::promote_args_t // Regularised lower incomplete gamma: // template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p(T1 a, T2 z, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -2132,7 +2463,7 @@ inline tools::promote_args_t forwarding_policy(), static_cast(nullptr)), "gamma_p<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p(T1 a, T2 z) { return gamma_p(a, z, policies::policy<>()); @@ -2140,7 +2471,7 @@ inline tools::promote_args_t // ratios of gamma functions: template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -2156,13 +2487,13 @@ inline tools::promote_args_t return policies::checked_narrowing_cast(detail::tgamma_delta_ratio_imp(static_cast(z), static_cast(delta), forwarding_policy()), "boost::math::tgamma_delta_ratio<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta) { return tgamma_delta_ratio(z, delta, policies::policy<>()); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_ratio(T1 a, T2 b, const Policy&) { typedef tools::promote_args_t result_type; @@ -2177,14 +2508,14 @@ inline tools::promote_args_t return policies::checked_narrowing_cast(detail::tgamma_ratio_imp(static_cast(a), static_cast(b), forwarding_policy()), "boost::math::tgamma_delta_ratio<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_ratio(T1 a, T2 b) { return tgamma_ratio(a, b, policies::policy<>()); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p_derivative(T1 a, T2 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -2200,7 +2531,7 @@ inline tools::promote_args_t return policies::checked_narrowing_cast(detail::gamma_p_derivative_imp(static_cast(a), static_cast(x), forwarding_policy()), "boost::math::gamma_p_derivative<%1%>(%1%, %1%)"); } template -inline tools::promote_args_t +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p_derivative(T1 a, T2 x) { return gamma_p_derivative(a, x, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypot.hpp b/include/boost/math/special_functions/hypot.hpp index c56c7511..f38e37e8 100644 --- a/include/boost/math/special_functions/hypot.hpp +++ b/include/boost/math/special_functions/hypot.hpp @@ -12,20 +12,20 @@ #include #include +#include +#include #include #include -#include // for swap -#include namespace boost{ namespace math{ namespace detail{ template -T hypot_imp(T x, T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED T hypot_imp(T x, T y, const Policy& pol) { // // Normalize x and y, so that both are positive and x >= y: // - using std::fabs; using std::sqrt; // ADL of std names + BOOST_MATH_STD_USING x = fabs(x); y = fabs(y); @@ -35,16 +35,16 @@ T hypot_imp(T x, T y, const Policy& pol) #pragma warning(disable: 4127) #endif // special case, see C99 Annex F: - if(std::numeric_limits::has_infinity - && ((x == std::numeric_limits::infinity()) - || (y == std::numeric_limits::infinity()))) + if(boost::math::numeric_limits::has_infinity + && ((x == boost::math::numeric_limits::infinity()) + || (y == boost::math::numeric_limits::infinity()))) return policies::raise_overflow_error("boost::math::hypot<%1%>(%1%,%1%)", nullptr, pol); #ifdef _MSC_VER #pragma warning(pop) #endif if(y > x) - (std::swap)(x, y); + BOOST_MATH_GPU_SAFE_SWAP(x, y); if(x * tools::epsilon() >= y) return x; @@ -56,7 +56,7 @@ T hypot_imp(T x, T y, const Policy& pol) } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hypot(T1 x, T2 y) { typedef typename tools::promote_args::type result_type; @@ -65,7 +65,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hypot(T1 x, T2 y, const Policy& pol) { typedef typename tools::promote_args::type result_type; diff --git a/include/boost/math/special_functions/lanczos.hpp b/include/boost/math/special_functions/lanczos.hpp index cb6e34d2..0ec24bdd 100644 --- a/include/boost/math/special_functions/lanczos.hpp +++ b/include/boost/math/special_functions/lanczos.hpp @@ -11,12 +11,16 @@ #endif #include -#include #include +#include +#include +#include #include -#include -#include + +#ifndef BOOST_MATH_HAS_NVRTC +#include #include +#endif #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -41,35 +45,6 @@ namespace boost{ namespace math{ namespace lanczos{ // http://my.fit.edu/~gabdo/gamma.txt and elaborated by Toth at // http://www.rskey.org/gamma.htm using NTL::RR at 1000 bit precision. // -// Begin with a small helper to force initialization of constants prior -// to main. This makes the constant initialization thread safe, even -// when called with a user-defined number type. -// -template -struct lanczos_initializer -{ - struct init - { - init() - { - T t(1); - Lanczos::lanczos_sum(t); - Lanczos::lanczos_sum_expG_scaled(t); - Lanczos::lanczos_sum_near_1(t); - Lanczos::lanczos_sum_near_2(t); - Lanczos::g(); - } - void force_instantiate()const{} - }; - static const init initializer; - static void force_instantiate() - { - initializer.force_instantiate(); - } -}; -template -typename lanczos_initializer::init const lanczos_initializer::initializer; - // // Non-member helper which allows us to have a different g() value for the // near_1 and near_2 approximations. This is a big help in reducing error @@ -77,7 +52,7 @@ typename lanczos_initializer::init const lanczos_initializer -inline double lanczos_g_near_1_and_2(const L&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const L&) { return L::g(); } @@ -88,17 +63,17 @@ inline double lanczos_g_near_1_and_2(const L&) // Max experimental error (with arbitrary precision arithmetic) 9.516e-12 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos6 : public std::integral_constant +struct lanczos6 : public boost::math::integral_constant { // // Produces slightly better than float precision when evaluated at // double precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[6] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[6] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 8706.349592549009182288174442774377925882)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 8523.650341121874633477483696775067709735)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 3338.029219476423550899999750161289306564)), @@ -106,22 +81,23 @@ struct lanczos6 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 63.99951844938187085666201263218840287667)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.506628274631006311133031631822390264407)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { - static_cast(0u), - static_cast(24u), - static_cast(50u), - static_cast(35u), - static_cast(10u), - static_cast(1u) + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint16_t) denom[6] = { + static_cast(0u), + static_cast(24u), + static_cast(50u), + static_cast(35u), + static_cast(10u), + static_cast(1u) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[6] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[6] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 32.81244541029783471623665933780748627823)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 32.12388941444332003446077108933558534361)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 12.58034729455216106950851080138931470954)), @@ -129,29 +105,31 @@ struct lanczos6 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.2412010548258800231126240760264822486599)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.009446967704539249494420221613134244048319)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { - static_cast(0u), - static_cast(24u), - static_cast(50u), - static_cast(35u), - static_cast(10u), - static_cast(1u) + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint16_t) denom[6] = { + static_cast(0u), + static_cast(24u), + static_cast(50u), + static_cast(35u), + static_cast(10u), + static_cast(1u) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[5] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[5] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.044879010930422922760429926121241330235)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -2.751366405578505366591317846728753993668)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 1.02282965224225004296750609604264824677)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -0.09786124911582813985028889636665335893627)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.0009829742267506615183144364420540766510112)), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -161,16 +139,17 @@ struct lanczos6 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[5] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[5] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 5.748142489536043490764289256167080091892)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -7.734074268282457156081021756682138251825)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.875167944990511006997713242805893543947)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -0.2750873773533504542306766137703788781776)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.002763134585812698552178368447708846850353)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -180,7 +159,7 @@ struct lanczos6 : public std::integral_constant return result; } - static double g(){ return 5.581000000000000405009359383257105946541; } + BOOST_MATH_GPU_ENABLED static double g(){ return 5.581000000000000405009359383257105946541; } }; // @@ -188,17 +167,17 @@ struct lanczos6 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 2.16676e-19 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos11 : public std::integral_constant +struct lanczos11 : public boost::math::integral_constant { // // Produces slightly better than double precision when evaluated at // extended-double precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[11] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[11] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 38474670393.31776828316099004518914832218)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 36857665043.51950660081971227404959150474)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 15889202453.72942008945006665994637853242)), @@ -211,27 +190,28 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 261.6140441641668190791708576058805625502)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 2.506628274631000502415573855452633787834)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { - static_cast(0u), - static_cast(362880u), - static_cast(1026576u), - static_cast(1172700u), - static_cast(723680u), - static_cast(269325u), - static_cast(63273u), - static_cast(9450u), - static_cast(870u), - static_cast(45u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[11] = { + static_cast(0u), + static_cast(362880u), + static_cast(1026576u), + static_cast(1172700u), + static_cast(723680u), + static_cast(269325u), + static_cast(63273u), + static_cast(9450u), + static_cast(870u), + static_cast(45u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[11] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[11] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 709811.662581657956893540610814842699825)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 679979.847415722640161734319823103390728)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 293136.785721159725251629480984140341656)), @@ -244,28 +224,29 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.004826466289237661857584712046231435101741)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.4624429436045378766270459638520555557321e-4)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { - static_cast(0u), - static_cast(362880u), - static_cast(1026576u), - static_cast(1172700u), - static_cast(723680u), - static_cast(269325u), - static_cast(63273u), - static_cast(9450u), - static_cast(870u), - static_cast(45u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[11] = { + static_cast(0u), + static_cast(362880u), + static_cast(1026576u), + static_cast(1172700u), + static_cast(723680u), + static_cast(269325u), + static_cast(63273u), + static_cast(9450u), + static_cast(870u), + static_cast(45u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[10] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[10] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 4.005853070677940377969080796551266387954)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -13.17044315127646469834125159673527183164)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 17.19146865350790353683895137079288129318)), @@ -277,6 +258,7 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.17655204574495137651670832229571934738e-4)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -0.1036282091079938047775645941885460820853e-7)), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -286,10 +268,10 @@ struct lanczos11 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[10] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[10] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 19.05889633808148715159575716844556056056)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -62.66183664701721716960978577959655644762)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 81.7929198065004751699057192860287512027)), @@ -301,6 +283,7 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.8399926504443119927673843789048514017761e-4)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -0.493038376656195010308610694048822561263e-7)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -310,7 +293,7 @@ struct lanczos11 : public std::integral_constant return result; } - static double g(){ return 10.90051099999999983936049829935654997826; } + BOOST_MATH_GPU_ENABLED static double g(){ return 10.90051099999999983936049829935654997826; } }; // @@ -318,17 +301,17 @@ struct lanczos11 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 9.2213e-23 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos13 : public std::integral_constant +struct lanczos13 : public boost::math::integral_constant { // // Produces slightly better than extended-double precision when evaluated at // higher precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[13] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[13] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 44012138428004.60895436261759919070125699)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 41590453358593.20051581730723108131357995)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 18013842787117.99677796276038389462742949)), @@ -343,29 +326,30 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 381.8801248632926870394389468349331394196)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 2.506628274631000502415763426076722427007)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[13] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[13] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 86091529.53418537217994842267760536134841)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 81354505.17858011242874285785316135398567)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 35236626.38815461910817650960734605416521)), @@ -380,30 +364,31 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.0007469903808915448316510079585999893674101)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.4903180573459871862552197089738373164184e-5)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[12] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[12] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 4.832115561461656947793029596285626840312)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -19.86441536140337740383120735104359034688)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 33.9927422807443239927197864963170585331)), @@ -417,6 +402,7 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.462590910138598083940803704521211569234e-6)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -0.1735307814426389420248044907765671743012e-9)), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -426,10 +412,10 @@ struct lanczos13 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[12] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[12] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 26.96979819614830698367887026728396466395)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -110.8705424709385114023884328797900204863)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 189.7258846119231466417015694690434770085)), @@ -443,6 +429,7 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.2581888478270733025288922038673392636029e-5)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -0.9685385411006641478305219367315965391289e-9)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -452,7 +439,7 @@ struct lanczos13 : public std::integral_constant return result; } - static double g(){ return 13.1445650000000000545696821063756942749; } + BOOST_MATH_GPU_ENABLED static double g(){ return 13.1445650000000000545696821063756942749; } }; // @@ -460,15 +447,16 @@ struct lanczos13 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 8.111667e-8 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos6m24 : public std::integral_constant +struct lanczos6m24 : public boost::math::integral_constant { // // Use for float precision, when evaluated as a float: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[6] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[6] = { static_cast(58.52061591769095910314047740215847630266L), static_cast(182.5248962595894264831189414768236280862L), static_cast(211.0971093028510041839168287718170827259L), @@ -476,21 +464,23 @@ struct lanczos6m24 : public std::integral_constant static_cast(27.5192015197455403062503721613097825345L), static_cast(2.50662858515256974113978724717473206342L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { - static_cast(0u), - static_cast(24u), - static_cast(50u), - static_cast(35u), - static_cast(10u), - static_cast(1u) + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint16_t) denom[6] = { + static_cast(0u), + static_cast(24u), + static_cast(50u), + static_cast(35u), + static_cast(10u), + static_cast(1u) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[6] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[6] = { static_cast(14.0261432874996476619570577285003839357L), static_cast(43.74732405540314316089531289293124360129L), static_cast(50.59547402616588964511581430025589038612L), @@ -498,28 +488,31 @@ struct lanczos6m24 : public std::integral_constant static_cast(6.595765571169314946316366571954421695196L), static_cast(0.6007854010515290065101128585795542383721L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { - static_cast(0u), - static_cast(24u), - static_cast(50u), - static_cast(35u), - static_cast(10u), - static_cast(1u) + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint16_t) denom[6] = { + static_cast(0u), + static_cast(24u), + static_cast(50u), + static_cast(35u), + static_cast(10u), + static_cast(1u) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[5] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[5] = { static_cast(0.4922488055204602807654354732674868442106L), static_cast(0.004954497451132152436631238060933905650346L), static_cast(-0.003374784572167105840686977985330859371848L), static_cast(0.001924276018962061937026396537786414831385L), static_cast(-0.00056533046336427583708166383712907694434L), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -529,15 +522,17 @@ struct lanczos6m24 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[5] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[5] = { static_cast(0.6534966888520080645505805298901130485464L), static_cast(0.006577461728560758362509168026049182707101L), static_cast(-0.004480276069269967207178373559014835978161L), static_cast(0.00255461870648818292376982818026706528842L), static_cast(-0.000750517993690428370380996157470900204524L), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -547,7 +542,7 @@ struct lanczos6m24 : public std::integral_constant return result; } - static double g(){ return 1.428456135094165802001953125; } + BOOST_MATH_GPU_ENABLED static double g(){ return 1.428456135094165802001953125; } }; // @@ -555,15 +550,16 @@ struct lanczos6m24 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 1.196214e-17 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos13m53 : public std::integral_constant +struct lanczos13m53 : public boost::math::integral_constant { // // Use for double precision, when evaluated as a double: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[13] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[13] = { static_cast(23531376880.41075968857200767445163675473L), static_cast(42919803642.64909876895789904700198885093L), static_cast(35711959237.35566804944018545154716670596L), @@ -578,28 +574,30 @@ struct lanczos13m53 : public std::integral_constant static_cast(210.8242777515793458725097339207133627117L), static_cast(2.506628274631000270164908177133837338626L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[13] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[13] = { static_cast(56906521.91347156388090791033559122686859L), static_cast(103794043.1163445451906271053616070238554L), static_cast(86363131.28813859145546927288977868422342L), @@ -614,29 +612,31 @@ struct lanczos13m53 : public std::integral_constant static_cast(0.5098416655656676188125178644804694509993L), static_cast(0.006061842346248906525783753964555936883222L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint32_t) denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[12] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[12] = { static_cast(2.208709979316623790862569924861841433016L), static_cast(-3.327150580651624233553677113928873034916L), static_cast(1.483082862367253753040442933770164111678L), @@ -650,6 +650,7 @@ struct lanczos13m53 : public std::integral_constant static_cast(-0.2499505151487868335680273909354071938387e-8L), static_cast(0.3394643171893132535170101292240837927725e-9L), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -659,9 +660,10 @@ struct lanczos13m53 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[12] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[12] = { static_cast(6.565936202082889535528455955485877361223L), static_cast(-9.8907772644920670589288081640128194231L), static_cast(4.408830289125943377923077727900630927902L), @@ -675,6 +677,7 @@ struct lanczos13m53 : public std::integral_constant static_cast(-0.7430396708998719707642735577238449585822e-8L), static_cast(0.1009141566987569892221439918230042368112e-8L), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -684,7 +687,7 @@ struct lanczos13m53 : public std::integral_constant return result; } - static double g(){ return 6.024680040776729583740234375; } + BOOST_MATH_GPU_ENABLED static double g(){ return 6.024680040776729583740234375; } }; // @@ -692,16 +695,16 @@ struct lanczos13m53 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 2.7699e-26 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos17m64 : public std::integral_constant +struct lanczos17m64 : public boost::math::integral_constant { // // Use for extended-double precision, when evaluated as an extended-double: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[17] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[17] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 553681095419291969.2230556393350368550504)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 731918863887667017.2511276782146694632234)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 453393234285807339.4627124634539085143364)), @@ -720,7 +723,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 488.0063567520005730476791712814838113252)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2.50662827463100050241576877135758834683)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint64_t) denom[17] = { BOOST_MATH_INT_VALUE_SUFFIX(0, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL), BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL), @@ -739,14 +742,15 @@ struct lanczos17m64 : public std::integral_constant BOOST_MATH_INT_VALUE_SUFFIX(120, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1, uLL) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[17] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[17] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2715894658327.717377557655133124376674911)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 3590179526097.912105038525528721129550434)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2223966599737.814969312127353235818710172)), @@ -765,7 +769,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.002393749522058449186690627996063983095463)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1229541408909435212800785616808830746135e-4)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, boost::math::uint64_t) denom[17] = { BOOST_MATH_INT_VALUE_SUFFIX(0, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL), BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL), @@ -784,15 +788,16 @@ struct lanczos17m64 : public std::integral_constant BOOST_MATH_INT_VALUE_SUFFIX(120, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1, uLL) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[16] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[16] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 4.493645054286536365763334986866616581265)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -16.95716370392468543800733966378143997694)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 26.19196892983737527836811770970479846644)), @@ -810,6 +815,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1472114697343266749193617793755763792681e-15)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.1410901942033374651613542904678399264447e-16)), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -819,10 +825,10 @@ struct lanczos17m64 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[16] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[16] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 23.56409085052261327114594781581930373708)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -88.92116338946308797946237246006238652361)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 137.3472822086847596961177383569603988797)), @@ -840,6 +846,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.7719578215795234036320348283011129450595e-15)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -0.7398586479708476329563577384044188912075e-16)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -849,7 +856,7 @@ struct lanczos17m64 : public std::integral_constant return result; } - static double g(){ return 12.2252227365970611572265625; } + BOOST_MATH_GPU_ENABLED static double g(){ return 12.2252227365970611572265625; } }; // @@ -857,16 +864,16 @@ struct lanczos17m64 : public std::integral_constant // Max experimental error (with arbitrary precision arithmetic) 1.0541e-38 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // -struct lanczos24m113 : public std::integral_constant +struct lanczos24m113 : public boost::math::integral_constant { // // Use for long-double precision, when evaluated as an long-double: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[24] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2029889364934367661624137213253.22102954656825019111612712252027267955023987678816620961507)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2338599599286656537526273232565.2727349714338768161421882478417543004440597874814359063158)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1288527989493833400335117708406.3953711906175960449186720680201425446299360322830739180195)), @@ -892,7 +899,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1151.61895453463992438325318456328526085882924197763140514450975619271382783957699017875304)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2.50662827463100050241576528481104515966515623051532908941425544355490413900497467936202516)) }; - static const T denom[24] = { + BOOST_MATH_STATIC const T denom[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.112400072777760768e22)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.414847677933545472e22)), @@ -918,14 +925,15 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 253.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1.0)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T num[24] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 3035162425359883494754.02878223286972654682199012688209026810841953293372712802258398358538)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 3496756894406430103600.16057175075063458536101374170860226963245118484234495645518505519827)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1926652656689320888654.01954015145958293168365236755537645929361841917596501251362171653478)), @@ -951,7 +959,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.172194142179211139195966608011235161516824700287310869949928393345257114743230967204370963e-5)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.374799931707148855771381263542708435935402853962736029347951399323367765509988401336565436e-8)) }; - static const T denom[24] = { + BOOST_MATH_STATIC const T denom[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.112400072777760768e22)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.414847677933545472e22)), @@ -977,15 +985,16 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 253.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1.0)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[23] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[23] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 7.4734083002469026177867421609938203388868806387315406134072298925733950040583068760685908)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -50.4225805042247530267317342133388132970816607563062253708655085754357843064134941138154171)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 152.288200621747008570784082624444625293884063492396162110698238568311211546361189979357019)), @@ -1010,6 +1019,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -0.615420597971283870342083342286977366161772327800327789325710571275345878439656918541092056e-25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.499641233843540749369110053005439398774706583601830828776209650445427083113181961630763702e-26)), }; + // LCOV_EXCL_STOP T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { @@ -1019,10 +1029,10 @@ struct lanczos24m113 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - lanczos_initializer::force_instantiate(); // Ensure our constants get initialized before main() - static const T d[23] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[23] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 61.4165001061101455341808888883960361969557848005400286332291451422461117307237198559485365)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -414.372973678657049667308134761613915623353625332248315105320470271523320700386200587519147)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1251.50505818554680171298972755376376836161706773644771875668053742215217922228357204561873)), @@ -1047,6 +1057,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -0.505752900177513489906064295001851463338022055787536494321532352380960774349054239257683149e-24)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.410605371184590959139968810080063542546949719163227555918846829816144878123034347778284006e-25)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) @@ -1056,7 +1067,7 @@ struct lanczos24m113 : public std::integral_constant return result; } - static double g(){ return 20.3209821879863739013671875; } + BOOST_MATH_GPU_ENABLED static double g(){ return 20.3209821879863739013671875; } }; // @@ -1065,12 +1076,13 @@ struct lanczos24m113 : public std::integral_constant // Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at May 23 2021 // Type precision was 134 bits or 42 max_digits10 // -struct lanczos27MP : public std::integral_constant +struct lanczos27MP : public boost::math::integral_constant { template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[27] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.532923291341302819860952064783714673718970e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.715272050979243637524956158081893927075092e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.399396313336459710065708403038293278484916e+36)), @@ -1099,7 +1111,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.580741273679785112052701460119954412080073e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.506628274631000502415765284811045253005320e+00)) }; - static const T denom[27] = { + BOOST_MATH_STATIC const T denom[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 0.000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.551121004333098598400000000000000000000000e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.919012881170120359936000000000000000000000e+25)), @@ -1128,13 +1140,15 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 3.250000000000000000000000000000000000000000e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[27] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.630539114451826442425094380936505531231478e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.963898228350662244301785145431331232866294e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.558292778812387748738731408569861630189290e+25)), @@ -1163,7 +1177,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.889816806780013044430000551700375309307825e-08)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.582468135039046226997146555551548992616343e-11)) }; - static const T denom[27] = { + BOOST_MATH_STATIC const T denom[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 0.000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.551121004333098598400000000000000000000000e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.919012881170120359936000000000000000000000e+25)), @@ -1192,14 +1206,16 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 3.250000000000000000000000000000000000000000e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[34] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[34] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 6.264579889722939745225908247624593169040293e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -3.470545597111704235784909052092266897169254e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 8.398164226943527197542310295220360303173237e+01)), @@ -1235,6 +1251,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -2.542428477414786133402832964643707382175743e-24)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.409458057545117569935733339065832415295665e-25)) }; + // LCOV_EXCL_STOP T result = 0; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) { @@ -1244,9 +1261,10 @@ struct lanczos27MP : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[34] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[34] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.391991857844535020743473289228849738381662e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -2.433141291692735004291785549611375831426138e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.887812040849956173864447000497922705559488e+02)), @@ -1282,6 +1300,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -1.782453950387991004107321678322483537333246e-23)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 9.881473972208065873607436095608077625677024e-25)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) @@ -1291,10 +1310,10 @@ struct lanczos27MP : public std::integral_constant return result; } - static double g() { return 2.472513680905104038743047567550092935562134e+01; } + BOOST_MATH_GPU_ENABLED static double g() { return 2.472513680905104038743047567550092935562134e+01; } }; -inline double lanczos_g_near_1_and_2(const lanczos27MP&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const lanczos27MP&) { return 17.03623256087303; } @@ -1305,12 +1324,13 @@ inline double lanczos_g_near_1_and_2(const lanczos27MP&) // Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019 // Type precision was 168 bits or 53 max_digits10 // -struct lanczos35MP : public std::integral_constant +struct lanczos35MP : public boost::math::integral_constant { template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[35] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.17215050716253100021302249837728942659410271586236104e+50)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.51055117651708470336913962553466820524801246971658127e+50)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.40813458996718289733677017073036013655624930344397267e+50)), @@ -1347,7 +1367,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.50897418653428667959996348205296461689142907811767371e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.50662827463100050241576528481104525300698674060984055e+00)) }; - static const T denom[35] = { + BOOST_MATH_STATIC const T denom[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 0.00000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.68331761881188649551819440128000000000000000000000000e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.55043336733310191803732770947072000000000000000000000e+37)), @@ -1384,13 +1404,15 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 5.61000000000000000000000000000000000000000000000000000e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.00000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[35] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.84421398435712762388902267099927585742388886580864424e+37)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28731583799033736725852757551292030085556435695468295e+37)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.84381150359300352571680869181416248982215282642834936e+37)), @@ -1427,7 +1449,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28525092722679899458094768960179796663588010298597603e-10)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28217919006153582429216342066702743329957749672852350e-13)) }; - static const T denom[35] = { + BOOST_MATH_STATIC const T denom[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 0.00000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.68331761881188649551819440128000000000000000000000000e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.55043336733310191803732770947072000000000000000000000e+37)), @@ -1464,14 +1486,16 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 5.61000000000000000000000000000000000000000000000000000e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.00000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[42] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[42] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.2258008829795701933757823508857131818190413131511363e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -6.1680809698202901664719598422224259984110345848176138e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.0937956909159916126016144892534179459545368045658870e+02)), @@ -1515,6 +1539,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 9.4607280988529299025458955706898751267120992042268667e-32)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -4.2702032336418528894772149178970767164510337389404370e-33)) }; + // LCOV_EXCL_STOP T result = 0; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) { @@ -1524,9 +1549,10 @@ struct lanczos35MP : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[42] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[42] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 7.3782193657165970743894979068466124765194827248379940e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -5.5325256602067816772285455933211570612342576586214891e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.8780522570799869937961476290263461833002660531646012e+03)), @@ -1570,6 +1596,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.4859004327675283792859615082199609974336399587796249e-31)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -3.8302040910318742925508017945893539585506545571212821e-32)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) @@ -1579,10 +1606,10 @@ struct lanczos35MP : public std::integral_constant return result; } - static double g() { return 2.96640371531248092651367187500000000000000000000000000e+01; } + BOOST_MATH_GPU_ENABLED static double g() { return 2.96640371531248092651367187500000000000000000000000000e+01; } }; -inline double lanczos_g_near_1_and_2(const lanczos35MP&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const lanczos35MP&) { return 22.36563469469547; } @@ -1592,12 +1619,13 @@ inline double lanczos_g_near_1_and_2(const lanczos35MP&) // Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019 // Type precision was 201 bits or 63 max_digits10 // -struct lanczos48MP : public std::integral_constant +struct lanczos48MP : public boost::math::integral_constant { template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[48] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.761757987425932419978923296640371540367427757167447418730589877e+70)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 8.723233313564421930629677035555276136256253817229396631458438691e+70)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 6.460052620548943146316510839385235752729444155384745952604400014e+70)), @@ -1647,7 +1675,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 3.749690888961891063146468955091435916957208840312184463551812828e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.506628274631000502415765284811045253006986740609938316629929233e+00)) }; - static const T denom[48] = { + BOOST_MATH_STATIC const T denom[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 0.000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.502622159812088949850305428800254892961651752960000000000000000e+57)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.430336111272256671478593169569751383305061494947840000000000000e+58)), @@ -1697,13 +1725,15 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.081000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[48] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.775732062655417998910881298714821053061055705608286949609421120e+58)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.688437299644448784121592662352787426980194425446481703306505899e+58)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.990941408817264621124181941423397180231807676408175000011574647e+58)), @@ -1753,7 +1783,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.155627562127299657410444702080985966726894475302009989071093439e-09)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 7.725246714864934496649491688787278190129598018071339049048385845e-13)) }; - static const T denom[48] = { + BOOST_MATH_STATIC const T denom[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 0.000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.502622159812088949850305428800254892961651752960000000000000000e+57)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.430336111272256671478593169569751383305061494947840000000000000e+58)), @@ -1803,14 +1833,16 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.081000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[47] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[47] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.059629332377126683204423480567078764834299559082175332563440691e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -1.045539783916612448318159279915745234781500064405838259582295756e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 4.784116147862702971548198855631720823614071322755242269800139953e+02)), @@ -1859,6 +1891,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.819104328189909539214493755590516594857915205552841395610714917e-40)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -7.261124772729210946163851510369531392121538686694430629664292782e-42)) }; + // LCOV_EXCL_STOP T result = 0; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) { @@ -1868,9 +1901,10 @@ struct lanczos48MP : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[47] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[47] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.201442621036266842137537764128372139686555918574926377003612763e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -1.185467427150643969519910927764836582205108528009141221591420898e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.424388386017623557963301151646679462091516489317860889362683594e+03)), @@ -1919,6 +1953,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.062560373914843383483799612278119836498689222815662595453851079e-39)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -8.232902310328177520527925464546117674377821202617522000849431630e-41)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) @@ -1928,7 +1963,7 @@ struct lanczos48MP : public std::integral_constant return result; } - static double g() { return 2.880805098265409469604492187500000000000000000000000000000000000e+01; } + BOOST_MATH_GPU_ENABLED static double g() { return 2.880805098265409469604492187500000000000000000000000000000000000e+01; } }; // // Lanczos Coefficients for N=49 G=3.531905273437499914734871708787977695465087890625000000000000000000000000e+01 @@ -1936,12 +1971,13 @@ struct lanczos48MP : public std::integral_constant // Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at May 23 2021 // Type precision was 234 bits or 72 max_digits10 // -struct lanczos49MP : public std::integral_constant +struct lanczos49MP : public boost::math::integral_constant { template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[49] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.019754080776483553135944314398390557182640085494778723336498544843678485e+75)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.676059842235360762770131859925648183945167646928679564649946220888559950e+75)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.735650057396761011129552305882284776566019938011364428733911563803428382e+75)), @@ -1992,7 +2028,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 4.390800780998954208500039666019609185743083611214630479125238184115750385e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.506628274631000502415765284811045253006986740609938316629923576327386304e+00)) }; - static const T denom[49] = { + BOOST_MATH_STATIC const T denom[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 0.000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.586232415111681806429643551536119799691976323891200000000000000000000000e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.147760594457772724544789095126583405046340554378444800000000000000000000e+60)), @@ -2043,13 +2079,15 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.128000000000000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.000000000000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[49] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 9.256115936295239128792053510340342045264892843178101822334871337037830072e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.226382973449509462464247401218271019985727521806127065773488938845990367e+60)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 7.954125855720840120393676022050001333138789037332565663424594891457273557e+59)), @@ -2100,7 +2138,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.012213341659767638341287600182102653785253052492980766472349845276996656e-12)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.148735984247176123115370642724455566337349193609892794757225210307646070e-15)) }; - static const T denom[49] = { + BOOST_MATH_STATIC const T denom[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 0.000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.586232415111681806429643551536119799691976323891200000000000000000000000e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.147760594457772724544789095126583405046340554378444800000000000000000000e+60)), @@ -2151,14 +2189,16 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.128000000000000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.000000000000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[48] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.233965513689195496302526816415068018137532804347903252026160914018410959e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -1.432567696701419045483804034990696504881298696037704685583731202573594084e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 7.800990151010204780591569831451389602736047219596430673280355834870101274e+02)), @@ -2208,6 +2248,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 6.892571860428412953244204670046307154753124542150699703190076405369134986e-46)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -2.750996769906711001487027901108989269217518777400665423098451353536180397e-47)) }; + // LCOV_EXCL_STOP T result = 0; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) { @@ -2217,9 +2258,10 @@ struct lanczos49MP : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[48] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.614127734928823683399031924928203896697519780457812139739363243361356121e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -1.873915620620241270111954934939697069495813017577862172724257417200307532e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.020433263568799913803105156119729477192007677199414299858195073560627451e+04)), @@ -2269,6 +2311,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 9.016047273189589762707582112298788030798897468010511171850691914431226857e-45)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -3.598528593988298984798384438686079221879557020145063999565131046963034260e-46)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) @@ -2278,10 +2321,10 @@ struct lanczos49MP : public std::integral_constant return result; } - static double g() { return 3.531905273437499914734871708787977695465087890625000000000000000000000000e+01; } + BOOST_MATH_GPU_ENABLED static double g() { return 3.531905273437499914734871708787977695465087890625000000000000000000000000e+01; } }; -inline double lanczos_g_near_1_and_2(const lanczos49MP&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const lanczos49MP&) { return 33.54638671875000; } @@ -2292,12 +2335,13 @@ inline double lanczos_g_near_1_and_2(const lanczos49MP&) // Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at May 22 2021 // Type precision was 267 bits or 82 max_digits10 // -struct lanczos52MP : public std::integral_constant +struct lanczos52MP : public boost::math::integral_constant { template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { - static const T num[52] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.2155666558597192337239536765115831322604714024167432764126799013946738944179064162e+86)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.4127424062560995063147129656553600039438028633959646865531341376543275935920940510e+86)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.2432219642804430367752303997394644425738553439619047355470691880100895245432999409e+86)), @@ -2351,7 +2395,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.3192906485096381210566149918556620595525679738152760526187454875638091923687554946e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 2.5066282746310005024157652848110452530069867406099383166299235763422936546004304390e+00)) }; - static const T denom[52] = { + BOOST_MATH_STATIC const T denom[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.0414093201713378043612608166064768844377641568960512000000000000000000000000000000e+64)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3683925049359750564345782687270252191318781054337155072000000000000000000000000000e+65)), @@ -2405,13 +2449,15 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2750000000000000000000000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { - static const T num[52] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T num[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2968364952374867351881152115042817894191583875220489481700563388077315440993668645e+65)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3379758994539627857606593702434364057385206718035611620158459666404856221820703129e+65)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.7667661507089657936560642518188013126674666141084536651063996312630940638352438169e+64)), @@ -2465,7 +2511,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3184778139696006596104645792244972612333458493576785210966728195969324996631733257e-18)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 5.2299125832253333486600023635817464870204660970908989075481425992405717273229096642e-22)) }; - static const T denom[52] = { + BOOST_MATH_STATIC const T denom[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.0414093201713378043612608166064768844377641568960512000000000000000000000000000000e+64)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3683925049359750564345782687270252191318781054337155072000000000000000000000000000e+65)), @@ -2519,14 +2565,16 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2750000000000000000000000000000000000000000000000000000000000000000000000000000000e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)) }; + // LCOV_EXCL_STOP return boost::math::tools::evaluate_rational(num, denom, z); } template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { - static const T d[56] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[56] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.4249481633301349696310814410227012806541100102720500928500445853537331413655453290e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -1.9263209672927829270913652941762375058727326960303110137656951784697992824730035351e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2326134462101140657073655882621393643823409472993225649429843685598155061860815843e+03)), @@ -2584,6 +2632,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -2.4634008445755689570224291035627638546740260971523702032261365019321949141711275488e-53)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 8.2246731300220072906782081133065950352668949898418513030190006777980796985877588993e-55)) }; + // LCOV_EXCL_STOP T result = 0; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) { @@ -2593,9 +2642,10 @@ struct lanczos52MP : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { - static const T d[56] = { + // LCOV_EXCL_START + BOOST_MATH_STATIC const T d[56] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 2.1359871474796665853092357455924330354587340093067807143261699873815704783987359772e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -2.8875414095359657817766255009397774415784763914903057809977502598124862632510767554e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.8476787764422274017528261804071971508619123082396685980448133660376964287516316704e+04)), @@ -2653,6 +2703,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -3.6926203201715401183464726950807528731521709827951454941037337126228208878967951308e-52)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2328726440751392123787631395330686880390176572387043105330275032212649717981066795e-53)), }; + // LCOV_EXCL_STOP T result = 0; T z = dz + 2; for (unsigned k = 1; k <= sizeof(d) / sizeof(d[0]); ++k) @@ -2662,10 +2713,10 @@ struct lanczos52MP : public std::integral_constant return result; } - static double g() { return 4.9921416015624998863131622783839702606201171875000000000000000000000000000000000000e+01; } + BOOST_MATH_GPU_ENABLED static double g() { return 4.9921416015624998863131622783839702606201171875000000000000000000000000000000000000e+01; } }; -inline double lanczos_g_near_1_and_2(const lanczos52MP&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const lanczos52MP&) { return 38.73733398437500; } @@ -2674,24 +2725,24 @@ inline double lanczos_g_near_1_and_2(const lanczos52MP&) // // placeholder for no lanczos info available: // -struct undefined_lanczos : public std::integral_constant::max)() - 1> { }; +struct undefined_lanczos : public boost::math::integral_constant::max)() - 1> { }; template struct lanczos { - static constexpr auto target_precision = policies::precision::type::value <= 0 ? (std::numeric_limits::max)()-2 : + BOOST_MATH_STATIC constexpr auto target_precision = policies::precision::type::value <= 0 ? (boost::math::numeric_limits::max)()-2 : policies::precision::type::value; - using type = typename std::conditional<(target_precision <= lanczos6m24::value), lanczos6m24, - typename std::conditional<(target_precision <= lanczos13m53::value), lanczos13m53, - typename std::conditional<(target_precision <= lanczos11::value), lanczos11, - typename std::conditional<(target_precision <= lanczos17m64::value), lanczos17m64, - typename std::conditional<(target_precision <= lanczos24m113::value), lanczos24m113, - typename std::conditional<(target_precision <= lanczos27MP::value), lanczos27MP, - typename std::conditional<(target_precision <= lanczos35MP::value), lanczos35MP, - typename std::conditional<(target_precision <= lanczos48MP::value), lanczos48MP, - typename std::conditional<(target_precision <= lanczos49MP::value), lanczos49MP, - typename std::conditional<(target_precision <= lanczos52MP::value), lanczos52MP, undefined_lanczos>::type + using type = typename boost::math::conditional<(target_precision <= lanczos6m24::value), lanczos6m24, + typename boost::math::conditional<(target_precision <= lanczos13m53::value), lanczos13m53, + typename boost::math::conditional<(target_precision <= lanczos11::value), lanczos11, + typename boost::math::conditional<(target_precision <= lanczos17m64::value), lanczos17m64, + typename boost::math::conditional<(target_precision <= lanczos24m113::value), lanczos24m113, + typename boost::math::conditional<(target_precision <= lanczos27MP::value), lanczos27MP, + typename boost::math::conditional<(target_precision <= lanczos35MP::value), lanczos35MP, + typename boost::math::conditional<(target_precision <= lanczos48MP::value), lanczos48MP, + typename boost::math::conditional<(target_precision <= lanczos49MP::value), lanczos49MP, + typename boost::math::conditional<(target_precision <= lanczos52MP::value), lanczos52MP, undefined_lanczos>::type >::type>::type>::type>::type>::type>::type>::type>::type >::type; }; @@ -2701,7 +2752,7 @@ struct lanczos } // namespace boost #if !defined(_CRAYC) && !defined(__CUDACC__) && (!defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))) -#if ((defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64)) && !defined(_MANAGED) +#if ((defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64)) && !defined(_MANAGED) && !defined(BOOST_MATH_HAS_GPU_SUPPORT) #include #endif #endif diff --git a/include/boost/math/special_functions/log1p.hpp b/include/boost/math/special_functions/log1p.hpp index 9b8a8e0e..758f6066 100644 --- a/include/boost/math/special_functions/log1p.hpp +++ b/include/boost/math/special_functions/log1p.hpp @@ -12,13 +12,14 @@ #pragma warning(disable:4702) // Unreachable code (release mode only warning) #endif -#include -#include -#include #include #include #include #include +#include +#include +#include +#include #include #include #include @@ -47,16 +48,16 @@ namespace detail { typedef T result_type; - log1p_series(T x) + BOOST_MATH_GPU_ENABLED log1p_series(T x) : k(0), m_mult(-x), m_prod(-1){} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { m_prod *= m_mult; return m_prod / ++k; } - int count()const + BOOST_MATH_GPU_ENABLED int count()const { return k; } @@ -79,12 +80,12 @@ namespace detail // it performs no better than log(1+x): which is to say not very well at all. // template -T log1p_imp(T const & x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const & x, const Policy& pol, const boost::math::integral_constant&) { // The function returns the natural logarithm of 1 + x. typedef typename tools::promote_args::type result_type; BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if((x < -1) || (boost::math::isnan)(x)) return policies::raise_domain_error( @@ -101,7 +102,7 @@ T log1p_imp(T const & x, const Policy& pol, const std::integral_constant if(a < tools::epsilon()) return x; detail::log1p_series s(x); - std::uintmax_t max_iter = policies::get_max_series_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_series_iterations(); result_type result = tools::sum_series(s, policies::get_epsilon(), max_iter); @@ -110,11 +111,11 @@ T log1p_imp(T const & x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const boost::math::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error( @@ -135,7 +136,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Expected Error Term: 1.843e-017 // Maximum Relative Change in Control Points: 8.138e-004 // Max Error found at double precision = 3.250766e-016 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(0.15141069795941984e-16L), static_cast(0.35495104378055055e-15L), static_cast(0.33333333333332835L), @@ -145,7 +146,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant static_cast(0.13703234928513215L), static_cast(0.011294864812099712L) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { static_cast(1L), static_cast(3.7274719063011499L), static_cast(5.5387948649720334L), @@ -163,11 +164,11 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const boost::math::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error( @@ -188,7 +189,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Expected Error Term: 8.088e-20 // Maximum Relative Change in Control Points: 9.648e-05 // Max Error found at long double precision = 2.242324e-19 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.807533446680736736712e-19), BOOST_MATH_BIG_CONSTANT(T, 64, -0.490881544804798926426e-18), BOOST_MATH_BIG_CONSTANT(T, 64, 0.333333333333333373941), @@ -199,7 +200,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant BOOST_MATH_BIG_CONSTANT(T, 64, 0.0706537026422828914622), BOOST_MATH_BIG_CONSTANT(T, 64, 0.00441709903782239229447) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 4.26423872346263928361), BOOST_MATH_BIG_CONSTANT(T, 64, 7.48189472704477708962), @@ -218,11 +219,11 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const boost::math::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error( @@ -244,13 +245,13 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Maximum Relative Change in Control Points: 2.509e-04 // Max Error found at double precision = 6.910422e-08 // Max Error found at float precision = 8.357242e-08 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { -0.671192866803148236519e-7L, 0.119670999140731844725e-6L, 0.333339469182083148598L, 0.237827183019664122066L }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { 1L, 1.46348272586988539733L, 0.497859871350117338894L, @@ -268,22 +269,24 @@ struct log1p_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { do_init(tag()); } template - static void do_init(const std::integral_constant&){} - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&){} + BOOST_MATH_GPU_ENABLED static void do_init(const boost::math::integral_constant&) { boost::math::log1p(static_cast(0.25), Policy()); } - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; - static const init initializer; - static void force_instantiate() + BOOST_MATH_STATIC const init initializer; + BOOST_MATH_GPU_ENABLED static void force_instantiate() { + #ifndef BOOST_MATH_HAS_GPU_SUPPORT initializer.force_instantiate(); + #endif } }; @@ -294,7 +297,7 @@ const typename log1p_initializer::init log1p_initializer -inline typename tools::promote_args::type log1p(T x, const Policy&) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -306,7 +309,7 @@ inline typename tools::promote_args::type log1p(T x, const Policy&) policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - typedef std::integral_constant::type log1p(T x, const Policy&) #if defined(BOOST_HAS_LOG1P) && !(defined(__osf__) && defined(__DECCXX_VER)) # ifdef BOOST_MATH_USE_C99 template -inline float log1p(float x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline float log1p(float x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -340,7 +343,7 @@ inline float log1p(float x, const Policy& pol) } #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS template -inline long double log1p(long double x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline long double log1p(long double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -365,7 +368,7 @@ inline float log1p(float x, const Policy& pol) } #endif template -inline double log1p(double x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline double log1p(double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -425,7 +428,7 @@ inline long double log1p(long double x, const Policy& pol) #endif template -inline typename tools::promote_args::type log1p(T x) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x) { return boost::math::log1p(x, policies::policy<>()); } @@ -433,12 +436,12 @@ inline typename tools::promote_args::type log1p(T x) // Compute log(1+x)-x: // template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1pmx(T x, const Policy& pol) { typedef typename tools::promote_args::type result_type; BOOST_MATH_STD_USING - static const char* function = "boost::math::log1pmx<%1%>(%1%)"; + constexpr auto function = "boost::math::log1pmx<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error( @@ -456,7 +459,7 @@ inline typename tools::promote_args::type return -x * x / 2; boost::math::detail::log1p_series s(x); s(); - std::uintmax_t max_iter = policies::get_max_series_iterations(); + boost::math::uintmax_t max_iter = policies::get_max_series_iterations(); T result = boost::math::tools::sum_series(s, policies::get_epsilon(), max_iter); @@ -465,7 +468,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type log1pmx(T x) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1pmx(T x) { return log1pmx(x, policies::policy<>()); } diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index 7b996514..91dde74c 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -4,6 +4,7 @@ // Copyright Paul A. Bristow 2006. // Copyright John Maddock 2006. +// Copyright Matt Borland 2024 // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. @@ -23,11 +24,91 @@ #pragma once #endif +#include +#include // for argument promotion. +#include +#include +#include + +#ifdef BOOST_MATH_HAS_NVRTC + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type +beta(RT1 a, RT2 b, A arg); + +namespace detail{ + + template + struct ellint_3_result + { + using type = typename boost::math::conditional< + policies::is_policy::value, + tools::promote_args_t, + tools::promote_args_t + >::type; + }; + + template + struct expint_result + { + using type = typename boost::math::conditional< + policies::is_policy::value, + tools::promote_args_t, + typename tools::promote_args::type + >::type; + }; + + typedef boost::math::integral_constant bessel_no_int_tag; // No integer optimisation possible. + typedef boost::math::integral_constant bessel_maybe_int_tag; // Maybe integer optimisation. + typedef boost::math::integral_constant bessel_int_tag; // Definite integer optimisation. + + template + struct bessel_traits + { + using result_type = typename boost::math::conditional< + boost::math::is_integral::value, + typename tools::promote_args::type, + tools::promote_args_t + >::type; + + typedef typename policies::precision::type precision_type; + + using optimisation_tag = typename boost::math::conditional< + (precision_type::value <= 0 || precision_type::value > 64), + bessel_no_int_tag, + typename boost::math::conditional< + boost::math::is_integral::value, + bessel_int_tag, + bessel_maybe_int_tag + >::type + >::type; + + using optimisation_tag128 = typename boost::math::conditional< + (precision_type::value <= 0 || precision_type::value > 113), + bessel_no_int_tag, + typename boost::math::conditional< + boost::math::is_integral::value, + bessel_int_tag, + bessel_maybe_int_tag + >::type + >::type; + }; + +} // namespace detail + +} // namespace math +} // namespace boost + +#else + #include #include #include #include -#include // for argument promotion. +#include #include #define BOOST_NO_MACRO_EXPAND /**/ @@ -39,139 +120,139 @@ namespace boost // Beta functions. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b); // Beta function (2 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta // Binomial: template - T binomial_coefficient(unsigned n, unsigned k, const Policy& pol); + BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol); template - T binomial_coefficient(unsigned n, unsigned k); + BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k); // erf & erfc error functions. template // Error function. - tools::promote_args_t erf(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erf(RT z); template // Error function. - tools::promote_args_t erf(RT z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erf(RT z, const Policy&); template // Error function complement. - tools::promote_args_t erfc(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc(RT z); template // Error function complement. - tools::promote_args_t erfc(RT z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc(RT z, const Policy&); template // Error function inverse. - tools::promote_args_t erf_inv(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erf_inv(RT z); template // Error function inverse. - tools::promote_args_t erf_inv(RT z, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erf_inv(RT z, const Policy& pol); template // Error function complement inverse. - tools::promote_args_t erfc_inv(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc_inv(RT z); template // Error function complement inverse. - tools::promote_args_t erfc_inv(RT z, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc_inv(RT z, const Policy& pol); // Polynomials: template @@ -250,15 +331,15 @@ namespace boost laguerre(unsigned n, T1 m, T2 x); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite(unsigned n, T x); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite(unsigned n, T x, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1); template @@ -311,90 +392,90 @@ namespace boost // Elliptic integrals: template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rf(T1 x, T2 y, T3 z); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rf(T1 x, T2 y, T3 z, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rd(T1 x, T2 y, T3 z); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rd(T1 x, T2 y, T3 z, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rc(T1 x, T2 y); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rc(T1 x, T2 y, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rj(T1 x, T2 y, T3 z, T4 p); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rg(T1 x, T2 y, T3 z); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rg(T1 x, T2 y, T3 z, const Policy& pol); template - tools::promote_args_t ellint_2(T k); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T k); template - tools::promote_args_t ellint_2(T1 k, T2 phi); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T1 k, T2 phi); template - tools::promote_args_t ellint_2(T1 k, T2 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T1 k, T2 phi, const Policy& pol); template - tools::promote_args_t ellint_1(T k); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T k); template - tools::promote_args_t ellint_1(T1 k, T2 phi); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T1 k, T2 phi); template - tools::promote_args_t ellint_1(T1 k, T2 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T1 k, T2 phi, const Policy& pol); template - tools::promote_args_t ellint_d(T k); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T k); template - tools::promote_args_t ellint_d(T1 k, T2 phi); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T1 k, T2 phi); template - tools::promote_args_t ellint_d(T1 k, T2 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T1 k, T2 phi, const Policy& pol); template - tools::promote_args_t jacobi_zeta(T1 k, T2 phi); + BOOST_MATH_GPU_ENABLED tools::promote_args_t jacobi_zeta(T1 k, T2 phi); template - tools::promote_args_t jacobi_zeta(T1 k, T2 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t jacobi_zeta(T1 k, T2 phi, const Policy& pol); template - tools::promote_args_t heuman_lambda(T1 k, T2 phi); + BOOST_MATH_GPU_ENABLED tools::promote_args_t heuman_lambda(T1 k, T2 phi); template - tools::promote_args_t heuman_lambda(T1 k, T2 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t heuman_lambda(T1 k, T2 phi, const Policy& pol); namespace detail{ template struct ellint_3_result { - using type = typename std::conditional< + using type = typename boost::math::conditional< policies::is_policy::value, tools::promote_args_t, tools::promote_args_t @@ -405,28 +486,28 @@ namespace boost template - typename detail::ellint_3_result::type ellint_3(T1 k, T2 v, T3 phi); + BOOST_MATH_GPU_ENABLED typename detail::ellint_3_result::type ellint_3(T1 k, T2 v, T3 phi); template - tools::promote_args_t ellint_3(T1 k, T2 v, T3 phi, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_3(T1 k, T2 v, T3 phi, const Policy& pol); template - tools::promote_args_t ellint_3(T1 k, T2 v); + BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_3(T1 k, T2 v); // Factorial functions. // Note: not for integral types, at present. template struct max_factorial; template - RT factorial(unsigned int); + BOOST_MATH_GPU_ENABLED RT factorial(unsigned int); template - RT factorial(unsigned int, const Policy& pol); + BOOST_MATH_GPU_ENABLED RT factorial(unsigned int, const Policy& pol); template - RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); + BOOST_MATH_GPU_ENABLED RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); template - RT double_factorial(unsigned i); + BOOST_MATH_GPU_ENABLED RT double_factorial(unsigned i); template - RT double_factorial(unsigned i, const Policy& pol); + BOOST_MATH_GPU_ENABLED RT double_factorial(unsigned i, const Policy& pol); template tools::promote_args_t falling_factorial(RT x, unsigned n); @@ -442,106 +523,106 @@ namespace boost // Gamma functions. template - tools::promote_args_t tgamma(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT z); template - tools::promote_args_t tgamma1pm1(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma1pm1(RT z); template - tools::promote_args_t tgamma1pm1(RT z, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma1pm1(RT z, const Policy& pol); template - tools::promote_args_t tgamma(RT1 a, RT2 z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z); template - tools::promote_args_t tgamma(RT1 a, RT2 z, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z, const Policy& pol); template - tools::promote_args_t lgamma(RT z, int* sign); + BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT z, int* sign); template - tools::promote_args_t lgamma(RT z, int* sign, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT z, int* sign, const Policy& pol); template - tools::promote_args_t lgamma(RT x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT x); template - tools::promote_args_t lgamma(RT x, const Policy& pol); + BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT x, const Policy& pol); template - tools::promote_args_t tgamma_lower(RT1 a, RT2 z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_lower(RT1 a, RT2 z); template - tools::promote_args_t tgamma_lower(RT1 a, RT2 z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_lower(RT1 a, RT2 z, const Policy&); template - tools::promote_args_t gamma_q(RT1 a, RT2 z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q(RT1 a, RT2 z); template - tools::promote_args_t gamma_q(RT1 a, RT2 z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q(RT1 a, RT2 z, const Policy&); template - tools::promote_args_t gamma_p(RT1 a, RT2 z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p(RT1 a, RT2 z); template - tools::promote_args_t gamma_p(RT1 a, RT2 z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p(RT1 a, RT2 z, const Policy&); template - tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta); template - tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta, const Policy&); template - tools::promote_args_t tgamma_ratio(T1 a, T2 b); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_ratio(T1 a, T2 b); template - tools::promote_args_t tgamma_ratio(T1 a, T2 b, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_ratio(T1 a, T2 b, const Policy&); template - tools::promote_args_t gamma_p_derivative(T1 a, T2 x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_derivative(T1 a, T2 x); template - tools::promote_args_t gamma_p_derivative(T1 a, T2 x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_derivative(T1 a, T2 x, const Policy&); // gamma inverse. template - tools::promote_args_t gamma_p_inv(T1 a, T2 p); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inv(T1 a, T2 p); template - tools::promote_args_t gamma_p_inva(T1 a, T2 p, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inva(T1 a, T2 p, const Policy&); template - tools::promote_args_t gamma_p_inva(T1 a, T2 p); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inva(T1 a, T2 p); template - tools::promote_args_t gamma_p_inv(T1 a, T2 p, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inv(T1 a, T2 p, const Policy&); template - tools::promote_args_t gamma_q_inv(T1 a, T2 q); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inv(T1 a, T2 q); template - tools::promote_args_t gamma_q_inv(T1 a, T2 q, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inv(T1 a, T2 q, const Policy&); template - tools::promote_args_t gamma_q_inva(T1 a, T2 q); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inva(T1 a, T2 q); template - tools::promote_args_t gamma_q_inva(T1 a, T2 q, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inva(T1 a, T2 q, const Policy&); // digamma: template - tools::promote_args_t digamma(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t digamma(T x); template - tools::promote_args_t digamma(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t digamma(T x, const Policy&); // trigamma: template - tools::promote_args_t trigamma(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t trigamma(T x); template - tools::promote_args_t trigamma(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t trigamma(T x, const Policy&); // polygamma: template @@ -552,63 +633,63 @@ namespace boost // Hypotenuse function sqrt(x ^ 2 + y ^ 2). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y, const Policy&); // cbrt - cube root. template - tools::promote_args_t cbrt(RT z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t cbrt(RT z); template - tools::promote_args_t cbrt(RT z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t cbrt(RT z, const Policy&); // log1p is log(x + 1) template - tools::promote_args_t log1p(T); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T); template - tools::promote_args_t log1p(T, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T, const Policy&); // log1pmx is log(x + 1) - x template - tools::promote_args_t log1pmx(T); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1pmx(T); template - tools::promote_args_t log1pmx(T, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1pmx(T, const Policy&); // Exp (x) minus 1 functions. template - tools::promote_args_t expm1(T); + BOOST_MATH_GPU_ENABLED tools::promote_args_t expm1(T); template - tools::promote_args_t expm1(T, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t expm1(T, const Policy&); // Power - 1 template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t powm1(const T1 a, const T2 z); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t powm1(const T1 a, const T2 z, const Policy&); // sqrt(1+x) - 1 template - tools::promote_args_t sqrt1pm1(const T& val); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sqrt1pm1(const T& val); template - tools::promote_args_t sqrt1pm1(const T& val, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sqrt1pm1(const T& val, const Policy&); // sinus cardinals: template - tools::promote_args_t sinc_pi(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sinc_pi(T x); template - tools::promote_args_t sinc_pi(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sinc_pi(T x, const Policy&); template tools::promote_args_t sinhc_pi(T x); @@ -630,43 +711,43 @@ namespace boost tools::promote_args_t acosh(T x, const Policy&); template - tools::promote_args_t atanh(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t atanh(T x); template - tools::promote_args_t atanh(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t atanh(T x, const Policy&); namespace detail{ - typedef std::integral_constant bessel_no_int_tag; // No integer optimisation possible. - typedef std::integral_constant bessel_maybe_int_tag; // Maybe integer optimisation. - typedef std::integral_constant bessel_int_tag; // Definite integer optimisation. + typedef boost::math::integral_constant bessel_no_int_tag; // No integer optimisation possible. + typedef boost::math::integral_constant bessel_maybe_int_tag; // Maybe integer optimisation. + typedef boost::math::integral_constant bessel_int_tag; // Definite integer optimisation. template struct bessel_traits { - using result_type = typename std::conditional< - std::is_integral::value, + using result_type = typename boost::math::conditional< + boost::math::is_integral::value, typename tools::promote_args::type, tools::promote_args_t >::type; typedef typename policies::precision::type precision_type; - using optimisation_tag = typename std::conditional< + using optimisation_tag = typename boost::math::conditional< (precision_type::value <= 0 || precision_type::value > 64), bessel_no_int_tag, - typename std::conditional< - std::is_integral::value, + typename boost::math::conditional< + boost::math::is_integral::value, bessel_int_tag, bessel_maybe_int_tag >::type >::type; - using optimisation_tag128 = typename std::conditional< + using optimisation_tag128 = typename boost::math::conditional< (precision_type::value <= 0 || precision_type::value > 113), bessel_no_int_tag, - typename std::conditional< - std::is_integral::value, + typename boost::math::conditional< + boost::math::is_integral::value, bessel_int_tag, bessel_maybe_int_tag >::type @@ -676,223 +757,225 @@ namespace boost // Bessel functions: template - typename detail::bessel_traits::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits::result_type cyl_bessel_j_prime(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j_prime(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_bessel_j(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j(T1 v, T2 x); template - typename detail::bessel_traits >::result_type cyl_bessel_j_prime(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j_prime(T1 v, T2 x); template - typename detail::bessel_traits::result_type sph_bessel(unsigned v, T x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_bessel(unsigned v, T x, const Policy& pol); template - typename detail::bessel_traits::result_type sph_bessel_prime(unsigned v, T x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_bessel_prime(unsigned v, T x, const Policy& pol); template - typename detail::bessel_traits >::result_type sph_bessel(unsigned v, T x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_bessel(unsigned v, T x); template - typename detail::bessel_traits >::result_type sph_bessel_prime(unsigned v, T x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_bessel_prime(unsigned v, T x); template - typename detail::bessel_traits::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits::result_type cyl_bessel_i_prime(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_i_prime(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_bessel_i(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_i(T1 v, T2 x); template - typename detail::bessel_traits >::result_type cyl_bessel_i_prime(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_i_prime(T1 v, T2 x); template - typename detail::bessel_traits::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits::result_type cyl_bessel_k_prime(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_k_prime(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_bessel_k(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_k(T1 v, T2 x); template - typename detail::bessel_traits >::result_type cyl_bessel_k_prime(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_k_prime(T1 v, T2 x); template - typename detail::bessel_traits::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits::result_type cyl_neumann_prime(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann_prime(T1 v, T2 x, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_neumann(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann(T1 v, T2 x); template - typename detail::bessel_traits >::result_type cyl_neumann_prime(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann_prime(T1 v, T2 x); template - typename detail::bessel_traits::result_type sph_neumann(unsigned v, T x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_neumann(unsigned v, T x, const Policy& pol); template - typename detail::bessel_traits::result_type sph_neumann_prime(unsigned v, T x, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_neumann_prime(unsigned v, T x, const Policy& pol); template - typename detail::bessel_traits >::result_type sph_neumann(unsigned v, T x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_neumann(unsigned v, T x); template - typename detail::bessel_traits >::result_type sph_neumann_prime(unsigned v, T x); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_neumann_prime(unsigned v, T x); template - typename detail::bessel_traits::result_type cyl_bessel_j_zero(T v, int m, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j_zero(T v, int m, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_bessel_j_zero(T v, int m); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j_zero(T v, int m); template - OutputIterator cyl_bessel_j_zero(T v, + BOOST_MATH_GPU_ENABLED OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it); template - OutputIterator cyl_bessel_j_zero(T v, + BOOST_MATH_GPU_ENABLED OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); template - typename detail::bessel_traits::result_type cyl_neumann_zero(T v, int m, const Policy& pol); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann_zero(T v, int m, const Policy& pol); template - typename detail::bessel_traits >::result_type cyl_neumann_zero(T v, int m); + BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann_zero(T v, int m); template - OutputIterator cyl_neumann_zero(T v, + BOOST_MATH_GPU_ENABLED OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it); template - OutputIterator cyl_neumann_zero(T v, + BOOST_MATH_GPU_ENABLED OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); template - std::complex >::result_type> cyl_hankel_1(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> cyl_hankel_1(T1 v, T2 x); template - std::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); template - std::complex::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol); template - std::complex >::result_type> cyl_hankel_2(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> cyl_hankel_2(T1 v, T2 x); template - std::complex::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol); template - std::complex >::result_type> sph_hankel_1(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> sph_hankel_1(T1 v, T2 x); template - std::complex::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol); + BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol); template - std::complex >::result_type> sph_hankel_2(T1 v, T2 x); + BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> sph_hankel_2(T1 v, T2 x); template - tools::promote_args_t airy_ai(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai(T x, const Policy&); template - tools::promote_args_t airy_ai(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai(T x); template - tools::promote_args_t airy_bi(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi(T x, const Policy&); template - tools::promote_args_t airy_bi(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi(T x); template - tools::promote_args_t airy_ai_prime(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai_prime(T x, const Policy&); template - tools::promote_args_t airy_ai_prime(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai_prime(T x); template - tools::promote_args_t airy_bi_prime(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi_prime(T x, const Policy&); template - tools::promote_args_t airy_bi_prime(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi_prime(T x); template - T airy_ai_zero(int m); + BOOST_MATH_GPU_ENABLED T airy_ai_zero(int m); template - T airy_ai_zero(int m, const Policy&); + BOOST_MATH_GPU_ENABLED T airy_ai_zero(int m, const Policy&); template - OutputIterator airy_ai_zero( + BOOST_MATH_GPU_ENABLED OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it); template - OutputIterator airy_ai_zero( + BOOST_MATH_GPU_ENABLED OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); template - T airy_bi_zero(int m); + BOOST_MATH_GPU_ENABLED T airy_bi_zero(int m); template - T airy_bi_zero(int m, const Policy&); + BOOST_MATH_GPU_ENABLED T airy_bi_zero(int m, const Policy&); template - OutputIterator airy_bi_zero( + BOOST_MATH_GPU_ENABLED OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it); template - OutputIterator airy_bi_zero( + BOOST_MATH_GPU_ENABLED OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); template - tools::promote_args_t sin_pi(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sin_pi(T x, const Policy&); template - tools::promote_args_t sin_pi(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t sin_pi(T x); template - tools::promote_args_t cos_pi(T x, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t cos_pi(T x, const Policy&); template - tools::promote_args_t cos_pi(T x); + BOOST_MATH_GPU_ENABLED tools::promote_args_t cos_pi(T x); template - int fpclassify BOOST_NO_MACRO_EXPAND(T t); + BOOST_MATH_GPU_ENABLED int fpclassify BOOST_NO_MACRO_EXPAND(T t); template - bool isfinite BOOST_NO_MACRO_EXPAND(T z); + BOOST_MATH_GPU_ENABLED bool isfinite BOOST_NO_MACRO_EXPAND(T z); template - bool isinf BOOST_NO_MACRO_EXPAND(T t); + BOOST_MATH_GPU_ENABLED bool isinf BOOST_NO_MACRO_EXPAND(T t); template - bool isnan BOOST_NO_MACRO_EXPAND(T t); + BOOST_MATH_GPU_ENABLED bool isnan BOOST_NO_MACRO_EXPAND(T t); template - bool isnormal BOOST_NO_MACRO_EXPAND(T t); + BOOST_MATH_GPU_ENABLED bool isnormal BOOST_NO_MACRO_EXPAND(T t); template - int signbit BOOST_NO_MACRO_EXPAND(T x); + BOOST_MATH_GPU_ENABLED int signbit BOOST_NO_MACRO_EXPAND(T x); template - int sign BOOST_NO_MACRO_EXPAND(const T& z); + BOOST_MATH_GPU_ENABLED int sign BOOST_NO_MACRO_EXPAND(const T& z); template - typename tools::promote_args_permissive::type copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y); + BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type + copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y); template - typename tools::promote_args_permissive::type changesign BOOST_NO_MACRO_EXPAND(const T& z); + BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type + changesign BOOST_NO_MACRO_EXPAND(const T& z); // Exponential integrals: namespace detail{ @@ -900,7 +983,7 @@ namespace boost template struct expint_result { - typedef typename std::conditional< + typedef typename boost::math::conditional< policies::is_policy::value, tools::promote_args_t, typename tools::promote_args::type @@ -910,13 +993,13 @@ namespace boost } // namespace detail template - tools::promote_args_t expint(unsigned n, T z, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t expint(unsigned n, T z, const Policy&); template - typename detail::expint_result::type expint(T const z, U const u); + BOOST_MATH_GPU_ENABLED typename detail::expint_result::type expint(T const z, U const u); template - tools::promote_args_t expint(T z); + BOOST_MATH_GPU_ENABLED tools::promote_args_t expint(T z); // Zeta: template @@ -1087,10 +1170,10 @@ namespace boost // pow: template - BOOST_CXX14_CONSTEXPR tools::promote_args_t pow(T base, const Policy& policy); + BOOST_MATH_GPU_ENABLED BOOST_MATH_CXX14_CONSTEXPR tools::promote_args_t pow(T base, const Policy& policy); template - BOOST_CXX14_CONSTEXPR tools::promote_args_t pow(T base); + BOOST_MATH_GPU_ENABLED BOOST_MATH_CXX14_CONSTEXPR tools::promote_args_t pow(T base); // next: template @@ -1191,13 +1274,13 @@ namespace boost #define BOOST_MATH_DETAIL_LL_FUNC(Policy)\ \ template \ - inline T modf(const T& v, long long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ \ template \ - inline long long lltrunc(const T& v){ using boost::math::lltrunc; return lltrunc(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v){ using boost::math::lltrunc; return lltrunc(v, Policy()); }\ \ template \ - inline long long llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline long long llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\ # define BOOST_MATH_DETAIL_11_FUNC(Policy)\ template \ @@ -1210,74 +1293,74 @@ namespace boost BOOST_MATH_DETAIL_11_FUNC(Policy)\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ beta(RT1 a, RT2 b) { return ::boost::math::beta(a, b, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ beta(RT1 a, RT2 b, A x){ return ::boost::math::beta(a, b, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ betac(RT1 a, RT2 b, RT3 x) { return ::boost::math::betac(a, b, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta(a, b, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibetac(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibetac(a, b, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta_inv(T1 a, T2 b, T3 p, T4* py){ return ::boost::math::ibeta_inv(a, b, p, py, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta_inv(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inv(a, b, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibetac_inv(a, b, q, py, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta_inva(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inva(a, b, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibetac_inva(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_inva(a, b, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta_invb(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_invb(a, b, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_invb(a, b, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibetac_inv(a, b, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ibeta_derivative(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta_derivative(a, b, x, Policy()); }\ \ - template T binomial_coefficient(unsigned n, unsigned k){ return ::boost::math::binomial_coefficient(n, k, Policy()); }\ + template BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k){ return ::boost::math::binomial_coefficient(n, k, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t erf(RT z) { return ::boost::math::erf(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t erf(RT z) { return ::boost::math::erf(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t erfc(RT z){ return ::boost::math::erfc(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t erfc(RT z){ return ::boost::math::erfc(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t erf_inv(RT z) { return ::boost::math::erf_inv(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t erf_inv(RT z) { return ::boost::math::erf_inv(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t erfc_inv(RT z){ return ::boost::math::erfc_inv(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t erfc_inv(RT z){ return ::boost::math::erfc_inv(z, Policy()); }\ \ using boost::math::legendre_next;\ \ @@ -1310,7 +1393,7 @@ namespace boost laguerre(unsigned n, T1 m, T2 x) { return ::boost::math::laguerre(n, m, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ hermite(unsigned n, T x){ return ::boost::math::hermite(n, x, Policy()); }\ \ using boost::math::hermite_next;\ @@ -1345,145 +1428,145 @@ namespace boost spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ellint_rf(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rf(x, y, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ellint_rd(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rd(x, y, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ellint_rc(T1 x, T2 y){ return ::boost::math::ellint_rc(x, y, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ellint_rj(T1 x, T2 y, T3 z, T4 p){ return boost::math::ellint_rj(x, y, z, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t \ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t \ ellint_rg(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rg(x, y, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_2(T k){ return boost::math::ellint_2(k, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_2(T k){ return boost::math::ellint_2(k, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_d(T k){ return boost::math::ellint_d(k, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_d(T k){ return boost::math::ellint_d(k, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_d(T1 k, T2 phi){ return boost::math::ellint_d(k, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_d(T1 k, T2 phi){ return boost::math::ellint_d(k, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t jacobi_zeta(T1 k, T2 phi){ return boost::math::jacobi_zeta(k, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t jacobi_zeta(T1 k, T2 phi){ return boost::math::jacobi_zeta(k, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t heuman_lambda(T1 k, T2 phi){ return boost::math::heuman_lambda(k, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t heuman_lambda(T1 k, T2 phi){ return boost::math::heuman_lambda(k, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_1(T1 k, T2 phi){ return boost::math::ellint_1(k, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_1(T1 k, T2 phi){ return boost::math::ellint_1(k, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_3(T1 k, T2 v, T3 phi){ return boost::math::ellint_3(k, v, phi, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_3(T1 k, T2 v, T3 phi){ return boost::math::ellint_3(k, v, phi, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t ellint_3(T1 k, T2 v){ return boost::math::ellint_3(k, v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t ellint_3(T1 k, T2 v){ return boost::math::ellint_3(k, v, Policy()); }\ \ using boost::math::max_factorial;\ template \ - inline RT factorial(unsigned int i) { return boost::math::factorial(i, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline RT factorial(unsigned int i) { return boost::math::factorial(i, Policy()); }\ using boost::math::unchecked_factorial;\ template \ - inline RT double_factorial(unsigned i){ return boost::math::double_factorial(i, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline RT double_factorial(unsigned i){ return boost::math::double_factorial(i, Policy()); }\ template \ inline boost::math::tools::promote_args_t falling_factorial(RT x, unsigned n){ return boost::math::falling_factorial(x, n, Policy()); }\ template \ inline boost::math::tools::promote_args_t rising_factorial(RT x, unsigned n){ return boost::math::rising_factorial(x, n, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma(RT z){ return boost::math::tgamma(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma(RT z){ return boost::math::tgamma(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma1pm1(RT z){ return boost::math::tgamma1pm1(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma1pm1(RT z){ return boost::math::tgamma1pm1(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma(RT1 a, RT2 z){ return boost::math::tgamma(a, z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma(RT1 a, RT2 z){ return boost::math::tgamma(a, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t lgamma(RT z, int* sign){ return boost::math::lgamma(z, sign, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t lgamma(RT z, int* sign){ return boost::math::lgamma(z, sign, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t lgamma(RT x){ return boost::math::lgamma(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t lgamma(RT x){ return boost::math::lgamma(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma_lower(RT1 a, RT2 z){ return boost::math::tgamma_lower(a, z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma_lower(RT1 a, RT2 z){ return boost::math::tgamma_lower(a, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta){ return boost::math::tgamma_delta_ratio(z, delta, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta){ return boost::math::tgamma_delta_ratio(z, delta, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t tgamma_ratio(T1 a, T2 b) { return boost::math::tgamma_ratio(a, b, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t tgamma_ratio(T1 a, T2 b) { return boost::math::tgamma_ratio(a, b, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_p_derivative(T1 a, T2 x){ return boost::math::gamma_p_derivative(a, x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_p_derivative(T1 a, T2 x){ return boost::math::gamma_p_derivative(a, x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_p_inv(T1 a, T2 p){ return boost::math::gamma_p_inv(a, p, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_p_inv(T1 a, T2 p){ return boost::math::gamma_p_inv(a, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_p_inva(T1 a, T2 p){ return boost::math::gamma_p_inva(a, p, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_p_inva(T1 a, T2 p){ return boost::math::gamma_p_inva(a, p, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_q_inv(T1 a, T2 q){ return boost::math::gamma_q_inv(a, q, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_q_inv(T1 a, T2 q){ return boost::math::gamma_q_inv(a, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t gamma_q_inva(T1 a, T2 q){ return boost::math::gamma_q_inva(a, q, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t gamma_q_inva(T1 a, T2 q){ return boost::math::gamma_q_inva(a, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t digamma(T x){ return boost::math::digamma(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t digamma(T x){ return boost::math::digamma(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t trigamma(T x){ return boost::math::trigamma(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t trigamma(T x){ return boost::math::trigamma(x, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t polygamma(int n, T x){ return boost::math::polygamma(n, x, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t \ - hypot(T1 x, T2 y){ return boost::math::hypot(x, y, Policy()); }\ + BOOST_MATH_GPU_ENABLED hypot(T1 x, T2 y){ return boost::math::hypot(x, y, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t cbrt(RT z){ return boost::math::cbrt(z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t log1p(T x){ return boost::math::log1p(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t log1p(T x){ return boost::math::log1p(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t log1pmx(T x){ return boost::math::log1pmx(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t log1pmx(T x){ return boost::math::log1pmx(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t expm1(T x){ return boost::math::expm1(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t expm1(T x){ return boost::math::expm1(x, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t \ - powm1(const T1 a, const T2 z){ return boost::math::powm1(a, z, Policy()); }\ + BOOST_MATH_GPU_ENABLED powm1(const T1 a, const T2 z){ return boost::math::powm1(a, z, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t sqrt1pm1(const T& val){ return boost::math::sqrt1pm1(val, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t sqrt1pm1(const T& val){ return boost::math::sqrt1pm1(val, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t sinc_pi(T x){ return boost::math::sinc_pi(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t sinc_pi(T x){ return boost::math::sinc_pi(x, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t sinhc_pi(T x){ return boost::math::sinhc_pi(x, Policy()); }\ @@ -1495,7 +1578,7 @@ namespace boost inline boost::math::tools::promote_args_t acosh(const T x){ return boost::math::acosh(x, Policy()); }\ \ template\ - inline boost::math::tools::promote_args_t atanh(const T x){ return boost::math::atanh(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t atanh(const T x){ return boost::math::atanh(x, Policy()); }\ \ template \ inline typename boost::math::detail::bessel_traits::result_type cyl_bessel_j(T1 v, T2 x)\ @@ -1568,10 +1651,10 @@ template \ { boost::math::cyl_neumann_zero(v, start_index, number_of_zeros, out_it, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t sin_pi(T x){ return boost::math::sin_pi(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t sin_pi(T x){ return boost::math::sin_pi(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t cos_pi(T x){ return boost::math::cos_pi(x, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t cos_pi(T x){ return boost::math::cos_pi(x, Policy()); }\ \ using boost::math::fpclassify;\ using boost::math::isfinite;\ @@ -1584,44 +1667,44 @@ template \ using boost::math::changesign;\ \ template \ - inline typename boost::math::tools::promote_args_t expint(T const& z, U const& u)\ + BOOST_MATH_GPU_ENABLED inline typename boost::math::tools::promote_args_t expint(T const& z, U const& u)\ { return boost::math::expint(z, u, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t expint(T z){ return boost::math::expint(z, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t expint(T z){ return boost::math::expint(z, Policy()); }\ \ template \ inline boost::math::tools::promote_args_t zeta(T s){ return boost::math::zeta(s, Policy()); }\ \ template \ - inline T round(const T& v){ using boost::math::round; return round(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T round(const T& v){ using boost::math::round; return round(v, Policy()); }\ \ template \ - inline int iround(const T& v){ using boost::math::iround; return iround(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline int iround(const T& v){ using boost::math::iround; return iround(v, Policy()); }\ \ template \ - inline long lround(const T& v){ using boost::math::lround; return lround(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline long lround(const T& v){ using boost::math::lround; return lround(v, Policy()); }\ \ template \ - inline T trunc(const T& v){ using boost::math::trunc; return trunc(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T trunc(const T& v){ using boost::math::trunc; return trunc(v, Policy()); }\ \ template \ - inline int itrunc(const T& v){ using boost::math::itrunc; return itrunc(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v){ using boost::math::itrunc; return itrunc(v, Policy()); }\ \ template \ - inline long ltrunc(const T& v){ using boost::math::ltrunc; return ltrunc(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v){ using boost::math::ltrunc; return ltrunc(v, Policy()); }\ \ template \ - inline T modf(const T& v, T* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T modf(const T& v, T* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ \ template \ - inline T modf(const T& v, int* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T modf(const T& v, int* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ \ template \ - inline T modf(const T& v, long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t pow(T v){ return boost::math::pow(v, Policy()); }\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t pow(T v){ return boost::math::pow(v, Policy()); }\ \ template T nextafter(const T& a, const T& b){ return static_cast(boost::math::nextafter(a, b, Policy())); }\ template T float_next(const T& a){ return static_cast(boost::math::float_next(a, Policy())); }\ @@ -1633,19 +1716,19 @@ template \ inline boost::math::tools::promote_args_t owens_t(RT1 a, RT2 z){ return boost::math::owens_t(a, z, Policy()); }\ \ template \ - inline std::complex::result_type> cyl_hankel_1(T1 v, T2 x)\ + inline BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_1(T1 v, T2 x)\ { return boost::math::cyl_hankel_1(v, x, Policy()); }\ \ template \ - inline std::complex::result_type> cyl_hankel_2(T1 v, T2 x)\ + inline BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_2(T1 v, T2 x)\ { return boost::math::cyl_hankel_2(v, x, Policy()); }\ \ template \ - inline std::complex::result_type> sph_hankel_1(T1 v, T2 x)\ + inline BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_1(T1 v, T2 x)\ { return boost::math::sph_hankel_1(v, x, Policy()); }\ \ template \ - inline std::complex::result_type> sph_hankel_2(T1 v, T2 x)\ + inline BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_2(T1 v, T2 x)\ { return boost::math::sph_hankel_2(v, x, Policy()); }\ \ template \ @@ -1749,33 +1832,33 @@ template \ { return boost::math::jacobi_theta4m1tau(z, q, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t airy_ai(T x)\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t airy_ai(T x)\ { return boost::math::airy_ai(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t airy_bi(T x)\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t airy_bi(T x)\ { return boost::math::airy_bi(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t airy_ai_prime(T x)\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t airy_ai_prime(T x)\ { return boost::math::airy_ai_prime(x, Policy()); }\ \ template \ - inline boost::math::tools::promote_args_t airy_bi_prime(T x)\ + BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t airy_bi_prime(T x)\ { return boost::math::airy_bi_prime(x, Policy()); }\ \ template \ - inline T airy_ai_zero(int m)\ + BOOST_MATH_GPU_ENABLED inline T airy_ai_zero(int m)\ { return boost::math::airy_ai_zero(m, Policy()); }\ template \ - OutputIterator airy_ai_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ + BOOST_MATH_GPU_ENABLED OutputIterator airy_ai_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ { return boost::math::airy_ai_zero(start_index, number_of_zeros, out_it, Policy()); }\ \ template \ - inline T airy_bi_zero(int m)\ + BOOST_MATH_GPU_ENABLED inline T airy_bi_zero(int m)\ { return boost::math::airy_bi_zero(m, Policy()); }\ template \ - OutputIterator airy_bi_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ + BOOST_MATH_GPU_ENABLED OutputIterator airy_bi_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ { return boost::math::airy_bi_zero(start_index, number_of_zeros, out_it, Policy()); }\ \ template \ @@ -1813,6 +1896,6 @@ template \ - +#endif // BOOST_MATH_HAS_NVRTC #endif // BOOST_MATH_SPECIAL_MATH_FWD_HPP diff --git a/include/boost/math/special_functions/next.hpp b/include/boost/math/special_functions/next.hpp index 07c55e8d..fd08162f 100644 --- a/include/boost/math/special_functions/next.hpp +++ b/include/boost/math/special_functions/next.hpp @@ -10,6 +10,11 @@ #pragma once #endif +#include + +// TODO(mborland): Need to remove recurrsion from these algos +#ifndef BOOST_MATH_HAS_NVRTC + #include #include #include @@ -82,8 +87,8 @@ inline T normalize_value(const T& val, const std::true_type&) } template -inline T get_smallest_value(std::true_type const&) -{ +inline T get_smallest_value(std::true_type const&) { + static_assert(std::numeric_limits::is_specialized, "Type T must be specialized."); // // numeric_limits lies about denorms being present - particularly // when this can be turned on or off at runtime, as is the case @@ -106,11 +111,12 @@ inline T get_smallest_value(std::false_type const&) template inline T get_smallest_value() { -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1310) - return get_smallest_value(std::integral_constant::is_specialized && (std::numeric_limits::has_denorm == 1)>()); -#else - return get_smallest_value(std::integral_constant::is_specialized && (std::numeric_limits::has_denorm == std::denorm_present)>()); -#endif + return get_smallest_value(std::integral_constant::is_specialized>()); +} + +template +inline bool has_denorm_now() { + return get_smallest_value() < tools::min_value(); } // @@ -193,10 +199,14 @@ T float_next_imp(const T& val, const std::true_type&, const Policy& pol) int fpclass = (boost::math::fpclassify)(val); - if((fpclass == (int)FP_NAN) || (fpclass == (int)FP_INFINITE)) + if (fpclass == (int)FP_INFINITE) { - if(val < 0) + if (val < 0) return -tools::max_value(); + return val; // +INF + } + else if (fpclass == (int)FP_NAN) + { return policies::raise_domain_error( function, "Argument must be finite, but got %1%", val, pol); @@ -242,10 +252,14 @@ T float_next_imp(const T& val, const std::false_type&, const Policy& pol) int fpclass = (boost::math::fpclassify)(val); - if((fpclass == (int)FP_NAN) || (fpclass == (int)FP_INFINITE)) + if (fpclass == (int)FP_INFINITE) { - if(val < 0) + if (val < 0) return -tools::max_value(); + return val; // +INF + } + else if (fpclass == (int)FP_NAN) + { return policies::raise_domain_error( function, "Argument must be finite, but got %1%", val, pol); @@ -327,10 +341,14 @@ T float_prior_imp(const T& val, const std::true_type&, const Policy& pol) int fpclass = (boost::math::fpclassify)(val); - if((fpclass == (int)FP_NAN) || (fpclass == (int)FP_INFINITE)) + if (fpclass == (int)FP_INFINITE) { - if(val > 0) + if (val > 0) return tools::max_value(); + return val; // -INF + } + else if (fpclass == (int)FP_NAN) + { return policies::raise_domain_error( function, "Argument must be finite, but got %1%", val, pol); @@ -377,10 +395,14 @@ T float_prior_imp(const T& val, const std::false_type&, const Policy& pol) int fpclass = (boost::math::fpclassify)(val); - if((fpclass == (int)FP_NAN) || (fpclass == (int)FP_INFINITE)) + if (fpclass == (int)FP_INFINITE) { - if(val > 0) + if (val > 0) return tools::max_value(); + return val; // -INF + } + else if (fpclass == (int)FP_NAN) + { return policies::raise_domain_error( function, "Argument must be finite, but got %1%", val, pol); @@ -693,9 +715,9 @@ inline typename tools::promote_args::type float_distance(const T& a, const && !std::numeric_limits::is_integer && !std::numeric_limits::is_integer)), "Float distance between two different floating point types is undefined."); - BOOST_IF_CONSTEXPR (!std::is_same::value) + BOOST_MATH_IF_CONSTEXPR (!std::is_same::value) { - BOOST_IF_CONSTEXPR(std::is_integral::value) + BOOST_MATH_IF_CONSTEXPR(std::is_integral::value) { return float_distance(static_cast(a), b, pol); } @@ -903,4 +925,6 @@ inline typename tools::promote_args::type float_advance(const T& val, int dis }} // boost math namespaces +#endif + #endif // BOOST_MATH_SPECIAL_NEXT_HPP diff --git a/include/boost/math/special_functions/pow.hpp b/include/boost/math/special_functions/pow.hpp index 753ac208..7a1bb14e 100644 --- a/include/boost/math/special_functions/pow.hpp +++ b/include/boost/math/special_functions/pow.hpp @@ -2,6 +2,7 @@ // Computes a power with exponent known at compile-time // (C) Copyright Bruno Lalande 2008. +// (C) Copyright Matt Borland 2024. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -12,12 +13,14 @@ #ifndef BOOST_MATH_POW_HPP #define BOOST_MATH_POW_HPP - -#include +#include #include #include #include +#ifndef BOOST_MATH_HAS_NVRTC +#include +#endif namespace boost { namespace math { @@ -34,7 +37,7 @@ template struct positive_power { template - static BOOST_CXX14_CONSTEXPR T result(T base) + BOOST_MATH_GPU_ENABLED static constexpr T result(T base) { T power = positive_power::result(base); return power * power; @@ -45,7 +48,7 @@ template struct positive_power { template - static BOOST_CXX14_CONSTEXPR T result(T base) + BOOST_MATH_GPU_ENABLED static constexpr T result(T base) { T power = positive_power::result(base); return base * power * power; @@ -56,7 +59,7 @@ template <> struct positive_power<1, 1> { template - static BOOST_CXX14_CONSTEXPR T result(T base){ return base; } + BOOST_MATH_GPU_ENABLED static constexpr T result(T base){ return base; } }; @@ -64,7 +67,7 @@ template struct power_if_positive { template - static BOOST_CXX14_CONSTEXPR T result(T base, const Policy&) + BOOST_MATH_GPU_ENABLED static constexpr T result(T base, const Policy&) { return positive_power::result(base); } }; @@ -72,7 +75,7 @@ template struct power_if_positive { template - static BOOST_CXX14_CONSTEXPR T result(T base, const Policy& policy) + BOOST_MATH_GPU_ENABLED static constexpr T result(T base, const Policy& policy) { if (base == 0) { @@ -91,7 +94,7 @@ template <> struct power_if_positive<0, true> { template - static BOOST_CXX14_CONSTEXPR T result(T base, const Policy& policy) + BOOST_MATH_GPU_ENABLED static constexpr T result(T base, const Policy& policy) { if (base == 0) { @@ -120,14 +123,14 @@ struct select_power_if_positive template -BOOST_CXX14_CONSTEXPR inline typename tools::promote_args::type pow(T base, const Policy& policy) +BOOST_MATH_GPU_ENABLED constexpr inline typename tools::promote_args::type pow(T base, const Policy& policy) { using result_type = typename tools::promote_args::type; return detail::select_power_if_positive::type::result(static_cast(base), policy); } template -BOOST_CXX14_CONSTEXPR inline typename tools::promote_args::type pow(T base) +BOOST_MATH_GPU_ENABLED constexpr inline typename tools::promote_args::type pow(T base) { return pow(base, policies::policy<>()); } #ifdef _MSC_VER diff --git a/include/boost/math/special_functions/powm1.hpp b/include/boost/math/special_functions/powm1.hpp index e52277b1..80d02dc2 100644 --- a/include/boost/math/special_functions/powm1.hpp +++ b/include/boost/math/special_functions/powm1.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,6 +13,7 @@ #pragma warning(disable:4702) // Unreachable code (release mode only warning) #endif +#include #include #include #include @@ -22,32 +24,23 @@ namespace boost{ namespace math{ namespace detail{ template -inline T powm1_imp(const T x, const T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline T powm1_imp(const T x, const T y, const Policy& pol) { BOOST_MATH_STD_USING - static const char* function = "boost::math::powm1<%1%>(%1%, %1%)"; - if (x > 0) + constexpr auto function = "boost::math::powm1<%1%>(%1%, %1%)"; + + if ((fabs(y * (x - 1)) < T(0.5)) || (fabs(y) < T(0.2))) { - if ((fabs(y * (x - 1)) < T(0.5)) || (fabs(y) < T(0.2))) - { - // We don't have any good/quick approximation for log(x) * y - // so just try it and see: - T l = y * log(x); - if (l < T(0.5)) - return boost::math::expm1(l, pol); - if (l > boost::math::tools::log_max_value()) - return boost::math::policies::raise_overflow_error(function, nullptr, pol); - // fall through.... - } - } - else if ((boost::math::signbit)(x)) // Need to error check -0 here as well - { - // y had better be an integer: - if (boost::math::trunc(y) != y) - return boost::math::policies::raise_domain_error(function, "For non-integral exponent, expected base > 0 but got %1%", x, pol); - if (boost::math::trunc(y / 2) == y / 2) - return powm1_imp(T(-x), y, pol); + // We don't have any good/quick approximation for log(x) * y + // so just try it and see: + T l = y * log(x); + if (l < T(0.5)) + return boost::math::expm1(l, pol); + if (l > boost::math::tools::log_max_value()) + return boost::math::policies::raise_overflow_error(function, nullptr, pol); + // fall through.... } + T result = pow(x, y) - 1; if((boost::math::isinf)(result)) return result < 0 ? -boost::math::policies::raise_overflow_error(function, nullptr, pol) : boost::math::policies::raise_overflow_error(function, nullptr, pol); @@ -56,22 +49,41 @@ inline T powm1_imp(const T x, const T y, const Policy& pol) return result; } +template +BOOST_MATH_GPU_ENABLED inline T powm1_imp_dispatch(const T x, const T y, const Policy& pol) +{ + BOOST_MATH_STD_USING + + if ((boost::math::signbit)(x)) // Need to error check -0 here as well + { + constexpr auto function = "boost::math::powm1<%1%>(%1%, %1%)"; + + // y had better be an integer: + if (boost::math::trunc(y) != y) + return boost::math::policies::raise_domain_error(function, "For non-integral exponent, expected base > 0 but got %1%", x, pol); + if (boost::math::trunc(y / 2) == y / 2) + return powm1_imp(T(-x), T(y), pol); + } + + return powm1_imp(T(x), T(y), pol); +} + } // detail template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type powm1(const T1 a, const T2 z) { typedef typename tools::promote_args::type result_type; - return detail::powm1_imp(static_cast(a), static_cast(z), policies::policy<>()); + return detail::powm1_imp_dispatch(static_cast(a), static_cast(z), policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type powm1(const T1 a, const T2 z, const Policy& pol) { typedef typename tools::promote_args::type result_type; - return detail::powm1_imp(static_cast(a), static_cast(z), pol); + return detail::powm1_imp_dispatch(static_cast(a), static_cast(z), pol); } } // namespace math diff --git a/include/boost/math/special_functions/sign.hpp b/include/boost/math/special_functions/sign.hpp index 8f9fc479..4f765226 100644 --- a/include/boost/math/special_functions/sign.hpp +++ b/include/boost/math/special_functions/sign.hpp @@ -1,6 +1,7 @@ // (C) Copyright John Maddock 2006. // (C) Copyright Johan Rade 2006. // (C) Copyright Paul A. Bristow 2011 (added changesign). +// (C) Copyright Matt Borland 2024 // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file @@ -13,6 +14,8 @@ #pragma once #endif +#ifndef __CUDACC_RTC__ + #include #include #include @@ -25,9 +28,10 @@ namespace detail { #ifdef BOOST_MATH_USE_STD_FPCLASSIFY template - inline int signbit_impl(T x, native_tag const&) + BOOST_MATH_GPU_ENABLED inline int signbit_impl(T x, native_tag const&) { - return (std::signbit)(x) ? 1 : 0; + using std::signbit; + return (signbit)(x) ? 1 : 0; } #endif @@ -35,13 +39,13 @@ namespace detail { // signed zero or NaN. template - inline int signbit_impl(T x, generic_tag const&) + BOOST_MATH_GPU_ENABLED inline int signbit_impl(T x, generic_tag const&) { return x < 0; } template - inline int signbit_impl(T x, generic_tag const&) + BOOST_MATH_GPU_ENABLED inline int signbit_impl(T x, generic_tag const&) { return x < 0; } @@ -65,7 +69,7 @@ namespace detail { #endif template - inline int signbit_impl(T x, ieee_copy_all_bits_tag const&) + BOOST_MATH_GPU_ENABLED inline int signbit_impl(T x, ieee_copy_all_bits_tag const&) { typedef typename fp_traits::type traits; @@ -75,7 +79,7 @@ namespace detail { } template - inline int signbit_impl(T x, ieee_copy_leading_bits_tag const&) + BOOST_MATH_GPU_ENABLED inline int signbit_impl(T x, ieee_copy_leading_bits_tag const&) { typedef typename fp_traits::type traits; @@ -91,13 +95,13 @@ namespace detail { // signed zero or NaN. template - inline T (changesign_impl)(T x, generic_tag const&) + BOOST_MATH_GPU_ENABLED inline T (changesign_impl)(T x, generic_tag const&) { return -x; } template - inline T (changesign_impl)(T x, generic_tag const&) + BOOST_MATH_GPU_ENABLED inline T (changesign_impl)(T x, generic_tag const&) { return -x; } @@ -124,7 +128,7 @@ namespace detail { #endif template - inline T changesign_impl(T x, ieee_copy_all_bits_tag const&) + BOOST_MATH_GPU_ENABLED inline T changesign_impl(T x, ieee_copy_all_bits_tag const&) { typedef typename fp_traits::sign_change_type traits; @@ -136,7 +140,7 @@ namespace detail { } template - inline T (changesign_impl)(T x, ieee_copy_leading_bits_tag const&) + BOOST_MATH_GPU_ENABLED inline T (changesign_impl)(T x, ieee_copy_leading_bits_tag const&) { typedef typename fp_traits::sign_change_type traits; @@ -150,7 +154,8 @@ namespace detail { } // namespace detail -template int (signbit)(T x) +template +BOOST_MATH_GPU_ENABLED int (signbit)(T x) { typedef typename detail::fp_traits::type traits; typedef typename traits::method method; @@ -160,12 +165,13 @@ template int (signbit)(T x) } template -inline int sign BOOST_NO_MACRO_EXPAND(const T& z) +BOOST_MATH_GPU_ENABLED inline int sign BOOST_NO_MACRO_EXPAND(const T& z) { return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1; } -template typename tools::promote_args_permissive::type (changesign)(const T& x) +template +BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type (changesign)(const T& x) { //!< \brief return unchanged binary pattern of x, except for change of sign bit. typedef typename detail::fp_traits::sign_change_type traits; typedef typename traits::method method; @@ -176,7 +182,7 @@ template typename tools::promote_args_permissive::type (changesign) } template -inline typename tools::promote_args_permissive::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args_permissive::type copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y) { BOOST_MATH_STD_USING @@ -188,6 +194,47 @@ inline typename tools::promote_args_permissive::type } // namespace math } // namespace boost +#else // NVRTC alias versions + +#include + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED int signbit(T x) +{ + return ::signbit(x); +} + +template +BOOST_MATH_GPU_ENABLED T changesign(T x) +{ + return -x; +} + +template +BOOST_MATH_GPU_ENABLED T copysign(T x, T y) +{ + return ::copysign(x, y); +} + +template <> +BOOST_MATH_GPU_ENABLED float copysign(float x, float y) +{ + return ::copysignf(x, y); +} + +template +BOOST_MATH_GPU_ENABLED T sign(T z) +{ + return (z == 0) ? 0 : ::signbit(z) ? -1 : 1; +} + +} // namespace math +} // namespace boost + +#endif // __CUDACC_RTC__ #endif // BOOST_MATH_TOOLS_SIGN_HPP diff --git a/include/boost/math/special_functions/sin_pi.hpp b/include/boost/math/special_functions/sin_pi.hpp index 5b8eb6fc..e59e232e 100644 --- a/include/boost/math/special_functions/sin_pi.hpp +++ b/include/boost/math/special_functions/sin_pi.hpp @@ -1,4 +1,5 @@ // Copyright (c) 2007 John Maddock +// Copyright (c) 2024 Matt Borland // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,9 +11,14 @@ #pragma once #endif +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include -#include +#include +#include #include #include #include @@ -21,11 +27,9 @@ namespace boost{ namespace math{ namespace detail{ template -inline T sin_pi_imp(T x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline T sin_pi_imp(T x, const Policy&) { BOOST_MATH_STD_USING // ADL of std names - if(x < 0) - return -sin_pi_imp(T(-x), pol); // sin of pi*x: if(x < T(0.5)) return sin(constants::pi() * x); @@ -39,7 +43,7 @@ inline T sin_pi_imp(T x, const Policy& pol) invert = false; T rem = floor(x); - if(abs(floor(rem/2)*2 - rem) > std::numeric_limits::epsilon()) + if(abs(floor(rem/2)*2 - rem) > boost::math::numeric_limits::epsilon()) { invert = !invert; } @@ -53,10 +57,23 @@ inline T sin_pi_imp(T x, const Policy& pol) return invert ? T(-rem) : rem; } +template +BOOST_MATH_GPU_ENABLED inline T sin_pi_dispatch(T x, const Policy& pol) +{ + if (x < T(0)) + { + return -sin_pi_imp(T(-x), pol); + } + else + { + return sin_pi_imp(T(x), pol); + } +} + } // namespace detail template -inline typename tools::promote_args::type sin_pi(T x, const Policy&) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sin_pi(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -69,7 +86,7 @@ inline typename tools::promote_args::type sin_pi(T x, const Policy&) // We want to ignore overflows since the result is in [-1,1] and the // check slows the code down considerably. policies::overflow_error >::type forwarding_policy; - return policies::checked_narrowing_cast(boost::math::detail::sin_pi_imp(x, forwarding_policy()), "sin_pi"); + return policies::checked_narrowing_cast(boost::math::detail::sin_pi_dispatch(x, forwarding_policy()), "sin_pi"); } template @@ -80,5 +97,40 @@ inline typename tools::promote_args::type sin_pi(T x) } // namespace math } // namespace boost + +#else // Special handling for NVRTC + +namespace boost { +namespace math { + +template +BOOST_MATH_GPU_ENABLED auto sin_pi(T x) +{ + return ::sinpi(x); +} + +template <> +BOOST_MATH_GPU_ENABLED auto sin_pi(float x) +{ + return ::sinpif(x); +} + +template +BOOST_MATH_GPU_ENABLED auto sin_pi(T x, const Policy&) +{ + return ::sinpi(x); +} + +template +BOOST_MATH_GPU_ENABLED auto sin_pi(float x, const Policy&) +{ + return ::sinpif(x); +} + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_HAS_NVRTC + #endif diff --git a/include/boost/math/special_functions/sqrt1pm1.hpp b/include/boost/math/special_functions/sqrt1pm1.hpp index 041916a5..4d8aeb38 100644 --- a/include/boost/math/special_functions/sqrt1pm1.hpp +++ b/include/boost/math/special_functions/sqrt1pm1.hpp @@ -10,6 +10,7 @@ #pragma once #endif +#include #include #include #include @@ -21,7 +22,7 @@ namespace boost{ namespace math{ template -inline typename tools::promote_args::type sqrt1pm1(const T& val, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sqrt1pm1(const T& val, const Policy& pol) { typedef typename tools::promote_args::type result_type; BOOST_MATH_STD_USING @@ -32,7 +33,7 @@ inline typename tools::promote_args::type sqrt1pm1(const T& val, const Policy } template -inline typename tools::promote_args::type sqrt1pm1(const T& val) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sqrt1pm1(const T& val) { return sqrt1pm1(val, policies::policy<>()); } diff --git a/include/boost/math/special_functions/trigamma.hpp b/include/boost/math/special_functions/trigamma.hpp index f74b43db..61a60b50 100644 --- a/include/boost/math/special_functions/trigamma.hpp +++ b/include/boost/math/special_functions/trigamma.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,14 +11,22 @@ #pragma once #endif -#include +#include #include -#include #include +#include +#include +#include #include #include -#include +#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC +#include #include +#include +#endif #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -33,15 +42,24 @@ namespace boost{ namespace math{ namespace detail{ +// TODO(mborland): Temporary for NVRTC +#ifndef BOOST_MATH_HAS_NVRTC template T polygamma_imp(const int n, T x, const Policy &pol); template -T trigamma_prec(T x, const std::integral_constant*, const Policy&) +T trigamma_prec(T x, const Policy& pol, const boost::math::integral_constant&) +{ + return polygamma_imp(1, x, pol); +} +#endif + +template +BOOST_MATH_GPU_ENABLED T trigamma_prec(T x, const Policy&, const boost::math::integral_constant&) { // Max error in interpolated form: 3.736e-017 - static const T offset = BOOST_MATH_BIG_CONSTANT(T, 53, 2.1093254089355469); - static const T P_1_2[] = { + BOOST_MATH_STATIC const T offset = BOOST_MATH_BIG_CONSTANT(T, 53, 2.1093254089355469); + BOOST_MATH_STATIC const T P_1_2[] = { BOOST_MATH_BIG_CONSTANT(T, 53, -1.1093280605946045), BOOST_MATH_BIG_CONSTANT(T, 53, -3.8310674472619321), BOOST_MATH_BIG_CONSTANT(T, 53, -3.3703848401898283), @@ -49,7 +67,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 53, 1.6638069578676164), BOOST_MATH_BIG_CONSTANT(T, 53, 0.64468386819102836), }; - static const T Q_1_2[] = { + BOOST_MATH_STATIC const T Q_1_2[] = { BOOST_MATH_BIG_CONSTANT(T, 53, 1.0), BOOST_MATH_BIG_CONSTANT(T, 53, 3.4535389668541151), BOOST_MATH_BIG_CONSTANT(T, 53, 4.5208926987851437), @@ -58,7 +76,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 53, -0.20314516859987728e-6), }; // Max error in interpolated form: 1.159e-017 - static const T P_2_4[] = { + BOOST_MATH_STATIC const T P_2_4[] = { BOOST_MATH_BIG_CONSTANT(T, 53, -0.13803835004508849e-7), BOOST_MATH_BIG_CONSTANT(T, 53, 0.50000049158540261), BOOST_MATH_BIG_CONSTANT(T, 53, 1.6077979838469348), @@ -66,7 +84,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 53, 2.0534873203680393), BOOST_MATH_BIG_CONSTANT(T, 53, 0.74566981111565923), }; - static const T Q_2_4[] = { + BOOST_MATH_STATIC const T Q_2_4[] = { BOOST_MATH_BIG_CONSTANT(T, 53, 1.0), BOOST_MATH_BIG_CONSTANT(T, 53, 2.8822787662376169), BOOST_MATH_BIG_CONSTANT(T, 53, 4.1681660554090917), @@ -77,7 +95,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) // Maximum Deviation Found: 6.896e-018 // Expected Error Term : -6.895e-018 // Maximum Relative Change in Control Points : 8.497e-004 - static const T P_4_inf[] = { + BOOST_MATH_STATIC const T P_4_inf[] = { static_cast(0.68947581948701249e-17L), static_cast(0.49999999999998975L), static_cast(1.0177274392923795L), @@ -86,7 +104,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) static_cast(1.5897035272532764L), static_cast(0.40154388356961734L), }; - static const T Q_4_inf[] = { + BOOST_MATH_STATIC const T Q_4_inf[] = { static_cast(1.0L), static_cast(1.7021215452463932L), static_cast(4.4290431747556469L), @@ -110,11 +128,11 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) } template -T trigamma_prec(T x, const std::integral_constant*, const Policy&) +BOOST_MATH_GPU_ENABLED T trigamma_prec(T x, const Policy&, const boost::math::integral_constant&) { // Max error in interpolated form: 1.178e-020 - static const T offset_1_2 = BOOST_MATH_BIG_CONSTANT(T, 64, 2.109325408935546875); - static const T P_1_2[] = { + BOOST_MATH_STATIC const T offset_1_2 = BOOST_MATH_BIG_CONSTANT(T, 64, 2.109325408935546875); + BOOST_MATH_STATIC const T P_1_2[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -1.10932535608960258341), BOOST_MATH_BIG_CONSTANT(T, 64, -4.18793841543017129052), BOOST_MATH_BIG_CONSTANT(T, 64, -4.63865531898487734531), @@ -123,7 +141,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 64, 1.21172611429185622377), BOOST_MATH_BIG_CONSTANT(T, 64, 0.259635673503366427284), }; - static const T Q_1_2[] = { + BOOST_MATH_STATIC const T Q_1_2[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 3.77521119359546982995), BOOST_MATH_BIG_CONSTANT(T, 64, 5.664338024578956321), @@ -133,7 +151,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 64, 0.629642219810618032207e-8), }; // Max error in interpolated form: 3.912e-020 - static const T P_2_8[] = { + BOOST_MATH_STATIC const T P_2_8[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.387540035162952880976e-11), BOOST_MATH_BIG_CONSTANT(T, 64, 0.500000000276430504), BOOST_MATH_BIG_CONSTANT(T, 64, 3.21926880986360957306), @@ -143,7 +161,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 64, 13.4346512182925923978), BOOST_MATH_BIG_CONSTANT(T, 64, 3.98656291026448279118), }; - static const T Q_2_8[] = { + BOOST_MATH_STATIC const T Q_2_8[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 6.10520430478613667724), BOOST_MATH_BIG_CONSTANT(T, 64, 18.475001060603645512), @@ -156,7 +174,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) // Maximum Deviation Found: 2.635e-020 // Expected Error Term : 2.635e-020 // Maximum Relative Change in Control Points : 1.791e-003 - static const T P_8_inf[] = { + BOOST_MATH_STATIC const T P_8_inf[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.263527875092466899848e-19), BOOST_MATH_BIG_CONSTANT(T, 64, 0.500000000000000058145), BOOST_MATH_BIG_CONSTANT(T, 64, 0.0730121433777364138677), @@ -164,7 +182,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) BOOST_MATH_BIG_CONSTANT(T, 64, 0.0517092358874932620529), BOOST_MATH_BIG_CONSTANT(T, 64, 1.07995383547483921121), }; - static const T Q_8_inf[] = { + BOOST_MATH_STATIC const T Q_8_inf[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, -0.187309046577818095504), BOOST_MATH_BIG_CONSTANT(T, 64, 3.95255391645238842975), @@ -188,7 +206,7 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) } template -T trigamma_prec(T x, const std::integral_constant*, const Policy&) +BOOST_MATH_GPU_ENABLED T trigamma_prec(T x, const Policy&, const boost::math::integral_constant&) { // Max error in interpolated form: 1.916e-035 @@ -356,8 +374,8 @@ T trigamma_prec(T x, const std::integral_constant*, const Policy&) return (1 + tools::evaluate_polynomial(P_16_inf, y) / tools::evaluate_polynomial(Q_16_inf, y)) / x; } -template -T trigamma_imp(T x, const Tag* t, const Policy& pol) +template +BOOST_MATH_GPU_ENABLED T trigamma_dispatch(T x, const Policy& pol, const Tag& tag) { // // This handles reflection of negative arguments, and all our @@ -373,27 +391,29 @@ T trigamma_imp(T x, const Tag* t, const Policy& pol) { // Reflect: T z = 1 - x; + + if(z < 1) + { + result = 1 / (z * z); + z += 1; + } + // Argument reduction for tan: if(floor(x) == x) { return policies::raise_pole_error("boost::math::trigamma<%1%>(%1%)", nullptr, (1-x), pol); } T s = fabs(x) < fabs(z) ? boost::math::sin_pi(x, pol) : boost::math::sin_pi(z, pol); - return -trigamma_imp(z, t, pol) + boost::math::pow<2>(constants::pi()) / (s * s); + return result - trigamma_prec(T(z), pol, tag) + boost::math::pow<2>(constants::pi()) / (s * s); } if(x < 1) { result = 1 / (x * x); x += 1; } - return result + trigamma_prec(x, t, pol); + return result + trigamma_prec(x, pol, tag); } -template -T trigamma_imp(T x, const std::integral_constant*, const Policy& pol) -{ - return polygamma_imp(1, x, pol); -} // // Initializer: ensure all our constants are initialized prior to the first call of main: // @@ -402,22 +422,24 @@ struct trigamma_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { typedef typename policies::precision::type precision_type; - do_init(std::integral_constant()); + do_init(boost::math::integral_constant()); } - void do_init(const std::true_type&) + BOOST_MATH_GPU_ENABLED void do_init(const boost::math::true_type&) { boost::math::trigamma(T(2.5), Policy()); } - void do_init(const std::false_type&){} - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED void do_init(const boost::math::false_type&){} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; static const init initializer; - static void force_instantiate() + BOOST_MATH_GPU_ENABLED static void force_instantiate() { + #ifndef BOOST_MATH_HAS_GPU_SUPPORT initializer.force_instantiate(); + #endif } }; @@ -427,13 +449,13 @@ const typename trigamma_initializer::init trigamma_initializer -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type trigamma(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; typedef typename policies::precision::type precision_type; - typedef std::integral_constant::type // Force initialization of constants: detail::trigamma_initializer::force_instantiate(); - return policies::checked_narrowing_cast(detail::trigamma_imp( + return policies::checked_narrowing_cast(detail::trigamma_dispatch( static_cast(x), - static_cast(nullptr), forwarding_policy()), "boost::math::trigamma<%1%>(%1%)"); + forwarding_policy(), + tag_type()), "boost::math::trigamma<%1%>(%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type trigamma(T x) { return trigamma(x, policies::policy<>()); diff --git a/include/boost/math/special_functions/trunc.hpp b/include/boost/math/special_functions/trunc.hpp index 7ac33a92..b52f4f32 100644 --- a/include/boost/math/special_functions/trunc.hpp +++ b/include/boost/math/special_functions/trunc.hpp @@ -11,23 +11,28 @@ #pragma once #endif +#include +#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC + #include #include -#include +#include #include #include +#include -#ifndef BOOST_NO_CXX17_IF_CONSTEXPR +#if !defined(BOOST_MATH_NO_CCMATH) && !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) #include -# if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) # define BOOST_MATH_HAS_CONSTEXPR_LDEXP -# endif #endif namespace boost{ namespace math{ namespace detail{ template -inline tools::promote_args_t trunc(const T& v, const Policy& pol, const std::false_type&) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v, const Policy& pol, const std::false_type&) { BOOST_MATH_STD_USING using result_type = tools::promote_args_t; @@ -39,23 +44,66 @@ inline tools::promote_args_t trunc(const T& v, const Policy& pol, const std:: } template -inline tools::promote_args_t trunc(const T& v, const Policy&, const std::true_type&) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v, const Policy&, const std::true_type&) { return v; } -} +} // Namespace detail template -inline tools::promote_args_t trunc(const T& v, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v, const Policy& pol) { return detail::trunc(v, pol, std::integral_constant::value>()); } + template -inline tools::promote_args_t trunc(const T& v) +BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v) { return trunc(v, policies::policy<>()); } + +#else // Special handling for nvrtc + +namespace boost { +namespace math { + +namespace detail { + +template +BOOST_MATH_GPU_ENABLED double trunc_impl(T x) +{ + return static_cast(x); +} + +BOOST_MATH_GPU_ENABLED inline float trunc_impl(float x) +{ + return ::truncf(x); +} + +BOOST_MATH_GPU_ENABLED inline double trunc_impl(double x) +{ + return ::trunc(x); +} + +} // Namespace detail + +template +BOOST_MATH_GPU_ENABLED auto trunc(T x, const Policy&) +{ + return detail::trunc_impl(x); +} + +template +BOOST_MATH_GPU_ENABLED auto trunc(T x) +{ + return detail::trunc_impl(x); +} + +#endif + +#ifndef BOOST_MATH_HAS_NVRTC + // // The following functions will not compile unless T has an // implicit conversion to the integer types. For user-defined @@ -70,13 +118,13 @@ inline tools::promote_args_t trunc(const T& v) // https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax // template -inline int itrunc(const T& v, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING using result_type = tools::promote_args_t; result_type r = boost::math::trunc(v, pol); - #ifdef BOOST_MATH_HAS_CONSTEXPR_LDEXP + #if defined(BOOST_MATH_HAS_CONSTEXPR_LDEXP) && !defined(BOOST_MATH_HAS_GPU_SUPPORT) if constexpr (std::is_arithmetic_v #ifdef BOOST_MATH_FLOAT128_TYPE && !std::is_same_v @@ -100,7 +148,7 @@ inline int itrunc(const T& v, const Policy& pol) } } #else - static const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); + BOOST_MATH_STATIC_LOCAL_VARIABLE const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); if (r >= max_val || r < -max_val) { @@ -110,20 +158,21 @@ inline int itrunc(const T& v, const Policy& pol) return static_cast(r); } + template -inline int itrunc(const T& v) +BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v) { return itrunc(v, policies::policy<>()); } template -inline long ltrunc(const T& v, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING using result_type = tools::promote_args_t; result_type r = boost::math::trunc(v, pol); - #ifdef BOOST_MATH_HAS_CONSTEXPR_LDEXP + #if defined(BOOST_MATH_HAS_CONSTEXPR_LDEXP) && !defined(BOOST_MATH_HAS_GPU_SUPPORT) if constexpr (std::is_arithmetic_v #ifdef BOOST_MATH_FLOAT128_TYPE && !std::is_same_v @@ -147,7 +196,7 @@ inline long ltrunc(const T& v, const Policy& pol) } } #else - static const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); + BOOST_MATH_STATIC_LOCAL_VARIABLE const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); if (r >= max_val || r < -max_val) { @@ -157,20 +206,21 @@ inline long ltrunc(const T& v, const Policy& pol) return static_cast(r); } + template -inline long ltrunc(const T& v) +BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v) { return ltrunc(v, policies::policy<>()); } template -inline long long lltrunc(const T& v, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING using result_type = tools::promote_args_t; result_type r = boost::math::trunc(v, pol); - #ifdef BOOST_MATH_HAS_CONSTEXPR_LDEXP + #if defined(BOOST_MATH_HAS_CONSTEXPR_LDEXP) && !defined(BOOST_MATH_HAS_GPU_SUPPORT) if constexpr (std::is_arithmetic_v #ifdef BOOST_MATH_FLOAT128_TYPE && !std::is_same_v @@ -194,7 +244,7 @@ inline long long lltrunc(const T& v, const Policy& pol) } } #else - static const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); + BOOST_MATH_STATIC_LOCAL_VARIABLE const result_type max_val = ldexp(static_cast(1), std::numeric_limits::digits); if (r >= max_val || r < -max_val) { @@ -204,21 +254,81 @@ inline long long lltrunc(const T& v, const Policy& pol) return static_cast(r); } + template -inline long long lltrunc(const T& v) +BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v) { return lltrunc(v, policies::policy<>()); } +#else // Reduced impl specifically for NVRTC platform + +namespace detail { + +template +BOOST_MATH_GPU_ENABLED TargetType integer_trunc_impl(T v) +{ + double r = boost::math::trunc(v); + + const double max_val = ldexp(1.0, boost::math::numeric_limits::digits); + + if (r >= max_val || r < -max_val) + { + r = 0; + } + + return static_cast(r); +} + +} // Namespace detail + +template +BOOST_MATH_GPU_ENABLED int itrunc(T v) +{ + return detail::integer_trunc_impl(v); +} + +template +BOOST_MATH_GPU_ENABLED int itrunc(T v, const Policy&) +{ + return detail::integer_trunc_impl(v); +} + +template +BOOST_MATH_GPU_ENABLED long ltrunc(T v) +{ + return detail::integer_trunc_impl(v); +} + +template +BOOST_MATH_GPU_ENABLED long ltrunc(T v, const Policy&) +{ + return detail::integer_trunc_impl(v); +} + +template +BOOST_MATH_GPU_ENABLED long long lltrunc(T v) +{ + return detail::integer_trunc_impl(v); +} + +template +BOOST_MATH_GPU_ENABLED long long lltrunc(T v, const Policy&) +{ + return detail::integer_trunc_impl(v); +} + +#endif // BOOST_MATH_HAS_NVRTC + template -inline typename std::enable_if::value, int>::type +BOOST_MATH_GPU_ENABLED inline boost::math::enable_if_t, int> iconvert(const T& v, const Policy&) { return static_cast(v); } template -inline typename std::enable_if::value, int>::type +BOOST_MATH_GPU_ENABLED inline boost::math::enable_if_t, int> iconvert(const T& v, const Policy& pol) { using boost::math::itrunc; @@ -226,14 +336,14 @@ inline typename std::enable_if::value, int>::type } template -inline typename std::enable_if::value, long>::type +BOOST_MATH_GPU_ENABLED inline boost::math::enable_if_t, long> lconvert(const T& v, const Policy&) { return static_cast(v); } template -inline typename std::enable_if::value, long>::type +BOOST_MATH_GPU_ENABLED inline boost::math::enable_if_t, long> lconvert(const T& v, const Policy& pol) { using boost::math::ltrunc; @@ -241,14 +351,29 @@ inline typename std::enable_if::value, long>::ty } template -inline typename std::enable_if::value, long long>::type +BOOST_MATH_GPU_ENABLED inline boost::math::enable_if_t, long long> + llconvert(const T& v, const Policy&) +{ + return static_cast(v); +} + +template +BOOST_MATH_GPU_ENABLED inline typename boost::math::enable_if_t, long long> + llconvert(const T& v, const Policy& pol) +{ + using boost::math::lltrunc; + return lltrunc(v, pol); +} + +template +BOOST_MATH_GPU_ENABLED [[deprecated("Use llconvert")]] inline boost::math::enable_if_t, long long> llconvertert(const T& v, const Policy&) { return static_cast(v); } template -inline typename std::enable_if::value, long long>::type +BOOST_MATH_GPU_ENABLED [[deprecated("Use llconvert")]] inline typename boost::math::enable_if_t, long long> llconvertert(const T& v, const Policy& pol) { using boost::math::lltrunc; diff --git a/include/boost/math/special_functions/zeta.hpp b/include/boost/math/special_functions/zeta.hpp index 118aa7d3..1a3bba74 100644 --- a/include/boost/math/special_functions/zeta.hpp +++ b/include/boost/math/special_functions/zeta.hpp @@ -936,7 +936,7 @@ T zeta_imp(T s, T sc, const Policy& pol, const Tag& tag) // if(floor(s) == s) { -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS // Without exceptions we expect itrunc to return INT_MAX on overflow // and we fall through anyway. try @@ -964,7 +964,7 @@ T zeta_imp(T s, T sc, const Policy& pol, const Tag& tag) else return zeta_imp_odd_integer(v, sc, pol, std::integral_constant()); } -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS } catch(const boost::math::rounding_error&){} // Just fall through, s is too large to round catch(const std::overflow_error&){} diff --git a/include/boost/math/tools/array.hpp b/include/boost/math/tools/array.hpp new file mode 100644 index 00000000..23e66667 --- /dev/null +++ b/include/boost/math/tools/array.hpp @@ -0,0 +1,41 @@ +// Copyright (c) 2024 Matt Borland +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Regular use of std::array functions can not be used on +// GPU platforms like CUDA since they are missing the __device__ marker +// Alias as needed to get correct support + +#ifndef BOOST_MATH_TOOLS_ARRAY_HPP +#define BOOST_MATH_TOOLS_ARRAY_HPP + +#include + +#ifdef BOOST_MATH_ENABLE_CUDA + +#include + +namespace boost { +namespace math { + +using cuda::std::array; + +} // namespace math +} // namespace boost + +#else + +#include + +namespace boost { +namespace math { + +using std::array; + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_ENABLE_CUDA + +#endif // BOOST_MATH_TOOLS_ARRAY_HPP diff --git a/include/boost/math/tools/assert.hpp b/include/boost/math/tools/assert.hpp index 3d565592..3f57351f 100644 --- a/include/boost/math/tools/assert.hpp +++ b/include/boost/math/tools/assert.hpp @@ -10,6 +10,19 @@ #ifndef BOOST_MATH_TOOLS_ASSERT_HPP #define BOOST_MATH_TOOLS_ASSERT_HPP +#include + +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +// Run time asserts are generally unsupported + +#define BOOST_MATH_ASSERT(expr) +#define BOOST_MATH_ASSERT_MSG(expr, msg) +#define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed") +#define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg) + +#else + #include #ifndef BOOST_MATH_STANDALONE @@ -29,6 +42,8 @@ #define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed") #define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg) -#endif +#endif // Is standalone + +#endif // BOOST_MATH_HAS_GPU_SUPPORT #endif // BOOST_MATH_TOOLS_ASSERT_HPP diff --git a/include/boost/math/tools/atomic.hpp b/include/boost/math/tools/atomic.hpp index e3cbf5db..f558bd63 100644 --- a/include/boost/math/tools/atomic.hpp +++ b/include/boost/math/tools/atomic.hpp @@ -10,7 +10,7 @@ #include #include -#ifdef BOOST_HAS_THREADS +#ifdef BOOST_MATH_HAS_THREADS #include namespace boost { @@ -45,6 +45,6 @@ namespace boost { #else # define BOOST_MATH_NO_ATOMIC_INT -#endif // BOOST_HAS_THREADS +#endif // BOOST_MATH_HAS_THREADS #endif // BOOST_MATH_ATOMIC_DETAIL_HPP diff --git a/include/boost/math/tools/big_constant.hpp b/include/boost/math/tools/big_constant.hpp index bec93a11..0d54976b 100644 --- a/include/boost/math/tools/big_constant.hpp +++ b/include/boost/math/tools/big_constant.hpp @@ -8,6 +8,12 @@ #define BOOST_MATH_TOOLS_BIG_CONSTANT_HPP #include + +// On NVRTC we don't need any of this +// We just have a simple definition of the macro since the largest float +// type on the platform is a 64-bit double +#ifndef BOOST_MATH_HAS_NVRTC + #ifndef BOOST_MATH_STANDALONE #include #endif @@ -43,12 +49,12 @@ typedef double largest_float; #endif template -inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T) { return static_cast(v); } template -inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T) { return static_cast(v); } @@ -60,7 +66,7 @@ inline T make_big_value(largest_float, const char* s, std::false_type const&, st } #else template -inline T make_big_value(largest_float, const char* s, std::false_type const&, std::false_type const&) +inline T make_big_value(largest_float, const char*, std::false_type const&, std::false_type const&) { static_assert(sizeof(T) == 0, "Type is unsupported in standalone mode. Please disable and try again."); } @@ -77,7 +83,7 @@ inline constexpr T make_big_value(largest_float, const char* s, std::false_type #define BOOST_MATH_BIG_CONSTANT(T, D, x)\ boost::math::tools::make_big_value(\ BOOST_MATH_LARGEST_FLOAT_C(x), \ - BOOST_STRINGIZE(x), \ + BOOST_MATH_STRINGIZE(x), \ std::integral_constant::value) && \ ((D <= boost::math::tools::numeric_traits::digits) \ || std::is_floating_point::value \ @@ -88,11 +94,13 @@ inline constexpr T make_big_value(largest_float, const char* s, std::false_type // For constants too huge for any conceivable long double (and which generate compiler errors if we try and declare them as such): // #define BOOST_MATH_HUGE_CONSTANT(T, D, x)\ - boost::math::tools::make_big_value(0.0L, BOOST_STRINGIZE(x), \ + boost::math::tools::make_big_value(0.0L, BOOST_MATH_STRINGIZE(x), \ std::integral_constant::value || (boost::math::tools::numeric_traits::is_specialized && boost::math::tools::numeric_traits::max_exponent <= boost::math::tools::numeric_traits::max_exponent && boost::math::tools::numeric_traits::digits <= boost::math::tools::numeric_traits::digits)>(), \ std::is_constructible()) }}} // namespaces +#endif // BOOST_MATH_HAS_NVRTC + #endif diff --git a/include/boost/math/tools/complex.hpp b/include/boost/math/tools/complex.hpp index d462ca80..ec514401 100644 --- a/include/boost/math/tools/complex.hpp +++ b/include/boost/math/tools/complex.hpp @@ -10,9 +10,39 @@ #ifndef BOOST_MATH_TOOLS_COMPLEX_HPP #define BOOST_MATH_TOOLS_COMPLEX_HPP -#include +#include #include +#ifdef BOOST_MATH_ENABLE_CUDA + +#include +#include + +namespace boost { +namespace math { + +template +using complex = cuda::std::complex; + +} // namespace math +} // namespace boost + +#else + +#include +#include + +namespace boost { +namespace math { + +template +using complex = std::complex; + +} // namespace math +} // namespace boost + +#endif + namespace boost { namespace math { namespace tools { @@ -24,12 +54,21 @@ namespace boost { static constexpr bool value = false; }; + #ifndef BOOST_MATH_ENABLE_CUDA template struct is_complex_type_impl().real()), decltype(std::declval().imag())>> { static constexpr bool value = true; }; + #else + template + struct is_complex_type_impl().real()), + decltype(cuda::std::declval().imag())>> + { + static constexpr bool value = true; + }; + #endif } // Namespace detail template diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 66e7da52..12f3411c 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -11,25 +11,80 @@ #pragma once #endif +#ifndef __CUDACC_RTC__ + #include // Minimum language standard transition #ifdef _MSVC_LANG # if _MSVC_LANG < 201402L -# pragma warning("The minimum language standard to use Boost.Math will be C++14 starting in July 2023 (Boost 1.82 release)"); +# pragma message("Boost.Math requires C++14"); +# endif +# if _MSC_VER == 1900 +# pragma message("MSVC 14.0 has broken C++14 constexpr support. Support for this compiler will be removed in Boost 1.86") # endif #else # if __cplusplus < 201402L -# warning "The minimum language standard to use Boost.Math will be C++14 starting in July 2023 (Boost 1.82 release)" +# warning "Boost.Math requires C++14" # endif #endif #ifndef BOOST_MATH_STANDALONE #include + +// The following are all defined as standalone macros as well +// If Boost.Config is available just use those definitions because they are more fine-grained + +// Could be defined in TR1 +#ifndef BOOST_MATH_PREVENT_MACRO_SUBSTITUTION +# define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION +#endif + +#define BOOST_MATH_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR +#ifdef BOOST_NO_CXX14_CONSTEXPR +# define BOOST_MATH_NO_CXX14_CONSTEXPR +#endif + +#define BOOST_MATH_IF_CONSTEXPR BOOST_IF_CONSTEXPR +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +# define BOOST_MATH_NO_CXX17_IF_CONSTEXPR +#endif + +#ifdef BOOST_NO_CXX17_HDR_EXECUTION +# define BOOST_MATH_NO_CXX17_HDR_EXECUTION +#endif + +#ifdef BOOST_HAS_THREADS +# define BOOST_MATH_HAS_THREADS +#endif +#ifdef BOOST_DISABLE_THREADS +# define BOOST_MATH_DISABLE_THREADS +#endif +#ifdef BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_MATH_NO_CXX11_THREAD_LOCAL +#endif + +#ifdef BOOST_NO_EXCEPTIONS +# define BOOST_MATH_NO_EXCEPTIONS +#endif + +#ifdef BOOST_NO_TYPEID +# define BOOST_MATH_NO_TYPEID +#endif +#ifdef BOOST_NO_RTTI +# define BOOST_MATH_NO_RTTI +#endif + +#define BOOST_MATH_NOINLINE BOOST_NOINLINE +#define BOOST_MATH_FORCEINLINE BOOST_FORCEINLINE + +#define BOOST_MATH_JOIN(X, Y) BOOST_JOIN(X, Y) +#define BOOST_MATH_STRINGIZE(X) BOOST_STRINGIZE(X) + #else // Things from boost/config that are required, and easy to replicate -#define BOOST_PREVENT_MACRO_SUBSTITUTION +#define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION #define BOOST_MATH_NO_REAL_CONCEPT_TESTS #define BOOST_MATH_NO_DISTRIBUTION_CONCEPT_TESTS #define BOOST_MATH_NO_LEXICAL_CAST @@ -38,59 +93,56 @@ #define BOOST_MATH_NO_MP_TESTS #if (__cplusplus > 201400L || _MSVC_LANG > 201400L) -#define BOOST_CXX14_CONSTEXPR constexpr +#define BOOST_MATH_CXX14_CONSTEXPR constexpr #else -#define BOOST_CXX14_CONSTEXPR -#define BOOST_NO_CXX14_CONSTEXPR -#endif // BOOST_CXX14_CONSTEXPR +#define BOOST_MATH_CXX14_CONSTEXPR +#define BOOST_MATH_NO_CXX14_CONSTEXPR +#endif // BOOST_MATH_CXX14_CONSTEXPR #if (__cplusplus > 201700L || _MSVC_LANG > 201700L) -#define BOOST_IF_CONSTEXPR if constexpr +#define BOOST_MATH_IF_CONSTEXPR if constexpr // Clang on mac provides the execution header with none of the functionality. TODO: Check back on this // https://en.cppreference.com/w/cpp/compiler_support "Standardization of Parallelism TS" -#if !__has_include() || (defined(__APPLE__) && defined(__clang__)) -#define BOOST_NO_CXX17_HDR_EXECUTION -#endif +# if !__has_include() || (defined(__APPLE__) && defined(__clang__)) +# define BOOST_MATH_NO_CXX17_HDR_EXECUTION +# endif #else -#define BOOST_IF_CONSTEXPR if -#define BOOST_NO_CXX17_IF_CONSTEXPR -#define BOOST_NO_CXX17_HDR_EXECUTION +# define BOOST_MATH_IF_CONSTEXPR if +# define BOOST_MATH_NO_CXX17_IF_CONSTEXPR +# define BOOST_MATH_NO_CXX17_HDR_EXECUTION #endif #if __cpp_lib_gcd_lcm >= 201606L #define BOOST_MATH_HAS_CXX17_NUMERIC #endif -#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y) -#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y) -#define BOOST_DO_JOIN2(X, Y) X##Y +#define BOOST_MATH_JOIN(X, Y) BOOST_MATH_DO_JOIN(X, Y) +#define BOOST_MATH_DO_JOIN(X, Y) BOOST_MATH_DO_JOIN2(X,Y) +#define BOOST_MATH_DO_JOIN2(X, Y) X##Y -#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) -#define BOOST_DO_STRINGIZE(X) #X +#define BOOST_MATH_STRINGIZE(X) BOOST_MATH_DO_STRINGIZE(X) +#define BOOST_MATH_DO_STRINGIZE(X) #X -#ifdef BOOST_DISABLE_THREADS // No threads, do nothing +#ifdef BOOST_MATH_DISABLE_THREADS // No threads, do nothing // Detect thread support via STL implementation #elif defined(__has_include) # if !__has_include() || !__has_include() || !__has_include() || !__has_include() -# define BOOST_DISABLE_THREADS +# define BOOST_MATH_DISABLE_THREADS # else -# define BOOST_HAS_THREADS +# define BOOST_MATH_HAS_THREADS # endif #else -# define BOOST_HAS_THREADS // The default assumption is that the machine has threads +# define BOOST_MATH_HAS_THREADS // The default assumption is that the machine has threads #endif // Thread Support -#ifdef BOOST_DISABLE_THREADS -# define BOOST_NO_CXX11_HDR_ATOMIC -# define BOOST_NO_CXX11_HDR_FUTURE -# define BOOST_NO_CXX11_HDR_THREAD -# define BOOST_NO_CXX11_THREAD_LOCAL -#endif // BOOST_DISABLE_THREADS +#ifdef BOOST_MATH_DISABLE_THREADS +# define BOOST_MATH_NO_CXX11_THREAD_LOCAL +#endif // BOOST_MATH_DISABLE_THREADS #ifdef __GNUC__ -# if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) -# define BOOST_NO_EXCEPTIONS +# if !defined(__EXCEPTIONS) && !defined(BOOST_MATH_NO_EXCEPTIONS) +# define BOOST_MATH_NO_EXCEPTIONS # endif // // Make sure we have some std lib headers included so we can detect __GXX_RTTI: @@ -98,43 +150,43 @@ # include // for min and max # include # ifndef __GXX_RTTI -# ifndef BOOST_NO_TYPEID -# define BOOST_NO_TYPEID +# ifndef BOOST_MATH_NO_TYPEID +# define BOOST_MATH_NO_TYPEID # endif -# ifndef BOOST_NO_RTTI -# define BOOST_NO_RTTI +# ifndef BOOST_MATH_NO_RTTI +# define BOOST_MATH_NO_RTTI # endif # endif #endif -#if !defined(BOOST_NOINLINE) +#if !defined(BOOST_MATH_NOINLINE) # if defined(_MSC_VER) -# define BOOST_NOINLINE __declspec(noinline) +# define BOOST_MATH_NOINLINE __declspec(noinline) # elif defined(__GNUC__) && __GNUC__ > 3 // Clang also defines __GNUC__ (as 4) # if defined(__CUDACC__) // nvcc doesn't always parse __noinline__, // see: https://svn.boost.org/trac/boost/ticket/9392 -# define BOOST_NOINLINE __attribute__ ((noinline)) +# define BOOST_MATH_NOINLINE __attribute__ ((noinline)) # elif defined(__HIP__) // See https://github.com/boostorg/config/issues/392 -# define BOOST_NOINLINE __attribute__ ((noinline)) +# define BOOST_MATH_NOINLINE __attribute__ ((noinline)) # else -# define BOOST_NOINLINE __attribute__ ((__noinline__)) +# define BOOST_MATH_NOINLINE __attribute__ ((__noinline__)) # endif # else -# define BOOST_NOINLINE +# define BOOST_MATH_NOINLINE # endif #endif -#if !defined(BOOST_FORCEINLINE) +#if !defined(BOOST_MATH_FORCEINLINE) # if defined(_MSC_VER) -# define BOOST_FORCEINLINE __forceinline +# define BOOST_MATH_FORCEINLINE __forceinline # elif defined(__GNUC__) && __GNUC__ > 3 // Clang also defines __GNUC__ (as 4) -# define BOOST_FORCEINLINE inline __attribute__ ((__always_inline__)) +# define BOOST_MATH_FORCEINLINE inline __attribute__ ((__always_inline__)) # else -# define BOOST_FORCEINLINE inline +# define BOOST_MATH_FORCEINLINE inline # endif #endif @@ -142,38 +194,21 @@ // Support compilers with P0024R2 implemented without linking TBB // https://en.cppreference.com/w/cpp/compiler_support -#if !defined(BOOST_NO_CXX17_HDR_EXECUTION) && defined(BOOST_HAS_THREADS) +#if !defined(BOOST_MATH_NO_CXX17_HDR_EXECUTION) && defined(BOOST_MATH_HAS_THREADS) # define BOOST_MATH_EXEC_COMPATIBLE #endif -// Attributes from C++14 and newer -#ifdef __has_cpp_attribute - -// C++17 -#if (__cplusplus >= 201703L || _MSVC_LANG >= 201703L) -# if __has_cpp_attribute(maybe_unused) -# define BOOST_MATH_MAYBE_UNUSED [[maybe_unused]] -# endif -#endif - -#endif // Standalone config - -// If attributes are not defined make sure we don't have compiler errors -#ifndef BOOST_MATH_MAYBE_UNUSED -# define BOOST_MATH_MAYBE_UNUSED -#endif - // C++23 -#if __cplusplus > 202002L || _MSVC_LANG > 202002L +#if __cplusplus > 202002L || (defined(_MSVC_LANG) &&_MSVC_LANG > 202002L) # if __GNUC__ >= 13 // libstdc++3 only defines to/from_chars for std::float128_t when one of these defines are set // otherwise we're right out of luck... # if defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) || defined(_GLIBCXX_HAVE_FLOAT128_MATH) -# include // std::strlen is used with from_chars -# include -# include -# define BOOST_MATH_USE_CHARCONV_FOR_CONVERSION -#endif +# include // std::strlen is used with from_chars +# include +# include +# define BOOST_MATH_USE_CHARCONV_FOR_CONVERSION +# endif # endif #endif @@ -185,12 +220,16 @@ #include -#if (defined(__NetBSD__) || defined(__EMSCRIPTEN__)\ +#if (defined(__NetBSD__)\ || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \ && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) //# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS #endif +#if defined(__EMSCRIPTEN__) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#endif + #ifdef __IBMCPP__ // // For reasons I don't understand, the tests with IMB's compiler all @@ -332,42 +371,62 @@ struct non_type {}; #endif // -// Tune performance options for specific compilers: +// Tune performance options for specific compilers, +// but check at each step that nothing has been previously defined by the user first // #ifdef _MSC_VER -# define BOOST_MATH_POLY_METHOD 2 +# ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_POLY_METHOD 2 +# endif #if _MSC_VER <= 1900 -# define BOOST_MATH_RATIONAL_METHOD 1 +# ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_RATIONAL_METHOD 1 +# endif #else -# define BOOST_MATH_RATIONAL_METHOD 2 +# ifndef BOOST_MATH_RATIONAL_METHOD +# define BOOST_MATH_RATIONAL_METHOD 2 +# endif #endif #if _MSC_VER > 1900 -# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT -# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +# ifndef BOOST_MATH_INT_TABLE_TYPE +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# endif +# ifndef BOOST_MATH_INT_VALUE_SUFFIX +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +# endif #endif #elif defined(__INTEL_COMPILER) -# define BOOST_MATH_POLY_METHOD 2 -# define BOOST_MATH_RATIONAL_METHOD 1 +# ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_POLY_METHOD 2 +# endif +# ifndef BOOST_MATH_RATIONAL_METHOD +# define BOOST_MATH_RATIONAL_METHOD 1 +# endif #elif defined(__GNUC__) -#if __GNUC__ < 4 -# define BOOST_MATH_POLY_METHOD 3 -# define BOOST_MATH_RATIONAL_METHOD 3 -# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT -# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L -#else -# define BOOST_MATH_POLY_METHOD 3 -# define BOOST_MATH_RATIONAL_METHOD 3 -#endif +# ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_POLY_METHOD 3 +# endif +# ifndef BOOST_MATH_RATIONAL_METHOD +# define BOOST_MATH_RATIONAL_METHOD 3 +# endif #elif defined(__clang__) #if __clang__ > 6 -# define BOOST_MATH_POLY_METHOD 3 -# define BOOST_MATH_RATIONAL_METHOD 3 -# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT -# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +# ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_POLY_METHOD 3 +# endif +# ifndef BOOST_MATH_RATIONAL_METHOD +# define BOOST_MATH_RATIONAL_METHOD 3 +# endif +# ifndef BOOST_MATH_INT_TABLE_TYPE +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# endif +# ifndef BOOST_MATH_INT_VALUE_SUFFIX +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +# endif #endif #endif @@ -410,7 +469,7 @@ struct non_type {}; #if defined(BOOST_MATH_STANDALONE) && defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && !defined(__STRICT_ANSI__) \ && !defined(BOOST_MATH_DISABLE_FLOAT128) && !defined(BOOST_MATH_USE_FLOAT128) # define BOOST_MATH_USE_FLOAT128 -#elif defined(BOOST_HAS_FLOAT128) && !defined(BOOST_MATH_USE_FLOAT128) +#elif defined(BOOST_HAS_FLOAT128) && !defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_MATH_DISABLE_FLOAT128) # define BOOST_MATH_USE_FLOAT128 #endif #ifdef BOOST_MATH_USE_FLOAT128 @@ -469,7 +528,9 @@ struct non_type {}; using std::ceil;\ using std::floor;\ using std::log10;\ - using std::sqrt; + using std::sqrt;\ + using std::log2;\ + using std::ilogb; #define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE @@ -478,13 +539,13 @@ namespace tools { template -inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c) BOOST_MATH_NOEXCEPT(T) +inline T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c) BOOST_MATH_NOEXCEPT(T) { return (std::max)((std::max)(a, b), c); } template -inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) BOOST_MATH_NOEXCEPT(T) +inline T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) BOOST_MATH_NOEXCEPT(T) { return (std::max)((std::max)(a, b), (std::max)(c, d)); } @@ -582,7 +643,7 @@ namespace boost{ namespace math{ // // Thread local storage: // -#ifndef BOOST_DISABLE_THREADS +#ifndef BOOST_MATH_DISABLE_THREADS # define BOOST_MATH_THREAD_LOCAL thread_local #else # define BOOST_MATH_THREAD_LOCAL @@ -600,13 +661,191 @@ namespace boost{ namespace math{ // // Can we have constexpr tables? // -#if (!defined(BOOST_NO_CXX14_CONSTEXPR)) || (defined(_MSC_VER) && _MSC_VER >= 1910) +#if (!defined(BOOST_MATH_NO_CXX14_CONSTEXPR)) || (defined(_MSC_VER) && _MSC_VER >= 1910) #define BOOST_MATH_HAVE_CONSTEXPR_TABLES #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION constexpr #else #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION #endif +// +// CUDA support: +// + +#ifdef __CUDACC__ + +// We have to get our include order correct otherwise you get compilation failures +#include +#include +#include +#include +#include +#include +#include +#include + +# define BOOST_MATH_CUDA_ENABLED __host__ __device__ +# define BOOST_MATH_HAS_GPU_SUPPORT + +# ifndef BOOST_MATH_ENABLE_CUDA +# define BOOST_MATH_ENABLE_CUDA +# endif + +// Device code can not handle exceptions +# ifndef BOOST_MATH_NO_EXCEPTIONS +# define BOOST_MATH_NO_EXCEPTIONS +# endif + +// We want to use force inline from CUDA instead of the host compiler +# undef BOOST_MATH_FORCEINLINE +# define BOOST_MATH_FORCEINLINE __forceinline__ + +#elif defined(SYCL_LANGUAGE_VERSION) + +# define BOOST_MATH_SYCL_ENABLED SYCL_EXTERNAL +# define BOOST_MATH_HAS_GPU_SUPPORT + +# ifndef BOOST_MATH_ENABLE_SYCL +# define BOOST_MATH_ENABLE_SYCL +# endif + +# ifndef BOOST_MATH_NO_EXCEPTIONS +# define BOOST_MATH_NO_EXCEPTIONS +# endif + +// spir64 does not support long double +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +# define BOOST_MATH_NO_REAL_CONCEPT_TESTS + +# undef BOOST_MATH_FORCEINLINE +# define BOOST_MATH_FORCEINLINE inline + +#endif + +#ifndef BOOST_MATH_CUDA_ENABLED +# define BOOST_MATH_CUDA_ENABLED +#endif + +#ifndef BOOST_MATH_SYCL_ENABLED +# define BOOST_MATH_SYCL_ENABLED +#endif + +// Not all functions that allow CUDA allow SYCL (e.g. Recursion is disallowed by SYCL) +# define BOOST_MATH_GPU_ENABLED BOOST_MATH_CUDA_ENABLED BOOST_MATH_SYCL_ENABLED + +// Additional functions that need replaced/marked up +#ifdef BOOST_MATH_HAS_GPU_SUPPORT +template +BOOST_MATH_GPU_ENABLED constexpr void gpu_safe_swap(T& a, T& b) { T t(a); a = b; b = t; } +template +BOOST_MATH_GPU_ENABLED constexpr T gpu_safe_min(const T& a, const T& b) { return a < b ? a : b; } +template +BOOST_MATH_GPU_ENABLED constexpr T gpu_safe_max(const T& a, const T& b) { return a > b ? a : b; } + +#define BOOST_MATH_GPU_SAFE_SWAP(a, b) gpu_safe_swap(a, b) +#define BOOST_MATH_GPU_SAFE_MIN(a, b) gpu_safe_min(a, b) +#define BOOST_MATH_GPU_SAFE_MAX(a, b) gpu_safe_max(a, b) + +#else + +#define BOOST_MATH_GPU_SAFE_SWAP(a, b) std::swap(a, b) +#define BOOST_MATH_GPU_SAFE_MIN(a, b) (std::min)(a, b) +#define BOOST_MATH_GPU_SAFE_MAX(a, b) (std::max)(a, b) + +#endif + +// Static variables are not allowed with CUDA or C++20 modules +// See if we can inline them instead + +#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L +# define BOOST_MATH_INLINE_CONSTEXPR inline constexpr +# define BOOST_MATH_STATIC static +# ifndef BOOST_MATH_HAS_GPU_SUPPORT +# define BOOST_MATH_STATIC_LOCAL_VARIABLE static +# else +# define BOOST_MATH_STATIC_LOCAL_VARIABLE +# endif +#else +# ifndef BOOST_MATH_HAS_GPU_SUPPORT +# define BOOST_MATH_INLINE_CONSTEXPR static constexpr +# define BOOST_MATH_STATIC static +# define BOOST_MATH_STATIC_LOCAL_VARIABLE +# else +# define BOOST_MATH_INLINE_CONSTEXPR constexpr +# define BOOST_MATH_STATIC constexpr +# define BOOST_MATH_STATIC_LOCAL_VARIABLE static +# endif +#endif + +#define BOOST_MATH_FP_NAN FP_NAN +#define BOOST_MATH_FP_INFINITE FP_INFINITE +#define BOOST_MATH_FP_ZERO FP_ZERO +#define BOOST_MATH_FP_SUBNORMAL FP_SUBNORMAL +#define BOOST_MATH_FP_NORMAL FP_NORMAL + +#else // Special section for CUDA NVRTC to ensure we consume no STL headers + +#ifndef BOOST_MATH_STANDALONE +# define BOOST_MATH_STANDALONE +#endif + +#define BOOST_MATH_HAS_NVRTC +#define BOOST_MATH_ENABLE_CUDA +#define BOOST_MATH_HAS_GPU_SUPPORT + +#define BOOST_MATH_GPU_ENABLED __host__ __device__ +#define BOOST_MATH_CUDA_ENABLED __host__ __device__ + +#define BOOST_MATH_STATIC static +#define BOOST_MATH_STATIC_LOCAL_VARIABLE + +#define BOOST_MATH_NOEXCEPT(T) noexcept(boost::math::is_floating_point_v) +#define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T) +#define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) +#define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T) +#define BOOST_MATH_BIG_CONSTANT(T, N, V) static_cast(V) +#define BOOST_MATH_FORCEINLINE __forceinline__ +#define BOOST_MATH_STD_USING +#define BOOST_MATH_IF_CONSTEXPR if +#define BOOST_MATH_IS_FLOAT(T) (boost::math::is_floating_point::value) +#define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION constexpr +#define BOOST_MATH_NO_EXCEPTIONS +#define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION + +// This should be defined to nothing but since it is not specifically a math macro +// we need to undef before proceeding +#ifdef BOOST_FPU_EXCEPTION_GUARD +# undef BOOST_FPU_EXCEPTION_GUARD +#endif + +#define BOOST_FPU_EXCEPTION_GUARD + +template +BOOST_MATH_GPU_ENABLED constexpr void gpu_safe_swap(T& a, T& b) { T t(a); a = b; b = t; } + +#define BOOST_MATH_GPU_SAFE_SWAP(a, b) gpu_safe_swap(a, b) +#define BOOST_MATH_GPU_SAFE_MIN(a, b) (::min)(a, b) +#define BOOST_MATH_GPU_SAFE_MAX(a, b) (::max)(a, b) + +#define BOOST_MATH_FP_NAN 0 +#define BOOST_MATH_FP_INFINITE 1 +#define BOOST_MATH_FP_ZERO 2 +#define BOOST_MATH_FP_SUBNORMAL 3 +#define BOOST_MATH_FP_NORMAL 4 + +#define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF +#define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT + +#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L +# define BOOST_MATH_INLINE_CONSTEXPR inline constexpr +#else +# define BOOST_MATH_INLINE_CONSTEXPR constexpr +#endif + +#define BOOST_MATH_INSTRUMENT_VARIABLE(x) +#define BOOST_MATH_INSTRUMENT_CODE(x) + +#endif // NVRTC #endif // BOOST_MATH_TOOLS_CONFIG_HPP diff --git a/include/boost/math/tools/convert_from_string.hpp b/include/boost/math/tools/convert_from_string.hpp index f6fe08ae..3b7895cd 100644 --- a/include/boost/math/tools/convert_from_string.hpp +++ b/include/boost/math/tools/convert_from_string.hpp @@ -14,7 +14,18 @@ #include #include #ifndef BOOST_MATH_STANDALONE + +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + #include + +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #endif namespace boost{ namespace math{ namespace tools{ diff --git a/include/boost/math/tools/cstdint.hpp b/include/boost/math/tools/cstdint.hpp new file mode 100644 index 00000000..ce2c913b --- /dev/null +++ b/include/boost/math/tools/cstdint.hpp @@ -0,0 +1,107 @@ +// Copyright (c) 2024 Matt Borland +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_TOOLS_CSTDINT +#define BOOST_MATH_TOOLS_CSTDINT + +#include + + +#ifdef BOOST_MATH_ENABLE_CUDA + +#include + +namespace boost { +namespace math { + +using cuda::std::int8_t; +using cuda::std::int16_t; +using cuda::std::int32_t; +using cuda::std::int64_t; + +using cuda::std::int_fast8_t; +using cuda::std::int_fast16_t; +using cuda::std::int_fast32_t; +using cuda::std::int_fast64_t; + +using cuda::std::int_least8_t; +using cuda::std::int_least16_t; +using cuda::std::int_least32_t; +using cuda::std::int_least64_t; + +using cuda::std::intmax_t; +using cuda::std::intptr_t; + +using cuda::std::uint8_t; +using cuda::std::uint16_t; +using cuda::std::uint32_t; +using cuda::std::uint64_t; + +using cuda::std::uint_fast8_t; +using cuda::std::uint_fast16_t; +using cuda::std::uint_fast32_t; +using cuda::std::uint_fast64_t; + +using cuda::std::uint_least8_t; +using cuda::std::uint_least16_t; +using cuda::std::uint_least32_t; +using cuda::std::uint_least64_t; + +using cuda::std::uintmax_t; +using cuda::std::uintptr_t; + +using size_t = unsigned long; + +#else + +#include + +namespace boost { +namespace math { + +using std::int8_t; +using std::int16_t; +using std::int32_t; +using std::int64_t; + +using std::int_fast8_t; +using std::int_fast16_t; +using std::int_fast32_t; +using std::int_fast64_t; + +using std::int_least8_t; +using std::int_least16_t; +using std::int_least32_t; +using std::int_least64_t; + +using std::intmax_t; +using std::intptr_t; + +using std::uint8_t; +using std::uint16_t; +using std::uint32_t; +using std::uint64_t; + +using std::uint_fast8_t; +using std::uint_fast16_t; +using std::uint_fast32_t; +using std::uint_fast64_t; + +using std::uint_least8_t; +using std::uint_least16_t; +using std::uint_least32_t; +using std::uint_least64_t; + +using std::uintmax_t; +using std::uintptr_t; + +using std::size_t; + +#endif + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_TOOLS_CSTDINT diff --git a/include/boost/math/tools/detail/polynomial_horner1_10.hpp b/include/boost/math/tools/detail/polynomial_horner1_10.hpp index 6876af2d..04ad90b6 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_10.hpp @@ -12,67 +12,67 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_11.hpp b/include/boost/math/tools/detail/polynomial_horner1_11.hpp index a5154c7a..f99ab825 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_11.hpp @@ -12,73 +12,73 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_12.hpp b/include/boost/math/tools/detail/polynomial_horner1_12.hpp index 82bf88c2..3006ebe5 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_12.hpp @@ -12,79 +12,79 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_13.hpp b/include/boost/math/tools/detail/polynomial_horner1_13.hpp index f61c553d..0f111890 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_13.hpp @@ -12,85 +12,85 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_14.hpp b/include/boost/math/tools/detail/polynomial_horner1_14.hpp index 76e9f07b..caba4b97 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_14.hpp @@ -12,91 +12,91 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_15.hpp b/include/boost/math/tools/detail/polynomial_horner1_15.hpp index bca8cf72..c8f42ac8 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_15.hpp @@ -12,97 +12,97 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_16.hpp b/include/boost/math/tools/detail/polynomial_horner1_16.hpp index 16ddb081..2ed591cc 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_16.hpp @@ -12,103 +12,103 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_17.hpp b/include/boost/math/tools/detail/polynomial_horner1_17.hpp index 5828621f..5e9fc8cd 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_17.hpp @@ -12,109 +12,109 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_18.hpp b/include/boost/math/tools/detail/polynomial_horner1_18.hpp index a2a1c12f..ffb62ff0 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_18.hpp @@ -12,115 +12,115 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_19.hpp b/include/boost/math/tools/detail/polynomial_horner1_19.hpp index 83ede26b..56df108a 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_19.hpp @@ -12,121 +12,121 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_2.hpp b/include/boost/math/tools/detail/polynomial_horner1_2.hpp index 93d0f7c9..63091ebd 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_2.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_20.hpp b/include/boost/math/tools/detail/polynomial_horner1_20.hpp index d7702091..c16e5143 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_20.hpp @@ -12,127 +12,127 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_3.hpp b/include/boost/math/tools/detail/polynomial_horner1_3.hpp index 0fde1a74..0aeccc11 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_3.hpp @@ -12,25 +12,25 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_4.hpp b/include/boost/math/tools/detail/polynomial_horner1_4.hpp index 9e589791..61058fce 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_5.hpp b/include/boost/math/tools/detail/polynomial_horner1_5.hpp index 64dc0025..47021bc5 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_6.hpp b/include/boost/math/tools/detail/polynomial_horner1_6.hpp index dbc06347..bfd24371 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_6.hpp @@ -12,43 +12,43 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_7.hpp b/include/boost/math/tools/detail/polynomial_horner1_7.hpp index 1472b2ed..50ddca63 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_7.hpp @@ -12,49 +12,49 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_8.hpp b/include/boost/math/tools/detail/polynomial_horner1_8.hpp index 95edfa0c..3be7ba4d 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_8.hpp @@ -12,55 +12,55 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_9.hpp b/include/boost/math/tools/detail/polynomial_horner1_9.hpp index f434a26c..4ec53c48 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_9.hpp @@ -12,61 +12,61 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_10.hpp b/include/boost/math/tools/detail/polynomial_horner2_10.hpp index 1fce239a..f242d746 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_10.hpp @@ -12,72 +12,72 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_11.hpp b/include/boost/math/tools/detail/polynomial_horner2_11.hpp index 3cf086c3..edf7f86c 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_11.hpp @@ -12,79 +12,79 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_12.hpp b/include/boost/math/tools/detail/polynomial_horner2_12.hpp index e9f8eae7..969c9c4d 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_12.hpp @@ -12,86 +12,86 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_13.hpp b/include/boost/math/tools/detail/polynomial_horner2_13.hpp index d9d2a5e2..ed4559d1 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_13.hpp @@ -12,93 +12,93 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_14.hpp b/include/boost/math/tools/detail/polynomial_horner2_14.hpp index b4280597..4b79eb78 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_14.hpp @@ -12,100 +12,100 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_15.hpp b/include/boost/math/tools/detail/polynomial_horner2_15.hpp index 89a7a46f..28b62eee 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_15.hpp @@ -12,107 +12,107 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_16.hpp b/include/boost/math/tools/detail/polynomial_horner2_16.hpp index d2379d2b..6368b405 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_16.hpp @@ -12,114 +12,114 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_17.hpp b/include/boost/math/tools/detail/polynomial_horner2_17.hpp index d1921efc..551e6191 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_17.hpp @@ -12,121 +12,121 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_18.hpp b/include/boost/math/tools/detail/polynomial_horner2_18.hpp index 945c4e40..19cfdc19 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_18.hpp @@ -12,128 +12,128 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_19.hpp b/include/boost/math/tools/detail/polynomial_horner2_19.hpp index a3049354..9ea87fd9 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_19.hpp @@ -12,135 +12,135 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_2.hpp b/include/boost/math/tools/detail/polynomial_horner2_2.hpp index 8b3a7dcd..1982a81f 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_20.hpp b/include/boost/math/tools/detail/polynomial_horner2_20.hpp index a4ccc93b..23afe55e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_20.hpp @@ -12,142 +12,142 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_3.hpp b/include/boost/math/tools/detail/polynomial_horner2_3.hpp index d0b988cf..f9d6953b 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_4.hpp b/include/boost/math/tools/detail/polynomial_horner2_4.hpp index 7f070868..8f11de5b 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_5.hpp b/include/boost/math/tools/detail/polynomial_horner2_5.hpp index f4e7b809..eba9ee9e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_6.hpp b/include/boost/math/tools/detail/polynomial_horner2_6.hpp index 764e5225..ef77c625 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_6.hpp @@ -12,44 +12,44 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_7.hpp b/include/boost/math/tools/detail/polynomial_horner2_7.hpp index 50fb3333..fe8d21b9 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_7.hpp @@ -12,51 +12,51 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_8.hpp b/include/boost/math/tools/detail/polynomial_horner2_8.hpp index c74b19d4..de1810a9 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_8.hpp @@ -12,58 +12,58 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_9.hpp b/include/boost/math/tools/detail/polynomial_horner2_9.hpp index 7d6e7e42..5c53b732 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_9.hpp @@ -12,65 +12,65 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner3_10.hpp b/include/boost/math/tools/detail/polynomial_horner3_10.hpp index b980b1b3..7fb5bb47 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_10.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_11.hpp b/include/boost/math/tools/detail/polynomial_horner3_11.hpp index 2ab4b2ac..9f22820d 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_11.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_12.hpp b/include/boost/math/tools/detail/polynomial_horner3_12.hpp index 46064272..b0496137 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_12.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_13.hpp b/include/boost/math/tools/detail/polynomial_horner3_13.hpp index d35fa904..f39a33cc 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_13.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_14.hpp b/include/boost/math/tools/detail/polynomial_horner3_14.hpp index 346b9dc2..32b9e7db 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_14.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_15.hpp b/include/boost/math/tools/detail/polynomial_horner3_15.hpp index 500bc323..55325c84 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_15.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_16.hpp b/include/boost/math/tools/detail/polynomial_horner3_16.hpp index 269f3673..f71d62f5 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_16.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_17.hpp b/include/boost/math/tools/detail/polynomial_horner3_17.hpp index 1d97a6f1..783a3455 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_17.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_18.hpp b/include/boost/math/tools/detail/polynomial_horner3_18.hpp index 80e49cbb..b10b270c 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_18.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_19.hpp b/include/boost/math/tools/detail/polynomial_horner3_19.hpp index eae3775e..21147591 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_19.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -406,7 +406,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_2.hpp b/include/boost/math/tools/detail/polynomial_horner3_2.hpp index 62816742..ee3e35e6 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_20.hpp b/include/boost/math/tools/detail/polynomial_horner3_20.hpp index 00f8caae..338aeb7d 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_20.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -406,7 +406,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -447,7 +447,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_3.hpp b/include/boost/math/tools/detail/polynomial_horner3_3.hpp index 8f69c2bf..1eee0cfa 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_4.hpp b/include/boost/math/tools/detail/polynomial_horner3_4.hpp index 34db8123..efa7fba4 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_5.hpp b/include/boost/math/tools/detail/polynomial_horner3_5.hpp index ed955e4a..f150e2a4 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_6.hpp b/include/boost/math/tools/detail/polynomial_horner3_6.hpp index 96d9a6dd..fe679e74 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_6.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_7.hpp b/include/boost/math/tools/detail/polynomial_horner3_7.hpp index 80a9f3af..76f080ad 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_7.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_8.hpp b/include/boost/math/tools/detail/polynomial_horner3_8.hpp index ee526ad7..75634bdf 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_8.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_9.hpp b/include/boost/math/tools/detail/polynomial_horner3_9.hpp index a17ce909..63a40580 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_9.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/rational_horner1_10.hpp b/include/boost/math/tools/detail/rational_horner1_10.hpp index dd23e0d7..e2f6c6d2 100644 --- a/include/boost/math/tools/detail/rational_horner1_10.hpp +++ b/include/boost/math/tools/detail/rational_horner1_10.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_11.hpp b/include/boost/math/tools/detail/rational_horner1_11.hpp index 7ca35d39..31d480a6 100644 --- a/include/boost/math/tools/detail/rational_horner1_11.hpp +++ b/include/boost/math/tools/detail/rational_horner1_11.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_12.hpp b/include/boost/math/tools/detail/rational_horner1_12.hpp index 5ee31385..c08a85b3 100644 --- a/include/boost/math/tools/detail/rational_horner1_12.hpp +++ b/include/boost/math/tools/detail/rational_horner1_12.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_13.hpp b/include/boost/math/tools/detail/rational_horner1_13.hpp index 6e675777..cc87ec2d 100644 --- a/include/boost/math/tools/detail/rational_horner1_13.hpp +++ b/include/boost/math/tools/detail/rational_horner1_13.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_14.hpp b/include/boost/math/tools/detail/rational_horner1_14.hpp index b8e5f7b2..25647371 100644 --- a/include/boost/math/tools/detail/rational_horner1_14.hpp +++ b/include/boost/math/tools/detail/rational_horner1_14.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_15.hpp b/include/boost/math/tools/detail/rational_horner1_15.hpp index 801f4439..2ab24814 100644 --- a/include/boost/math/tools/detail/rational_horner1_15.hpp +++ b/include/boost/math/tools/detail/rational_horner1_15.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_16.hpp b/include/boost/math/tools/detail/rational_horner1_16.hpp index b0f8cbb0..dce0b5e9 100644 --- a/include/boost/math/tools/detail/rational_horner1_16.hpp +++ b/include/boost/math/tools/detail/rational_horner1_16.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -192,9 +192,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_17.hpp b/include/boost/math/tools/detail/rational_horner1_17.hpp index 32759b83..8e875d65 100644 --- a/include/boost/math/tools/detail/rational_horner1_17.hpp +++ b/include/boost/math/tools/detail/rational_horner1_17.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -192,9 +192,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -204,9 +204,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_18.hpp b/include/boost/math/tools/detail/rational_horner1_18.hpp index 6c91a930..ab67a970 100644 --- a/include/boost/math/tools/detail/rational_horner1_18.hpp +++ b/include/boost/math/tools/detail/rational_horner1_18.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -192,9 +192,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -204,9 +204,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -216,9 +216,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_19.hpp b/include/boost/math/tools/detail/rational_horner1_19.hpp index 8c9e0831..dc300343 100644 --- a/include/boost/math/tools/detail/rational_horner1_19.hpp +++ b/include/boost/math/tools/detail/rational_horner1_19.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -192,9 +192,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -204,9 +204,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -216,9 +216,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -228,9 +228,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_2.hpp b/include/boost/math/tools/detail/rational_horner1_2.hpp index 605bb042..c6b1ef9e 100644 --- a/include/boost/math/tools/detail/rational_horner1_2.hpp +++ b/include/boost/math/tools/detail/rational_horner1_2.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_20.hpp b/include/boost/math/tools/detail/rational_horner1_20.hpp index 2c29d6ba..5b8b170c 100644 --- a/include/boost/math/tools/detail/rational_horner1_20.hpp +++ b/include/boost/math/tools/detail/rational_horner1_20.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -120,9 +120,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -132,9 +132,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -144,9 +144,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -156,9 +156,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -168,9 +168,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -192,9 +192,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -204,9 +204,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -216,9 +216,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -228,9 +228,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -240,9 +240,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_3.hpp b/include/boost/math/tools/detail/rational_horner1_3.hpp index 3f16fdf1..6933e22b 100644 --- a/include/boost/math/tools/detail/rational_horner1_3.hpp +++ b/include/boost/math/tools/detail/rational_horner1_3.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_4.hpp b/include/boost/math/tools/detail/rational_horner1_4.hpp index 778a692c..49b98357 100644 --- a/include/boost/math/tools/detail/rational_horner1_4.hpp +++ b/include/boost/math/tools/detail/rational_horner1_4.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_5.hpp b/include/boost/math/tools/detail/rational_horner1_5.hpp index 0ae61fca..91e97ff4 100644 --- a/include/boost/math/tools/detail/rational_horner1_5.hpp +++ b/include/boost/math/tools/detail/rational_horner1_5.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_6.hpp b/include/boost/math/tools/detail/rational_horner1_6.hpp index 9e250169..876b026c 100644 --- a/include/boost/math/tools/detail/rational_horner1_6.hpp +++ b/include/boost/math/tools/detail/rational_horner1_6.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_7.hpp b/include/boost/math/tools/detail/rational_horner1_7.hpp index 7dc78d1f..bcac1829 100644 --- a/include/boost/math/tools/detail/rational_horner1_7.hpp +++ b/include/boost/math/tools/detail/rational_horner1_7.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_8.hpp b/include/boost/math/tools/detail/rational_horner1_8.hpp index 8f5df2c2..55e30a53 100644 --- a/include/boost/math/tools/detail/rational_horner1_8.hpp +++ b/include/boost/math/tools/detail/rational_horner1_8.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner1_9.hpp b/include/boost/math/tools/detail/rational_horner1_9.hpp index a46c9d7a..c7087de5 100644 --- a/include/boost/math/tools/detail/rational_horner1_9.hpp +++ b/include/boost/math/tools/detail/rational_horner1_9.hpp @@ -12,21 +12,21 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); else { @@ -36,9 +36,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); else { @@ -48,9 +48,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -60,9 +60,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -72,9 +72,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -84,9 +84,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -96,9 +96,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { @@ -108,9 +108,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); else { diff --git a/include/boost/math/tools/detail/rational_horner2_10.hpp b/include/boost/math/tools/detail/rational_horner2_10.hpp index f3ff0753..4d74a714 100644 --- a/include/boost/math/tools/detail/rational_horner2_10.hpp +++ b/include/boost/math/tools/detail/rational_horner2_10.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_11.hpp b/include/boost/math/tools/detail/rational_horner2_11.hpp index 250b4ee2..15f1cf25 100644 --- a/include/boost/math/tools/detail/rational_horner2_11.hpp +++ b/include/boost/math/tools/detail/rational_horner2_11.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_12.hpp b/include/boost/math/tools/detail/rational_horner2_12.hpp index df2b2771..24e9d9e7 100644 --- a/include/boost/math/tools/detail/rational_horner2_12.hpp +++ b/include/boost/math/tools/detail/rational_horner2_12.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_13.hpp b/include/boost/math/tools/detail/rational_horner2_13.hpp index 2bbc97e4..495f8852 100644 --- a/include/boost/math/tools/detail/rational_horner2_13.hpp +++ b/include/boost/math/tools/detail/rational_horner2_13.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_14.hpp b/include/boost/math/tools/detail/rational_horner2_14.hpp index 157a844c..273e723b 100644 --- a/include/boost/math/tools/detail/rational_horner2_14.hpp +++ b/include/boost/math/tools/detail/rational_horner2_14.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_15.hpp b/include/boost/math/tools/detail/rational_horner2_15.hpp index 9b392bef..c7e24ec7 100644 --- a/include/boost/math/tools/detail/rational_horner2_15.hpp +++ b/include/boost/math/tools/detail/rational_horner2_15.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_16.hpp b/include/boost/math/tools/detail/rational_horner2_16.hpp index d884131a..2eebd702 100644 --- a/include/boost/math/tools/detail/rational_horner2_16.hpp +++ b/include/boost/math/tools/detail/rational_horner2_16.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -218,9 +218,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_17.hpp b/include/boost/math/tools/detail/rational_horner2_17.hpp index 87efe07f..1fee6304 100644 --- a/include/boost/math/tools/detail/rational_horner2_17.hpp +++ b/include/boost/math/tools/detail/rational_horner2_17.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -218,9 +218,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -234,9 +234,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_18.hpp b/include/boost/math/tools/detail/rational_horner2_18.hpp index 6989c6db..7aedbf2a 100644 --- a/include/boost/math/tools/detail/rational_horner2_18.hpp +++ b/include/boost/math/tools/detail/rational_horner2_18.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -218,9 +218,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -234,9 +234,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -250,9 +250,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_19.hpp b/include/boost/math/tools/detail/rational_horner2_19.hpp index 11d382a5..1c36a267 100644 --- a/include/boost/math/tools/detail/rational_horner2_19.hpp +++ b/include/boost/math/tools/detail/rational_horner2_19.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -218,9 +218,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -234,9 +234,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -250,9 +250,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -266,9 +266,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_2.hpp b/include/boost/math/tools/detail/rational_horner2_2.hpp index 9c4fe47a..bb2e2c4d 100644 --- a/include/boost/math/tools/detail/rational_horner2_2.hpp +++ b/include/boost/math/tools/detail/rational_horner2_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_20.hpp b/include/boost/math/tools/detail/rational_horner2_20.hpp index 469cbb7e..a591b901 100644 --- a/include/boost/math/tools/detail/rational_horner2_20.hpp +++ b/include/boost/math/tools/detail/rational_horner2_20.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -122,9 +122,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -138,9 +138,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -154,9 +154,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -170,9 +170,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -186,9 +186,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -202,9 +202,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -218,9 +218,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -234,9 +234,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -250,9 +250,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -266,9 +266,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); @@ -282,9 +282,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((((b[19] * x2 + b[17]) * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_3.hpp b/include/boost/math/tools/detail/rational_horner2_3.hpp index d19993cc..0b410d8b 100644 --- a/include/boost/math/tools/detail/rational_horner2_3.hpp +++ b/include/boost/math/tools/detail/rational_horner2_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_4.hpp b/include/boost/math/tools/detail/rational_horner2_4.hpp index 847f26dc..07a9a2c5 100644 --- a/include/boost/math/tools/detail/rational_horner2_4.hpp +++ b/include/boost/math/tools/detail/rational_horner2_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_5.hpp b/include/boost/math/tools/detail/rational_horner2_5.hpp index e1cf5667..0933ddfb 100644 --- a/include/boost/math/tools/detail/rational_horner2_5.hpp +++ b/include/boost/math/tools/detail/rational_horner2_5.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_6.hpp b/include/boost/math/tools/detail/rational_horner2_6.hpp index 480fcb47..dee9c6e1 100644 --- a/include/boost/math/tools/detail/rational_horner2_6.hpp +++ b/include/boost/math/tools/detail/rational_horner2_6.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_7.hpp b/include/boost/math/tools/detail/rational_horner2_7.hpp index 9ae76bd3..6f9a8583 100644 --- a/include/boost/math/tools/detail/rational_horner2_7.hpp +++ b/include/boost/math/tools/detail/rational_horner2_7.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner2_8.hpp b/include/boost/math/tools/detail/rational_horner2_8.hpp index 2f82d365..33dda23b 100644 --- a/include/boost/math/tools/detail/rational_horner2_8.hpp +++ b/include/boost/math/tools/detail/rational_horner2_8.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_9.hpp b/include/boost/math/tools/detail/rational_horner2_9.hpp index e4b22243..a9025a89 100644 --- a/include/boost/math/tools/detail/rational_horner2_9.hpp +++ b/include/boost/math/tools/detail/rational_horner2_9.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); @@ -58,9 +58,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); @@ -74,9 +74,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); @@ -90,9 +90,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); @@ -106,9 +106,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); diff --git a/include/boost/math/tools/detail/rational_horner3_10.hpp b/include/boost/math/tools/detail/rational_horner3_10.hpp index 9b3bdbe9..b7cec124 100644 --- a/include/boost/math/tools/detail/rational_horner3_10.hpp +++ b/include/boost/math/tools/detail/rational_horner3_10.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_11.hpp b/include/boost/math/tools/detail/rational_horner3_11.hpp index dd00d58c..579f0e48 100644 --- a/include/boost/math/tools/detail/rational_horner3_11.hpp +++ b/include/boost/math/tools/detail/rational_horner3_11.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_12.hpp b/include/boost/math/tools/detail/rational_horner3_12.hpp index bfc53420..54300dd0 100644 --- a/include/boost/math/tools/detail/rational_horner3_12.hpp +++ b/include/boost/math/tools/detail/rational_horner3_12.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_13.hpp b/include/boost/math/tools/detail/rational_horner3_13.hpp index c1237d58..d2fc7b63 100644 --- a/include/boost/math/tools/detail/rational_horner3_13.hpp +++ b/include/boost/math/tools/detail/rational_horner3_13.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_14.hpp b/include/boost/math/tools/detail/rational_horner3_14.hpp index 030fa4ec..0b7675f4 100644 --- a/include/boost/math/tools/detail/rational_horner3_14.hpp +++ b/include/boost/math/tools/detail/rational_horner3_14.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_15.hpp b/include/boost/math/tools/detail/rational_horner3_15.hpp index 92526754..8286caed 100644 --- a/include/boost/math/tools/detail/rational_horner3_15.hpp +++ b/include/boost/math/tools/detail/rational_horner3_15.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_16.hpp b/include/boost/math/tools/detail/rational_horner3_16.hpp index 5bbf67d9..fc823e41 100644 --- a/include/boost/math/tools/detail/rational_horner3_16.hpp +++ b/include/boost/math/tools/detail/rational_horner3_16.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -900,9 +900,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_17.hpp b/include/boost/math/tools/detail/rational_horner3_17.hpp index 1f1e2d73..cf7f75a7 100644 --- a/include/boost/math/tools/detail/rational_horner3_17.hpp +++ b/include/boost/math/tools/detail/rational_horner3_17.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -900,9 +900,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1026,9 +1026,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_18.hpp b/include/boost/math/tools/detail/rational_horner3_18.hpp index 6ce9844b..f853ed3e 100644 --- a/include/boost/math/tools/detail/rational_horner3_18.hpp +++ b/include/boost/math/tools/detail/rational_horner3_18.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -900,9 +900,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1026,9 +1026,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1160,9 +1160,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_19.hpp b/include/boost/math/tools/detail/rational_horner3_19.hpp index b1084476..d44e22c9 100644 --- a/include/boost/math/tools/detail/rational_horner3_19.hpp +++ b/include/boost/math/tools/detail/rational_horner3_19.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -900,9 +900,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1026,9 +1026,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1160,9 +1160,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1302,9 +1302,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_2.hpp b/include/boost/math/tools/detail/rational_horner3_2.hpp index 9c4fe47a..bb2e2c4d 100644 --- a/include/boost/math/tools/detail/rational_horner3_2.hpp +++ b/include/boost/math/tools/detail/rational_horner3_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_20.hpp b/include/boost/math/tools/detail/rational_horner3_20.hpp index e125934a..967edf08 100644 --- a/include/boost/math/tools/detail/rational_horner3_20.hpp +++ b/include/boost/math/tools/detail/rational_horner3_20.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -312,9 +312,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -390,9 +390,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -476,9 +476,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -570,9 +570,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -672,9 +672,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -782,9 +782,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -900,9 +900,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1026,9 +1026,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1160,9 +1160,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1302,9 +1302,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -1452,9 +1452,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_3.hpp b/include/boost/math/tools/detail/rational_horner3_3.hpp index d19993cc..0b410d8b 100644 --- a/include/boost/math/tools/detail/rational_horner3_3.hpp +++ b/include/boost/math/tools/detail/rational_horner3_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_4.hpp b/include/boost/math/tools/detail/rational_horner3_4.hpp index 847f26dc..07a9a2c5 100644 --- a/include/boost/math/tools/detail/rational_horner3_4.hpp +++ b/include/boost/math/tools/detail/rational_horner3_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_5.hpp b/include/boost/math/tools/detail/rational_horner3_5.hpp index 0150b143..62c76dd5 100644 --- a/include/boost/math/tools/detail/rational_horner3_5.hpp +++ b/include/boost/math/tools/detail/rational_horner3_5.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_6.hpp b/include/boost/math/tools/detail/rational_horner3_6.hpp index c4a2c14f..f81a068a 100644 --- a/include/boost/math/tools/detail/rational_horner3_6.hpp +++ b/include/boost/math/tools/detail/rational_horner3_6.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_7.hpp b/include/boost/math/tools/detail/rational_horner3_7.hpp index 43555ab1..fea457cc 100644 --- a/include/boost/math/tools/detail/rational_horner3_7.hpp +++ b/include/boost/math/tools/detail/rational_horner3_7.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_8.hpp b/include/boost/math/tools/detail/rational_horner3_8.hpp index 1c14fb46..306e2a41 100644 --- a/include/boost/math/tools/detail/rational_horner3_8.hpp +++ b/include/boost/math/tools/detail/rational_horner3_8.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/detail/rational_horner3_9.hpp b/include/boost/math/tools/detail/rational_horner3_9.hpp index 05703523..93a3527c 100644 --- a/include/boost/math/tools/detail/rational_horner3_9.hpp +++ b/include/boost/math/tools/detail/rational_horner3_9.hpp @@ -12,39 +12,39 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -80,9 +80,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -126,9 +126,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -180,9 +180,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; @@ -242,9 +242,9 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant*) BOOST_MATH_NOEXCEPT(V) { - if(x <= 1) + if((-1 <= x) && (x <= 1)) { V x2 = x * x; V t[4]; diff --git a/include/boost/math/tools/fraction.hpp b/include/boost/math/tools/fraction.hpp index a64c0702..f36d024c 100644 --- a/include/boost/math/tools/fraction.hpp +++ b/include/boost/math/tools/fraction.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2005-2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,11 +11,13 @@ #pragma once #endif +#include +#include +#include +#include #include #include -#include -#include -#include +#include namespace boost{ namespace math{ namespace tools{ @@ -22,10 +25,10 @@ namespace detail { template - struct is_pair : public std::false_type{}; + struct is_pair : public boost::math::false_type{}; template - struct is_pair> : public std::true_type{}; + struct is_pair> : public boost::math::true_type{}; template struct fraction_traits_simple @@ -33,11 +36,11 @@ namespace detail using result_type = typename Gen::result_type; using value_type = typename Gen::result_type; - static result_type a(const value_type&) BOOST_MATH_NOEXCEPT(value_type) + BOOST_MATH_GPU_ENABLED static result_type a(const value_type&) BOOST_MATH_NOEXCEPT(value_type) { return 1; } - static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) + BOOST_MATH_GPU_ENABLED static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) { return v; } @@ -49,11 +52,11 @@ namespace detail using value_type = typename Gen::result_type; using result_type = typename value_type::first_type; - static result_type a(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) + BOOST_MATH_GPU_ENABLED static result_type a(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) { return v.first; } - static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) + BOOST_MATH_GPU_ENABLED static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type) { return v.second; } @@ -61,7 +64,7 @@ namespace detail template struct fraction_traits - : public std::conditional< + : public boost::math::conditional< is_pair::value, fraction_traits_pair, fraction_traits_simple>::type @@ -74,7 +77,7 @@ namespace detail // For float, double, and long double, 1/min_value() is finite. // But for mpfr_float and cpp_bin_float, 1/min_value() is inf. // Multiply the min by 16 so that the reciprocal doesn't overflow. - static T get() { + BOOST_MATH_GPU_ENABLED static T get() { return 16*tools::min_value(); } }; @@ -82,13 +85,15 @@ namespace detail struct tiny_value { using value_type = typename T::value_type; - static T get() { + BOOST_MATH_GPU_ENABLED static T get() { return 16*tools::min_value(); } }; } // namespace detail +namespace detail { + // // continued_fraction_b // Evaluates: @@ -103,9 +108,15 @@ namespace detail // // Note that the first a0 returned by generator Gen is discarded. // + template -inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor, std::uintmax_t& max_terms) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b_impl(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + // SYCL can not handle this condition so we only check float on that platform + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -129,7 +140,7 @@ inline typename detail::fraction_traits::result_type continued_fraction_b(G C = f; D = 0; - std::uintmax_t counter(max_terms); + boost::math::uintmax_t counter(max_terms); do{ v = g(); D = traits::b(v) + traits::a(v) * D; @@ -148,17 +159,38 @@ inline typename detail::fraction_traits::result_type continued_fraction_b(G return f; } +} // namespace detail + +template +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) +{ + return detail::continued_fraction_b_impl(g, factor, max_terms); +} + template -inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { - std::uintmax_t max_terms = (std::numeric_limits::max)(); - return continued_fraction_b(g, factor, max_terms); + boost::math::uintmax_t max_terms = (boost::math::numeric_limits::max)(); + return detail::continued_fraction_b_impl(g, factor, max_terms); } template -inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -166,13 +198,17 @@ inline typename detail::fraction_traits::result_type continued_fraction_b(G using result_type = typename traits::result_type; result_type factor = ldexp(1.0f, 1 - bits); // 1 / pow(result_type(2), bits); - std::uintmax_t max_terms = (std::numeric_limits::max)(); - return continued_fraction_b(g, factor, max_terms); + boost::math::uintmax_t max_terms = (boost::math::numeric_limits::max)(); + return detail::continued_fraction_b_impl(g, factor, max_terms); } template -inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits, std::uintmax_t& max_terms) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -180,9 +216,11 @@ inline typename detail::fraction_traits::result_type continued_fraction_b(G using result_type = typename traits::result_type; result_type factor = ldexp(1.0f, 1 - bits); // 1 / pow(result_type(2), bits); - return continued_fraction_b(g, factor, max_terms); + return detail::continued_fraction_b_impl(g, factor, max_terms); } +namespace detail { + // // continued_fraction_a // Evaluates: @@ -198,8 +236,12 @@ inline typename detail::fraction_traits::result_type continued_fraction_b(G // Note that the first a1 and b1 returned by generator Gen are both used. // template -inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor, std::uintmax_t& max_terms) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a_impl(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -224,7 +266,7 @@ inline typename detail::fraction_traits::result_type continued_fraction_a(G C = f; D = 0; - std::uintmax_t counter(max_terms); + boost::math::uintmax_t counter(max_terms); do{ v = g(); @@ -244,17 +286,38 @@ inline typename detail::fraction_traits::result_type continued_fraction_a(G return a0/f; } +} // namespace detail + +template +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) +{ + return detail::continued_fraction_a_impl(g, factor, max_terms); +} + template -inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { - std::uintmax_t max_iter = (std::numeric_limits::max)(); - return continued_fraction_a(g, factor, max_iter); + boost::math::uintmax_t max_iter = (boost::math::numeric_limits::max)(); + return detail::continued_fraction_a_impl(g, factor, max_iter); } template -inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -262,14 +325,18 @@ inline typename detail::fraction_traits::result_type continued_fraction_a(G typedef typename traits::result_type result_type; result_type factor = ldexp(1.0f, 1-bits); // 1 / pow(result_type(2), bits); - std::uintmax_t max_iter = (std::numeric_limits::max)(); + boost::math::uintmax_t max_iter = (boost::math::numeric_limits::max)(); - return continued_fraction_a(g, factor, max_iter); + return detail::continued_fraction_a_impl(g, factor, max_iter); } template -inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits, std::uintmax_t& max_terms) - noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits, boost::math::uintmax_t& max_terms) + noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()()) + #endif + ) { BOOST_MATH_STD_USING // ADL of std names @@ -277,7 +344,7 @@ inline typename detail::fraction_traits::result_type continued_fraction_a(G using result_type = typename traits::result_type; result_type factor = ldexp(1.0f, 1-bits); // 1 / pow(result_type(2), bits); - return continued_fraction_a(g, factor, max_terms); + return detail::continued_fraction_a_impl(g, factor, max_terms); } } // namespace tools diff --git a/include/boost/math/tools/is_constant_evaluated.hpp b/include/boost/math/tools/is_constant_evaluated.hpp index 6803b7d7..eb903dbd 100644 --- a/include/boost/math/tools/is_constant_evaluated.hpp +++ b/include/boost/math/tools/is_constant_evaluated.hpp @@ -19,7 +19,7 @@ #endif #ifdef __has_builtin -# if __has_builtin(__builtin_is_constant_evaluated) && !defined(BOOST_NO_CXX14_CONSTEXPR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) +# if __has_builtin(__builtin_is_constant_evaluated) && !defined(BOOST_MATH_NO_CXX14_CONSTEXPR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) # define BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED # endif #endif @@ -32,15 +32,15 @@ // // As does GCC-9: // -#if !defined(BOOST_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 9) && !defined(BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED) +#if !defined(BOOST_MATH_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 9) && !defined(BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED) # define BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED #endif -#if defined(BOOST_MATH_HAS_IS_CONSTANT_EVALUATED) && !defined(BOOST_NO_CXX14_CONSTEXPR) +#if defined(BOOST_MATH_HAS_IS_CONSTANT_EVALUATED) && !defined(BOOST_MATH_NO_CXX14_CONSTEXPR) # define BOOST_MATH_IS_CONSTANT_EVALUATED(x) std::is_constant_evaluated() #elif defined(BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED) # define BOOST_MATH_IS_CONSTANT_EVALUATED(x) __builtin_is_constant_evaluated() -#elif !defined(BOOST_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 6) +#elif !defined(BOOST_MATH_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 6) # define BOOST_MATH_IS_CONSTANT_EVALUATED(x) __builtin_constant_p(x) # define BOOST_MATH_USING_BUILTIN_CONSTANT_P #else diff --git a/include/boost/math/tools/is_detected.hpp b/include/boost/math/tools/is_detected.hpp index 8dfe86b7..93fa96f6 100644 --- a/include/boost/math/tools/is_detected.hpp +++ b/include/boost/math/tools/is_detected.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_MATH_TOOLS_IS_DETECTED_HPP #define BOOST_MATH_TOOLS_IS_DETECTED_HPP -#include +#include namespace boost { namespace math { namespace tools { @@ -20,14 +20,14 @@ namespace detail { template class Op, typename... Args> struct detector { - using value_t = std::false_type; + using value_t = boost::math::false_type; using type = Default; }; template class Op, typename... Args> struct detector>, Op, Args...> { - using value_t = std::true_type; + using value_t = boost::math::true_type; using type = Op; }; diff --git a/include/boost/math/tools/mp.hpp b/include/boost/math/tools/mp.hpp index 3100a0bb..560ae8b5 100644 --- a/include/boost/math/tools/mp.hpp +++ b/include/boost/math/tools/mp.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_MATH_TOOLS_MP #define BOOST_MATH_TOOLS_MP -#include -#include -#include +#include +#include +#include namespace boost { namespace math { namespace tools { namespace meta_programming { @@ -23,12 +23,12 @@ template struct mp_list {}; // Size_t -template -using mp_size_t = std::integral_constant; +template +using mp_size_t = boost::math::integral_constant; // Boolean template -using mp_bool = std::integral_constant; +using mp_bool = boost::math::integral_constant; // Identity template @@ -53,7 +53,7 @@ struct mp_size_impl {}; template class L, typename... T> // Template template parameter must use class struct mp_size_impl> { - using type = std::integral_constant; + using type = boost::math::integral_constant; }; } @@ -79,7 +79,7 @@ namespace detail { // At // TODO - Use tree based lookup for larger typelists // http://odinthenerd.blogspot.com/2017/04/tree-based-lookup-why-kvasirmpl-is.html -template +template struct mp_at_c {}; template class L, typename T0, typename... T> @@ -168,11 +168,11 @@ struct mp_at_c, 1 }; } -template -using mp_at_c = typename detail::mp_at_c::type; +template +using mp_at_c = typename detail::mp_at_c::type; -template -using mp_at = typename detail::mp_at_c::type; +template +using mp_at = typename detail::mp_at_c::type; // Back template @@ -336,25 +336,11 @@ using mp_remove_if = typename detail::mp_remove_if_impl::type; template using mp_remove_if_q = mp_remove_if; -// Index sequence -// Use C++14 index sequence if available -#if defined(__cpp_lib_integer_sequence) && (__cpp_lib_integer_sequence >= 201304) -template -using index_sequence = std::index_sequence; - -template -using make_index_sequence = std::make_index_sequence; - -template -using index_sequence_for = std::index_sequence_for; - -#else - -template +template struct integer_sequence {}; -template -using index_sequence = integer_sequence; +template +using index_sequence = integer_sequence; namespace detail { @@ -385,10 +371,10 @@ struct iseq_identity template struct append_integer_sequence {}; -template -struct append_integer_sequence, integer_sequence> +template +struct append_integer_sequence, integer_sequence> { - using type = integer_sequence; + using type = integer_sequence; }; template @@ -426,13 +412,11 @@ struct make_integer_sequence_impl template using make_integer_sequence = typename detail::make_integer_sequence_impl::type; -template -using make_index_sequence = make_integer_sequence; +template +using make_index_sequence = make_integer_sequence; template -using index_sequence_for = make_integer_sequence; - -#endif +using index_sequence_for = make_integer_sequence; }}}} // namespaces diff --git a/include/boost/math/tools/numeric_limits.hpp b/include/boost/math/tools/numeric_limits.hpp new file mode 100644 index 00000000..87a78023 --- /dev/null +++ b/include/boost/math/tools/numeric_limits.hpp @@ -0,0 +1,888 @@ +// Copyright (c) 2024 Matt Borland +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Regular use of std::numeric_limits functions can not be used on +// GPU platforms like CUDA since they are missing the __device__ marker +// and libcu++ does not provide something analogous. +// Rather than using giant if else blocks make our own version of numeric limits +// +// On the CUDA NVRTC platform we use a best attempt at emulating the functions +// and values since we do not have any macros to go off of. +// Use the values as found on GCC 11.4 RHEL 9.4 x64 + +#ifndef BOOST_MATH_TOOLS_NUMERIC_LIMITS_HPP +#define BOOST_MATH_TOOLS_NUMERIC_LIMITS_HPP + +#include + +#ifndef BOOST_MATH_HAS_NVRTC + +#include +#include +#include +#include + +#endif + +namespace boost { +namespace math { + +template +struct numeric_limits +#ifndef BOOST_MATH_HAS_NVRTC +: public std::numeric_limits {}; +#else +{}; +#endif + +#if defined(BOOST_MATH_HAS_GPU_SUPPORT) && !defined(BOOST_MATH_HAS_NVRTC) + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float (min) () { return FLT_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float (max) () { return FLT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float lowest () { return -FLT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float epsilon () { return FLT_EPSILON; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float round_error () { return 0.5F; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float infinity () { return static_cast(INFINITY); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float quiet_NaN () { return static_cast(NAN); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float signaling_NaN () + { + #ifdef FLT_SNAN + return FLT_SNAN; + #else + return static_cast(NAN); + #endif + } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float denorm_min () { return FLT_TRUE_MIN; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double (min) () { return DBL_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double (max) () { return DBL_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double lowest () { return -DBL_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double epsilon () { return DBL_EPSILON; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double round_error () { return 0.5; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double infinity () { return static_cast(INFINITY); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double quiet_NaN () { return static_cast(NAN); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double signaling_NaN () + { + #ifdef DBL_SNAN + return DBL_SNAN; + #else + return static_cast(NAN); + #endif + } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double denorm_min () { return DBL_TRUE_MIN; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short (min) () { return SHRT_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short (max) () { return SHRT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short lowest () { return SHRT_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short (max) () { return USHRT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int (min) () { return INT_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int (max) () { return INT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int lowest () { return INT_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int (max) () { return UINT_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long (min) () { return LONG_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long (max) () { return LONG_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long lowest () { return LONG_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long (max) () { return ULONG_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long (min) () { return LLONG_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long (max) () { return LLONG_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long lowest () { return LLONG_MIN; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long (max) () { return ULLONG_MAX; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = std::numeric_limits::is_specialized; + BOOST_MATH_STATIC constexpr bool is_signed = std::numeric_limits::is_signed; + BOOST_MATH_STATIC constexpr bool is_integer = std::numeric_limits::is_integer; + BOOST_MATH_STATIC constexpr bool is_exact = std::numeric_limits::is_exact; + BOOST_MATH_STATIC constexpr bool has_infinity = std::numeric_limits::has_infinity; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = std::numeric_limits::has_quiet_NaN; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = std::numeric_limits::has_signaling_NaN; + + BOOST_MATH_STATIC constexpr std::float_round_style round_style = std::numeric_limits::round_style; + BOOST_MATH_STATIC constexpr bool is_iec559 = std::numeric_limits::is_iec559; + BOOST_MATH_STATIC constexpr bool is_bounded = std::numeric_limits::is_bounded; + BOOST_MATH_STATIC constexpr bool is_modulo = std::numeric_limits::is_modulo; + BOOST_MATH_STATIC constexpr int digits = std::numeric_limits::digits; + BOOST_MATH_STATIC constexpr int digits10 = std::numeric_limits::digits10; + BOOST_MATH_STATIC constexpr int max_digits10 = std::numeric_limits::max_digits10; + BOOST_MATH_STATIC constexpr int radix = std::numeric_limits::radix; + BOOST_MATH_STATIC constexpr int min_exponent = std::numeric_limits::min_exponent; + BOOST_MATH_STATIC constexpr int min_exponent10 = std::numeric_limits::min_exponent10; + BOOST_MATH_STATIC constexpr int max_exponent = std::numeric_limits::max_exponent; + BOOST_MATH_STATIC constexpr int max_exponent10 = std::numeric_limits::max_exponent10; + BOOST_MATH_STATIC constexpr bool traps = std::numeric_limits::traps; + BOOST_MATH_STATIC constexpr bool tinyness_before = std::numeric_limits::tinyness_before; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool (min) () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool (max) () { return true; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool lowest () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool epsilon () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool round_error () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool infinity () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool quiet_NaN () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool signaling_NaN () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool denorm_min () { return false; } +}; + +#elif defined(BOOST_MATH_HAS_NVRTC) // Pure NVRTC support - Removes rounding style and approximates the traits + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = false; + BOOST_MATH_STATIC constexpr bool is_exact = false; + BOOST_MATH_STATIC constexpr bool has_infinity = true; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = true; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = true; + + BOOST_MATH_STATIC constexpr bool is_iec559 = true; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 24; + BOOST_MATH_STATIC constexpr int digits10 = 6; + BOOST_MATH_STATIC constexpr int max_digits10 = 9; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = -125; + BOOST_MATH_STATIC constexpr int min_exponent10 = -37; + BOOST_MATH_STATIC constexpr int max_exponent = 128; + BOOST_MATH_STATIC constexpr int max_exponent10 = 38; + BOOST_MATH_STATIC constexpr bool traps = false; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float (min) () { return 1.17549435e-38F; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float (max) () { return 3.40282347e+38F; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float lowest () { return -3.40282347e+38F; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float epsilon () { return 1.1920929e-07; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float round_error () { return 0.5F; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float infinity () { return __int_as_float(0x7f800000); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float quiet_NaN () { return __int_as_float(0x7fc00000); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float signaling_NaN () { return __int_as_float(0x7fa00000); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr float denorm_min () { return 1.4013e-45F; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = false; + BOOST_MATH_STATIC constexpr bool is_exact = false; + BOOST_MATH_STATIC constexpr bool has_infinity = true; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = true; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = true; + + BOOST_MATH_STATIC constexpr bool is_iec559 = true; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 53; + BOOST_MATH_STATIC constexpr int digits10 = 15; + BOOST_MATH_STATIC constexpr int max_digits10 = 21; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = -1021; + BOOST_MATH_STATIC constexpr int min_exponent10 = -307; + BOOST_MATH_STATIC constexpr int max_exponent = 1024; + BOOST_MATH_STATIC constexpr int max_exponent10 = 308; + BOOST_MATH_STATIC constexpr bool traps = false; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double (min) () { return 2.2250738585072014e-308; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double (max) () { return 1.7976931348623157e+308; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double lowest () { return -1.7976931348623157e+308; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double epsilon () { return 2.2204460492503131e-16; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double round_error () { return 0.5; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double infinity () { return __longlong_as_double(0x7ff0000000000000ULL); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double quiet_NaN () { return __longlong_as_double(0x7ff8000000000000ULL); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double signaling_NaN () { return __longlong_as_double(0x7ff4000000000000ULL); } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr double denorm_min () { return 4.9406564584124654e-324; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 15; + BOOST_MATH_STATIC constexpr int digits10 = 4; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short (min) () { return -32768; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short (max) () { return 32767; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short lowest () { return -32768; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr short denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = false; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = true; + BOOST_MATH_STATIC constexpr int digits = 16; + BOOST_MATH_STATIC constexpr int digits10 = 4; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short (max) () { return 65535U; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned short denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 31; + BOOST_MATH_STATIC constexpr int digits10 = 9; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int (min) () { return -2147483648; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int (max) () { return 2147483647; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int lowest () { return -2147483648; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr int denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = false; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = true; + BOOST_MATH_STATIC constexpr int digits = 32; + BOOST_MATH_STATIC constexpr int digits10 = 9; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int (max) () { return 4294967295U; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned int denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 63; + BOOST_MATH_STATIC constexpr int digits10 = 18; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long (min) () { return -9223372036854775808L; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long (max) () { return 9223372036854775807L; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long lowest () { return -9223372036854775808L; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = false; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = true; + BOOST_MATH_STATIC constexpr int digits = 64; + BOOST_MATH_STATIC constexpr int digits10 = 19; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long (max) () { return 18446744073709551615UL; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = true; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 63; + BOOST_MATH_STATIC constexpr int digits10 = 18; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long (min) () { return -9223372036854775808LL; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long (max) () { return 9223372036854775807LL; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long lowest () { return -9223372036854775808LL; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr long long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = false; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = true; + BOOST_MATH_STATIC constexpr int digits = 64; + BOOST_MATH_STATIC constexpr int digits10 = 19; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = true; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long (min) () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long (max) () { return 18446744073709551615UL; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long lowest () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long epsilon () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long round_error () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long infinity () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long quiet_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long signaling_NaN () { return 0; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr unsigned long long denorm_min () { return 0; } +}; + +template <> +struct numeric_limits +{ + BOOST_MATH_STATIC constexpr bool is_specialized = true; + BOOST_MATH_STATIC constexpr bool is_signed = false; + BOOST_MATH_STATIC constexpr bool is_integer = true; + BOOST_MATH_STATIC constexpr bool is_exact = true; + BOOST_MATH_STATIC constexpr bool has_infinity = false; + BOOST_MATH_STATIC constexpr bool has_quiet_NaN = false; + BOOST_MATH_STATIC constexpr bool has_signaling_NaN = false; + + BOOST_MATH_STATIC constexpr bool is_iec559 = false; + BOOST_MATH_STATIC constexpr bool is_bounded = true; + BOOST_MATH_STATIC constexpr bool is_modulo = false; + BOOST_MATH_STATIC constexpr int digits = 1; + BOOST_MATH_STATIC constexpr int digits10 = 0; + BOOST_MATH_STATIC constexpr int max_digits10 = 0; + BOOST_MATH_STATIC constexpr int radix = 2; + BOOST_MATH_STATIC constexpr int min_exponent = 0; + BOOST_MATH_STATIC constexpr int min_exponent10 = 0; + BOOST_MATH_STATIC constexpr int max_exponent = 0; + BOOST_MATH_STATIC constexpr int max_exponent10 = 0; + BOOST_MATH_STATIC constexpr bool traps = false; + BOOST_MATH_STATIC constexpr bool tinyness_before = false; + + // Member Functions + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool (min) () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool (max) () { return true; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool lowest () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool epsilon () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool round_error () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool infinity () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool quiet_NaN () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool signaling_NaN () { return false; } + BOOST_MATH_GPU_ENABLED BOOST_MATH_STATIC constexpr bool denorm_min () { return false; } +}; + +#endif // BOOST_MATH_HAS_GPU_SUPPORT + +} // namespace math +} // namespace boost + +#endif diff --git a/include/boost/math/tools/precision.hpp b/include/boost/math/tools/precision.hpp index d1643e01..66265773 100644 --- a/include/boost/math/tools/precision.hpp +++ b/include/boost/math/tools/precision.hpp @@ -10,14 +10,20 @@ #pragma once #endif +#include #include +#include +#include #include + +#ifndef BOOST_MATH_HAS_NVRTC #include #include #include #include #include #include // LDBL_MANT_DIG +#endif namespace boost{ namespace math { @@ -36,30 +42,30 @@ namespace tools // See Conceptual Requirements for Real Number Types. template -inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept +BOOST_MATH_GPU_ENABLED inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept { - static_assert( ::std::numeric_limits::is_specialized, "Type T must be specialized"); - static_assert( ::std::numeric_limits::radix == 2 || ::std::numeric_limits::radix == 10, "Type T must have a radix of 2 or 10"); + static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); + static_assert( ::boost::math::numeric_limits::radix == 2 || ::boost::math::numeric_limits::radix == 10, "Type T must have a radix of 2 or 10"); - return std::numeric_limits::radix == 2 - ? std::numeric_limits::digits - : ((std::numeric_limits::digits + 1) * 1000L) / 301L; + return boost::math::numeric_limits::radix == 2 + ? boost::math::numeric_limits::digits + : ((boost::math::numeric_limits::digits + 1) * 1000L) / 301L; } template -inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { - static_assert( ::std::numeric_limits::is_specialized, "Type T must be specialized"); - return (std::numeric_limits::max)(); + static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); + return (boost::math::numeric_limits::max)(); } // Also used as a finite 'infinite' value for - and +infinity, for example: // -max_value = -1.79769e+308, max_value = 1.79769e+308. template -inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { - static_assert( ::std::numeric_limits::is_specialized, "Type T must be specialized"); + static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); - return (std::numeric_limits::min)(); + return (boost::math::numeric_limits::min)(); } namespace detail{ @@ -72,13 +78,13 @@ namespace detail{ // For type float first: // template -inline constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_max_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return 88.0f; } template -inline constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_min_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return -87.0f; } @@ -86,13 +92,13 @@ inline constexpr T log_min_value(const std::integral_constant& BOOST_M // Now double: // template -inline constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_max_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return 709.0; } template -inline constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_min_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return -708.0; } @@ -100,19 +106,19 @@ inline constexpr T log_min_value(const std::integral_constant& BOOST_ // 80 and 128-bit long doubles: // template -inline constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T log_max_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return 11356.0L; } template -inline constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T log_min_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { return -11355.0L; } template -inline T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) +BOOST_MATH_GPU_ENABLED inline T log_max_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { BOOST_MATH_STD_USING #ifdef __SUNPRO_CC @@ -125,7 +131,7 @@ inline T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_E } template -inline T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) +BOOST_MATH_GPU_ENABLED inline T log_min_value(const boost::math::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { BOOST_MATH_STD_USING #ifdef __SUNPRO_CC @@ -138,14 +144,14 @@ inline T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_E } template -inline constexpr T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T epsilon(const boost::math::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { - return std::numeric_limits::epsilon(); + return boost::math::numeric_limits::epsilon(); } #if defined(__GNUC__) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) template <> -inline constexpr long double epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr long double epsilon(const boost::math::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) noexcept(boost::math::is_floating_point::value) { // numeric_limits on Darwin (and elsewhere) tells lies here: // the issue is that long double on a few platforms is @@ -164,7 +170,7 @@ inline constexpr long double epsilon(const std::true_type& BOOST_MA #endif template -inline T epsilon(const std::false_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) +BOOST_MATH_GPU_ENABLED inline T epsilon(const boost::math::false_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { // Note: don't cache result as precision may vary at runtime: BOOST_MATH_STD_USING // for ADL of std names @@ -174,23 +180,23 @@ inline T epsilon(const std::false_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE template struct log_limit_traits { - typedef typename std::conditional< - (std::numeric_limits::radix == 2) && - (std::numeric_limits::max_exponent == 128 - || std::numeric_limits::max_exponent == 1024 - || std::numeric_limits::max_exponent == 16384), - std::integral_constant::max_exponent > INT_MAX ? INT_MAX : static_cast(std::numeric_limits::max_exponent))>, - std::integral_constant + typedef typename boost::math::conditional< + (boost::math::numeric_limits::radix == 2) && + (boost::math::numeric_limits::max_exponent == 128 + || boost::math::numeric_limits::max_exponent == 1024 + || boost::math::numeric_limits::max_exponent == 16384), + boost::math::integral_constant::max_exponent > (boost::math::numeric_limits::max)() ? (boost::math::numeric_limits::max)() : static_cast(boost::math::numeric_limits::max_exponent))>, + boost::math::integral_constant >::type tag_type; static constexpr bool value = (tag_type::value != 0); - static_assert(::std::numeric_limits::is_specialized || !value, "Type T must be specialized or equal to 0"); + static_assert(::boost::math::numeric_limits::is_specialized || !value, "Type T must be specialized or equal to 0"); }; template struct log_limit_noexcept_traits_imp : public log_limit_traits {}; -template struct log_limit_noexcept_traits_imp : public std::integral_constant {}; +template struct log_limit_noexcept_traits_imp : public boost::math::integral_constant {}; template -struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp::value> {}; +struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp::value> {}; } // namespace detail @@ -200,28 +206,36 @@ struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp -inline constexpr T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) +BOOST_MATH_GPU_ENABLED inline constexpr T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - return detail::log_max_value(typename detail::log_limit_traits::tag_type()); +#ifndef BOOST_MATH_HAS_NVRTC + #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + return detail::log_max_value(typename detail::log_limit_traits::tag_type()); + #else + BOOST_MATH_ASSERT(::boost::math::numeric_limits::is_specialized); + BOOST_MATH_STD_USING + static const T val = log((boost::math::numeric_limits::max)()); + return val; + #endif #else - BOOST_MATH_ASSERT(::std::numeric_limits::is_specialized); - BOOST_MATH_STD_USING - static const T val = log((std::numeric_limits::max)()); - return val; + return log((boost::math::numeric_limits::max)()); #endif } template -inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) +BOOST_MATH_GPU_ENABLED inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - return detail::log_min_value(typename detail::log_limit_traits::tag_type()); +#ifndef BOOST_MATH_HAS_NVRTC + #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + return detail::log_min_value(typename detail::log_limit_traits::tag_type()); + #else + BOOST_MATH_ASSERT(::boost::math::numeric_limits::is_specialized); + BOOST_MATH_STD_USING + static const T val = log((boost::math::numeric_limits::min)()); + return val; + #endif #else - BOOST_MATH_ASSERT(::std::numeric_limits::is_specialized); - BOOST_MATH_STD_USING - static const T val = log((std::numeric_limits::min)()); - return val; + return log((boost::math::numeric_limits::min)()); #endif } @@ -230,84 +244,89 @@ inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept( #endif template -inline constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(boost::math::is_floating_point::value) { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - return detail::epsilon(std::integral_constant::is_specialized>()); + // NVRTC does not like this dispatching method so we just skip to where we want to go +#ifndef BOOST_MATH_HAS_NVRTC + #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + return detail::epsilon(boost::math::integral_constant::is_specialized>()); + #else + return ::boost::math::numeric_limits::is_specialized ? + detail::epsilon(boost::math::true_type()) : + detail::epsilon(boost::math::false_type()); + #endif #else - return ::std::numeric_limits::is_specialized ? - detail::epsilon(std::true_type()) : - detail::epsilon(std::false_type()); + return boost::math::numeric_limits::epsilon(); #endif } namespace detail{ template -inline constexpr T root_epsilon_imp(const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon_imp(const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.00034526698300124390839884978618400831996329879769945L); } template -inline constexpr T root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.1490116119384765625e-7L); } template -inline constexpr T root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.32927225399135962333569506281281311031656150598474e-9L); } template -inline constexpr T root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.1387778780781445675529539585113525390625e-16L); } template -inline T root_epsilon_imp(const T*, const Tag&) +BOOST_MATH_GPU_ENABLED inline T root_epsilon_imp(const T*, const Tag&) { BOOST_MATH_STD_USING - static const T r_eps = sqrt(tools::epsilon()); + BOOST_MATH_STATIC_LOCAL_VARIABLE const T r_eps = sqrt(tools::epsilon()); return r_eps; } template -inline T root_epsilon_imp(const T*, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline T root_epsilon_imp(const T*, const boost::math::integral_constant&) { BOOST_MATH_STD_USING return sqrt(tools::epsilon()); } template -inline constexpr T cbrt_epsilon_imp(const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon_imp(const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.0049215666011518482998719164346805794944150447839903L); } template -inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(6.05545445239333906078989272793696693569753008995e-6L); } template -inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(4.76837158203125e-7L); } template -inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(5.7749313854154005630396773604745549542403508090496e-12L); } template -inline T cbrt_epsilon_imp(const T*, const Tag&) +BOOST_MATH_GPU_ENABLED inline T cbrt_epsilon_imp(const T*, const Tag&) { BOOST_MATH_STD_USING; static const T cbrt_eps = pow(tools::epsilon(), T(1) / 3); @@ -315,38 +334,38 @@ inline T cbrt_epsilon_imp(const T*, const Tag&) } template -inline T cbrt_epsilon_imp(const T*, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline T cbrt_epsilon_imp(const T*, const boost::math::integral_constant&) { BOOST_MATH_STD_USING; return pow(tools::epsilon(), T(1) / 3); } template -inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.018581361171917516667460937040007436176452688944747L); } template -inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.0001220703125L); } template -inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.18145860519450699870567321328132261891067079047605e-4L); } template -inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon_imp(const T*, const boost::math::integral_constant&) noexcept(boost::math::is_floating_point::value) { return static_cast(0.37252902984619140625e-8L); } template -inline T forth_root_epsilon_imp(const T*, const Tag&) +BOOST_MATH_GPU_ENABLED inline T forth_root_epsilon_imp(const T*, const Tag&) { BOOST_MATH_STD_USING static const T r_eps = sqrt(sqrt(tools::epsilon())); @@ -354,7 +373,7 @@ inline T forth_root_epsilon_imp(const T*, const Tag&) } template -inline T forth_root_epsilon_imp(const T*, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED inline T forth_root_epsilon_imp(const T*, const boost::math::integral_constant&) { BOOST_MATH_STD_USING return sqrt(sqrt(tools::epsilon())); @@ -363,26 +382,26 @@ inline T forth_root_epsilon_imp(const T*, const std::integral_constant&) template struct root_epsilon_traits { - typedef std::integral_constant::radix == 2) && (::std::numeric_limits::digits != INT_MAX) ? std::numeric_limits::digits : 0> tag_type; + typedef boost::math::integral_constant::radix == 2) && (::boost::math::numeric_limits::digits != (boost::math::numeric_limits::max)()) ? boost::math::numeric_limits::digits : 0> tag_type; static constexpr bool has_noexcept = (tag_type::value == 113) || (tag_type::value == 64) || (tag_type::value == 53) || (tag_type::value == 24); }; } template -inline constexpr T root_epsilon() noexcept(std::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) +BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::root_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); } template -inline constexpr T cbrt_epsilon() noexcept(std::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) +BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::cbrt_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); } template -inline constexpr T forth_root_epsilon() noexcept(std::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) +BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::forth_root_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); } diff --git a/include/boost/math/tools/promotion.hpp b/include/boost/math/tools/promotion.hpp index 68127efb..a65f3703 100644 --- a/include/boost/math/tools/promotion.hpp +++ b/include/boost/math/tools/promotion.hpp @@ -3,6 +3,7 @@ // Copyright John Maddock 2006. // Copyright Paul A. Bristow 2006. // Copyright Matt Borland 2023. +// Copyright Ryan Elandt 2023. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. @@ -24,11 +25,7 @@ #endif #include -#include - -#if __has_include() -# include -#endif +#include namespace boost { @@ -36,272 +33,103 @@ namespace boost { namespace tools { + ///// This promotion system works as follows: + // + // Rule (one argument promotion rule): + // - Promotes `T` to `double` if `T` is an integer type as identified by + // `std::is_integral`, otherwise is `T` + // + // Rule (two or more argument promotion rule): + // - 1. Calculates type using applying Rule. + // - 2. Calculates type using applying Rule + // - If the type calculated in 1 and 2 are both floating point types, as + // identified by `std::is_floating_point`, then return the type + // determined by `std::common_type`. Otherwise return the type using + // an asymmetric convertibility rule. + // + ///// Discussion: + // // If either T1 or T2 is an integer type, // pretend it was a double (for the purposes of further analysis). // Then pick the wider of the two floating-point types // as the actual signature to forward to. // For example: - // foo(int, short) -> double foo(double, double); - // foo(int, float) -> double foo(double, double); - // Note: NOT float foo(float, float) - // foo(int, double) -> foo(double, double); - // foo(double, float) -> double foo(double, double); - // foo(double, float) -> double foo(double, double); - // foo(any-int-or-float-type, long double) -> foo(long double, long double); - // but ONLY float foo(float, float) is unchanged. - // So the only way to get an entirely float version is to call foo(1.F, 2.F), - // But since most (all?) the math functions convert to double internally, - // probably there would not be the hoped-for gain by using float here. - + // foo(int, short) -> double foo(double, double); // ***NOT*** float foo(float, float) + // foo(int, float) -> double foo(double, double); // ***NOT*** float foo(float, float) + // foo(int, double) -> foo(double, double); + // foo(double, float) -> double foo(double, double); + // foo(double, float) -> double foo(double, double); + // foo(any-int-or-float-type, long double) -> foo(long double, long double); + // ONLY float foo(float, float) is unchanged, so the only way to get an + // entirely float version is to call foo(1.F, 2.F). But since most (all?) the + // math functions convert to double internally, probably there would not be the + // hoped-for gain by using float here. + // // This follows the C-compatible conversion rules of pow, etc // where pow(int, float) is converted to pow(double, double). + + // Promotes a single argument to double if it is an integer type template - struct promote_arg - { // If T is integral type, then promote to double. - using type = typename std::conditional::value, double, T>::type; + struct promote_arg { + using type = typename boost::math::conditional::value, double, T>::type; }; - // These full specialisations reduce std::conditional usage and speed up - // compilation: - template <> struct promote_arg { using type = float; }; - template <> struct promote_arg{ using type = double; }; - template <> struct promote_arg { using type = long double; }; - template <> struct promote_arg { using type = double; }; - #ifdef __STDCPP_FLOAT16_T__ - template <> struct promote_arg { using type = std::float16_t; }; - #endif - #ifdef __STDCPP_FLOAT32_T__ - template <> struct promote_arg { using type = std::float32_t; }; - #endif - #ifdef __STDCPP_FLOAT64_T__ - template <> struct promote_arg { using type = std::float64_t; }; - #endif - #ifdef __STDCPP_FLOAT128_T__ - template <> struct promote_arg { using type = std::float128_t; }; - #endif - - template - using promote_arg_t = typename promote_arg::type; + // Promotes two arguments, neither of which is an integer type using an asymmetric + // convertibility rule. + template ::value && boost::math::is_floating_point::value)> + struct pa2_integral_already_removed { + using type = typename boost::math::conditional< + !boost::math::is_floating_point::value && boost::math::is_convertible::value, + T2, T1>::type; + }; + // For two floating point types, promotes using `std::common_type` functionality template - struct promote_args_2 - { // Promote, if necessary, & pick the wider of the two floating-point types. - // for both parameter types, if integral promote to double. - using T1P = typename promote_arg::type; // T1 perhaps promoted. - using T2P = typename promote_arg::type; // T2 perhaps promoted. - using intermediate_type = typename std::conditional< - std::is_floating_point::value && std::is_floating_point::value, // both T1P and T2P are floating-point? -#ifdef __STDCPP_FLOAT128_T__ - typename std::conditional::value || std::is_same::value, // either long double? - std::float128_t, -#endif -#ifdef BOOST_MATH_USE_FLOAT128 - typename std::conditional::value || std::is_same<__float128, T2P>::value, // either long double? - __float128, -#endif - typename std::conditional::value || std::is_same::value, // either long double? - long double, // then result type is long double. -#ifdef __STDCPP_FLOAT64_T__ - typename std::conditional::value || std::is_same::value, // either float64? - std::float64_t, // then result type is float64_t. -#endif - typename std::conditional::value || std::is_same::value, // either double? - double, // result type is double. -#ifdef __STDCPP_FLOAT32_T__ - typename std::conditional::value || std::is_same::value, // either float32? - std::float32_t, // then result type is float32_t. -#endif - float // else result type is float. - >::type -#ifdef BOOST_MATH_USE_FLOAT128 - >::type -#endif -#ifdef __STDCPP_FLOAT128_T__ - >::type -#endif -#ifdef __STDCPP_FLOAT64_T__ - >::type -#endif -#ifdef __STDCPP_FLOAT32_T__ - >::type -#endif - >::type, - // else one or the other is a user-defined type: - typename std::conditional::value && std::is_convertible::value, T2P, T1P>::type>::type; - -#ifdef __STDCPP_FLOAT64_T__ - // If long doubles are doubles then we should prefer to use std::float64_t when available - using type = std::conditional_t<(sizeof(double) == sizeof(long double) && std::is_same::value), std::float64_t, intermediate_type>; -#else - using type = intermediate_type; -#endif - }; // promote_arg2 - // These full specialisations reduce std::conditional usage and speed up - // compilation: - template <> struct promote_args_2 { using type = float; }; - template <> struct promote_args_2{ using type = double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - - #ifdef __STDCPP_FLOAT128_T__ - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - - #ifdef __STDCPP_FLOAT16_T__ - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - #endif - - #ifdef __STDCPP_FLOAT32_T__ - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - #endif - - #ifdef __STDCPP_FLOAT64_T__ - template <> struct promote_args_2 { using type = std::float128_t; }; - template <> struct promote_args_2 { using type = std::float128_t; }; - #endif - - template <> struct promote_args_2 { using type = std::float128_t; }; - #endif - - #ifdef __STDCPP_FLOAT64_T__ - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - - #ifdef __STDCPP_FLOAT16_T__ - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - #endif - - #ifdef __STDCPP_FLOAT32_T__ - template <> struct promote_args_2 { using type = std::float64_t; }; - template <> struct promote_args_2 { using type = std::float64_t; }; - #endif - - template <> struct promote_args_2 { using type = std::float64_t; }; - #endif - - #ifdef __STDCPP_FLOAT32_T__ - template <> struct promote_args_2 { using type = std::float32_t; }; - template <> struct promote_args_2 { using type = std::float32_t; }; - template <> struct promote_args_2 { using type = std::float32_t; }; - template <> struct promote_args_2 { using type = std::float32_t; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - - #ifdef __STDCPP_FLOAT16_T__ - template <> struct promote_args_2 { using type = std::float32_t; }; - template <> struct promote_args_2 { using type = std::float32_t; }; - #endif - - template <> struct promote_args_2 { using type = std::float32_t; }; - #endif + struct pa2_integral_already_removed { + using type = boost::math::common_type_t; + }; - #ifdef __STDCPP_FLOAT16_T__ - template <> struct promote_args_2 { using type = std::float16_t; }; - template <> struct promote_args_2 { using type = std::float16_t; }; - template <> struct promote_args_2 { using type = float; }; - template <> struct promote_args_2 { using type = float; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = long double; }; - template <> struct promote_args_2 { using type = std::float16_t; }; - #endif + // Template definition for promote_args_permissive + template + struct promote_args_permissive; + // Specialization for one argument + template + struct promote_args_permissive { + using type = typename promote_arg::type>::type; + }; + // Specialization for two or more arguments + template + struct promote_args_permissive { + using type = typename pa2_integral_already_removed< + typename promote_args_permissive::type, + typename promote_args_permissive::type + >::type; + }; - template - using promote_args_2_t = typename promote_args_2::type; + template + using promote_args_permissive_t = typename promote_args_permissive::type; - template - struct promote_args - { - using type = typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, typename std::remove_cv::type - >::type - >::type - >::type - >::type - >::type; + // Same as `promote_args_permissive` but with a static assertion that the promoted type + // is not `long double` if `BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS` is defined + template + struct promote_args { + using type = typename promote_args_permissive::type; #if defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) // // Guard against use of long double if it's not supported: // - static_assert((0 == std::is_same::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented."); + static_assert((0 == boost::math::is_same::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented."); #endif }; - template - using promote_args_t = typename promote_args::type; - - // - // This struct is the same as above, but has no static assert on long double usage, - // it should be used only on functions that can be implemented for long double - // even when std lib support is missing or broken for that type. - // - template - struct promote_args_permissive - { - using type = typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, - typename promote_args_2< - typename std::remove_cv::type, typename std::remove_cv::type - >::type - >::type - >::type - >::type - >::type; - }; - - template - using promote_args_permissive_t = typename promote_args_permissive::type; + template + using promote_args_t = typename promote_args::type; } // namespace tools } // namespace math } // namespace boost #endif // BOOST_MATH_PROMOTION_HPP - diff --git a/include/boost/math/tools/rational.hpp b/include/boost/math/tools/rational.hpp index 727720b2..a535abcd 100644 --- a/include/boost/math/tools/rational.hpp +++ b/include/boost/math/tools/rational.hpp @@ -10,33 +10,38 @@ #pragma once #endif -#include #include #include +#include +#include + +#ifndef BOOST_MATH_HAS_NVRTC +#include +#endif #if BOOST_MATH_POLY_METHOD == 1 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #elif BOOST_MATH_POLY_METHOD == 2 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #elif BOOST_MATH_POLY_METHOD == 3 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #endif #if BOOST_MATH_RATIONAL_METHOD == 1 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #elif BOOST_MATH_RATIONAL_METHOD == 2 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #elif BOOST_MATH_RATIONAL_METHOD == 3 -# define BOOST_HEADER() +# define BOOST_HEADER() # include BOOST_HEADER() # undef BOOST_HEADER #endif @@ -168,12 +173,12 @@ namespace boost{ namespace math{ namespace tools{ // Forward declaration to keep two phase lookup happy: // template -U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U); +BOOST_MATH_GPU_ENABLED U evaluate_polynomial(const T* poly, U const& z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U); namespace detail{ template -inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, val, Tag::value); } @@ -186,7 +191,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_M // the loop expanded versions above: // template -inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_polynomial(const T* poly, U const& z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { BOOST_MATH_ASSERT(count > 0); U sum = static_cast(poly[count - 1]); @@ -201,69 +206,75 @@ inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST // Compile time sized polynomials, just inline forwarders to the // implementations above: // -template -inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V) +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V) { - typedef std::integral_constant tag_type; + typedef boost::math::integral_constant tag_type; return detail::evaluate_polynomial_c_imp(static_cast(a), val, static_cast(nullptr)); } -template -inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_NOEXCEPT(V) +#ifndef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_NOEXCEPT(V) { - typedef std::integral_constant tag_type; + typedef boost::math::integral_constant tag_type; return detail::evaluate_polynomial_c_imp(static_cast(a.data()), val, static_cast(nullptr)); } +#endif // // Even polynomials are trivial: just square the argument! // template -inline U evaluate_even_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_even_polynomial(const T* poly, U z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { return evaluate_polynomial(poly, U(z*z), count); } -template -inline V evaluate_even_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_even_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, V(z*z)); } -template -inline V evaluate_even_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) +#ifndef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_even_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, V(z*z)); } +#endif // // Odd polynomials come next: // template -inline U evaluate_odd_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_odd_polynomial(const T* poly, U z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { return poly[0] + z * evaluate_polynomial(poly+1, U(z*z), count-1); } -template -inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { - typedef std::integral_constant tag_type; + typedef boost::math::integral_constant tag_type; return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast(a) + 1, V(z*z), static_cast(nullptr)); } -template -inline V evaluate_odd_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) +#ifndef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) { - typedef std::integral_constant tag_type; + typedef boost::math::integral_constant tag_type; return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast(a.data()) + 1, V(z*z), static_cast(nullptr)); } +#endif template -V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V); +BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, boost::math::size_t count) BOOST_MATH_NOEXCEPT(V); namespace detail{ template -inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*) BOOST_MATH_NOEXCEPT(V) { return boost::math::tools::evaluate_rational(num, denom, z, Tag::value); } @@ -278,7 +289,7 @@ inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const // in our Lanczos code for example. // template -V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, boost::math::size_t count) BOOST_MATH_NOEXCEPT(V) { V z(z_); V s1, s2; @@ -310,17 +321,19 @@ V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count return s1 / s2; } -template -inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { - return detail::evaluate_rational_c_imp(a, b, z, static_cast*>(nullptr)); + return detail::evaluate_rational_c_imp(a, b, z, static_cast*>(nullptr)); } -template -inline V evaluate_rational(const std::array& a, const std::array& b, const V& z) BOOST_MATH_NOEXCEPT(V) +#ifndef BOOST_MATH_HAS_NVRTC +template +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational(const std::array& a, const std::array& b, const V& z) BOOST_MATH_NOEXCEPT(V) { - return detail::evaluate_rational_c_imp(a.data(), b.data(), z, static_cast*>(nullptr)); + return detail::evaluate_rational_c_imp(a.data(), b.data(), z, static_cast*>(nullptr)); } +#endif } // namespace tools } // namespace math diff --git a/include/boost/math/tools/roots.hpp b/include/boost/math/tools/roots.hpp index 9fd7bee4..b0b0fc24 100644 --- a/include/boost/math/tools/roots.hpp +++ b/include/boost/math/tools/roots.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -9,20 +10,21 @@ #ifdef _MSC_VER #pragma once #endif -#include // test for multiprecision types in complex Newton - -#include -#include -#include -#include #include -#include - +#include // test for multiprecision types in complex Newton +#include +#include +#include +#include #include +#include +#include + +#ifndef BOOST_MATH_HAS_GPU_SUPPORT #include #include -#include +#endif namespace boost { namespace math { @@ -33,11 +35,11 @@ namespace detail { namespace dummy { template - typename T::value_type get(const T&) BOOST_MATH_NOEXCEPT(T); + BOOST_MATH_GPU_ENABLED typename T::value_type get(const T&) BOOST_MATH_NOEXCEPT(T); } template -void unpack_tuple(const Tuple& t, T& a, T& b) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED void unpack_tuple(const Tuple& t, T& a, T& b) BOOST_MATH_NOEXCEPT(T) { using dummy::get; // Use ADL to find the right overload for get: @@ -45,7 +47,7 @@ void unpack_tuple(const Tuple& t, T& a, T& b) BOOST_MATH_NOEXCEPT(T) b = get<1>(t); } template -void unpack_tuple(const Tuple& t, T& a, T& b, T& c) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED void unpack_tuple(const Tuple& t, T& a, T& b, T& c) BOOST_MATH_NOEXCEPT(T) { using dummy::get; // Use ADL to find the right overload for get: @@ -55,7 +57,7 @@ void unpack_tuple(const Tuple& t, T& a, T& b, T& c) BOOST_MATH_NOEXCEPT(T) } template -inline void unpack_0(const Tuple& t, T& val) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED inline void unpack_0(const Tuple& t, T& val) BOOST_MATH_NOEXCEPT(T) { using dummy::get; // Rely on ADL to find the correct overload of get: @@ -63,26 +65,30 @@ inline void unpack_0(const Tuple& t, T& val) BOOST_MATH_NOEXCEPT(T) } template -inline void unpack_tuple(const std::pair& p, V& a, V& b) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED inline void unpack_tuple(const boost::math::pair& p, V& a, V& b) BOOST_MATH_NOEXCEPT(T) { a = p.first; b = p.second; } template -inline void unpack_0(const std::pair& p, V& a) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED inline void unpack_0(const boost::math::pair& p, V& a) BOOST_MATH_NOEXCEPT(T) { a = p.first; } template -void handle_zero_derivative(F f, +BOOST_MATH_GPU_ENABLED void handle_zero_derivative(F f, T& last_f0, const T& f0, T& delta, T& result, T& guess, const T& min, - const T& max) noexcept(BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) + const T& max) noexcept(BOOST_MATH_IS_FLOAT(T) + #ifndef BOOST_MATH_HAS_GPU_SUPPORT + && noexcept(std::declval()(std::declval())) + #endif + ) { if (last_f0 == 0) { @@ -128,25 +134,29 @@ void handle_zero_derivative(F f, } // namespace template -std::pair bisect(F f, T min, T max, Tol tol, std::uintmax_t& max_iter, const Policy& pol) noexcept(policies::is_noexcept_error_policy::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) +BOOST_MATH_GPU_ENABLED boost::math::pair bisect(F f, T min, T max, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) noexcept(policies::is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()(std::declval())) +#endif +) { T fmin = f(min); T fmax = f(max); if (fmin == 0) { max_iter = 2; - return std::make_pair(min, min); + return boost::math::make_pair(min, min); } if (fmax == 0) { max_iter = 2; - return std::make_pair(max, max); + return boost::math::make_pair(max, max); } // // Error checking: // - static const char* function = "boost::math::tools::bisect<%1%>"; + constexpr auto function = "boost::math::tools::bisect<%1%>"; if (min >= max) { return boost::math::detail::pair_from_single(policies::raise_evaluation_error(function, @@ -196,29 +206,41 @@ std::pair bisect(F f, T min, T max, Tol tol, std::uintmax_t& max_iter, con std::cout << "Bisection required " << max_iter << " iterations.\n"; #endif - return std::make_pair(min, max); + return boost::math::make_pair(min, max); } template -inline std::pair bisect(F f, T min, T max, Tol tol, std::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) +BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, Tol tol, boost::math::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()(std::declval())) +#endif +) { return bisect(f, min, max, tol, max_iter, policies::policy<>()); } template -inline std::pair bisect(F f, T min, T max, Tol tol) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) +BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, Tol tol) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()(std::declval())) +#endif +) { - std::uintmax_t m = (std::numeric_limits::max)(); + boost::math::uintmax_t m = (boost::math::numeric_limits::max)(); return bisect(f, min, max, tol, m, policies::policy<>()); } template -T newton_raphson_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) +BOOST_MATH_GPU_ENABLED T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::math::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()(std::declval())) +#endif +) { BOOST_MATH_STD_USING - static const char* function = "boost::math::tools::newton_raphson_iterate<%1%>"; + constexpr auto function = "boost::math::tools::newton_raphson_iterate<%1%>"; if (min > max) { return policies::raise_evaluation_error(function, "Range arguments in wrong order in boost::math::tools::newton_raphson_iterate(first arg=%1%)", min, boost::math::policies::policy<>()); @@ -245,7 +267,7 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& T max_range_f = 0; T min_range_f = 0; - std::uintmax_t count(max_iter); + boost::math::uintmax_t count(max_iter); #ifdef BOOST_MATH_INSTRUMENT std::cout << "Newton_raphson_iterate, guess = " << guess << ", min = " << min << ", max = " << max @@ -278,8 +300,7 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& T shift = (delta > 0) ? (result - min) / 2 : (result - max) / 2; if ((result != 0) && (fabs(shift) > fabs(result))) { - delta = sign(delta) * fabs(result) * 1.1f; // Protect against huge jumps! - //delta = sign(delta) * result; // Protect against huge jumps! Failed for negative result. https://github.com/boostorg/math/issues/216 + delta = sign(delta) * fabs(result); // protect against huge jumps! } else delta = shift; @@ -333,12 +354,22 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& } template -inline T newton_raphson_iterate(F f, T guess, T min, T max, int digits) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) +BOOST_MATH_GPU_ENABLED inline T newton_raphson_iterate(F f, T guess, T min, T max, int digits) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()(std::declval())) +#endif +) { - std::uintmax_t m = (std::numeric_limits::max)(); + boost::math::uintmax_t m = (boost::math::numeric_limits::max)(); return newton_raphson_iterate(f, guess, min, max, digits, m); } +// TODO(mborland): Disabled for now +// Recursion needs to be removed, but there is no demand at this time +#ifdef BOOST_MATH_HAS_NVRTC +}}} // Namespaces +#else + namespace detail { struct halley_step @@ -543,13 +574,13 @@ namespace detail { last_f0 = f0; delta2 = delta1; delta1 = delta; -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS try #endif { detail::unpack_tuple(f(result), f0, f1, f2); } -#ifndef BOOST_NO_EXCEPTIONS +#ifndef BOOST_MATH_NO_EXCEPTIONS catch (const std::overflow_error&) { f0 = max > 0 ? tools::max_value() : -tools::min_value(); @@ -596,7 +627,8 @@ namespace detail { #ifdef BOOST_MATH_INSTRUMENT std::cout << "Second order root iteration, delta = " << delta << ", residual = " << f0 << "\n"; #endif - T convergence = fabs(delta / delta2); + // We need to avoid delta/delta2 overflowing here: + T convergence = (fabs(delta2) > 1) || (fabs(tools::max_value() * delta2) > fabs(delta)) ? fabs(delta / delta2) : tools::max_value(); if ((convergence > 0.8) && (convergence < 2)) { // last two steps haven't converged. @@ -790,35 +822,35 @@ inline T schroeder_iterate(F f, T guess, T min, T max, int digits) noexcept(poli * so this default should recover full precision even in this somewhat pathological case. * For isolated roots, the problem is so rapidly convergent that this doesn't matter at all. */ -template -Complex complex_newton(F g, Complex guess, int max_iterations = std::numeric_limits::digits) +template +ComplexType complex_newton(F g, ComplexType guess, int max_iterations = std::numeric_limits::digits) { - typedef typename Complex::value_type Real; + typedef typename ComplexType::value_type Real; using std::norm; using std::abs; using std::max; // z0, z1, and z2 cannot be the same, in case we immediately need to resort to Muller's Method: - Complex z0 = guess + Complex(1, 0); - Complex z1 = guess + Complex(0, 1); - Complex z2 = guess; + ComplexType z0 = guess + ComplexType(1, 0); + ComplexType z1 = guess + ComplexType(0, 1); + ComplexType z2 = guess; do { auto pair = g(z2); if (norm(pair.second) == 0) { // Muller's method. Notation follows Numerical Recipes, 9.5.2: - Complex q = (z2 - z1) / (z1 - z0); + ComplexType q = (z2 - z1) / (z1 - z0); auto P0 = g(z0); auto P1 = g(z1); - Complex qp1 = static_cast(1) + q; - Complex A = q * (pair.first - qp1 * P1.first + q * P0.first); - - Complex B = (static_cast(2) * q + static_cast(1)) * pair.first - qp1 * qp1 * P1.first + q * q * P0.first; - Complex C = qp1 * pair.first; - Complex rad = sqrt(B * B - static_cast(4) * A * C); - Complex denom1 = B + rad; - Complex denom2 = B - rad; - Complex correction = (z1 - z2) * static_cast(2) * C; + ComplexType qp1 = static_cast(1) + q; + ComplexType A = q * (pair.first - qp1 * P1.first + q * P0.first); + + ComplexType B = (static_cast(2) * q + static_cast(1)) * pair.first - qp1 * qp1 * P1.first + q * q * P0.first; + ComplexType C = qp1 * pair.first; + ComplexType rad = sqrt(B * B - static_cast(4) * A * C); + ComplexType denom1 = B + rad; + ComplexType denom2 = B - rad; + ComplexType correction = (z1 - z2) * static_cast(2) * C; if (norm(denom1) > norm(denom2)) { correction /= denom1; @@ -870,7 +902,7 @@ Complex complex_newton(F g, Complex guess, int max_iterations = std::numeric_lim #endif -#if !defined(BOOST_NO_CXX17_IF_CONSTEXPR) +#if !defined(BOOST_MATH_NO_CXX17_IF_CONSTEXPR) // https://stackoverflow.com/questions/48979861/numerically-stable-method-for-solving-quadratic-equations/50065711 namespace detail { @@ -1025,4 +1057,6 @@ inline std::pair::type, typename tools: } // namespace math } // namespace boost +#endif // BOOST_MATH_HAS_NVRTC + #endif // BOOST_MATH_TOOLS_NEWTON_SOLVER_HPP diff --git a/include/boost/math/tools/series.hpp b/include/boost/math/tools/series.hpp index a4822fea..4617ea3d 100644 --- a/include/boost/math/tools/series.hpp +++ b/include/boost/math/tools/series.hpp @@ -10,10 +10,11 @@ #pragma once #endif -#include -#include -#include + #include +#include +#include +#include namespace boost{ namespace math{ namespace tools{ @@ -21,13 +22,17 @@ namespace boost{ namespace math{ namespace tools{ // Simple series summation come first: // template -inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms, const V& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; - std::uintmax_t counter = max_terms; + boost::math::uintmax_t counter = max_terms; result_type result = init_value; result_type next_term; @@ -44,14 +49,22 @@ inline typename Functor::result_type sum_series(Functor& func, const U& factor, } template -inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { typename Functor::result_type init_value = 0; return sum_series(func, factor, max_terms, init_value); } template -inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; @@ -60,17 +73,25 @@ inline typename Functor::result_type sum_series(Functor& func, int bits, std::ui } template -inline typename Functor::result_type sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; - std::uintmax_t iters = (std::numeric_limits::max)(); + boost::math::uintmax_t iters = (boost::math::numeric_limits::max)(); result_type init_val = 0; return sum_series(func, bits, iters, init_val); } template -inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; @@ -79,23 +100,31 @@ inline typename Functor::result_type sum_series(Functor& func, int bits, std::ui } template -inline typename Functor::result_type sum_series(Functor& func, int bits, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING - std::uintmax_t iters = (std::numeric_limits::max)(); + boost::math::uintmax_t iters = (boost::math::numeric_limits::max)(); return sum_series(func, bits, iters, init_value); } // // Checked summation: // template -inline typename Functor::result_type checked_sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value, V& norm) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type checked_sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms, const V& init_value, V& norm) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; - std::uintmax_t counter = max_terms; + boost::math::uintmax_t counter = max_terms; result_type result = init_value; result_type next_term; @@ -125,7 +154,11 @@ inline typename Functor::result_type checked_sum_series(Functor& func, const U& // in any case the result is still much better than a naive summation. // template -inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING @@ -148,13 +181,17 @@ inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) n } template -inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) +#ifndef BOOST_MATH_HAS_GPU_SUPPORT +&& noexcept(std::declval()()) +#endif +) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; - std::uintmax_t counter = max_terms; + boost::math::uintmax_t counter = max_terms; result_type factor = ldexp(result_type(1), bits); result_type result = func(); diff --git a/include/boost/math/tools/throw_exception.hpp b/include/boost/math/tools/throw_exception.hpp index 56a2c9c3..3a918db9 100644 --- a/include/boost/math/tools/throw_exception.hpp +++ b/include/boost/math/tools/throw_exception.hpp @@ -10,12 +10,33 @@ #ifndef BOOST_MATH_STANDALONE +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + #include #define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr); +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #else // Standalone mode - use standard library facilities -#define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; +#ifdef _MSC_VER +# ifdef _CPPUNWIND +# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; +# else +# define BOOST_MATH_THROW_EXCEPTION(expr) +# endif +#else +# ifdef __EXCEPTIONS +# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; +# else +# define BOOST_MATH_THROW_EXCEPTION(expr) +# endif +#endif #endif // BOOST_MATH_STANDALONE diff --git a/include/boost/math/tools/toms748_solve.hpp b/include/boost/math/tools/toms748_solve.hpp index 2de491a9..dee23468 100644 --- a/include/boost/math/tools/toms748_solve.hpp +++ b/include/boost/math/tools/toms748_solve.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,13 +11,13 @@ #pragma once #endif +#include #include +#include +#include +#include #include -#include #include -#include -#include -#include #ifdef BOOST_MATH_LOG_ROOT_ITERATIONS # define BOOST_MATH_LOGGER_INCLUDE @@ -32,61 +33,74 @@ template class eps_tolerance { public: - eps_tolerance() : eps(4 * tools::epsilon()) + BOOST_MATH_GPU_ENABLED eps_tolerance() : eps(4 * tools::epsilon()) { } - eps_tolerance(unsigned bits) + BOOST_MATH_GPU_ENABLED eps_tolerance(unsigned bits) { BOOST_MATH_STD_USING - eps = (std::max)(T(ldexp(1.0F, 1-bits)), T(4 * tools::epsilon())); + eps = BOOST_MATH_GPU_SAFE_MAX(T(ldexp(1.0F, 1-bits)), T(4 * tools::epsilon())); } - bool operator()(const T& a, const T& b) + BOOST_MATH_GPU_ENABLED bool operator()(const T& a, const T& b) { BOOST_MATH_STD_USING - return fabs(a - b) <= (eps * (std::min)(fabs(a), fabs(b))); + return fabs(a - b) <= (eps * BOOST_MATH_GPU_SAFE_MIN(fabs(a), fabs(b))); } private: T eps; }; +// CUDA warns about __host__ __device__ marker on defaulted constructor +// but the warning is benign +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_suppress 20012 +#endif + struct equal_floor { - equal_floor()= default; + BOOST_MATH_GPU_ENABLED equal_floor() = default; + template - bool operator()(const T& a, const T& b) + BOOST_MATH_GPU_ENABLED bool operator()(const T& a, const T& b) { BOOST_MATH_STD_USING - return floor(a) == floor(b); + return (floor(a) == floor(b)) || (fabs((b-a)/b) < boost::math::tools::epsilon() * 2); } }; struct equal_ceil { - equal_ceil()= default; + BOOST_MATH_GPU_ENABLED equal_ceil() = default; + template - bool operator()(const T& a, const T& b) + BOOST_MATH_GPU_ENABLED bool operator()(const T& a, const T& b) { BOOST_MATH_STD_USING - return ceil(a) == ceil(b); + return (ceil(a) == ceil(b)) || (fabs((b - a) / b) < boost::math::tools::epsilon() * 2); } }; struct equal_nearest_integer { - equal_nearest_integer()= default; + BOOST_MATH_GPU_ENABLED equal_nearest_integer() = default; + template - bool operator()(const T& a, const T& b) + BOOST_MATH_GPU_ENABLED bool operator()(const T& a, const T& b) { BOOST_MATH_STD_USING - return floor(a + 0.5f) == floor(b + 0.5f); + return (floor(a + 0.5f) == floor(b + 0.5f)) || (fabs((b - a) / b) < boost::math::tools::epsilon() * 2); } }; +#ifdef BOOST_MATH_ENABLE_CUDA +# pragma nv_diag_default 20012 +#endif + namespace detail{ template -void bracket(F f, T& a, T& b, T c, T& fa, T& fb, T& d, T& fd) +BOOST_MATH_GPU_ENABLED void bracket(F f, T& a, T& b, T c, T& fa, T& fb, T& d, T& fd) { // // Given a point c inside the existing enclosing interval @@ -150,7 +164,7 @@ void bracket(F f, T& a, T& b, T c, T& fa, T& fb, T& d, T& fd) } template -inline T safe_div(T num, T denom, T r) +BOOST_MATH_GPU_ENABLED inline T safe_div(T num, T denom, T r) { // // return num / denom without overflow, @@ -167,7 +181,7 @@ inline T safe_div(T num, T denom, T r) } template -inline T secant_interpolate(const T& a, const T& b, const T& fa, const T& fb) +BOOST_MATH_GPU_ENABLED inline T secant_interpolate(const T& a, const T& b, const T& fa, const T& fb) { // // Performs standard secant interpolation of [a,b] given @@ -188,9 +202,9 @@ inline T secant_interpolate(const T& a, const T& b, const T& fa, const T& fb) } template -T quadratic_interpolate(const T& a, const T& b, T const& d, - const T& fa, const T& fb, T const& fd, - unsigned count) +BOOST_MATH_GPU_ENABLED T quadratic_interpolate(const T& a, const T& b, T const& d, + const T& fa, const T& fb, T const& fd, + unsigned count) { // // Performs quadratic interpolation to determine the next point, @@ -244,9 +258,9 @@ T quadratic_interpolate(const T& a, const T& b, T const& d, } template -T cubic_interpolate(const T& a, const T& b, const T& d, - const T& e, const T& fa, const T& fb, - const T& fd, const T& fe) +BOOST_MATH_GPU_ENABLED T cubic_interpolate(const T& a, const T& b, const T& d, + const T& e, const T& fa, const T& fb, + const T& fd, const T& fe) { // // Uses inverse cubic interpolation of f(x) at points @@ -293,7 +307,7 @@ T cubic_interpolate(const T& a, const T& b, const T& d, } // namespace detail template -std::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, std::uintmax_t& max_iter, const Policy& pol) +BOOST_MATH_GPU_ENABLED boost::math::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { // // Main entry point and logic for Toms Algorithm 748 @@ -301,15 +315,15 @@ std::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const // BOOST_MATH_STD_USING // For ADL of std math functions - static const char* function = "boost::math::tools::toms748_solve<%1%>"; + constexpr auto function = "boost::math::tools::toms748_solve<%1%>"; // // Sanity check - are we allowed to iterate at all? // if (max_iter == 0) - return std::make_pair(ax, bx); + return boost::math::make_pair(ax, bx); - std::uintmax_t count = max_iter; + boost::math::uintmax_t count = max_iter; T a, b, fa, fb, c, u, fu, a0, b0, d, fd, e, fe; static const T mu = 0.5f; @@ -330,7 +344,7 @@ std::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const b = a; else if(fb == 0) a = b; - return std::make_pair(a, b); + return boost::math::make_pair(a, b); } if(boost::math::sign(fa) * boost::math::sign(fb) > 0) @@ -472,37 +486,37 @@ std::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const a = b; } BOOST_MATH_LOG_COUNT(max_iter) - return std::make_pair(a, b); + return boost::math::make_pair(a, b); } template -inline std::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, std::uintmax_t& max_iter) +BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::math::uintmax_t& max_iter) { return toms748_solve(f, ax, bx, fax, fbx, tol, max_iter, policies::policy<>()); } template -inline std::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, std::uintmax_t& max_iter, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { if (max_iter <= 2) - return std::make_pair(ax, bx); + return boost::math::make_pair(ax, bx); max_iter -= 2; - std::pair r = toms748_solve(f, ax, bx, f(ax), f(bx), tol, max_iter, pol); + boost::math::pair r = toms748_solve(f, ax, bx, f(ax), f(bx), tol, max_iter, pol); max_iter += 2; return r; } template -inline std::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, std::uintmax_t& max_iter) +BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::math::uintmax_t& max_iter) { return toms748_solve(f, ax, bx, tol, max_iter, policies::policy<>()); } template -std::pair bracket_and_solve_root(F f, const T& guess, T factor, bool rising, Tol tol, std::uintmax_t& max_iter, const Policy& pol) +BOOST_MATH_GPU_ENABLED boost::math::pair bracket_and_solve_root(F f, const T& guess, T factor, bool rising, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { BOOST_MATH_STD_USING - static const char* function = "boost::math::tools::bracket_and_solve_root<%1%>"; + constexpr auto function = "boost::math::tools::bracket_and_solve_root<%1%>"; // // Set up initial brackets: // @@ -513,7 +527,7 @@ std::pair bracket_and_solve_root(F f, const T& guess, T factor, bool risin // // Set up invocation count: // - std::uintmax_t count = max_iter - 1; + boost::math::uintmax_t count = max_iter - 1; int step = 32; @@ -563,7 +577,7 @@ std::pair bracket_and_solve_root(F f, const T& guess, T factor, bool risin // Escape route just in case the answer is zero! max_iter -= count; max_iter += 1; - return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0)); + return a > 0 ? boost::math::make_pair(T(0), T(a)) : boost::math::make_pair(T(a), T(0)); } if(count == 0) return boost::math::detail::pair_from_single(policies::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", a, pol)); @@ -592,7 +606,7 @@ std::pair bracket_and_solve_root(F f, const T& guess, T factor, bool risin } max_iter -= count; max_iter += 1; - std::pair r = toms748_solve( + boost::math::pair r = toms748_solve( f, (a < 0 ? b : a), (a < 0 ? a : b), @@ -608,7 +622,7 @@ std::pair bracket_and_solve_root(F f, const T& guess, T factor, bool risin } template -inline std::pair bracket_and_solve_root(F f, const T& guess, const T& factor, bool rising, Tol tol, std::uintmax_t& max_iter) +BOOST_MATH_GPU_ENABLED inline boost::math::pair bracket_and_solve_root(F f, const T& guess, const T& factor, bool rising, Tol tol, boost::math::uintmax_t& max_iter) { return bracket_and_solve_root(f, guess, factor, rising, tol, max_iter, policies::policy<>()); } diff --git a/include/boost/math/tools/tuple.hpp b/include/boost/math/tools/tuple.hpp index b5e42fc5..dcc763e3 100644 --- a/include/boost/math/tools/tuple.hpp +++ b/include/boost/math/tools/tuple.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2010. +// (C) Copyright Matt Borland 2024. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -6,12 +7,65 @@ #ifndef BOOST_MATH_TUPLE_HPP_INCLUDED #define BOOST_MATH_TUPLE_HPP_INCLUDED -#include +#include + +#ifdef BOOST_MATH_ENABLE_CUDA + +#include +#include +#include + +namespace boost { +namespace math { + +using cuda::std::pair; +using cuda::std::tuple; + +using cuda::std::make_pair; + +using cuda::std::tie; +using cuda::std::get; + +using cuda::std::tuple_size; +using cuda::std::tuple_element; + +namespace detail { + +template +BOOST_MATH_GPU_ENABLED T&& forward(boost::math::remove_reference_t& arg) noexcept +{ + return static_cast(arg); +} + +template +BOOST_MATH_GPU_ENABLED T&& forward(boost::math::remove_reference_t&& arg) noexcept +{ + static_assert(!boost::math::is_lvalue_reference::value, "Cannot forward an rvalue as an lvalue."); + return static_cast(arg); +} + +} // namespace detail + +template +BOOST_MATH_GPU_ENABLED auto make_tuple(T&& t, Ts&&... ts) +{ + return cuda::std::tuple, boost::math::decay_t...>( + boost::math::detail::forward(t), boost::math::detail::forward(ts)... + ); +} + +} // namespace math +} // namespace boost + +#else + #include -namespace boost{ namespace math{ +namespace boost { +namespace math { using ::std::tuple; +using ::std::pair; // [6.1.3.2] Tuple creation functions using ::std::ignore; @@ -23,5 +77,12 @@ using ::std::get; using ::std::tuple_size; using ::std::tuple_element; -}} +// Pair helpers +using ::std::make_pair; + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_ENABLE_CUDA + #endif diff --git a/include/boost/math/tools/type_traits.hpp b/include/boost/math/tools/type_traits.hpp new file mode 100644 index 00000000..a1333279 --- /dev/null +++ b/include/boost/math/tools/type_traits.hpp @@ -0,0 +1,494 @@ +// Copyright (c) 2024 Matt Borland +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Regular use of is not compatible with CUDA +// Adds aliases to unify the support +// Also adds convience overloads like is_same_v so we don't have to wait for C++17 + +#ifndef BOOST_MATH_TOOLS_TYPE_TRAITS +#define BOOST_MATH_TOOLS_TYPE_TRAITS + +#include + +#ifdef BOOST_MATH_ENABLE_CUDA + +#include + +namespace boost { +namespace math { + +// Helper classes +using cuda::std::integral_constant; +using cuda::std::true_type; +using cuda::std::false_type; + +// Primary type categories +using cuda::std::is_void; +using cuda::std::is_null_pointer; +using cuda::std::is_integral; +using cuda::std::is_floating_point; +using cuda::std::is_array; +using cuda::std::is_enum; +using cuda::std::is_union; +using cuda::std::is_class; +using cuda::std::is_function; +using cuda::std::is_pointer; +using cuda::std::is_lvalue_reference; +using cuda::std::is_rvalue_reference; +using cuda::std::is_member_object_pointer; +using cuda::std::is_member_function_pointer; + +// Composite Type Categories +using cuda::std::is_fundamental; +using cuda::std::is_arithmetic; +using cuda::std::is_scalar; +using cuda::std::is_object; +using cuda::std::is_compound; +using cuda::std::is_reference; +using cuda::std::is_member_pointer; + +// Type properties +using cuda::std::is_const; +using cuda::std::is_volatile; +using cuda::std::is_trivial; +using cuda::std::is_trivially_copyable; +using cuda::std::is_standard_layout; +using cuda::std::is_empty; +using cuda::std::is_polymorphic; +using cuda::std::is_abstract; +using cuda::std::is_final; +using cuda::std::is_signed; +using cuda::std::is_unsigned; + +// Supported Operations +using cuda::std::is_constructible; +using cuda::std::is_trivially_constructible; +using cuda::std::is_nothrow_constructible; + +using cuda::std::is_default_constructible; +using cuda::std::is_trivially_default_constructible; +using cuda::std::is_nothrow_default_constructible; + +using cuda::std::is_copy_constructible; +using cuda::std::is_trivially_copy_constructible; +using cuda::std::is_nothrow_copy_constructible; + +using cuda::std::is_move_constructible; +using cuda::std::is_trivially_move_constructible; +using cuda::std::is_nothrow_move_constructible; + +using cuda::std::is_assignable; +using cuda::std::is_trivially_assignable; +using cuda::std::is_nothrow_assignable; + +using cuda::std::is_copy_assignable; +using cuda::std::is_trivially_copy_assignable; +using cuda::std::is_nothrow_copy_assignable; + +using cuda::std::is_move_assignable; +using cuda::std::is_trivially_move_assignable; +using cuda::std::is_nothrow_move_assignable; + +using cuda::std::is_destructible; +using cuda::std::is_trivially_destructible; +using cuda::std::is_nothrow_destructible; + +using cuda::std::has_virtual_destructor; + +// Property Queries +using cuda::std::alignment_of; +using cuda::std::rank; +using cuda::std::extent; + +// Type Relationships +using cuda::std::is_same; +using cuda::std::is_base_of; +using cuda::std::is_convertible; + +// Const-volatility specifiers +using cuda::std::remove_cv; +using cuda::std::remove_cv_t; +using cuda::std::remove_const; +using cuda::std::remove_const_t; +using cuda::std::remove_volatile; +using cuda::std::remove_volatile_t; +using cuda::std::add_cv; +using cuda::std::add_cv_t; +using cuda::std::add_const; +using cuda::std::add_const_t; +using cuda::std::add_volatile; +using cuda::std::add_volatile_t; + +// References +using cuda::std::remove_reference; +using cuda::std::remove_reference_t; +using cuda::std::add_lvalue_reference; +using cuda::std::add_lvalue_reference_t; +using cuda::std::add_rvalue_reference; +using cuda::std::add_rvalue_reference_t; + +// Pointers +using cuda::std::remove_pointer; +using cuda::std::remove_pointer_t; +using cuda::std::add_pointer; +using cuda::std::add_pointer_t; + +// Sign Modifiers +using cuda::std::make_signed; +using cuda::std::make_signed_t; +using cuda::std::make_unsigned; +using cuda::std::make_unsigned_t; + +// Arrays +using cuda::std::remove_extent; +using cuda::std::remove_extent_t; +using cuda::std::remove_all_extents; +using cuda::std::remove_all_extents_t; + +// Misc transformations +using cuda::std::decay; +using cuda::std::decay_t; +using cuda::std::enable_if; +using cuda::std::enable_if_t; +using cuda::std::conditional; +using cuda::std::conditional_t; +using cuda::std::common_type; +using cuda::std::common_type_t; +using cuda::std::underlying_type; +using cuda::std::underlying_type_t; + +#else // STD versions + +#include + +namespace boost { +namespace math { + +// Helper classes +using std::integral_constant; +using std::true_type; +using std::false_type; + +// Primary type categories +using std::is_void; +using std::is_null_pointer; +using std::is_integral; +using std::is_floating_point; +using std::is_array; +using std::is_enum; +using std::is_union; +using std::is_class; +using std::is_function; +using std::is_pointer; +using std::is_lvalue_reference; +using std::is_rvalue_reference; +using std::is_member_object_pointer; +using std::is_member_function_pointer; + +// Composite Type Categories +using std::is_fundamental; +using std::is_arithmetic; +using std::is_scalar; +using std::is_object; +using std::is_compound; +using std::is_reference; +using std::is_member_pointer; + +// Type properties +using std::is_const; +using std::is_volatile; +using std::is_trivial; +using std::is_trivially_copyable; +using std::is_standard_layout; +using std::is_empty; +using std::is_polymorphic; +using std::is_abstract; +using std::is_final; +using std::is_signed; +using std::is_unsigned; + +// Supported Operations +using std::is_constructible; +using std::is_trivially_constructible; +using std::is_nothrow_constructible; + +using std::is_default_constructible; +using std::is_trivially_default_constructible; +using std::is_nothrow_default_constructible; + +using std::is_copy_constructible; +using std::is_trivially_copy_constructible; +using std::is_nothrow_copy_constructible; + +using std::is_move_constructible; +using std::is_trivially_move_constructible; +using std::is_nothrow_move_constructible; + +using std::is_assignable; +using std::is_trivially_assignable; +using std::is_nothrow_assignable; + +using std::is_copy_assignable; +using std::is_trivially_copy_assignable; +using std::is_nothrow_copy_assignable; + +using std::is_move_assignable; +using std::is_trivially_move_assignable; +using std::is_nothrow_move_assignable; + +using std::is_destructible; +using std::is_trivially_destructible; +using std::is_nothrow_destructible; + +using std::has_virtual_destructor; + +// Property Queries +using std::alignment_of; +using std::rank; +using std::extent; + +// Type Relationships +using std::is_same; +using std::is_base_of; +using std::is_convertible; + +// Const-volatility specifiers +using std::remove_cv; +using std::remove_cv_t; +using std::remove_const; +using std::remove_const_t; +using std::remove_volatile; +using std::remove_volatile_t; +using std::add_cv; +using std::add_cv_t; +using std::add_const; +using std::add_const_t; +using std::add_volatile; +using std::add_volatile_t; + +// References +using std::remove_reference; +using std::remove_reference_t; +using std::add_lvalue_reference; +using std::add_lvalue_reference_t; +using std::add_rvalue_reference; +using std::add_rvalue_reference_t; + +// Pointers +using std::remove_pointer; +using std::remove_pointer_t; +using std::add_pointer; +using std::add_pointer_t; + +// Sign Modifiers +using std::make_signed; +using std::make_signed_t; +using std::make_unsigned; +using std::make_unsigned_t; + +// Arrays +using std::remove_extent; +using std::remove_extent_t; +using std::remove_all_extents; +using std::remove_all_extents_t; + +// Misc transformations +using std::decay; +using std::decay_t; +using std::enable_if; +using std::enable_if_t; +using std::conditional; +using std::conditional_t; +using std::common_type; +using std::common_type_t; +using std::underlying_type; +using std::underlying_type_t; + +#endif + +template +using bool_constant = boost::math::integral_constant; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_void_v = boost::math::is_void::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_null_pointer_v = boost::math::is_null_pointer::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_integral_v = boost::math::is_integral::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_floating_point_v = boost::math::is_floating_point::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_array_v = boost::math::is_array::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_enum_v = boost::math::is_enum::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_union_v = boost::math::is_union::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_class_v = boost::math::is_class::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_function_v = boost::math::is_function::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_pointer_v = boost::math::is_pointer::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_lvalue_reference_v = boost::math::is_lvalue_reference::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_rvalue_reference_v = boost::math::is_rvalue_reference::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_member_object_pointer_v = boost::math::is_member_object_pointer::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_member_function_pointer_v = boost::math::is_member_function_pointer::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_fundamental_v = boost::math::is_fundamental::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_arithmetic_v = boost::math::is_arithmetic::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_scalar_v = boost::math::is_scalar::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_object_v = boost::math::is_object::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_compound_v = boost::math::is_compound::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_reference_v = boost::math::is_reference::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_member_pointer_v = boost::math::is_member_pointer::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_const_v = boost::math::is_const::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_volatile_v = boost::math::is_volatile::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivial_v = boost::math::is_trivial::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copyable_v = boost::math::is_trivially_copyable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_standard_layout_v = boost::math::is_standard_layout::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_empty_v = boost::math::is_empty::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_polymorphic_v = boost::math::is_polymorphic::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_abstract_v = boost::math::is_abstract::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_final_v = boost::math::is_final::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_signed_v = boost::math::is_signed::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_unsigned_v = boost::math::is_unsigned::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_constructible_v = boost::math::is_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_constructible_v = boost::math::is_trivially_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_constructible_v = boost::math::is_nothrow_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_default_constructible_v = boost::math::is_default_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_default_constructible_v = boost::math::is_trivially_default_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_default_constructible_v = boost::math::is_nothrow_default_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_copy_constructible_v = boost::math::is_copy_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copy_constructible_v = boost::math::is_trivially_copy_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_copy_constructible_v = boost::math::is_nothrow_copy_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_move_constructible_v = boost::math::is_move_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_move_constructible_v = boost::math::is_trivially_move_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_move_constructible_v = boost::math::is_nothrow_move_constructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_assignable_v = boost::math::is_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_assignable_v = boost::math::is_trivially_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_assignable_v = boost::math::is_nothrow_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_copy_assignable_v = boost::math::is_copy_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copy_assignable_v = boost::math::is_trivially_copy_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_copy_assignable_v = boost::math::is_nothrow_copy_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_move_assignable_v = boost::math::is_move_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_move_assignable_v = boost::math::is_trivially_move_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_move_assignable_v = boost::math::is_nothrow_move_assignable::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_destructible_v = boost::math::is_destructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_destructible_v = boost::math::is_trivially_destructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_destructible_v = boost::math::is_nothrow_destructible::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool has_virtual_destructor_v = boost::math::has_virtual_destructor::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_same_v = boost::math::is_same::value; + +template +BOOST_MATH_INLINE_CONSTEXPR bool is_base_of_v = boost::math::is_base_of::value; + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_TOOLS_TYPE_TRAITS diff --git a/include/boost/move/adl_move_swap.hpp b/include/boost/move/adl_move_swap.hpp index d9096e36..3648ea47 100644 --- a/include/boost/move/adl_move_swap.hpp +++ b/include/boost/move/adl_move_swap.hpp @@ -40,6 +40,8 @@ //In GCC 4.4 stl_move.h was renamed to move.h #include #endif +#elif defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 13000) + #include <__utility/swap.h> //libc++ refactored headers in smaller headers #elif defined(_LIBCPP_VERSION) #include //The initial import of libc++ defines std::swap and still there #elif __cplusplus >= 201103L @@ -155,7 +157,7 @@ struct and_op_not {}; template -BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y, typename boost::move_detail::enable_if_c::value>::type* = 0) +inline void swap_proxy(T& x, T& y, typename boost::move_detail::enable_if_c::value>::type* = 0) { //use std::swap if argument dependent lookup fails //Use using directive ("using namespace xxx;") instead as some older compilers @@ -165,14 +167,14 @@ BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y, typename boost::move_detail:: } template -BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y +void swap_proxy(T& x, T& y , typename boost::move_detail::enable_if< and_op_not_impl , boost_move_member_swap::has_member_swap > >::type* = 0) { T t(::boost::move(x)); x = ::boost::move(y); y = ::boost::move(t); } template -BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y +inline void swap_proxy(T& x, T& y , typename boost::move_detail::enable_if< and_op_impl< boost::move_detail::has_move_emulation_enabled_impl , boost_move_member_swap::has_member_swap > >::type* = 0) @@ -185,7 +187,7 @@ BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y namespace boost_move_adl_swap{ template -BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y) +inline void swap_proxy(T& x, T& y) { using std::swap; swap(x, y); @@ -222,7 +224,7 @@ namespace boost{ //! - Otherwise a move-based swap is called, equivalent to: //! T t(::boost::move(x)); x = ::boost::move(y); y = ::boost::move(t);. template -BOOST_MOVE_FORCEINLINE void adl_move_swap(T& x, T& y) +inline void adl_move_swap(T& x, T& y) { ::boost_move_adl_swap::swap_proxy(x, y); } diff --git a/include/boost/move/algo/adaptive_merge.hpp b/include/boost/move/algo/adaptive_merge.hpp index bba41bd2..5261d729 100644 --- a/include/boost/move/algo/adaptive_merge.hpp +++ b/include/boost/move/algo/adaptive_merge.hpp @@ -19,6 +19,7 @@ #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #endif namespace boost { diff --git a/include/boost/move/algo/detail/adaptive_sort_merge.hpp b/include/boost/move/algo/detail/adaptive_sort_merge.hpp index 79c46996..2b45407d 100644 --- a/include/boost/move/algo/detail/adaptive_sort_merge.hpp +++ b/include/boost/move/algo/detail/adaptive_sort_merge.hpp @@ -60,6 +60,7 @@ #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #endif #ifndef BOOST_MOVE_ADAPTIVE_SORT_STATS_LEVEL @@ -93,26 +94,12 @@ #define BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(L) #endif -namespace boost { -namespace movelib { - #if defined(BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS) +#include +#endif -bool is_sorted(::order_perf_type *first, ::order_perf_type *last, ::order_type_less) -{ - if (first != last) { - const order_perf_type *next = first, *cur(first); - while (++next != last) { - if (!(cur->key < next->key || (cur->key == next->key && cur->val < next->val))) - return false; - cur = next; - } - } - return true; -} - -#endif //BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS - +namespace boost { +namespace movelib { namespace detail_adaptive { static const std::size_t AdaptiveSortInsertionSortThreshold = 16; @@ -1320,7 +1307,6 @@ void op_merge_blocks_with_buf //swap_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min); buffer_end = buffer_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min, buffer = buf_first, op); BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_swp: ", len); - BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first2, last2, comp)); BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first_min, last_min, comp)); first1 = first2; BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first, first1, comp)); diff --git a/include/boost/move/algo/detail/basic_op.hpp b/include/boost/move/algo/detail/basic_op.hpp index 144280b3..43ae68d1 100644 --- a/include/boost/move/algo/detail/basic_op.hpp +++ b/include/boost/move/algo/detail/basic_op.hpp @@ -36,19 +36,19 @@ struct four_way_t{}; struct move_op { template - BOOST_MOVE_FORCEINLINE void operator()(SourceIt source, DestinationIt dest) + inline void operator()(SourceIt source, DestinationIt dest) { *dest = ::boost::move(*source); } template - BOOST_MOVE_FORCEINLINE DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) + inline DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) { return ::boost::move(first, last, dest_begin); } template - BOOST_MOVE_FORCEINLINE DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_last) + inline DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_last) { return ::boost::move_backward(first, last, dest_last); } template - BOOST_MOVE_FORCEINLINE void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) + inline void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) { *dest2it = boost::move(*dest1it); *dest1it = boost::move(*srcit); @@ -65,7 +65,7 @@ struct move_op } template - BOOST_MOVE_FORCEINLINE void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) + inline void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) { *dest3it = boost::move(*dest2it); *dest2it = boost::move(*dest1it); @@ -76,19 +76,19 @@ struct move_op struct swap_op { template - BOOST_MOVE_FORCEINLINE void operator()(SourceIt source, DestinationIt dest) + inline void operator()(SourceIt source, DestinationIt dest) { boost::adl_move_swap(*dest, *source); } template - BOOST_MOVE_FORCEINLINE DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) + inline DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) { return boost::adl_move_swap_ranges(first, last, dest_begin); } template - BOOST_MOVE_FORCEINLINE DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) + inline DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) { return boost::adl_move_swap_ranges_backward(first, last, dest_begin); } template - BOOST_MOVE_FORCEINLINE void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) + inline void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) { typename ::boost::movelib::iterator_traits::value_type tmp(boost::move(*dest2it)); *dest2it = boost::move(*dest1it); @@ -106,7 +106,7 @@ struct swap_op } template - BOOST_MOVE_FORCEINLINE void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) + inline void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) { typename ::boost::movelib::iterator_traits::value_type tmp(boost::move(*dest3it)); *dest3it = boost::move(*dest2it); diff --git a/include/boost/move/algo/detail/heap_sort.hpp b/include/boost/move/algo/detail/heap_sort.hpp index 60db353e..4ed5a1c7 100644 --- a/include/boost/move/algo/detail/heap_sort.hpp +++ b/include/boost/move/algo/detail/heap_sort.hpp @@ -106,7 +106,7 @@ class heap_sort_helper }; template -BOOST_MOVE_FORCEINLINE void heap_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) +inline void heap_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) { heap_sort_helper::sort(first, last, comp); } diff --git a/include/boost/move/algo/detail/merge.hpp b/include/boost/move/algo/detail/merge.hpp index ad260046..f9f12757 100644 --- a/include/boost/move/algo/detail/merge.hpp +++ b/include/boost/move/algo/detail/merge.hpp @@ -43,11 +43,11 @@ class adaptive_xbuf typedef RandRawIt iterator; typedef SizeType size_type; - BOOST_MOVE_FORCEINLINE adaptive_xbuf() + inline adaptive_xbuf() : m_ptr(), m_size(0), m_capacity(0) {} - BOOST_MOVE_FORCEINLINE adaptive_xbuf(RandRawIt raw_memory, size_type cap) + inline adaptive_xbuf(RandRawIt raw_memory, size_type cap) : m_ptr(raw_memory), m_size(0), m_capacity(cap) {} @@ -102,7 +102,7 @@ class adaptive_xbuf } } - BOOST_MOVE_FORCEINLINE void set_size(size_type sz) + inline void set_size(size_type sz) { m_size = sz; } @@ -144,12 +144,12 @@ class adaptive_xbuf private: template - BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(RIt) + inline static bool is_raw_ptr(RIt) { return false; } - BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(T*) + inline static bool is_raw_ptr(T*) { return true; } @@ -168,43 +168,43 @@ class adaptive_xbuf } template - BOOST_MOVE_FORCEINLINE U *aligned_trailing() const + inline U *aligned_trailing() const { return this->aligned_trailing(this->size()); } template - BOOST_MOVE_FORCEINLINE U *aligned_trailing(size_type pos) const + inline U *aligned_trailing(size_type pos) const { uintptr_t u_addr = uintptr_t(&*(this->data()+pos)); u_addr = ((u_addr + sizeof(U)-1)/sizeof(U))*sizeof(U); return (U*)u_addr; } - BOOST_MOVE_FORCEINLINE ~adaptive_xbuf() + inline ~adaptive_xbuf() { this->clear(); } - BOOST_MOVE_FORCEINLINE size_type capacity() const + inline size_type capacity() const { return m_capacity; } - BOOST_MOVE_FORCEINLINE iterator data() const + inline iterator data() const { return m_ptr; } - BOOST_MOVE_FORCEINLINE iterator begin() const + inline iterator begin() const { return m_ptr; } - BOOST_MOVE_FORCEINLINE iterator end() const + inline iterator end() const { return m_ptr+m_size; } - BOOST_MOVE_FORCEINLINE size_type size() const + inline size_type size() const { return m_size; } - BOOST_MOVE_FORCEINLINE bool empty() const + inline bool empty() const { return !m_size; } - BOOST_MOVE_FORCEINLINE void clear() + inline void clear() { this->shrink_to_fit(0u); } diff --git a/include/boost/move/algo/predicate.hpp b/include/boost/move/algo/predicate.hpp index 58a4d620..023066a1 100644 --- a/include/boost/move/algo/predicate.hpp +++ b/include/boost/move/algo/predicate.hpp @@ -24,19 +24,19 @@ namespace movelib { template struct antistable { - BOOST_MOVE_FORCEINLINE explicit antistable(Comp &comp) + inline explicit antistable(Comp &comp) : m_comp(comp) {} - BOOST_MOVE_FORCEINLINE antistable(const antistable & other) + inline antistable(const antistable & other) : m_comp(other.m_comp) {} template - BOOST_MOVE_FORCEINLINE bool operator()(const U &u, const V & v) + inline bool operator()(const U &u, const V & v) { return !m_comp(v, u); } - BOOST_MOVE_FORCEINLINE const Comp &get() const + inline const Comp &get() const { return m_comp; } private: @@ -56,15 +56,15 @@ template class negate { public: - BOOST_MOVE_FORCEINLINE negate() + inline negate() {} - BOOST_MOVE_FORCEINLINE explicit negate(Comp comp) + inline explicit negate(Comp comp) : m_comp(comp) {} template - BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r) + inline bool operator()(const T1& l, const T2& r) { return !m_comp(l, r); } @@ -78,15 +78,15 @@ template class inverse { public: - BOOST_MOVE_FORCEINLINE inverse() + inline inverse() {} - BOOST_MOVE_FORCEINLINE explicit inverse(Comp comp) + inline explicit inverse(Comp comp) : m_comp(comp) {} template - BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r) + inline bool operator()(const T1& l, const T2& r) { return m_comp(r, l); } diff --git a/include/boost/move/core.hpp b/include/boost/move/core.hpp index 7b604e67..e5e82ca8 100644 --- a/include/boost/move/core.hpp +++ b/include/boost/move/core.hpp @@ -447,7 +447,7 @@ #else //!defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED) - #include + #include namespace boost { namespace move_detail { diff --git a/include/boost/move/detail/config_begin.hpp b/include/boost/move/detail/config_begin.hpp index 4e95a4ab..ded00501 100644 --- a/include/boost/move/detail/config_begin.hpp +++ b/include/boost/move/detail/config_begin.hpp @@ -16,7 +16,6 @@ # pragma warning (disable : 4619) // there is no warning number 'XXXX' # pragma warning (disable : 4324) // structure was padded due to __declspec(align()) # pragma warning (disable : 4675) // "function": resolved overload was found by argument-dependent lookup -# pragma warning (disable : 4996) // "function": was declared deprecated (_CRT_SECURE_NO_DEPRECATE/_SCL_SECURE_NO_WARNINGS) # pragma warning (disable : 4714) // "function": marked as __forceinline not inlined # pragma warning (disable : 4127) // conditional expression is constant #endif diff --git a/include/boost/move/detail/iterator_to_raw_pointer.hpp b/include/boost/move/detail/iterator_to_raw_pointer.hpp index 67afd6c1..97ee3a65 100644 --- a/include/boost/move/detail/iterator_to_raw_pointer.hpp +++ b/include/boost/move/detail/iterator_to_raw_pointer.hpp @@ -27,11 +27,11 @@ namespace movelib { namespace detail { template -BOOST_MOVE_FORCEINLINE T* iterator_to_pointer(T* i) +inline T* iterator_to_pointer(T* i) { return i; } template -BOOST_MOVE_FORCEINLINE typename boost::movelib::iterator_traits::pointer +inline typename boost::movelib::iterator_traits::pointer iterator_to_pointer(const Iterator &i) { return i.operator->(); } @@ -46,7 +46,7 @@ struct iterator_to_element_ptr } //namespace detail { template -BOOST_MOVE_FORCEINLINE typename boost::movelib::detail::iterator_to_element_ptr::type +inline typename boost::movelib::detail::iterator_to_element_ptr::type iterator_to_raw_pointer(const Iterator &i) { return ::boost::movelib::to_raw_pointer diff --git a/include/boost/move/detail/launder.hpp b/include/boost/move/detail/launder.hpp new file mode 100644 index 00000000..a6236de9 --- /dev/null +++ b/include/boost/move/detail/launder.hpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP +#define BOOST_MOVE_DETAIL_LAUNDER_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include + +namespace boost { +namespace move_detail { + +#if defined(BOOST_MOVE_HAS_BUILTIN_LAUNDER) + +template +BOOST_MOVE_FORCEINLINE T* launder(T* p) +{ + return __builtin_launder( p ); +} + +#else + +template +BOOST_MOVE_FORCEINLINE T* launder(T* p) +{ + return p; +} + +#endif + +template +BOOST_MOVE_FORCEINLINE T launder_cast(const volatile void* p) +{ + return (launder)((T)p); +} + +} //namespace move_detail { +} //namespace boost { + +#endif //#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP diff --git a/include/boost/move/detail/meta_utils.hpp b/include/boost/move/detail/meta_utils.hpp index 7c90de28..6e12b178 100644 --- a/include/boost/move/detail/meta_utils.hpp +++ b/include/boost/move/detail/meta_utils.hpp @@ -17,10 +17,9 @@ #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif -#include + #include //forceinline #include -#include //for std::size_t #include //Small meta-typetraits to support move @@ -57,8 +56,8 @@ struct apply template< bool C_ > struct bool_ : integral_constant { - BOOST_MOVE_FORCEINLINE operator bool() const { return C_; } - BOOST_MOVE_FORCEINLINE bool operator()() const { return C_; } + inline operator bool() const { return C_; } + inline bool operator()() const { return C_; } }; typedef bool_ true_; @@ -201,22 +200,6 @@ struct add_const_lvalue_reference ::type type; }; -////////////////////////////////////// -// is_lvalue_reference -////////////////////////////////////// -template -struct is_lvalue_reference -{ - static const bool value = false; -}; - -template -struct is_lvalue_reference -{ - static const bool value = true; -}; - - ////////////////////////////////////// // identity ////////////////////////////////////// @@ -558,6 +541,4 @@ template< class T > struct remove_rvalue_reference { typedef T type; }; } //namespace move_detail { } //namespace boost { -#include - #endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP diff --git a/include/boost/move/detail/meta_utils_core.hpp b/include/boost/move/detail/meta_utils_core.hpp index 4e116738..fcd04c74 100644 --- a/include/boost/move/detail/meta_utils_core.hpp +++ b/include/boost/move/detail/meta_utils_core.hpp @@ -131,6 +131,21 @@ struct enable_if_same : enable_if, R> {}; template struct disable_if_same : disable_if, R> {}; +////////////////////////////////////// +// is_lvalue_reference +////////////////////////////////////// +template +struct is_lvalue_reference +{ + static const bool value = false; +}; + +template +struct is_lvalue_reference +{ + static const bool value = true; +}; + } //namespace move_detail { } //namespace boost { diff --git a/include/boost/move/detail/move_helpers.hpp b/include/boost/move/detail/move_helpers.hpp index 17138444..89c73a09 100644 --- a/include/boost/move/detail/move_helpers.hpp +++ b/include/boost/move/detail/move_helpers.hpp @@ -69,13 +69,13 @@ {}; #define BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(static_cast(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(::boost::move(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(TYPE &x)\ + inline RETURN_VALUE PUB_FUNCTION(TYPE &x)\ { return FWD_FUNCTION(const_cast(x)); }\ // #if defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) @@ -83,12 +83,12 @@ BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ \ template\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\ + inline RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\ typename boost_move_conversion_aware_catch_1< ::boost::move_detail::nat, BOOST_MOVE_TEMPL_PARAM, TYPE>::type* = 0)\ { return FWD_FUNCTION(u); }\ \ template\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\ + inline RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\ typename boost_move_conversion_aware_catch_2< ::boost::move_detail::nat, BOOST_MOVE_TEMPL_PARAM, TYPE>::type* = 0)\ {\ TYPE t((u));\ @@ -100,12 +100,12 @@ BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ \ template\ - BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1::type\ + inline typename boost_move_conversion_aware_catch_1::type\ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ { return FWD_FUNCTION(u); }\ \ template\ - BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_2::type\ + inline typename boost_move_conversion_aware_catch_2::type\ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ {\ TYPE t((u));\ @@ -116,14 +116,14 @@ #elif (defined(_MSC_VER) && (_MSC_VER == 1600)) #define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(static_cast(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(::boost::move(x)); }\ \ template\ - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c\ + inline typename ::boost::move_detail::enable_if_c\ < !::boost::move_detail::is_same::value\ , RETURN_VALUE >::type\ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ @@ -136,10 +136,10 @@ #else //BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(x); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(::boost::move(x)); }\ // @@ -174,13 +174,13 @@ {}; #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(arg1, static_cast(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\ { return FWD_FUNCTION(arg1, const_cast(x)); }\ // #if defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) @@ -188,12 +188,12 @@ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ \ template\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\ typename boost_move_conversion_aware_catch_1arg_1::type* = 0)\ { return FWD_FUNCTION(arg1, u); }\ \ template\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\ typename boost_move_conversion_aware_catch_1arg_2::type* = 0)\ {\ TYPE t((u));\ @@ -205,12 +205,12 @@ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ \ template\ - BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1arg_1::type\ + inline typename boost_move_conversion_aware_catch_1arg_1::type\ PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\ { return FWD_FUNCTION(arg1, u); }\ \ template\ - BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1arg_2::type\ + inline typename boost_move_conversion_aware_catch_1arg_2::type\ PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\ {\ TYPE t((u));\ @@ -222,14 +222,14 @@ #elif (defined(_MSC_VER) && (_MSC_VER == 1600)) #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(arg1, static_cast(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ \ template\ - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::disable_if_or\ + inline typename ::boost::move_detail::disable_if_or\ < RETURN_VALUE \ , ::boost::move_detail::is_same \ , ::boost::move_detail::is_same_or_convertible \ @@ -244,10 +244,10 @@ #else #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ { return FWD_FUNCTION(arg1, static_cast(x)); }\ \ - BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + inline RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ // diff --git a/include/boost/move/detail/placement_new.hpp b/include/boost/move/detail/placement_new.hpp index 69d33328..11a9fca5 100644 --- a/include/boost/move/detail/placement_new.hpp +++ b/include/boost/move/detail/placement_new.hpp @@ -18,6 +18,8 @@ # pragma once #endif +#include + struct boost_move_new_t{}; //avoid including diff --git a/include/boost/move/detail/reverse_iterator.hpp b/include/boost/move/detail/reverse_iterator.hpp index 7fda6edf..19fb2877 100644 --- a/include/boost/move/detail/reverse_iterator.hpp +++ b/include/boost/move/detail/reverse_iterator.hpp @@ -29,7 +29,7 @@ namespace boost { namespace movelib { template -BOOST_MOVE_FORCEINLINE typename iterator_traits::pointer iterator_arrow_result(const I &i) +inline typename iterator_traits::pointer iterator_arrow_result(const I &i) { return i.operator->(); } template @@ -49,38 +49,38 @@ class reverse_iterator typedef It iterator_type; - BOOST_MOVE_FORCEINLINE reverse_iterator() + inline reverse_iterator() : m_current() //Value initialization to achieve "null iterators" (N3644) {} - BOOST_MOVE_FORCEINLINE explicit reverse_iterator(It r) + inline explicit reverse_iterator(It r) : m_current(r) {} - BOOST_MOVE_FORCEINLINE reverse_iterator(const reverse_iterator& r) + inline reverse_iterator(const reverse_iterator& r) : m_current(r.base()) {} template - BOOST_MOVE_FORCEINLINE + inline reverse_iterator( const reverse_iterator& r , typename boost::move_detail::enable_if_convertible::type* =0 ) : m_current(r.base()) {} - BOOST_MOVE_FORCEINLINE reverse_iterator & operator=( const reverse_iterator& r) + inline reverse_iterator & operator=( const reverse_iterator& r) { m_current = r.base(); return *this; } template - BOOST_MOVE_FORCEINLINE typename boost::move_detail::enable_if_convertible::type + inline typename boost::move_detail::enable_if_convertible::type operator=( const reverse_iterator& r) { m_current = r.base(); return *this; } - BOOST_MOVE_FORCEINLINE It base() const + inline It base() const { return m_current; } - BOOST_MOVE_FORCEINLINE reference operator*() const + inline reference operator*() const { It temp(m_current); --temp; @@ -88,78 +88,78 @@ class reverse_iterator return r; } - BOOST_MOVE_FORCEINLINE pointer operator->() const + inline pointer operator->() const { It temp(m_current); --temp; return (iterator_arrow_result)(temp); } - BOOST_MOVE_FORCEINLINE reference operator[](difference_type off) const + inline reference operator[](difference_type off) const { return this->m_current[difference_type(-off - 1)]; } - BOOST_MOVE_FORCEINLINE reverse_iterator& operator++() + inline reverse_iterator& operator++() { --m_current; return *this; } - BOOST_MOVE_FORCEINLINE reverse_iterator operator++(int) + inline reverse_iterator operator++(int) { reverse_iterator temp((*this)); --m_current; return temp; } - BOOST_MOVE_FORCEINLINE reverse_iterator& operator--() + inline reverse_iterator& operator--() { ++m_current; return *this; } - BOOST_MOVE_FORCEINLINE reverse_iterator operator--(int) + inline reverse_iterator operator--(int) { reverse_iterator temp((*this)); ++m_current; return temp; } - BOOST_MOVE_FORCEINLINE friend bool operator==(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator==(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current == r.m_current; } - BOOST_MOVE_FORCEINLINE friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current != r.m_current; } - BOOST_MOVE_FORCEINLINE friend bool operator<(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator<(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current > r.m_current; } - BOOST_MOVE_FORCEINLINE friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current >= r.m_current; } - BOOST_MOVE_FORCEINLINE friend bool operator>(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator>(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current < r.m_current; } - BOOST_MOVE_FORCEINLINE friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r) + inline friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r) { return l.m_current <= r.m_current; } - BOOST_MOVE_FORCEINLINE reverse_iterator& operator+=(difference_type off) + inline reverse_iterator& operator+=(difference_type off) { m_current -= off; return *this; } - BOOST_MOVE_FORCEINLINE reverse_iterator& operator-=(difference_type off) + inline reverse_iterator& operator-=(difference_type off) { m_current += off; return *this; } - BOOST_MOVE_FORCEINLINE friend reverse_iterator operator+(reverse_iterator l, difference_type off) + inline friend reverse_iterator operator+(reverse_iterator l, difference_type off) { return (l += off); } - BOOST_MOVE_FORCEINLINE friend reverse_iterator operator+(difference_type off, reverse_iterator r) + inline friend reverse_iterator operator+(difference_type off, reverse_iterator r) { return (r += off); } - BOOST_MOVE_FORCEINLINE friend reverse_iterator operator-(reverse_iterator l, difference_type off) + inline friend reverse_iterator operator-(reverse_iterator l, difference_type off) { return (l-= off); } - BOOST_MOVE_FORCEINLINE friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r) + inline friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r) { return r.m_current - l.m_current; } private: @@ -167,7 +167,7 @@ class reverse_iterator }; template< class Iterator > -BOOST_MOVE_FORCEINLINE reverse_iterator make_reverse_iterator( Iterator i ) +inline reverse_iterator make_reverse_iterator( Iterator i ) { return reverse_iterator(i); } } //namespace movelib { diff --git a/include/boost/move/detail/std_ns_begin.hpp b/include/boost/move/detail/std_ns_begin.hpp index 1d28117b..de13cde5 100644 --- a/include/boost/move/detail/std_ns_begin.hpp +++ b/include/boost/move/detail/std_ns_begin.hpp @@ -23,12 +23,12 @@ #elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE) //GCC >= 4.2 #define BOOST_MOVE_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std) #define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE -#else - #if defined(_MSC_VER) && (_MSC_VER >= 1915) - #pragma warning (push) - #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard - #endif +#elif defined(BOOST_DINKUMWARE_STDLIB) + #define BOOST_MOVE_STD_NS_BEG _STD_BEGIN + #define BOOST_MOVE_STD_NS_END _STD_END +#endif - #define BOOST_MOVE_STD_NS_BEG namespace std{ - #define BOOST_MOVE_STD_NS_END } +#if defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (push) + #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard #endif diff --git a/include/boost/move/detail/std_ns_end.hpp b/include/boost/move/detail/std_ns_end.hpp index 61af2d7b..abc40ed0 100644 --- a/include/boost/move/detail/std_ns_end.hpp +++ b/include/boost/move/detail/std_ns_end.hpp @@ -14,3 +14,6 @@ #elif defined(_MSC_VER) && (_MSC_VER >= 1915) #pragma warning (pop) #endif //BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH + +#undef BOOST_MOVE_STD_NS_BEG +#undef BOOST_MOVE_STD_NS_END diff --git a/include/boost/move/detail/to_raw_pointer.hpp b/include/boost/move/detail/to_raw_pointer.hpp index 7e89beb4..06beb2d4 100644 --- a/include/boost/move/detail/to_raw_pointer.hpp +++ b/include/boost/move/detail/to_raw_pointer.hpp @@ -33,7 +33,7 @@ BOOST_MOVE_FORCEINLINE T* to_raw_pointer(T* p) { return p; } template -BOOST_MOVE_FORCEINLINE typename boost::movelib::pointer_element::type* +inline typename boost::movelib::pointer_element::type* to_raw_pointer(const Pointer &p) { return ::boost::movelib::to_raw_pointer(p.operator->()); } diff --git a/include/boost/move/detail/type_traits.hpp b/include/boost/move/detail/type_traits.hpp index 5a093186..de8b2eb6 100644 --- a/include/boost/move/detail/type_traits.hpp +++ b/include/boost/move/detail/type_traits.hpp @@ -581,6 +581,28 @@ struct remove_cvref { }; +////////////////////////// +// is_unsigned +////////////////////////// +template struct is_unsigned_cv { static const bool value = true; }; +template <> struct is_unsigned_cv { static const bool value = false; }; +template <> struct is_unsigned_cv { static const bool value = false; }; +template <> struct is_unsigned_cv { static const bool value = false; }; +template <> struct is_unsigned_cv { static const bool value = false; }; +#ifdef BOOST_HAS_LONG_LONG +template <> struct is_unsigned_cv< ::boost::long_long_type > { static const bool value = false; }; +#endif + +#ifdef BOOST_HAS_INT128 +template <> struct is_unsigned_cv< ::boost::int128_type > { static const bool value = false; }; +#endif + +template +struct is_unsigned + : is_unsigned_cv::type> +{}; + + ////////////////////////// // make_unsigned ////////////////////////// @@ -594,6 +616,11 @@ template <> struct make_unsigned_impl { typedef uns template <> struct make_unsigned_impl< ::boost::long_long_type > { typedef ::boost::ulong_long_type type; }; #endif +#ifdef BOOST_HAS_INT128 +template <> struct make_unsigned_impl< ::boost::int128_type > { typedef ::boost::uint128_type type; }; +#endif + + template struct make_unsigned : make_unsigned_impl::type> @@ -639,6 +666,13 @@ template<> struct is_integral_cv< unsigned long>{ static const bool template<> struct is_integral_cv< ::boost:: long_long_type>{ static const bool value = true; }; template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; }; #endif +#ifdef BOOST_HAS_INT128 +template <> struct is_integral_cv< ::boost::int128_type > { static const bool value = true; }; +template <> struct is_integral_cv< ::boost::uint128_type > { static const bool value = true; }; +#endif +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L +template<> struct is_integral_cv { static const bool value = true; }; +#endif template struct is_integral @@ -660,13 +694,6 @@ template struct remove_all_extents { typedef typename remove_all_extents::type type;}; -////////////////////////// -// is_scalar -////////////////////////// -template -struct is_scalar -{ static const bool value = is_integral::value || is_floating_point::value; }; - ////////////////////////// // is_void ////////////////////////// @@ -732,6 +759,11 @@ struct is_nullptr_t : is_nullptr_t_cv::type> {}; +template +struct is_null_pointer + : is_nullptr_t_cv::type> +{}; + ////////////////////////////////////// // is_function ////////////////////////////////////// @@ -802,6 +834,7 @@ struct is_arithmetic is_integral::value; }; + ////////////////////////////////////// // is_member_function_pointer ////////////////////////////////////// @@ -829,21 +862,38 @@ struct is_member_function_pointer template struct is_enum_nonintrinsic { - static const bool value = !is_arithmetic::value && - !is_reference::value && - !is_class_or_union::value && - !is_array::value && - !is_void::value && - !is_nullptr_t::value && - !is_member_pointer::value && - !is_pointer::value && - !is_function::value; + static const bool value = !is_arithmetic::value && + !is_reference::value && + !is_class_or_union::value && + !is_array::value && + !is_void::value && + !is_nullptr_t::value && + !is_member_pointer::value && + !is_pointer::value && + !is_function::value; }; #endif template struct is_enum -{ static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T); }; +{ + static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T); +}; + + +////////////////////////// +// is_scalar +////////////////////////// +template +struct is_scalar +{ + static const bool value = is_arithmetic::value || + is_enum::value || + is_pointer::value || + is_member_pointer::value || + is_null_pointer::value; +}; + ////////////////////////////////////// // is_pod @@ -1147,12 +1197,20 @@ struct aligned_struct; template <> struct aligned_struct<1> { char data; }; template <> struct aligned_struct<2> { short data; }; template <> struct aligned_struct<4> { int data; }; -template <> struct aligned_struct<8> { double data; }; +//8 byte alignment does not propely work in x86 if attribute is not used. +//If a user declares a variable with 8 byte alignment, such as a double +//the compiler will not realign the stack. +// +//If _declspec(align) is used MSVC will realign the stack. +// +//Disabled specialization +//template <> struct aligned_struct<8> { double data; }; #define BOOST_MOVE_ALIGNED_STRUCT(x) \ template <> struct aligned_struct { \ __declspec(align(x)) char data; \ } +BOOST_MOVE_ALIGNED_STRUCT(8); BOOST_MOVE_ALIGNED_STRUCT(16); BOOST_MOVE_ALIGNED_STRUCT(32); BOOST_MOVE_ALIGNED_STRUCT(64); diff --git a/include/boost/move/detail/workaround.hpp b/include/boost/move/detail/workaround.hpp index 2fcd027d..f12e9331 100644 --- a/include/boost/move/detail/workaround.hpp +++ b/include/boost/move/detail/workaround.hpp @@ -61,8 +61,11 @@ #elif defined(BOOST_MSVC) && (_MSC_VER < 1900 || defined(_DEBUG)) //"__forceinline" and MSVC seems to have some bugs in old versions and in debug mode #define BOOST_MOVE_FORCEINLINE inline -#elif defined(BOOST_GCC) && (__GNUC__ <= 5) +#elif defined(BOOST_CLANG) || (defined(BOOST_GCC) && ((__GNUC__ <= 5) || defined(__MINGW32__))) //Older GCCs have problems with forceinline + //Clang can have code bloat issues with forceinline, see + //https://lists.boost.org/boost-users/2023/04/91445.php and + //https://github.com/llvm/llvm-project/issues/62202 #define BOOST_MOVE_FORCEINLINE inline #else #define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE @@ -126,7 +129,7 @@ template struct static_assert_test {}; #define BOOST_MOVE_STATIC_ASSERT(B) \ typedef ::boost::move_detail::static_assert_test<\ (unsigned)sizeof(::boost::move_detail::STATIC_ASSERTION_FAILURE)>\ - BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED + BOOST_JOIN(boost_move_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED #endif @@ -144,5 +147,10 @@ template struct static_assert_test {}; #define BOOST_MOVE_INTRINSIC_CAST BOOST_MOVE_FORCEINLINE #endif -#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP +#if defined(__has_builtin) +#if __has_builtin(__builtin_launder) + #define BOOST_MOVE_HAS_BUILTIN_LAUNDER +#endif +#endif +#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP diff --git a/include/boost/move/iterator.hpp b/include/boost/move/iterator.hpp index c289c083..7d1636e0 100644 --- a/include/boost/move/iterator.hpp +++ b/include/boost/move/iterator.hpp @@ -58,20 +58,20 @@ class move_iterator typedef typename boost::movelib::iterator_traits::difference_type difference_type; typedef typename boost::movelib::iterator_traits::iterator_category iterator_category; - BOOST_MOVE_FORCEINLINE move_iterator() + inline move_iterator() : m_it() {} - BOOST_MOVE_FORCEINLINE explicit move_iterator(const It &i) + inline explicit move_iterator(const It &i) : m_it(i) {} template - BOOST_MOVE_FORCEINLINE move_iterator(const move_iterator& u) + inline move_iterator(const move_iterator& u) : m_it(u.m_it) {} - BOOST_MOVE_FORCEINLINE reference operator*() const + inline reference operator*() const { #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return *m_it; @@ -80,34 +80,34 @@ class move_iterator #endif } - BOOST_MOVE_FORCEINLINE pointer operator->() const + inline pointer operator->() const { return m_it; } - BOOST_MOVE_FORCEINLINE move_iterator& operator++() + inline move_iterator& operator++() { ++m_it; return *this; } - BOOST_MOVE_FORCEINLINE move_iterator operator++(int) + inline move_iterator operator++(int) { move_iterator tmp(*this); ++(*this); return tmp; } - BOOST_MOVE_FORCEINLINE move_iterator& operator--() + inline move_iterator& operator--() { --m_it; return *this; } - BOOST_MOVE_FORCEINLINE move_iterator operator--(int) + inline move_iterator operator--(int) { move_iterator tmp(*this); --(*this); return tmp; } move_iterator operator+ (difference_type n) const { return move_iterator(m_it + n); } - BOOST_MOVE_FORCEINLINE move_iterator& operator+=(difference_type n) + inline move_iterator& operator+=(difference_type n) { m_it += n; return *this; } - BOOST_MOVE_FORCEINLINE move_iterator operator- (difference_type n) const + inline move_iterator operator- (difference_type n) const { return move_iterator(m_it - n); } - BOOST_MOVE_FORCEINLINE move_iterator& operator-=(difference_type n) + inline move_iterator& operator-=(difference_type n) { m_it -= n; return *this; } - BOOST_MOVE_FORCEINLINE reference operator[](difference_type n) const + inline reference operator[](difference_type n) const { #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return m_it[n]; @@ -116,28 +116,28 @@ class move_iterator #endif } - BOOST_MOVE_FORCEINLINE friend bool operator==(const move_iterator& x, const move_iterator& y) + inline friend bool operator==(const move_iterator& x, const move_iterator& y) { return x.m_it == y.m_it; } - BOOST_MOVE_FORCEINLINE friend bool operator!=(const move_iterator& x, const move_iterator& y) + inline friend bool operator!=(const move_iterator& x, const move_iterator& y) { return x.m_it != y.m_it; } - BOOST_MOVE_FORCEINLINE friend bool operator< (const move_iterator& x, const move_iterator& y) + inline friend bool operator< (const move_iterator& x, const move_iterator& y) { return x.m_it < y.m_it; } - BOOST_MOVE_FORCEINLINE friend bool operator<=(const move_iterator& x, const move_iterator& y) + inline friend bool operator<=(const move_iterator& x, const move_iterator& y) { return x.m_it <= y.m_it; } - BOOST_MOVE_FORCEINLINE friend bool operator> (const move_iterator& x, const move_iterator& y) + inline friend bool operator> (const move_iterator& x, const move_iterator& y) { return x.m_it > y.m_it; } - BOOST_MOVE_FORCEINLINE friend bool operator>=(const move_iterator& x, const move_iterator& y) + inline friend bool operator>=(const move_iterator& x, const move_iterator& y) { return x.m_it >= y.m_it; } - BOOST_MOVE_FORCEINLINE friend difference_type operator-(const move_iterator& x, const move_iterator& y) + inline friend difference_type operator-(const move_iterator& x, const move_iterator& y) { return x.m_it - y.m_it; } - BOOST_MOVE_FORCEINLINE friend move_iterator operator+(difference_type n, const move_iterator& x) + inline friend move_iterator operator+(difference_type n, const move_iterator& x) { return move_iterator(x.m_it + n); } private: @@ -170,7 +170,7 @@ struct is_move_iterator< ::boost::move_iterator > //! //! Returns: move_iterator(i). template -BOOST_MOVE_FORCEINLINE move_iterator make_move_iterator(const It &it) +inline move_iterator make_move_iterator(const It &it) { return move_iterator(it); } ////////////////////////////////////////////////////////////////////////////// diff --git a/include/boost/move/utility.hpp b/include/boost/move/utility.hpp deleted file mode 100644 index 9c94d770..00000000 --- a/include/boost/move/utility.hpp +++ /dev/null @@ -1,150 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2012-2012. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/move for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -//! \file -//! This header includes core utilities from and defines -//! some more advanced utilities such as: - -#ifndef BOOST_MOVE_MOVE_UTILITY_HPP -#define BOOST_MOVE_MOVE_UTILITY_HPP - -#ifndef BOOST_CONFIG_HPP -# include -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include -#include //forceinline -#include -#include - -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) - - namespace boost { - - ////////////////////////////////////////////////////////////////////////////// - // - // move_if_noexcept() - // - ////////////////////////////////////////////////////////////////////////////// - - template - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c - < enable_move_utility_emulation::value && !has_move_emulation_enabled::value - , typename ::boost::move_detail::add_const::type & - >::type - move_if_noexcept(T& x) BOOST_NOEXCEPT - { - return x; - } - - template - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c - < enable_move_utility_emulation::value && has_move_emulation_enabled::value - && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, rv&>::type - move_if_noexcept(T& x) BOOST_NOEXCEPT - { - return *static_cast* >(::boost::move_detail::addressof(x)); - } - - template - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c - < enable_move_utility_emulation::value && has_move_emulation_enabled::value - && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value - , rv& - >::type - move_if_noexcept(rv& x) BOOST_NOEXCEPT - { - return x; - } - - template - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c - < enable_move_utility_emulation::value && has_move_emulation_enabled::value - && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value - , typename ::boost::move_detail::add_const::type & - >::type - move_if_noexcept(T& x) BOOST_NOEXCEPT - { - return x; - } - - template - BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c - < enable_move_utility_emulation::value && has_move_emulation_enabled::value - && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value - , typename ::boost::move_detail::add_const::type & - >::type - move_if_noexcept(rv& x) BOOST_NOEXCEPT - { - return x; - } - - } //namespace boost - -#else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) - - #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) - #include - - namespace boost{ - - using ::std::move_if_noexcept; - - } //namespace boost - - #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE - - namespace boost { - - ////////////////////////////////////////////////////////////////////////////// - // - // move_if_noexcept() - // - ////////////////////////////////////////////////////////////////////////////// - #if defined(BOOST_MOVE_DOXYGEN_INVOKED) - //! This function provides a way to convert a reference into a rvalue reference - //! in compilers with rvalue references. For other compilers converts T & into - //! ::boost::rv & so that move emulation is activated. Reference - //! would be converted to rvalue reference only if input type is nothrow move - //! constructible or if it has no copy constructor. In all other cases const - //! reference would be returned - template - rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept; - - #else //BOOST_MOVE_DOXYGEN_INVOKED - - template - BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c - < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, T&&>::type - move_if_noexcept(T& x) BOOST_NOEXCEPT - { return ::boost::move(x); } - - template - BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c - < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, const T&>::type - move_if_noexcept(T& x) BOOST_NOEXCEPT - { return x; } - - #endif //BOOST_MOVE_DOXYGEN_INVOKED - - } //namespace boost { - - #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) - -#endif //BOOST_NO_CXX11_RVALUE_REFERENCES - -#include - -#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index be377f5a..8f802440 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -26,6 +26,11 @@ #include #include +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + namespace boost { namespace mp11 @@ -84,6 +89,25 @@ template class F, template class L1, class... T1, t #endif }; +#if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) + +template class F, template class L, auto... A> struct mp_transform_impl> +{ + using type = L< F< mp_value >::value... >; +}; + +template class F, template class L1, auto... A1, template class L2, auto... A2> struct mp_transform_impl, L2> +{ + using type = L1< F< mp_value, mp_value >::value... >; +}; + +template class F, template class L1, auto... A1, template class L2, auto... A2, template class L3, auto... A3> struct mp_transform_impl, L2, L3> +{ + using type = L1< F< mp_value, mp_value, mp_value >::value... >; +}; + +#endif + #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, == 1900 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 ) template using mp_same_size_1 = mp_same...>; @@ -473,6 +497,10 @@ struct mp_take_c_impl, typen template using mp_take_c = mp_assign>::type>; template using mp_take = mp_take_c; +// mp_slice(_c) +template using mp_slice_c = mp_drop_c< mp_take_c, I >; +template using mp_slice = mp_drop< mp_take, I >; + // mp_back template using mp_back = mp_at_c::value - 1>; @@ -1261,6 +1289,33 @@ template using mp_pairwise_fold_impl = mp_transform_q using mp_pairwise_fold_q = mp_eval_if, mp_clear, detail::mp_pairwise_fold_impl, L, Q>; template class F> using mp_pairwise_fold = mp_pairwise_fold_q>; +// mp_sliding_fold +namespace detail +{ + +template struct mp_sliding_fold_impl; + +template struct mp_sliding_fold_impl +{ + static const std::size_t M = mp_size::value - N::value + 1; + + template using F = mp_slice_c; + + using J = mp_transform>; + + using type = mp_apply>; +}; + +template struct mp_sliding_fold_impl +{ + using type = mp_clear; +}; + +} // namespace detail + +template using mp_sliding_fold_q = typename detail::mp_sliding_fold_impl::value >= N::value)>, L, N, Q>::type; +template class F> using mp_sliding_fold = mp_sliding_fold_q>; + // mp_intersperse namespace detail { @@ -1324,4 +1379,8 @@ template using mp_join = mp_apply #include +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + namespace boost { namespace mp11 @@ -108,4 +113,8 @@ template using mp_bind_q = mp_bind; } // namespace mp11 } // namespace boost +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #endif // #ifndef BOOST_MP11_BIND_HPP_INCLUDED diff --git a/include/boost/mp11/detail/mp_count.hpp b/include/boost/mp11/detail/mp_count.hpp index 37b39ed5..bc8aed93 100644 --- a/include/boost/mp11/detail/mp_count.hpp +++ b/include/boost/mp11/detail/mp_count.hpp @@ -51,9 +51,9 @@ template constexpr std::size_t cx_count() std::size_t r = 0; - for( std::size_t i = 1; i < sizeof...(T) + 1; ++i ) + for( std::size_t i = 0; i < sizeof...(T); ++i ) { - r += a[ i ]; + r += a[ i+1 ]; } return r; @@ -98,9 +98,9 @@ template class P, class... T> constexpr std::size_t cx_count_ std::size_t r = 0; - for( std::size_t i = 1; i < sizeof...(T) + 1; ++i ) + for( std::size_t i = 0; i < sizeof...(T); ++i ) { - r += a[ i ]; + r += a[ i+1 ]; } return r; diff --git a/include/boost/mp11/detail/mp_fold.hpp b/include/boost/mp11/detail/mp_fold.hpp index 266d9c18..e2c464c9 100644 --- a/include/boost/mp11/detail/mp_fold.hpp +++ b/include/boost/mp11/detail/mp_fold.hpp @@ -10,6 +10,8 @@ #include #include +#include +#include namespace boost { @@ -155,7 +157,7 @@ struct mp_fold_impl, V, F> } // namespace detail -template class F> using mp_fold = typename detail::mp_fold_impl::type; +template class F> using mp_fold = typename detail::mp_fold_impl, V, F>::type; template using mp_fold_q = mp_fold; } // namespace mp11 diff --git a/include/boost/mp11/integer_sequence.hpp b/include/boost/mp11/integer_sequence.hpp index 83e24501..013991fa 100644 --- a/include/boost/mp11/integer_sequence.hpp +++ b/include/boost/mp11/integer_sequence.hpp @@ -11,6 +11,11 @@ #include #include +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + #if defined(__has_builtin) # if __has_builtin(__make_integer_seq) # define BOOST_MP11_HAS_MAKE_INTEGER_SEQ @@ -109,4 +114,8 @@ template using index_sequence_for = make_integer_sequence #include +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + namespace boost { namespace mp11 @@ -39,4 +44,8 @@ template using mp_size_t = std::integral_constant } // namespace mp11 } // namespace boost +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #endif // #ifndef BOOST_MP11_INTEGRAL_HPP_INCLUDED diff --git a/include/boost/mp11/list.hpp b/include/boost/mp11/list.hpp index 36467644..46b56053 100644 --- a/include/boost/mp11/list.hpp +++ b/include/boost/mp11/list.hpp @@ -19,6 +19,11 @@ #include #include +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + namespace boost { namespace mp11 @@ -469,4 +474,8 @@ template using mp_transform_third_q = mp_transform_third= 201103L private: BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); diff --git a/include/boost/multiprecision/cpp_bin_float.hpp b/include/boost/multiprecision/cpp_bin_float.hpp index 7678c5e0..4d873b4b 100644 --- a/include/boost/multiprecision/cpp_bin_float.hpp +++ b/include/boost/multiprecision/cpp_bin_float.hpp @@ -37,7 +37,10 @@ #endif #ifdef BOOST_HAS_FLOAT128 -#include +# if __has_include() +# include +# define BOOST_MP_HAS_FLOAT128_SUPPORT +# endif #endif namespace boost { @@ -66,7 +69,7 @@ template struct is_cpp_bin_float_implicitly_constructible_from_type { static constexpr bool value = (std::numeric_limits::digits <= static_cast(bit_count)) && (std::numeric_limits::radix == 2) && std::numeric_limits::is_specialized -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT && !std::is_same::value #endif && (std::is_floating_point::value || is_number::value); @@ -82,7 +85,7 @@ template struct is_cpp_bin_float_explicitly_constructible_from_type { static constexpr bool value = (std::numeric_limits::digits > static_cast(bit_count)) && (std::numeric_limits::radix == 2) && std::numeric_limits::is_specialized -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT && !std::is_same::value #endif ; @@ -167,7 +170,7 @@ class cpp_bin_float { this->assign_float(f); } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template cpp_bin_float(const Float& f, typename std::enable_if< @@ -277,7 +280,7 @@ class cpp_bin_float } return *this; } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template typename std::enable_if< (number_category::value == number_kind_floating_point) @@ -298,9 +301,15 @@ class cpp_bin_float return assign_float(f); } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template - typename std::enable_if::value, cpp_bin_float&>::type assign_float(Float f) + typename std::enable_if::value && (std::numeric_limits::digits > Digits), cpp_bin_float&>::type assign_float(Float f) + { + cpp_bin_float<113, DigitBase, Allocator, Exponent, MinExponent, MaxExponent> bf(f); + return *this = bf; + } + template + typename std::enable_if::value && (std::numeric_limits::digits <= Digits), cpp_bin_float&>::type assign_float(Float f) { using default_ops::eval_add; using bf_int_type = typename boost::multiprecision::detail::canonical::type; @@ -337,7 +346,7 @@ class cpp_bin_float m_sign = false; m_exponent = 0; - constexpr std::ptrdiff_t bits = sizeof(int) * CHAR_BIT - 1; + constexpr std::ptrdiff_t bits = sizeof(int) * CHAR_BIT - 1 < MaxExponent - 1 ? sizeof(int) * CHAR_BIT - 1 : 3; int e; f = frexpq(f, &e); while (f) @@ -352,15 +361,36 @@ class cpp_bin_float eval_add(*this, t); } m_exponent += static_cast(e); + if (m_exponent > max_exponent) + { + m_exponent = exponent_infinity; + m_data = static_cast(0u); + } + else if (m_exponent < min_exponent) + { + m_exponent = exponent_zero; + m_data = static_cast(0u); + } return *this; } #endif -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT + template + typename std::enable_if::value && !std::is_same::value && (std::numeric_limits::digits > Digits), cpp_bin_float&>::type assign_float(Float f) +#else + template + typename std::enable_if::value && (std::numeric_limits::digits > Digits), cpp_bin_float&>::type assign_float(Float f) +#endif + { + cpp_bin_float::digits, DigitBase, Allocator, Exponent, MinExponent, MaxExponent> bf(f); + return *this = bf; + } +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template - typename std::enable_if::value && !std::is_same::value, cpp_bin_float&>::type assign_float(Float f) + typename std::enable_if::value && !std::is_same::value && (std::numeric_limits::digits <= Digits), cpp_bin_float&>::type assign_float(Float f) #else template - typename std::enable_if::value, cpp_bin_float&>::type assign_float(Float f) + typename std::enable_if::value && (std::numeric_limits::digits <= Digits), cpp_bin_float&>::type assign_float(Float f) #endif { using std::frexp; @@ -399,7 +429,13 @@ class cpp_bin_float m_sign = false; m_exponent = 0; - constexpr std::ptrdiff_t bits = sizeof(int) * CHAR_BIT - 1; + // + // This code picks off the bits in f a few at a time and injects them into *this. + // It does not do roundingm so we must have more digits precision in *this than + // in the floating point value (the normal situation, unless we're emulating another + // type like float16_t). + // + constexpr std::ptrdiff_t bits = static_cast(sizeof(int) * CHAR_BIT - 1) < static_cast(MaxExponent - 1) ? static_cast(sizeof(int) * CHAR_BIT - 1) : 3; int e; f = frexp(f, &e); while (f != static_cast(0.0F)) @@ -414,6 +450,16 @@ class cpp_bin_float eval_add(*this, t); } m_exponent += static_cast(e); + if (m_exponent > max_exponent) + { + m_exponent = exponent_infinity; + m_data = static_cast(0u); + } + else if(m_exponent < min_exponent) + { + m_exponent = exponent_zero; + m_data = static_cast(0u); + } return *this; } @@ -514,7 +560,12 @@ class cpp_bin_float using ar_type = typename boost::multiprecision::detail::canonical::type; m_data = static_cast(fi); std::size_t shift = msb(fi); - if (shift >= bit_count) + if (shift > max_exponent) + { + m_exponent = exponent_infinity; + m_data = static_cast(0); + } + else if (shift >= bit_count) { m_exponent = static_cast(shift); m_data = static_cast(fi >> (shift + 1 - bit_count)); @@ -524,7 +575,7 @@ class cpp_bin_float m_exponent = static_cast(shift); eval_left_shift(m_data, bit_count - shift - 1); } - BOOST_MP_ASSERT(eval_bit_test(m_data, bit_count - 1)); + BOOST_MP_ASSERT((m_exponent == exponent_infinity) || eval_bit_test(m_data, bit_count - 1)); m_sign = detail::is_negative(i); } return *this; @@ -1281,7 +1332,7 @@ inline void eval_divide(cpp_bin_float -inline typename std::enable_if::value>::type eval_divide(cpp_bin_float& res, +inline typename std::enable_if::value && (std::numeric_limits::digits <= Digits)>::type eval_divide(cpp_bin_float& res, const cpp_bin_float& u, const U& v) { #ifdef BOOST_MSVC @@ -1396,14 +1447,14 @@ inline typename std::enable_if::va } template -inline typename std::enable_if::value>::type eval_divide(cpp_bin_float& res, const U& v) +inline typename std::enable_if::value && (std::numeric_limits::digits <= Digits)>::type eval_divide(cpp_bin_float& res, const U& v) { eval_divide(res, res, v); } template -inline typename std::enable_if::value && boost::multiprecision::detail::is_integral::value>::type eval_divide(cpp_bin_float& res, +inline typename std::enable_if::value && boost::multiprecision::detail::is_integral::value && (std::numeric_limits::digits <= Digits)>::type eval_divide(cpp_bin_float& res, const cpp_bin_float& u, const S& v) { using ui_type = typename boost::multiprecision::detail::make_unsigned::type; @@ -1413,7 +1464,7 @@ inline typename std::enable_if::valu } template -inline typename std::enable_if::value && boost::multiprecision::detail::is_integral::value>::type eval_divide(cpp_bin_float& res, const S& v) +inline typename std::enable_if::value && boost::multiprecision::detail::is_integral::value && (std::numeric_limits::digits <= Digits)>::type eval_divide(cpp_bin_float& res, const S& v) { eval_divide(res, res, v); } @@ -1658,7 +1709,7 @@ inline typename std::enable_if::value>::type eval_ // // Perform rounding first, then afterwards extract the digits: // - cpp_bin_float(float_digits), digit_base_2, Allocator, Exponent, MinE, MaxE> arg; + cpp_bin_float(float_digits), digit_base_2, Allocator, Exponent, 0, 0> arg; typename cpp_bin_float::rep_type bits(original_arg.bits()); arg.exponent() = original_arg.exponent(); copy_and_round(arg, bits, (std::ptrdiff_t)digits_to_round_to); @@ -2154,7 +2205,14 @@ class numeric_limits, ExpressionTemplates> >::has_quiet_NaN; template constexpr bool numeric_limits, ExpressionTemplates> >::has_signaling_NaN; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4996) +#endif template constexpr float_denorm_style numeric_limits, ExpressionTemplates> >::has_denorm; +#ifdef _MSC_VER +#pragma warning(pop) +#endif template constexpr bool numeric_limits, ExpressionTemplates> >::has_denorm_loss; template diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index f0dad5a1..efcf50ca 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -844,10 +844,17 @@ struct cpp_int_base BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void normalize() noexcept((Checked == unchecked)) { limb_pointer p = limbs(); - detail::verify_limb_mask(m_limbs == internal_limb_count, p[internal_limb_count - 1], upper_limb_mask, checked_type()); + + limb_type c = p[internal_limb_count - 1]; + bool full_limbs = m_limbs == internal_limb_count; + p[internal_limb_count - 1] &= upper_limb_mask; while ((m_limbs - 1) && !p[m_limbs - 1]) --m_limbs; + // + // Verification at the end, so that we're in a valid state if we throw: + // + detail::verify_limb_mask(full_limbs, c, upper_limb_mask, checked_type()); } BOOST_MP_FORCEINLINE constexpr cpp_int_base() noexcept @@ -1264,8 +1271,13 @@ struct cpp_int_base } BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void normalize() noexcept((Checked == unchecked)) { - detail::verify_limb_mask(true, m_data, limb_mask, checked_type()); + local_limb_type c = m_data; m_data &= limb_mask; + // + // Verification has to come afterwards, otherwise we can leave + // ourselves in an invalid state: + // + detail::verify_limb_mask(true, c, limb_mask, checked_type()); } BOOST_MP_FORCEINLINE constexpr cpp_int_base() noexcept : m_data(0) {} diff --git a/include/boost/multiprecision/cpp_int/bitwise.hpp b/include/boost/multiprecision/cpp_int/bitwise.hpp index de23f526..99f63581 100644 --- a/include/boost/multiprecision/cpp_int/bitwise.hpp +++ b/include/boost/multiprecision/cpp_int/bitwise.hpp @@ -436,12 +436,12 @@ inline BOOST_MP_CXX14_CONSTEXPR void left_shift_generic(Int& result, double_limb ++i; } } - for (; rs - i >= 2 + offset; ++i) + for (; rs - i >= static_cast(static_cast(2u) + offset); ++i) { pr[rs - 1 - i] = pr[rs - 1 - i - offset] << shift; pr[rs - 1 - i] |= pr[rs - 2 - i - offset] >> (Int::limb_bits - shift); } - if (rs - i >= 1 + offset) + if (rs - i >= static_cast(static_cast(1u) + offset)) { pr[rs - 1 - i] = pr[rs - 1 - i - offset] << shift; ++i; diff --git a/include/boost/multiprecision/cpp_int/divide.hpp b/include/boost/multiprecision/cpp_int/divide.hpp index b1253fc3..50d8aa9f 100644 --- a/include/boost/multiprecision/cpp_int/divide.hpp +++ b/include/boost/multiprecision/cpp_int/divide.hpp @@ -551,9 +551,19 @@ eval_modulus( const cpp_int_backend& a, const limb_type mod) { + + if(mod == 0) + BOOST_MP_THROW_EXCEPTION(std::overflow_error("Division by zero.")); + const std::ptrdiff_t n = static_cast(a.size()); - const double_limb_type two_n_mod = static_cast(1u) + (~static_cast(0u) - mod) % mod; - limb_type res = a.limbs()[n - 1] % mod; + + const double_limb_type two_n_mod = + static_cast + ( + static_cast(1u) + static_cast(static_cast(~static_cast(0u) - mod) % mod) + ); + + limb_type res = a.limbs()[n - 1] % mod; for (std::ptrdiff_t i = n - 2; i >= 0; --i) res = static_cast(static_cast(static_cast(res * two_n_mod) + a.limbs()[i]) % mod); @@ -650,6 +660,44 @@ eval_modulus( result.sign(result.sign()); } +template +BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< + is_trivial_cpp_int >::value && std::is_unsigned::value>::type +eval_modulus( + cpp_int_backend& result, + const cpp_int_backend& a, + V o) +{ + using local_limb_type = typename cpp_int_backend::local_limb_type; + + BOOST_IF_CONSTEXPR(std::numeric_limits::digits > MaxBits1) + { + if (o >= (static_cast(1u) << MaxBits1)) + { + // Modulus is larger than any value that the result can hold, + // so the result is just "a": + result = a; + return; + } + } + if (!o) + BOOST_MP_THROW_EXCEPTION(std::overflow_error("Division by zero.")); + *result.limbs() = *a.limbs() % static_cast(o); + result.sign(a.sign()); +} + +template +BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< + is_trivial_cpp_int >::value && std::is_signed::value>::type +eval_modulus( + cpp_int_backend& result, + const cpp_int_backend& a, + V o) +{ + using unsigned_type = typename std::make_unsigned::type; + eval_modulus(result, a, static_cast(o < 0 ? -o : o)); +} + }}} // namespace boost::multiprecision::backends #endif diff --git a/include/boost/multiprecision/cpp_int/limits.hpp b/include/boost/multiprecision/cpp_int/limits.hpp index df80d02e..fa29cc48 100644 --- a/include/boost/multiprecision/cpp_int/limits.hpp +++ b/include/boost/multiprecision/cpp_int/limits.hpp @@ -200,7 +200,14 @@ class numeric_limits, ExpressionTemplates> >::has_quiet_NaN; template constexpr bool numeric_limits, ExpressionTemplates> >::has_signaling_NaN; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4996) +#endif template constexpr float_denorm_style numeric_limits, ExpressionTemplates> >::has_denorm; +#ifdef _MSC_VER +#pragma warning(pop) +#endif template constexpr bool numeric_limits, ExpressionTemplates> >::has_denorm_loss; template diff --git a/include/boost/multiprecision/cpp_int/misc.hpp b/include/boost/multiprecision/cpp_int/misc.hpp index cdae2f75..a8a76400 100644 --- a/include/boost/multiprecision/cpp_int/misc.hpp +++ b/include/boost/multiprecision/cpp_int/misc.hpp @@ -184,7 +184,9 @@ eval_convert_to(R* result, const cpp_int_backend inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value && !is_trivial_cpp_int >::value, void>::type -eval_convert_to(R* result, const cpp_int_backend& backend) noexcept(boost::multiprecision::detail::is_arithmetic::value && std::numeric_limits::has_infinity) +eval_convert_to(R* result, const cpp_int_backend& backend) noexcept(boost::multiprecision::detail::is_arithmetic::value && + (std::numeric_limits::has_infinity || + std::numeric_limits::has_quiet_NaN)) { BOOST_MP_FLOAT128_USING using std::ldexp; if (eval_is_zero(backend)) @@ -244,10 +246,11 @@ eval_convert_to(R* result, const cpp_int_backend(bits)) || eval_bit_test(backend, static_cast(bits + 1))) { #ifdef BOOST_MP_MATH_AVAILABLE - BOOST_IF_CONSTEXPR(std::numeric_limits::has_infinity) + BOOST_IF_CONSTEXPR(std::numeric_limits::has_infinity || std::numeric_limits::has_quiet_NaN) { // Must NOT throw: - *result = boost::math::float_next(*result, boost::math::policies::make_policy(boost::math::policies::overflow_error())); + *result = boost::math::float_next(*result, boost::math::policies::make_policy(boost::math::policies::overflow_error(), + boost::math::policies::domain_error())); } else { diff --git a/include/boost/multiprecision/detail/default_ops.hpp b/include/boost/multiprecision/detail/default_ops.hpp index 6a2cc98b..bd0240ab 100644 --- a/include/boost/multiprecision/detail/default_ops.hpp +++ b/include/boost/multiprecision/detail/default_ops.hpp @@ -1295,6 +1295,30 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_fmod(T& result, const T& a, const T& b eval_floor(n, result); eval_multiply(n, b); eval_subtract(result, a, n); + if (eval_get_sign(result) != 0) + { + // + // Sanity check, that due to rounding errors in division, + // we haven't accidently calculated the wrong value: + // See https://github.com/boostorg/multiprecision/issues/604 for an example. + // + if (eval_get_sign(result) == eval_get_sign(b)) + { + if (result.compare(b) >= 0) + { + eval_subtract(result, b); + } + } + else + { + n = b; + n.negate(); + if (result.compare(n) >= 0) + { + eval_subtract(result, n); + } + } + } } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value, void>::type eval_fmod(T& result, const T& x, const A& a) @@ -2462,7 +2486,7 @@ void raise_rounding_error(T1, T2, T3, T4, T5) template void raise_overflow_error(T1, T2, T3, T4, T5) { - BOOST_MP_THROW_EXCEPTION(std::runtime_error("Overflow error")); + BOOST_MP_THROW_EXCEPTION(std::overflow_error("Overflow error")); } template @@ -2471,6 +2495,12 @@ void raise_evaluation_error(T1, T2, T3, T4, T5) BOOST_MP_THROW_EXCEPTION(std::runtime_error("Evaluation error")); } +template +void raise_domain_error(T1, T2, T3, T4, T5) +{ + BOOST_MP_THROW_EXCEPTION(std::domain_error("Domain error")); +} + template struct is_policy { @@ -3950,41 +3980,46 @@ ilogb(const detail::expression& val) } //namespace multiprecision namespace math { + + // // Overload of Boost.Math functions that find the wrong overload when used with number: // namespace detail { + template T sinc_pi_imp(T); -template -T sinhc_pi_imp(T); +template +T sinhc_pi_imp(T, const Policy&); + } // namespace detail + template inline multiprecision::number sinc_pi(const multiprecision::number& x) { boost::multiprecision::detail::scoped_default_precision > precision_guard(x); - return std::move(detail::sinc_pi_imp(x)); + return detail::sinc_pi_imp(x); } template inline multiprecision::number sinc_pi(const multiprecision::number& x, const Policy&) { boost::multiprecision::detail::scoped_default_precision > precision_guard(x); - return std::move(detail::sinc_pi_imp(x)); + return detail::sinc_pi_imp(x); } template inline multiprecision::number sinhc_pi(const multiprecision::number& x) { boost::multiprecision::detail::scoped_default_precision > precision_guard(x); - return std::move(detail::sinhc_pi_imp(x)); + return detail::sinhc_pi_imp(x, boost::math::policies::policy<>()); } template -inline multiprecision::number sinhc_pi(const multiprecision::number& x, const Policy&) +inline multiprecision::number sinhc_pi(const multiprecision::number& x, const Policy& pol) { - boost::multiprecision::detail::scoped_default_precision > precision_guard(x); - return std::move(boost::math::sinhc_pi(x)); + boost::multiprecision::detail::scoped_default_precision > precision_guard(x, pol); + return detail::sinhc_pi_imp(x, pol); } using boost::multiprecision::gcd; diff --git a/include/boost/multiprecision/detail/functions/trunc.hpp b/include/boost/multiprecision/detail/functions/trunc.hpp index 84e2444a..28b6e6fb 100644 --- a/include/boost/multiprecision/detail/functions/trunc.hpp +++ b/include/boost/multiprecision/detail/functions/trunc.hpp @@ -23,12 +23,16 @@ namespace impl { template inline T trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const T arg) { - using std::floor; - using std::ceil; + if (arg > 0) + { + using std::floor; - return (arg > 0) ? floor(arg) : ceil(arg); -} + return floor(arg); + } + + using std::ceil; + return ceil(arg);} } // namespace impl #ifdef BOOST_MP_MATH_AVAILABLE diff --git a/include/boost/multiprecision/detail/min_max.hpp b/include/boost/multiprecision/detail/min_max.hpp index 8a78c612..835ed8a6 100644 --- a/include/boost/multiprecision/detail/min_max.hpp +++ b/include/boost/multiprecision/detail/min_max.hpp @@ -36,14 +36,14 @@ inline typename std::enable_if t(b); if (a < t) return a; - return std::move(t); + return t; } template inline typename std::enable_if::value, const number >::type(min)(const detail::expression& a, const number& b) { number t(a); if (t < b) - return std::move(t); + return t; return b; } template @@ -51,16 +51,16 @@ inline typename detail::expression::result_type(min)(const { typename detail::expression::result_type t1(a), t2(b); if (t1 < t2) - return std::move(t1); - return std::move(t2); + return t1; + return t2; } template inline typename detail::expression::result_type(min)(const detail::expression& a, const detail::expression& b) { typename detail::expression::result_type t1(a), t2(b); if (t1 < t2) - return std::move(t1); - return std::move(t2); + return t1; + return t2; } template @@ -74,14 +74,14 @@ inline typename std::enable_if t(b); if (a > t) return a; - return std::move(t); + return t; } template inline typename std::enable_if::value, const number >::type(max)(const detail::expression& a, const number& b) { number t(a); if (t > b) - return std::move(t); + return t; return b; } template @@ -89,16 +89,16 @@ inline typename detail::expression::result_type(max)(const { typename detail::expression::result_type t1(a), t2(b); if (t1 > t2) - return std::move(t1); - return std::move(t2); + return t1; + return t2; } template inline typename detail::expression::result_type(max)(const detail::expression& a, const detail::expression& b) { typename detail::expression::result_type t1(a), t2(b); if (t1 > t2) - return std::move(t1); - return std::move(t2); + return t1; + return t2; } }} // namespace boost::multiprecision diff --git a/include/boost/multiprecision/detail/number_base.hpp b/include/boost/multiprecision/detail/number_base.hpp index 2f4db9df..99017c92 100644 --- a/include/boost/multiprecision/detail/number_base.hpp +++ b/include/boost/multiprecision/detail/number_base.hpp @@ -150,10 +150,17 @@ template struct is_number_expression > : public std::integral_constant {}; +namespace detail { +template +struct canonical; +} + template struct is_compatible_arithmetic_type : public std::integral_constant::value && !std::is_same::value && !is_number_expression::value> + std::is_convertible::value && !std::is_same::value && !is_number_expression::value + && (std::is_constructible::type>::value + || std::is_assignable::type>::value || is_number::value || is_number_expression::value)> {}; namespace detail { @@ -199,7 +206,7 @@ struct bits_of : sizeof(T) * CHAR_BIT - (boost::multiprecision::detail::is_signed::value ? 1 : 0); }; -#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) +#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) && !defined(__PGI) #define BOOST_MP_BITS_OF_FLOAT128_DEFINED template <> struct bits_of @@ -1527,6 +1534,11 @@ struct number_category > : public number_ca template struct number_category > : public number_category::result_type> {}; +#if defined(__SIZEOF_FLOAT128__) || defined(BOOST_HAS_FLOAT128) +template <> +struct number_category<__float128> : public std::integral_constant {}; +#endif + // // Specializations for types which do not always have numberic_limits specializations: // @@ -1538,11 +1550,6 @@ template <> struct number_category : public std::integral_constant {}; #endif -#ifdef BOOST_HAS_FLOAT128 -template <> -struct number_category : public std::integral_constant -{}; -#endif template struct component_type diff --git a/include/boost/multiprecision/number.hpp b/include/boost/multiprecision/number.hpp index 4dd1fb02..aac21d3c 100644 --- a/include/boost/multiprecision/number.hpp +++ b/include/boost/multiprecision/number.hpp @@ -51,7 +51,7 @@ class number static constexpr expression_template_option et = ExpressionTemplates; BOOST_MP_FORCEINLINE constexpr number() noexcept(noexcept(Backend())) {} - BOOST_MP_FORCEINLINE constexpr number(const number& e) noexcept(noexcept(Backend(std::declval()))) : m_backend(e.m_backend) {} + BOOST_MP_FORCEINLINE constexpr number(const number& e) noexcept(noexcept(Backend(std::declval()))) = default; template BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number(const V& v, typename std::enable_if< @@ -372,11 +372,7 @@ class number } BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number& operator=(const number& e) - noexcept(noexcept(std::declval() = std::declval())) - { - m_backend = e.m_backend; - return *this; - } + noexcept(noexcept(std::declval() = std::declval())) = default; template BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value, number&>::type @@ -451,14 +447,9 @@ class number // rvalues: BOOST_MP_FORCEINLINE constexpr number(number&& r) - noexcept(noexcept(Backend(std::declval()))) - : m_backend(static_cast(r.m_backend)) - {} - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number& operator=(number&& r) noexcept(noexcept(std::declval() = std::declval())) - { - m_backend = static_cast(r.m_backend); - return *this; - } + noexcept(noexcept(Backend(std::declval()))) = default; + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number& operator=(number&& r) noexcept(noexcept(std::declval() = std::declval())) = default; + template BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number(number&& val, typename std::enable_if<(std::is_convertible::value && !detail::is_restricted_conversion::value)>::type* = nullptr) diff --git a/include/boost/multiprecision/traits/std_integer_traits.hpp b/include/boost/multiprecision/traits/std_integer_traits.hpp index 2c835887..d6b126f8 100644 --- a/include/boost/multiprecision/traits/std_integer_traits.hpp +++ b/include/boost/multiprecision/traits/std_integer_traits.hpp @@ -27,6 +27,11 @@ struct make_unsigned : public std::make_unsigned {}; template struct make_signed : public std::make_signed {}; +#if defined(__SIZEOF_FLOAT128__) +template <> +struct is_arithmetic<__float128> : public std::true_type {}; +#endif + #ifdef BOOST_HAS_INT128 template <> diff --git a/include/boost/predef/make.h b/include/boost/predef/make.h index e65a0e1b..c2aa8748 100644 --- a/include/boost/predef/make.h +++ b/include/boost/predef/make.h @@ -106,6 +106,10 @@ Macros are: */ // end::reference[] #define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0) /* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVR_0PPPPP(V, P)`, the second parameter specifies a year-month patch level with the first digit discarded +*/ // end::reference[] +#define BOOST_PREDEF_MAKE_10_VVR_0PPPPP(V, P) BOOST_VERSION_NUMBER(((V)/10)%100,(V)%10,(P)%100000) +/* tag::reference[] * `BOOST_PREDEF_MAKE_10_VVRR(V)` */ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0) diff --git a/include/boost/preprocessor/variadic/has_opt.hpp b/include/boost/preprocessor/variadic/has_opt.hpp index 7054e945..bb40e378 100644 --- a/include/boost/preprocessor/variadic/has_opt.hpp +++ b/include/boost/preprocessor/variadic/has_opt.hpp @@ -19,6 +19,8 @@ # if defined(__cplusplus) && __cplusplus > 201703L # if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 8 && __GNUC__ < 10 # define BOOST_PP_VARIADIC_HAS_OPT() 0 +# elif defined(__clang__) && __clang_major__ < 9 +# define BOOST_PP_VARIADIC_HAS_OPT() 0 # else # include # define BOOST_PP_VARIADIC_HAS_OPT() \ diff --git a/include/boost/qvm/assert.hpp b/include/boost/qvm/assert.hpp index 6375faa8..2a6c0054 100644 --- a/include/boost/qvm/assert.hpp +++ b/include/boost/qvm/assert.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/config.hpp b/include/boost/qvm/config.hpp index 46581433..51b9578b 100644 --- a/include/boost/qvm/config.hpp +++ b/include/boost/qvm/config.hpp @@ -1,11 +1,10 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. +#ifndef BOOST_QVM_CONFIG_HPP_INCLUDED +#define BOOST_QVM_CONFIG_HPP_INCLUDED +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the 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_QVM_CONFIG_HPP_INCLUDED -#define BOOST_QVM_CONFIG_HPP_INCLUDED - #if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_QVM_NO_WORKAROUNDS ) # define BOOST_QVM_WORKAROUND( symbol, test ) 0 #else diff --git a/include/boost/qvm/deduce_mat.hpp b/include/boost/qvm/deduce_mat.hpp index 5e51d791..0db6aea7 100644 --- a/include/boost/qvm/deduce_mat.hpp +++ b/include/boost/qvm/deduce_mat.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DEDUCE_MAT_HPP_INCLUDED #define BOOST_QVM_DEDUCE_MAT_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/deduce_scalar.hpp b/include/boost/qvm/deduce_scalar.hpp index be94a2dd..d37bec6b 100644 --- a/include/boost/qvm/deduce_scalar.hpp +++ b/include/boost/qvm/deduce_scalar.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DEDUCE_SCALAR_HPP_INCLUDED #define BOOST_QVM_DEDUCE_SCALAR_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/deduce_vec.hpp b/include/boost/qvm/deduce_vec.hpp index 675b0960..3346ca14 100644 --- a/include/boost/qvm/deduce_vec.hpp +++ b/include/boost/qvm/deduce_vec.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DEDUCE_VEC_HPP_INCLUDED #define BOOST_QVM_DEDUCE_VEC_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/cofactor_impl.hpp b/include/boost/qvm/detail/cofactor_impl.hpp index ca65ce02..f6571ee2 100644 --- a/include/boost/qvm/detail/cofactor_impl.hpp +++ b/include/boost/qvm/detail/cofactor_impl.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_COFACTOR_IMPL_HPP_INCLUDED #define BOOST_QVM_DETAIL_COFACTOR_IMPL_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/determinant_impl.hpp b/include/boost/qvm/detail/determinant_impl.hpp index 0e18f959..fbce5551 100644 --- a/include/boost/qvm/detail/determinant_impl.hpp +++ b/include/boost/qvm/detail/determinant_impl.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_DETERMINANT_IMPL_HPP_INCLUDED #define BOOST_QVM_DETAIL_DETERMINANT_IMPL_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/mat_assign.hpp b/include/boost/qvm/detail/mat_assign.hpp index 7b6b3464..d2cddf5e 100644 --- a/include/boost/qvm/detail/mat_assign.hpp +++ b/include/boost/qvm/detail/mat_assign.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED #define BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/remove_const.hpp b/include/boost/qvm/detail/remove_const.hpp index a24b9839..2b73e835 100644 --- a/include/boost/qvm/detail/remove_const.hpp +++ b/include/boost/qvm/detail/remove_const.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_REMOVE_CONST_HPP_INCLUDED #define BOOST_QVM_DETAIL_REMOVE_CONST_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/transp_impl.hpp b/include/boost/qvm/detail/transp_impl.hpp index 1953481c..0e86f7cc 100644 --- a/include/boost/qvm/detail/transp_impl.hpp +++ b/include/boost/qvm/detail/transp_impl.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_TRANSP_IMPL_HPP_INCLUDED #define BOOST_QVM_DETAIL_TRANSP_IMPL_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/detail/vec_assign.hpp b/include/boost/qvm/detail/vec_assign.hpp index 04fffef1..46357020 100644 --- a/include/boost/qvm/detail/vec_assign.hpp +++ b/include/boost/qvm/detail/vec_assign.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED #define BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/enable_if.hpp b/include/boost/qvm/enable_if.hpp index 50ed4b44..a3cc23b9 100644 --- a/include/boost/qvm/enable_if.hpp +++ b/include/boost/qvm/enable_if.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_ENABLE_IF_HPP_INCLUDED #define BOOST_QVM_ENABLE_IF_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/error.hpp b/include/boost/qvm/error.hpp index 7e8f08d9..c3a5c18d 100644 --- a/include/boost/qvm/error.hpp +++ b/include/boost/qvm/error.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_ERROR_HPP_INCLUDED #define BOOST_QVM_ERROR_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/gen/mat_assign2.hpp b/include/boost/qvm/gen/mat_assign2.hpp index 879bc6da..645e5b73 100644 --- a/include/boost/qvm/gen/mat_assign2.hpp +++ b/include/boost/qvm/gen/mat_assign2.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_ASSIGN2_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_ASSIGN2_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/mat_assign3.hpp b/include/boost/qvm/gen/mat_assign3.hpp index bbaac864..93946adc 100644 --- a/include/boost/qvm/gen/mat_assign3.hpp +++ b/include/boost/qvm/gen/mat_assign3.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_ASSIGN3_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_ASSIGN3_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/mat_assign4.hpp b/include/boost/qvm/gen/mat_assign4.hpp index ed6cd4c3..ca487d3f 100644 --- a/include/boost/qvm/gen/mat_assign4.hpp +++ b/include/boost/qvm/gen/mat_assign4.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_ASSIGN4_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_ASSIGN4_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/mat_operations2.hpp b/include/boost/qvm/gen/mat_operations2.hpp index 46546832..31320e6e 100644 --- a/include/boost/qvm/gen/mat_operations2.hpp +++ b/include/boost/qvm/gen/mat_operations2.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_OPERATIONS2_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_OPERATIONS2_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/mat_operations3.hpp b/include/boost/qvm/gen/mat_operations3.hpp index b7634271..3f423206 100644 --- a/include/boost/qvm/gen/mat_operations3.hpp +++ b/include/boost/qvm/gen/mat_operations3.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_OPERATIONS3_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_OPERATIONS3_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/mat_operations4.hpp b/include/boost/qvm/gen/mat_operations4.hpp index 262cb678..830c2eff 100644 --- a/include/boost/qvm/gen/mat_operations4.hpp +++ b/include/boost/qvm/gen/mat_operations4.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_MAT_OPERATIONS4_HPP_INCLUDED #define BOOST_QVM_GEN_MAT_OPERATIONS4_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_assign2.hpp b/include/boost/qvm/gen/vec_assign2.hpp index 6e3dc376..f35bd0bc 100644 --- a/include/boost/qvm/gen/vec_assign2.hpp +++ b/include/boost/qvm/gen/vec_assign2.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_ASSIGN2_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_ASSIGN2_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_assign3.hpp b/include/boost/qvm/gen/vec_assign3.hpp index 863bf277..d5e65caa 100644 --- a/include/boost/qvm/gen/vec_assign3.hpp +++ b/include/boost/qvm/gen/vec_assign3.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_ASSIGN3_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_ASSIGN3_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_assign4.hpp b/include/boost/qvm/gen/vec_assign4.hpp index acc7998d..1e98d1f9 100644 --- a/include/boost/qvm/gen/vec_assign4.hpp +++ b/include/boost/qvm/gen/vec_assign4.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_ASSIGN4_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_ASSIGN4_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_mat_operations2.hpp b/include/boost/qvm/gen/vec_mat_operations2.hpp index 44886ca3..ad12b291 100644 --- a/include/boost/qvm/gen/vec_mat_operations2.hpp +++ b/include/boost/qvm/gen/vec_mat_operations2.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_mat_operations3.hpp b/include/boost/qvm/gen/vec_mat_operations3.hpp index 25f9a865..be537a90 100644 --- a/include/boost/qvm/gen/vec_mat_operations3.hpp +++ b/include/boost/qvm/gen/vec_mat_operations3.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS3_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS3_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/gen/vec_mat_operations4.hpp b/include/boost/qvm/gen/vec_mat_operations4.hpp index aaafced5..b03a9e98 100644 --- a/include/boost/qvm/gen/vec_mat_operations4.hpp +++ b/include/boost/qvm/gen/vec_mat_operations4.hpp @@ -1,13 +1,11 @@ #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS4_HPP_INCLUDED #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS4_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// This file was generated by a program. Do not edit manually. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// This file was generated by a program. Do not edit manually. - #include #include #include diff --git a/include/boost/qvm/is_scalar.hpp b/include/boost/qvm/is_scalar.hpp index 32abbbe4..6060bfe5 100644 --- a/include/boost/qvm/is_scalar.hpp +++ b/include/boost/qvm/is_scalar.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_IS_SCALAR_HPP_INCLUDED #define BOOST_QVM_IS_SCALAR_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -28,6 +27,8 @@ template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; +template <> struct is_scalar { static bool const value=true; }; +template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; template <> struct is_scalar { static bool const value=true; }; diff --git a/include/boost/qvm/map_mat_mat.hpp b/include/boost/qvm/map_mat_mat.hpp index 80b81155..194175d1 100644 --- a/include/boost/qvm/map_mat_mat.hpp +++ b/include/boost/qvm/map_mat_mat.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MAP_MAT_MAT_HPP_INCLUDED #define BOOST_QVM_MAP_MAT_MAT_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/map_mat_vec.hpp b/include/boost/qvm/map_mat_vec.hpp index 562e6563..52cf3d7d 100644 --- a/include/boost/qvm/map_mat_vec.hpp +++ b/include/boost/qvm/map_mat_vec.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MAP_MAT_VEC_HPP_INCLUDED #define BOOST_QVM_MAP_MAT_VEC_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat.hpp b/include/boost/qvm/mat.hpp index 16dca3ee..9fc118db 100644 --- a/include/boost/qvm/mat.hpp +++ b/include/boost/qvm/mat.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MAT_HPP_INCLUDED #define BOOST_QVM_MAT_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_access.hpp b/include/boost/qvm/mat_access.hpp index 23dac800..2963bea5 100644 --- a/include/boost/qvm/mat_access.hpp +++ b/include/boost/qvm/mat_access.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MAT_ACCESS_HPP_INCLUDED #define BOOST_QVM_MAT_ACCESS_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_operations.hpp b/include/boost/qvm/mat_operations.hpp index 28d7e6e6..49c4c87c 100644 --- a/include/boost/qvm/mat_operations.hpp +++ b/include/boost/qvm/mat_operations.hpp @@ -3,7 +3,6 @@ // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. // Copyright 2019 agate-pris - // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -16,7 +15,7 @@ #include #include #include -#include +#include namespace boost { namespace qvm { @@ -34,12 +33,6 @@ qvm_detail //////////////////////////////////////////////// -namespace -qvm_to_string_detail - { - template - std::string to_string( T const & x ); - } namespace qvm_detail diff --git a/include/boost/qvm/mat_operations2.hpp b/include/boost/qvm/mat_operations2.hpp index 0cb193c2..6d3a08fe 100644 --- a/include/boost/qvm/mat_operations2.hpp +++ b/include/boost/qvm/mat_operations2.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_operations3.hpp b/include/boost/qvm/mat_operations3.hpp index c3da2d3b..f4b25f1a 100644 --- a/include/boost/qvm/mat_operations3.hpp +++ b/include/boost/qvm/mat_operations3.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_operations4.hpp b/include/boost/qvm/mat_operations4.hpp index b780f81c..36405d4c 100644 --- a/include/boost/qvm/mat_operations4.hpp +++ b/include/boost/qvm/mat_operations4.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_traits.hpp b/include/boost/qvm/mat_traits.hpp index 97d1a13a..9592ec2e 100644 --- a/include/boost/qvm/mat_traits.hpp +++ b/include/boost/qvm/mat_traits.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_TRAITS_HPP_INCLUDED #define BOOST_QVM_TRAITS_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/mat_traits_array.hpp b/include/boost/qvm/mat_traits_array.hpp index ba9175d3..ddcc95ec 100644 --- a/include/boost/qvm/mat_traits_array.hpp +++ b/include/boost/qvm/mat_traits_array.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MAT_TRAITS_ARRAY_HPP_INCLUDED #define BOOST_QVM_MAT_TRAITS_ARRAY_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/math.hpp b/include/boost/qvm/math.hpp index 4959cab1..84192eef 100644 --- a/include/boost/qvm/math.hpp +++ b/include/boost/qvm/math.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_MATH_HPP_INCLUDED #define BOOST_QVM_MATH_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/quat_traits.hpp b/include/boost/qvm/quat_traits.hpp index 2af10a22..fe3b0989 100644 --- a/include/boost/qvm/quat_traits.hpp +++ b/include/boost/qvm/quat_traits.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_QUAT_TRAITS #define BOOST_QVM_QUAT_TRAITS -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -79,7 +78,7 @@ typename enable_if_c< void>::type write_quat_element_idx( int i, Q & q, typename quat_traits::scalar_type s ) { - quat_traits::template write_element_idx(i, q) = s; + quat_traits::write_element_idx(i, q) = s; } template @@ -89,7 +88,7 @@ typename enable_if_c< void>::type write_vec_element_idx( int i, Q & q, typename quat_traits::scalar_type s ) { - quat_traits::template write_element_idx(i, q, s); + quat_traits::write_element_idx(i, q, s); } } } diff --git a/include/boost/qvm/scalar_traits.hpp b/include/boost/qvm/scalar_traits.hpp index e8bbadda..7802940d 100644 --- a/include/boost/qvm/scalar_traits.hpp +++ b/include/boost/qvm/scalar_traits.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_SCALAR_TRAITS_HPP_INCLUDED #define BOOST_QVM_SCALAR_TRAITS_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/static_assert.hpp b/include/boost/qvm/static_assert.hpp index b3d90ff4..3ef6daf1 100644 --- a/include/boost/qvm/static_assert.hpp +++ b/include/boost/qvm/static_assert.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/throw_exception.hpp b/include/boost/qvm/throw_exception.hpp index 782ee03f..c05e586f 100644 --- a/include/boost/qvm/throw_exception.hpp +++ b/include/boost/qvm/throw_exception.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/to_string.hpp b/include/boost/qvm/to_string.hpp new file mode 100644 index 00000000..2e54da4f --- /dev/null +++ b/include/boost/qvm/to_string.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_QVM_TO_STRING_HPP_INCLUDED +#define BOOST_QVM_TO_STRING_HPP_INCLUDED + +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include + +#if __cplusplus >= 201103L + +namespace boost { namespace qvm { + +namespace +qvm_to_string_detail + { + using std::to_string; + } + +} } + +#else + +#include + +namespace boost { namespace qvm { + +namespace +qvm_to_string_detail + { + template + std::string + to_string( T const & x ) + { + std::stringstream s; + s << x; + return s.str(); + } + } + +} } + +#endif + +#endif diff --git a/include/boost/qvm/vec.hpp b/include/boost/qvm/vec.hpp index 03db1d99..6e5cb53c 100644 --- a/include/boost/qvm/vec.hpp +++ b/include/boost/qvm/vec.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_VEC_HPP_INCLUDED #define BOOST_QVM_VEC_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_access.hpp b/include/boost/qvm/vec_access.hpp index 01f88c0a..8e099f78 100644 --- a/include/boost/qvm/vec_access.hpp +++ b/include/boost/qvm/vec_access.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_VEC_ACCESS_HPP_INCLUDED #define BOOST_QVM_VEC_ACCESS_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_mat_operations.hpp b/include/boost/qvm/vec_mat_operations.hpp index e11800ae..464fd46e 100644 --- a/include/boost/qvm/vec_mat_operations.hpp +++ b/include/boost/qvm/vec_mat_operations.hpp @@ -1,8 +1,7 @@ #ifndef BOOST_QVM_VEC_MAT_OPERATIONS_HPP_INCLUDED #define BOOST_QVM_VEC_MAT_OPERATIONS_HPP_INCLUDED -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_mat_operations2.hpp b/include/boost/qvm/vec_mat_operations2.hpp index 65ab7b89..b5bc906b 100644 --- a/include/boost/qvm/vec_mat_operations2.hpp +++ b/include/boost/qvm/vec_mat_operations2.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_mat_operations3.hpp b/include/boost/qvm/vec_mat_operations3.hpp index 7b8ffc75..c35ead3a 100644 --- a/include/boost/qvm/vec_mat_operations3.hpp +++ b/include/boost/qvm/vec_mat_operations3.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_mat_operations4.hpp b/include/boost/qvm/vec_mat_operations4.hpp index 2201d6c1..f03dbcaa 100644 --- a/include/boost/qvm/vec_mat_operations4.hpp +++ b/include/boost/qvm/vec_mat_operations4.hpp @@ -1,5 +1,4 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. - +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/qvm/vec_traits.hpp b/include/boost/qvm/vec_traits.hpp index d5ad7dfc..e6d1c7e5 100644 --- a/include/boost/qvm/vec_traits.hpp +++ b/include/boost/qvm/vec_traits.hpp @@ -1,11 +1,10 @@ -// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. +#ifndef BOOST_QVM_VEC_TRAITS_HPP_INCLUDED +#define BOOST_QVM_VEC_TRAITS_HPP_INCLUDED +// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the 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_QVM_VEC_TRAITS_HPP_INCLUDED -#define BOOST_QVM_VEC_TRAITS_HPP_INCLUDED - #include #include #include diff --git a/include/boost/ref.hpp b/include/boost/ref.hpp deleted file mode 100644 index 17b56ec0..00000000 --- a/include/boost/ref.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014 Glen Fernandes - * - * Distributed under the 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_REF_HPP -#define BOOST_REF_HPP - -// The header file at this path is deprecated; -// use boost/core/ref.hpp instead. - -#include - -#endif diff --git a/include/boost/serialization/force_include.hpp b/include/boost/serialization/force_include.hpp index a418b0ec..022279d1 100644 --- a/include/boost/serialization/force_include.hpp +++ b/include/boost/serialization/force_include.hpp @@ -18,7 +18,7 @@ #include -// the following help macro is to guarentee that certain coded +// the following help macro is to guarantee that certain coded // is not removed by over-eager linker optimiser. In certain cases // we create static objects must be created but are actually never // referenced - creation has a side-effect such as global registration diff --git a/include/boost/serialization/nvp.hpp b/include/boost/serialization/nvp.hpp index 88cecc8b..cad0f949 100644 --- a/include/boost/serialization/nvp.hpp +++ b/include/boost/serialization/nvp.hpp @@ -126,7 +126,7 @@ struct is_wrapper > { }; -} // seralization +} // serialization } // boost diff --git a/include/boost/serialization/serialization.hpp b/include/boost/serialization/serialization.hpp index 79d6412d..73fd5adb 100644 --- a/include/boost/serialization/serialization.hpp +++ b/include/boost/serialization/serialization.hpp @@ -27,7 +27,7 @@ // public interface to serialization. ///////////////////////////////////////////////////////////////////////////// -// layer 0 - intrusive verison +// layer 0 - intrusive version // declared and implemented for each user defined class to be serialized // // template diff --git a/include/boost/serialization/split_free.hpp b/include/boost/serialization/split_free.hpp index 9de2e927..2da9964d 100644 --- a/include/boost/serialization/split_free.hpp +++ b/include/boost/serialization/split_free.hpp @@ -31,12 +31,11 @@ namespace archive { namespace serialization { -//namespace detail { template struct free_saver { static void invoke( Archive & ar, - const T & t, + const T & t, const unsigned int file_version ){ // use function overload (version_type) to workaround @@ -58,7 +57,6 @@ struct free_loader { load(ar, t, v); } }; -//} // namespace detail template inline void split_free( diff --git a/include/boost/serialization/split_member.hpp b/include/boost/serialization/split_member.hpp index c6a59f1b..65c62947 100644 --- a/include/boost/serialization/split_member.hpp +++ b/include/boost/serialization/split_member.hpp @@ -72,7 +72,7 @@ inline void split_member( } // namespace serialization } // namespace boost -// split member function serialize funcition into save/load +// split member function serialize function into save/load #define BOOST_SERIALIZATION_SPLIT_MEMBER() \ template \ void serialize( \ diff --git a/include/boost/serialization/strong_typedef.hpp b/include/boost/serialization/strong_typedef.hpp index 2770ae45..b6003a4c 100644 --- a/include/boost/serialization/strong_typedef.hpp +++ b/include/boost/serialization/strong_typedef.hpp @@ -18,7 +18,7 @@ // See http://www.boost.org/libs/serialization for updates, documentation, and revision history. // macro used to implement a strong typedef. strong typedef -// guarentees that two types are distinguised even though the +// guarantees that two types are distinguished even though they // share the same underlying implementation. typedef does not create // a new type. BOOST_STRONG_TYPEDEF(T, D) creates a new type named D // that operates as a type T. diff --git a/include/boost/serialization/tracking.hpp b/include/boost/serialization/tracking.hpp index 89334074..94950702 100644 --- a/include/boost/serialization/tracking.hpp +++ b/include/boost/serialization/tracking.hpp @@ -107,7 +107,7 @@ struct tracking_level< T > \ /* tracking for a class */ \ BOOST_STATIC_ASSERT(( \ mpl::greater< \ - /* that is a prmitive */ \ + /* that is a primitive */ \ implementation_level< T >, \ mpl::int_ \ >::value \ diff --git a/include/boost/serialization/traits.hpp b/include/boost/serialization/traits.hpp index 45e0c93f..d361f156 100644 --- a/include/boost/serialization/traits.hpp +++ b/include/boost/serialization/traits.hpp @@ -18,11 +18,11 @@ // This header is used to apply serialization traits to templates. The // standard system can't be used for platforms which don't support -// Partial Templlate Specialization. +// Partial Template Specialization. // The motivation for this is the Name-Value Pair (NVP) template. // it has to work the same on all platforms in order for archives -// to be portable accross platforms. +// to be portable across platforms. #include #include diff --git a/include/boost/serialization/version.hpp b/include/boost/serialization/version.hpp index 6299ada2..076c859e 100644 --- a/include/boost/serialization/version.hpp +++ b/include/boost/serialization/version.hpp @@ -64,7 +64,7 @@ const int version::value; * as an error an attempt to set a version # for a class which doesn't * save its class information (including version #) in the archive. * However, this imposes a requirement that the version be set after - * the implemention level which would be pretty confusing. If this + * the implementation level which would be pretty confusing. If this * is to be done, do this check in the input or output operators when * ALL the serialization traits are available. Included the implementation * here with this comment as a reminder not to do this! diff --git a/include/boost/tuple/detail/tuple_basic.hpp b/include/boost/tuple/detail/tuple_basic.hpp index 96fb5bde..ad488be7 100644 --- a/include/boost/tuple/detail/tuple_basic.hpp +++ b/include/boost/tuple/detail/tuple_basic.hpp @@ -36,10 +36,10 @@ #include // needed for the assignment from pair to tuple #include // for std::size_t +#include #include #include #include -#include #include // needed for BOOST_WORKAROUND @@ -964,11 +964,11 @@ void swap(tuple& lhs, inline void swap(null_type&, null_type&) {} template inline void swap(cons& lhs, cons& rhs) { - ::boost::swap(lhs.head, rhs.head); + ::boost::core::invoke_swap(lhs.head, rhs.head); } template inline void swap(cons& lhs, cons& rhs) { - ::boost::swap(lhs.head, rhs.head); + ::boost::core::invoke_swap(lhs.head, rhs.head); ::boost::tuples::swap(lhs.tail, rhs.tail); } template // other compilers -#include +#include #include diff --git a/include/boost/type_index.hpp b/include/boost/type_index.hpp index 07ea5153..367dc8d5 100644 --- a/include/boost/type_index.hpp +++ b/include/boost/type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright 2012-2023 Antony Polukhin. +// Copyright 2012-2024 Antony Polukhin. // // Distributed under the 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,26 +20,6 @@ # pragma once #endif - - -#include -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ - defined(BOOST_NO_CXX11_FINAL) || \ - defined(BOOST_NO_CXX11_ALIGNOF) || \ - defined(BOOST_NO_CXX11_STATIC_ASSERT) || \ - defined(BOOST_NO_CXX11_SMART_PTR) || \ - defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \ - defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.TypeIndex 1.82 and will be removed in Boost.TypeIndex 1.84.") - -#endif - #if defined(BOOST_TYPE_INDEX_USER_TYPEINDEX) # include BOOST_TYPE_INDEX_USER_TYPEINDEX # ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH @@ -228,7 +208,7 @@ typedef type_index::type_info_t type_info; /// \throw Nothing. /// \return boost::typeindex::type_index with information about the specified type T. template -inline type_index type_id() BOOST_NOEXCEPT { +inline type_index type_id() noexcept { return type_index::type_id(); } @@ -248,7 +228,7 @@ inline type_index type_id() BOOST_NOEXCEPT { /// \throw Nothing. /// \return boost::typeindex::type_index with information about the specified type T. template -inline type_index type_id_with_cvr() BOOST_NOEXCEPT { +inline type_index type_id_with_cvr() noexcept { return type_index::type_id_with_cvr(); } @@ -273,7 +253,7 @@ inline type_index type_id_with_cvr() BOOST_NOEXCEPT { /// \throw Nothing. /// \return boost::typeindex::type_index with information about the specified variable. template -inline type_index type_id_runtime(const T& runtime_val) BOOST_NOEXCEPT { +inline type_index type_id_runtime(const T& runtime_val) noexcept { return type_index::type_id_runtime(runtime_val); } diff --git a/include/boost/type_index/ctti_type_index.hpp b/include/boost/type_index/ctti_type_index.hpp index 818545b8..f54a4faf 100644 --- a/include/boost/type_index/ctti_type_index.hpp +++ b/include/boost/type_index/ctti_type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2023 Antony Polukhin. +// Copyright 2013-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -22,10 +22,8 @@ #include #include +#include #include -#include -#include -#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once @@ -58,24 +56,17 @@ namespace detail { /// std::cout << ti.pretty_name(); /// \endcode class ctti_data { -#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS public: ctti_data() = delete; ctti_data(const ctti_data&) = delete; ctti_data& operator=(const ctti_data&) = delete; -#else -private: - ctti_data(); - ctti_data(const ctti_data&); - ctti_data& operator=(const ctti_data&); -#endif }; } // namespace detail /// Helper method for getting detail::ctti_data of a template parameter T. template -inline const detail::ctti_data& ctti_construct() BOOST_NOEXCEPT { +inline const detail::ctti_data& ctti_construct() noexcept { // Standard C++11, 5.2.10 Reinterpret cast: // An object pointer can be explicitly converted to an object pointer of a different type. When a prvalue // v of type "pointer to T1" is converted to the type "pointer to cv T2", the result is static_cast { const char* data_; - inline std::size_t get_raw_name_length() const BOOST_NOEXCEPT; + inline std::size_t get_raw_name_length() const noexcept; - BOOST_CXX14_CONSTEXPR inline explicit ctti_type_index(const char* data) BOOST_NOEXCEPT + BOOST_CXX14_CONSTEXPR inline explicit ctti_type_index(const char* data) noexcept : data_(data) {} public: typedef detail::ctti_data type_info_t; - BOOST_CXX14_CONSTEXPR inline ctti_type_index() BOOST_NOEXCEPT + BOOST_CXX14_CONSTEXPR inline ctti_type_index() noexcept : data_(boost::detail::ctti::n()) {} - inline ctti_type_index(const type_info_t& data) BOOST_NOEXCEPT + inline ctti_type_index(const type_info_t& data) noexcept : data_(reinterpret_cast(&data)) {} - inline const type_info_t& type_info() const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline const char* raw_name() const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline const char* name() const BOOST_NOEXCEPT; + inline const type_info_t& type_info() const noexcept; + BOOST_CXX14_CONSTEXPR inline const char* raw_name() const noexcept; + BOOST_CXX14_CONSTEXPR inline const char* name() const noexcept; inline std::string pretty_name() const; - inline std::size_t hash_code() const BOOST_NOEXCEPT; + inline std::size_t hash_code() const noexcept; - BOOST_CXX14_CONSTEXPR inline bool equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline bool before(const ctti_type_index& rhs) const BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline bool equal(const ctti_type_index& rhs) const noexcept; + BOOST_CXX14_CONSTEXPR inline bool before(const ctti_type_index& rhs) const noexcept; template - BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id() BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id() noexcept; template - BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id_with_cvr() BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id_with_cvr() noexcept; template - inline static ctti_type_index type_id_runtime(const T& variable) BOOST_NOEXCEPT; + inline static ctti_type_index type_id_runtime(const T& variable) noexcept; }; -inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const BOOST_NOEXCEPT { +inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const noexcept { return *reinterpret_cast(data_); } -BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::equal(const ctti_type_index& rhs) const noexcept { const char* const left = raw_name(); const char* const right = rhs.raw_name(); return /*left == right ||*/ !boost::typeindex::detail::constexpr_strcmp(left, right); } -BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& rhs) const BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& rhs) const noexcept { const char* const left = raw_name(); const char* const right = rhs.raw_name(); return /*left != right &&*/ boost::typeindex::detail::constexpr_strcmp(left, right) < 0; @@ -161,37 +152,37 @@ BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& template -BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_t; +BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id() noexcept { + typedef typename std::remove_reference::type no_ref_t; + typedef typename std::remove_cv::type no_cvr_t; return ctti_type_index(boost::detail::ctti::n()); } template -BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id_with_cvr() BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id_with_cvr() noexcept { return ctti_type_index(boost::detail::ctti::n()); } template -inline ctti_type_index ctti_type_index::type_id_runtime(const T& variable) BOOST_NOEXCEPT { +inline ctti_type_index ctti_type_index::type_id_runtime(const T& variable) noexcept { return variable.boost_type_index_type_id_runtime_(); } -BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::raw_name() const BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::raw_name() const noexcept { return data_; } -BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::name() const BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::name() const noexcept { return data_; } -inline std::size_t ctti_type_index::get_raw_name_length() const BOOST_NOEXCEPT { - return std::strlen(raw_name() + detail::ctti_skip_size_at_end); +inline std::size_t ctti_type_index::get_raw_name_length() const noexcept { + return std::strlen(raw_name() + detail::skip().size_at_end); } @@ -202,7 +193,7 @@ inline std::string ctti_type_index::pretty_name() const { } -inline std::size_t ctti_type_index::hash_code() const BOOST_NOEXCEPT { +inline std::size_t ctti_type_index::hash_code() const noexcept { return boost::hash_range(raw_name(), raw_name() + get_raw_name_length()); } diff --git a/include/boost/type_index/detail/compile_time_type_info.hpp b/include/boost/type_index/detail/compile_time_type_info.hpp index c8080841..236c4ab7 100644 --- a/include/boost/type_index/detail/compile_time_type_info.hpp +++ b/include/boost/type_index/detail/compile_time_type_info.hpp @@ -1,5 +1,5 @@ // -// Copyright 2012-2023 Antony Polukhin. +// Copyright 2012-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -13,10 +13,10 @@ /// \brief Contains helper macros and implementation details of boost::typeindex::ctti_type_index. /// Not intended for inclusion from user's code. -#include #include -#include -#include + +#include +#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once @@ -35,74 +35,87 @@ #define BOOST_TYPE_INDEX_DETAIL_BUILTIN_STRCMP(str1, str2) __builtin_strcmp(str1, str2) #endif -#define BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(begin_skip, end_skip, runtime_skip, runtime_skip_until) \ - namespace boost { namespace typeindex { namespace detail { \ - BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_begin = begin_skip; \ - BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_end = end_skip; \ - BOOST_STATIC_CONSTEXPR bool ctti_skip_more_at_runtime = runtime_skip; \ - BOOST_STATIC_CONSTEXPR char ctti_skip_until_runtime[] = runtime_skip_until; \ - }}} /* namespace boost::typeindex::detail */ \ - /**/ /// @endcond +namespace boost { namespace typeindex { namespace detail { + struct ctti_skip { + std::size_t size_at_begin; + std::size_t size_at_end; + const char* until_runtime; + std::size_t until_runtime_length; + }; + + template + constexpr ctti_skip make_ctti_skip(std::size_t size_at_begin, + std::size_t size_at_end, + bool more_at_runtime, + const char (&until_runtime)[N]) + { + return ctti_skip{size_at_begin, size_at_end, until_runtime, more_at_runtime ? N - 1 : 0}; + } + + template + constexpr ctti_skip make_ctti_skip(std::size_t size_at_begin, + std::size_t size_at_end, + const char (&until_runtime)[N]) + { + return ctti_skip{size_at_begin, size_at_end, until_runtime, N - 1}; + } + #if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) /* Nothing to document. All the macro docs are moved to */ #elif defined(BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING) -# include - BOOST_PP_EXPAND( BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING ) +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING; } #elif defined(_MSC_VER) && !defined(__clang__) && defined (BOOST_NO_CXX11_NOEXCEPT) // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(40, 10, ""); } #elif defined(_MSC_VER) && !defined(__clang__) && !defined (BOOST_NO_CXX11_NOEXCEPT) // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(40, 19, ""); } #elif defined(__clang__) && defined(__APPLE__) // Someone made __clang_major__ equal to LLVM version rather than compiler version // on APPLE platform. // // Using less efficient solution because there is no good way to detect real version of Clang. // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "???????????>::n() [T = int" - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(39, 1, "T = "); } #elif defined(__clang__) && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ == 0)) // sizeof("static const char *boost::detail::ctti<") - 1, sizeof(">::n()") - 1 // note: checked on 3.0 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 6, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(39, 6, ""); } #elif defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ > 0)) // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "int>::n() [T = int" // note: checked on 3.1, 3.4 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(39, 1, "T = "); } #elif defined(__EDG__) && !defined(BOOST_NO_CXX14_CONSTEXPR) // sizeof("static cha boost::detail::ctti::s() [with I = 40U, T = ") - 1, sizeof("]") - 1 // note: checked on 4.14 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(58, 1, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(58, 1, ""); } #elif defined(__EDG__) && defined(BOOST_NO_CXX14_CONSTEXPR) // sizeof("static const char *boost::detail::ctti::n() [with T = ") - 1, sizeof("]") - 1 // note: checked on 4.14 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(57, 1, ""); } #elif defined(__GNUC__) && (__GNUC__ < 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) - // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0u; T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(81, 1, false, "") + // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0u; } T = ") - 1, sizeof("]") - 1 +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(81, 1, ""); } #elif defined(__GNUC__) && (__GNUC__ >= 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) - // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0; T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(80, 1, false, "") + // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0; } T = ") - 1, sizeof("]") - 1 +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(80, 1, ""); } #elif defined(__GNUC__) && defined(BOOST_NO_CXX14_CONSTEXPR) // sizeof("static const char* boost::detail::ctti::n() [with T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(57, 1, ""); } #elif defined(__ghs__) // sizeof("static const char *boost::detail::ctti::n() [with T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(57, 1, ""); } #else // Deafult code for other platforms... Just skip nothing! - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(0, 0, false, "") +constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(0, 0, ""); } #endif -#undef BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS - -namespace boost { namespace typeindex { namespace detail { template - BOOST_CXX14_CONSTEXPR inline void assert_compile_time_legths() BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + BOOST_CXX14_CONSTEXPR inline void assert_compile_time_legths() noexcept { + static_assert( Condition, "TypeIndex library is misconfigured for your compiler. " "Please define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct values. See section " @@ -111,8 +124,8 @@ namespace boost { namespace typeindex { namespace detail { } template - BOOST_CXX14_CONSTEXPR inline void failed_to_get_function_name() BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + BOOST_CXX14_CONSTEXPR inline void failed_to_get_function_name() noexcept { + static_assert( sizeof(T) && false, "TypeIndex library could not detect your compiler. " "Please make the BOOST_TYPE_INDEX_FUNCTION_SIGNATURE macro use " @@ -122,7 +135,7 @@ namespace boost { namespace typeindex { namespace detail { } #if defined(BOOST_TYPE_INDEX_DETAIL_IS_CONSTANT) - BOOST_CXX14_CONSTEXPR BOOST_FORCEINLINE bool is_constant_string(const char* str) BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR BOOST_FORCEINLINE bool is_constant_string(const char* str) noexcept { while (BOOST_TYPE_INDEX_DETAIL_IS_CONSTANT(*str)) { if (*str == '\0') return true; @@ -132,17 +145,12 @@ namespace boost { namespace typeindex { namespace detail { } #endif // defined(BOOST_TYPE_INDEX_DETAIL_IS_CONSTANT) - template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::false_type) BOOST_NOEXCEPT { - return begin; - } - template BOOST_CXX14_CONSTEXPR inline ForwardIterator1 constexpr_search( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, - ForwardIterator2 last2) BOOST_NOEXCEPT + ForwardIterator2 last2) noexcept { if (first2 == last2) { return first1; // specified in C++11 @@ -165,7 +173,7 @@ namespace boost { namespace typeindex { namespace detail { return last1; } - BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp_loop(const char *v1, const char *v2) BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp_loop(const char *v1, const char *v2) noexcept { while (*v1 != '\0' && *v1 == *v2) { ++v1; ++v2; @@ -174,7 +182,7 @@ namespace boost { namespace typeindex { namespace detail { return static_cast(*v1) - *v2; } - BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp(const char *v1, const char *v2) BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp(const char *v1, const char *v2) noexcept { #if !defined(BOOST_NO_CXX14_CONSTEXPR) && defined(BOOST_TYPE_INDEX_DETAIL_IS_CONSTANT) && defined(BOOST_TYPE_INDEX_DETAIL_BUILTIN_STRCMP) if (boost::typeindex::detail::is_constant_string(v1) && boost::typeindex::detail::is_constant_string(v2)) return boost::typeindex::detail::constexpr_strcmp_loop(v1, v2); @@ -187,21 +195,21 @@ namespace boost { namespace typeindex { namespace detail { } template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::true_type) BOOST_NOEXCEPT { - const char* const it = constexpr_search( + BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin) noexcept { + const char* const it = detail::constexpr_search( begin, begin + ArrayLength, - ctti_skip_until_runtime, ctti_skip_until_runtime + sizeof(ctti_skip_until_runtime) - 1 + skip().until_runtime, skip().until_runtime + skip().until_runtime_length ); - return (it == begin + ArrayLength ? begin : it + sizeof(ctti_skip_until_runtime) - 1); + return (it == begin + ArrayLength ? begin : it + skip().until_runtime_length); } template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining(const char* begin) BOOST_NOEXCEPT { - assert_compile_time_legths<(ArrayLength > ctti_skip_size_at_begin + ctti_skip_size_at_end)>(); - return skip_begining_runtime( - begin + ctti_skip_size_at_begin, - boost::integral_constant() - ); + BOOST_CXX14_CONSTEXPR inline const char* skip_begining(const char* begin) noexcept { + detail::assert_compile_time_legths<(ArrayLength > skip().size_at_begin + skip().size_at_end)>(); + return skip().until_runtime_length + ? detail::skip_begining_runtime(begin + skip().size_at_begin) + : begin + skip().size_at_begin + ; } #if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) @@ -257,7 +265,7 @@ struct ctti { #if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) //helper functions template - constexpr static char s() BOOST_NOEXCEPT { // step + constexpr static char s() noexcept { // step constexpr unsigned int offset = (I >= 10u ? 1u : 0u) + (I >= 100u ? 1u : 0u) @@ -277,12 +285,12 @@ struct ctti { } template - constexpr static const char* impl(::boost::typeindex::detail::index_seq ) BOOST_NOEXCEPT { + constexpr static const char* impl(::boost::typeindex::detail::index_seq ) noexcept { return ::boost::typeindex::detail::cstring()...>::data_; } template // `D` means `Dummy` - constexpr static const char* n() BOOST_NOEXCEPT { + constexpr static const char* n() noexcept { #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) constexpr unsigned int size = sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); #elif defined(__FUNCSIG__) @@ -300,19 +308,19 @@ struct ctti { #endif boost::typeindex::detail::assert_compile_time_legths< - (size > boost::typeindex::detail::ctti_skip_size_at_begin + boost::typeindex::detail::ctti_skip_size_at_end + sizeof("const *") - 1) + (size > boost::typeindex::detail::skip().size_at_begin + boost::typeindex::detail::skip().size_at_end + sizeof("const *") - 1) >(); - static_assert(!boost::typeindex::detail::ctti_skip_more_at_runtime, "Skipping for GCC in C++14 mode is unsupported"); + static_assert(!boost::typeindex::detail::skip().until_runtime_length, "Skipping for GCC in C++14 mode is unsupported"); typedef typename boost::typeindex::detail::make_index_seq_impl< - boost::typeindex::detail::ctti_skip_size_at_begin, - size - sizeof("const *") + 1 - boost::typeindex::detail::ctti_skip_size_at_begin + boost::typeindex::detail::skip().size_at_begin, + size - sizeof("const *") + 1 - boost::typeindex::detail::skip().size_at_begin >::type idx_seq; return impl(idx_seq()); } #else /// Returns raw name. Must be as short, as possible, to avoid code bloat - BOOST_CXX14_CONSTEXPR static const char* n() BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR static const char* n() noexcept { #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) return boost::typeindex::detail::skip_begining< sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) >(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); #elif defined(__FUNCSIG__) @@ -336,4 +344,6 @@ struct ctti { }} // namespace boost::detail + + #endif // BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP diff --git a/include/boost/type_index/detail/ctti_register_class.hpp b/include/boost/type_index/detail/ctti_register_class.hpp index ba1f068a..57e55d9c 100644 --- a/include/boost/type_index/detail/ctti_register_class.hpp +++ b/include/boost/type_index/detail/ctti_register_class.hpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2023 Antony Polukhin. +// Copyright 2013-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -22,17 +22,17 @@ namespace boost { namespace typeindex { namespace detail { template -inline const ctti_data& ctti_construct_typeid_ref(const T*) BOOST_NOEXCEPT { - return ctti_construct(); +inline const ctti_data& ctti_construct_typeid_ref(const T*) noexcept { + return boost::typeindex::ctti_construct(); } }}} // namespace boost::typeindex::detail /// @cond -#define BOOST_TYPE_INDEX_REGISTER_CLASS \ - virtual const boost::typeindex::detail::ctti_data& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ - return boost::typeindex::detail::ctti_construct_typeid_ref(this); \ - } \ +#define BOOST_TYPE_INDEX_REGISTER_CLASS \ + virtual const boost::typeindex::detail::ctti_data& boost_type_index_type_id_runtime_() const noexcept { \ + return boost::typeindex::detail::ctti_construct_typeid_ref(this); \ + } \ /**/ /// @endcond diff --git a/include/boost/type_index/detail/stl_register_class.hpp b/include/boost/type_index/detail/stl_register_class.hpp index 590fc96f..ee4a64f0 100644 --- a/include/boost/type_index/detail/stl_register_class.hpp +++ b/include/boost/type_index/detail/stl_register_class.hpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2023 Antony Polukhin. +// Copyright 2013-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -22,17 +22,17 @@ namespace boost { namespace typeindex { namespace detail { template -inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) BOOST_NOEXCEPT { +inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) noexcept { return typeid(T); } }}} // namespace boost::typeindex::detail /// @cond -#define BOOST_TYPE_INDEX_REGISTER_CLASS \ - virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ - return boost::typeindex::detail::stl_construct_typeid_ref(this); \ - } \ +#define BOOST_TYPE_INDEX_REGISTER_CLASS \ + virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const noexcept { \ + return boost::typeindex::detail::stl_construct_typeid_ref(this); \ + } \ /**/ /// @endcond diff --git a/include/boost/type_index/stl_type_index.hpp b/include/boost/type_index/stl_type_index.hpp index 06c3cac2..3e86e04a 100644 --- a/include/boost/type_index/stl_type_index.hpp +++ b/include/boost/type_index/stl_type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2023 Antony Polukhin. +// Copyright 2013-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -29,30 +29,9 @@ #include #include // std::strcmp, std::strlen, std::strstr #include -#include +#include #include #include -#include -#include -#include -#include -#include -#include - -#if (defined(_MSC_VER) && _MSC_VER > 1600) \ - || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) \ - || (defined(__GNUC__) && __GNUC__ > 4 && __cplusplus >= 201103) -# define BOOST_TYPE_INDEX_STD_TYPE_INDEX_HAS_HASH_CODE -#else -# include -#endif - -#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) -# include -# include -# include -#endif #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once @@ -86,40 +65,40 @@ class stl_type_index const type_info_t* data_; public: - inline stl_type_index() BOOST_NOEXCEPT + inline stl_type_index() noexcept : data_(&typeid(void)) {} - inline stl_type_index(const type_info_t& data) BOOST_NOEXCEPT + inline stl_type_index(const type_info_t& data) noexcept : data_(&data) {} - inline const type_info_t& type_info() const BOOST_NOEXCEPT; + inline const type_info_t& type_info() const noexcept; - inline const char* raw_name() const BOOST_NOEXCEPT; - inline const char* name() const BOOST_NOEXCEPT; + inline const char* raw_name() const noexcept; + inline const char* name() const noexcept; inline std::string pretty_name() const; - inline std::size_t hash_code() const BOOST_NOEXCEPT; - inline bool equal(const stl_type_index& rhs) const BOOST_NOEXCEPT; - inline bool before(const stl_type_index& rhs) const BOOST_NOEXCEPT; + inline std::size_t hash_code() const noexcept; + inline bool equal(const stl_type_index& rhs) const noexcept; + inline bool before(const stl_type_index& rhs) const noexcept; template - inline static stl_type_index type_id() BOOST_NOEXCEPT; + inline static stl_type_index type_id() noexcept; template - inline static stl_type_index type_id_with_cvr() BOOST_NOEXCEPT; + inline static stl_type_index type_id_with_cvr() noexcept; template - inline static stl_type_index type_id_runtime(const T& value) BOOST_NOEXCEPT; + inline static stl_type_index type_id_runtime(const T& value) noexcept; }; -inline const stl_type_index::type_info_t& stl_type_index::type_info() const BOOST_NOEXCEPT { +inline const stl_type_index::type_info_t& stl_type_index::type_info() const noexcept { return *data_; } -inline const char* stl_type_index::raw_name() const BOOST_NOEXCEPT { +inline const char* stl_type_index::raw_name() const noexcept { #ifdef _MSC_VER return data_->raw_name(); #else @@ -127,7 +106,7 @@ inline const char* stl_type_index::raw_name() const BOOST_NOEXCEPT { #endif } -inline const char* stl_type_index::name() const BOOST_NOEXCEPT { +inline const char* stl_type_index::name() const noexcept { return data_->name(); } @@ -180,12 +159,8 @@ inline std::string stl_type_index::pretty_name() const { } -inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT { -#ifdef BOOST_TYPE_INDEX_STD_TYPE_INDEX_HAS_HASH_CODE +inline std::size_t stl_type_index::hash_code() const noexcept { return data_->hash_code(); -#else - return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name())); -#endif } @@ -203,7 +178,7 @@ inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT { /// @endcond -inline bool stl_type_index::equal(const stl_type_index& rhs) const BOOST_NOEXCEPT { +inline bool stl_type_index::equal(const stl_type_index& rhs) const noexcept { #ifdef BOOST_TYPE_INDEX_CLASSINFO_COMPARE_BY_NAMES return raw_name() == rhs.raw_name() || !std::strcmp(raw_name(), rhs.raw_name()); #else @@ -211,7 +186,7 @@ inline bool stl_type_index::equal(const stl_type_index& rhs) const BOOST_NOEXCEP #endif } -inline bool stl_type_index::before(const stl_type_index& rhs) const BOOST_NOEXCEPT { +inline bool stl_type_index::before(const stl_type_index& rhs) const noexcept { #ifdef BOOST_TYPE_INDEX_CLASSINFO_COMPARE_BY_NAMES return raw_name() != rhs.raw_name() && std::strcmp(raw_name(), rhs.raw_name()) < 0; #else @@ -223,26 +198,9 @@ inline bool stl_type_index::before(const stl_type_index& rhs) const BOOST_NOEXCE template -inline stl_type_index stl_type_index::type_id() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_prefinal_t; - - # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) - - // Old EDG-based compilers seem to mistakenly distinguish 'integral' from 'signed integral' - // in typeid() expressions. Full template specialization for 'integral' fixes that issue: - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_signed::value, - boost::make_signed, - boost::type_identity - >::type no_cvr_prefinal_lazy_t; - - typedef BOOST_DEDUCED_TYPENAME no_cvr_prefinal_t::type no_cvr_t; - #else - typedef no_cvr_prefinal_t no_cvr_t; - #endif - +inline stl_type_index stl_type_index::type_id() noexcept { + typedef typename std::remove_reference::type no_ref_t; + typedef typename std::remove_cv::type no_cvr_t; return typeid(no_cvr_t); } @@ -251,9 +209,9 @@ namespace detail { } template -inline stl_type_index stl_type_index::type_id_with_cvr() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_reference::value || boost::is_const::value || boost::is_volatile::value, +inline stl_type_index stl_type_index::type_id_with_cvr() noexcept { + typedef typename std::conditional< + std::is_reference::value || std::is_const::value || std::is_volatile::value, detail::cvr_saver, T >::type type; @@ -263,7 +221,7 @@ inline stl_type_index stl_type_index::type_id_with_cvr() BOOST_NOEXCEPT { template -inline stl_type_index stl_type_index::type_id_runtime(const T& value) BOOST_NOEXCEPT { +inline stl_type_index stl_type_index::type_id_runtime(const T& value) noexcept { #ifdef BOOST_NO_RTTI return value.boost_type_index_type_id_runtime_(); #else @@ -273,6 +231,4 @@ inline stl_type_index stl_type_index::type_id_runtime(const T& value) BOOST_NOEX }} // namespace boost::typeindex -#undef BOOST_TYPE_INDEX_STD_TYPE_INDEX_HAS_HASH_CODE - #endif // BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP diff --git a/include/boost/type_index/type_index_facade.hpp b/include/boost/type_index/type_index_facade.hpp index 4145aa4e..421e06b1 100644 --- a/include/boost/type_index/type_index_facade.hpp +++ b/include/boost/type_index/type_index_facade.hpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2023 Antony Polukhin. +// Copyright 2013-2024 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -13,14 +13,8 @@ #include #include #include - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) +#include #include // for std::basic_ostream -#else -#include -#endif -#endif #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once @@ -62,7 +56,7 @@ template class type_index_facade { private: /// @cond - BOOST_CXX14_CONSTEXPR const Derived & derived() const BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR const Derived & derived() const noexcept { return *static_cast(this); } /// @endcond @@ -71,7 +65,7 @@ class type_index_facade { /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. /// \return Name of a type. By default returns Derived::raw_name(). - inline const char* name() const BOOST_NOEXCEPT { + inline const char* name() const noexcept { return derived().raw_name(); } @@ -83,7 +77,7 @@ class type_index_facade { /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. /// \return True if two types are equal. By default compares types by raw_name(). - inline bool equal(const Derived& rhs) const BOOST_NOEXCEPT { + inline bool equal(const Derived& rhs) const noexcept { const char* const left = derived().raw_name(); const char* const right = rhs.raw_name(); return left == right || !std::strcmp(left, right); @@ -91,7 +85,7 @@ class type_index_facade { /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. /// \return True if rhs is greater than this. By default compares types by raw_name(). - inline bool before(const Derived& rhs) const BOOST_NOEXCEPT { + inline bool before(const Derived& rhs) const noexcept { const char* const left = derived().raw_name(); const char* const right = rhs.raw_name(); return left != right && std::strcmp(left, right) < 0; @@ -101,7 +95,7 @@ class type_index_facade { /// \return Hash code of a type. By default hashes types by raw_name(). /// \note Derived class header \b must include , \b unless this function is redefined in /// Derived class to not use boost::hash_range(). - inline std::size_t hash_code() const BOOST_NOEXCEPT { + inline std::size_t hash_code() const noexcept { const char* const name_raw = derived().raw_name(); return boost::hash_range(name_raw, name_raw + std::strlen(name_raw)); } @@ -110,11 +104,11 @@ class type_index_facade { protected: /// \b Override: This function \b must be redefined in Derived class. Overrides \b must not throw. /// \return Pointer to unredable/raw type name. - inline const char* raw_name() const BOOST_NOEXCEPT; + inline const char* raw_name() const noexcept; /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. /// \return Const reference to underlying low level type_info_t. - inline const type_info_t& type_info() const BOOST_NOEXCEPT; + inline const type_info_t& type_info() const noexcept; /// This is a factory method that is used to create instances of Derived classes. /// boost::typeindex::type_id() will call this method, if Derived has same type as boost::typeindex::type_index. @@ -124,7 +118,7 @@ class type_index_facade { /// \tparam T Type for which type_index must be created. /// \return type_index for type T. template - static Derived type_id() BOOST_NOEXCEPT; + static Derived type_id() noexcept; /// This is a factory method that is used to create instances of Derived classes. /// boost::typeindex::type_id_with_cvr() will call this method, if Derived has same type as boost::typeindex::type_index. @@ -134,7 +128,7 @@ class type_index_facade { /// \tparam T Type for which type_index must be created. /// \return type_index for type T. template - static Derived type_id_with_cvr() BOOST_NOEXCEPT; + static Derived type_id_with_cvr() noexcept; /// This is a factory method that is used to create instances of Derived classes. /// boost::typeindex::type_id_runtime(const T&) will call this method, if Derived has same type as boost::typeindex::type_index. @@ -143,7 +137,7 @@ class type_index_facade { /// \param variable Variable which runtime type will be stored in type_index. /// \return type_index with runtime type of variable. template - static Derived type_id_runtime(const T& variable) BOOST_NOEXCEPT; + static Derived type_id_runtime(const T& variable) noexcept; #endif @@ -151,96 +145,96 @@ class type_index_facade { /// @cond template -BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return static_cast(lhs).equal(static_cast(rhs)); } template -BOOST_CXX14_CONSTEXPR inline bool operator < (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator < (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return static_cast(lhs).before(static_cast(rhs)); } template -BOOST_CXX14_CONSTEXPR inline bool operator > (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator > (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return rhs < lhs; } template -BOOST_CXX14_CONSTEXPR inline bool operator <= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator <= (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return !(lhs > rhs); } template -BOOST_CXX14_CONSTEXPR inline bool operator >= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator >= (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return !(lhs < rhs); } template -BOOST_CXX14_CONSTEXPR inline bool operator != (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +BOOST_CXX14_CONSTEXPR inline bool operator != (const type_index_facade& lhs, const type_index_facade& rhs) noexcept { return !(lhs == rhs); } // ######################### COMPARISONS with Derived ############################ // template -inline bool operator == (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator == (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return Derived(lhs) == rhs; } template -inline bool operator < (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator < (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return Derived(lhs) < rhs; } template -inline bool operator > (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator > (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return rhs < Derived(lhs); } template -inline bool operator <= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator <= (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return !(Derived(lhs) > rhs); } template -inline bool operator >= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator >= (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return !(Derived(lhs) < rhs); } template -inline bool operator != (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { +inline bool operator != (const TypeInfo& lhs, const type_index_facade& rhs) noexcept { return !(Derived(lhs) == rhs); } template -inline bool operator == (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator == (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return lhs == Derived(rhs); } template -inline bool operator < (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator < (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return lhs < Derived(rhs); } template -inline bool operator > (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator > (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return Derived(rhs) < lhs; } template -inline bool operator <= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator <= (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return !(lhs > Derived(rhs)); } template -inline bool operator >= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator >= (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return !(lhs < Derived(rhs)); } template -inline bool operator != (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { +inline bool operator != (const type_index_facade& lhs, const TypeInfo& rhs) noexcept { return !(lhs == Derived(rhs)); } @@ -262,16 +256,6 @@ bool operator ==, !=, <, ... (const TypeInfo& lhs, const type_index_facade& rhs) #endif #ifndef BOOST_NO_IOSTREAM -#ifdef BOOST_NO_TEMPLATED_IOSTREAMS -/// @cond -/// Ostream operator that will output demangled name -template -inline std::ostream& operator<<(std::ostream& ostr, const type_index_facade& ind) { - ostr << static_cast(ind).pretty_name(); - return ostr; -} -/// @endcond -#else /// Ostream operator that will output demangled name. template inline std::basic_ostream& operator<<( @@ -281,13 +265,12 @@ inline std::basic_ostream& operator<<( ostr << static_cast(ind).pretty_name(); return ostr; } -#endif // BOOST_NO_TEMPLATED_IOSTREAMS #endif // BOOST_NO_IOSTREAM /// This free function is used by Boost's unordered containers. /// \note has to be included if this function is used. template -inline std::size_t hash_value(const type_index_facade& lhs) BOOST_NOEXCEPT { +inline std::size_t hash_value(const type_index_facade& lhs) noexcept { return static_cast(lhs).hash_code(); } diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp deleted file mode 100644 index 985a4c51..00000000 --- a/include/boost/type_traits/composite_traits.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard -// Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. -// -// defines traits classes for composite types: -// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union. -// - -#ifndef BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED -#define BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED - -#include -#include -#include -#include -#include -#include -#include - -#endif // BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED - - - - - diff --git a/include/boost/type_traits/has_left_shift.hpp b/include/boost/type_traits/has_left_shift.hpp deleted file mode 100644 index e95c12a8..00000000 --- a/include/boost/type_traits/has_left_shift.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// (C) Copyright 2009-2011 Frederic Bron. -// -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED -#define BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED - -#define BOOST_TT_TRAIT_NAME has_left_shift -#define BOOST_TT_TRAIT_OP << -#define BOOST_TT_FORBIDDEN_IF\ - (\ - /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - (\ - ::boost::is_fundamental< Lhs_nocv >::value && \ - ::boost::is_fundamental< Rhs_nocv >::value && \ - ( \ - (! ::boost::is_integral< Lhs_noref >::value ) || \ - (! ::boost::is_integral< Rhs_noref >::value )\ - )\ - )||\ - /* Lhs==fundamental and Rhs==pointer */\ - (\ - ::boost::is_fundamental< Lhs_nocv >::value && \ - ::boost::is_pointer< Rhs_noref >::value\ - )||\ - /* Rhs==fundamental and Lhs==pointer */\ - (\ - ::boost::is_fundamental< Rhs_nocv >::value && \ - ::boost::is_pointer< Lhs_noref >::value\ - )||\ - /* Lhs==pointer and Rhs==pointer */\ - (\ - ::boost::is_pointer< Lhs_noref >::value && \ - ::boost::is_pointer< Rhs_noref >::value\ - )\ - ) - - -#include - -#undef BOOST_TT_TRAIT_NAME -#undef BOOST_TT_TRAIT_OP -#undef BOOST_TT_FORBIDDEN_IF - -#endif diff --git a/include/boost/type_traits/has_right_shift.hpp b/include/boost/type_traits/has_right_shift.hpp deleted file mode 100644 index 55629112..00000000 --- a/include/boost/type_traits/has_right_shift.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// (C) Copyright 2009-2011 Frederic Bron. -// -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED -#define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED - -#define BOOST_TT_TRAIT_NAME has_right_shift -#define BOOST_TT_TRAIT_OP >> -#define BOOST_TT_FORBIDDEN_IF\ - (\ - /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - (\ - ::boost::is_fundamental< Lhs_nocv >::value && \ - ::boost::is_fundamental< Rhs_nocv >::value && \ - ( \ - (! ::boost::is_integral< Lhs_noref >::value ) || \ - (! ::boost::is_integral< Rhs_noref >::value )\ - )\ - )||\ - /* Lhs==fundamental and Rhs==pointer */\ - (\ - ::boost::is_fundamental< Lhs_nocv >::value && \ - ::boost::is_pointer< Rhs_noref >::value\ - )||\ - /* Rhs==fundamental and Lhs==pointer */\ - (\ - ::boost::is_fundamental< Rhs_nocv >::value && \ - ::boost::is_pointer< Lhs_noref >::value\ - )||\ - /* Lhs==pointer and Rhs==pointer */\ - (\ - ::boost::is_pointer< Lhs_noref >::value && \ - ::boost::is_pointer< Rhs_noref >::value\ - )\ - ) - - -#include - -#undef BOOST_TT_TRAIT_NAME -#undef BOOST_TT_TRAIT_OP -#undef BOOST_TT_FORBIDDEN_IF - -#endif diff --git a/include/boost/type_traits/is_floating_point.hpp b/include/boost/type_traits/is_floating_point.hpp index 196c900c..f9f3d395 100644 --- a/include/boost/type_traits/is_floating_point.hpp +++ b/include/boost/type_traits/is_floating_point.hpp @@ -10,6 +10,10 @@ #include +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + namespace boost { //* is a type T a floating-point type described in the standard (3.9.1p8) @@ -25,6 +29,24 @@ namespace boost { template<> struct is_floating_point<__float128> : public true_type{}; #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT32_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT64_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT128_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_BFLOAT16_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#endif + } // namespace boost #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/include/boost/type_traits/make_signed.hpp b/include/boost/type_traits/make_signed.hpp deleted file mode 100644 index 6d8b1fb8..00000000 --- a/include/boost/type_traits/make_signed.hpp +++ /dev/null @@ -1,137 +0,0 @@ - -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_MAKE_SIGNED_HPP_INCLUDED -#define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { - -template -struct make_signed -{ -private: - BOOST_STATIC_ASSERT_MSG(( ::boost::is_integral::value || ::boost::is_enum::value), "The template argument to make_signed must be an integer or enum type."); - BOOST_STATIC_ASSERT_MSG(!(::boost::is_same::type, bool>::value), "The template argument to make_signed must not be the type bool."); - - typedef typename remove_cv::type t_no_cv; - typedef typename conditional< - (::boost::is_signed::value - && ::boost::is_integral::value - && ! ::boost::is_same::value - && ! ::boost::is_same::value - && ! ::boost::is_same::value), - T, - typename conditional< - (::boost::is_integral::value - && ! ::boost::is_same::value - && ! ::boost::is_same::value - && ! ::boost::is_same::value), - typename conditional< - is_same::value, - signed char, - typename conditional< - is_same::value, - signed short, - typename conditional< - is_same::value, - int, - typename conditional< - is_same::value, - long, -#if defined(BOOST_HAS_LONG_LONG) -#ifdef BOOST_HAS_INT128 - typename conditional< - sizeof(t_no_cv) == sizeof(boost::long_long_type), - boost::long_long_type, - boost::int128_type - >::type -#else - boost::long_long_type -#endif -#elif defined(BOOST_HAS_MS_INT64) - __int64 -#else - long -#endif - >::type - >::type - >::type - >::type, - // Not a regular integer type: - typename conditional< - sizeof(t_no_cv) == sizeof(unsigned char), - signed char, - typename conditional< - sizeof(t_no_cv) == sizeof(unsigned short), - signed short, - typename conditional< - sizeof(t_no_cv) == sizeof(unsigned int), - int, - typename conditional< - sizeof(t_no_cv) == sizeof(unsigned long), - long, -#if defined(BOOST_HAS_LONG_LONG) -#ifdef BOOST_HAS_INT128 - typename conditional< - sizeof(t_no_cv) == sizeof(boost::long_long_type), - boost::long_long_type, - boost::int128_type - >::type -#else - boost::long_long_type -#endif -#elif defined(BOOST_HAS_MS_INT64) - __int64 -#else - long -#endif - >::type - >::type - >::type - >::type - >::type - >::type base_integer_type; - - // Add back any const qualifier: - typedef typename conditional< - is_const::value, - typename add_const::type, - base_integer_type - >::type const_base_integer_type; -public: - // Add back any volatile qualifier: - typedef typename conditional< - is_volatile::value, - typename add_volatile::type, - const_base_integer_type - >::type type; -}; - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - - template using make_signed_t = typename make_signed::type; - -#endif - -} // namespace boost - -#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED - diff --git a/include/boost/utility/swap.hpp b/include/boost/utility/swap.hpp deleted file mode 100644 index dd9ecd90..00000000 --- a/include/boost/utility/swap.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014 Glen Fernandes - * - * Distributed under the 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_UTILITY_SWAP_HPP -#define BOOST_UTILITY_SWAP_HPP - -// The header file at this path is deprecated; -// use boost/core/swap.hpp instead. - -#include - -#endif diff --git a/include/boost/variant/detail/apply_visitor_binary.hpp b/include/boost/variant/detail/apply_visitor_binary.hpp index 10c2403d..1b1016c6 100644 --- a/include/boost/variant/detail/apply_visitor_binary.hpp +++ b/include/boost/variant/detail/apply_visitor_binary.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 Eric Friedman -// Copyright (c) 2014-2023 Antony Polukhin +// Copyright (c) 2014-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -21,12 +21,10 @@ # include #endif -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -# include -# include -# include -# include // for boost::move, boost::forward -#endif +#include +#include +#include +#include namespace boost { @@ -63,33 +61,20 @@ class apply_visitor_binary_invoke public: // visitor interfaces -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template typename enable_if_c::value, result_type>::type operator()(Value2&& value2) { - return visitor_(::boost::move(value1_), ::boost::forward(value2)); + return visitor_(std::move(value1_), std::forward(value2)); } template typename disable_if_c::value, result_type>::type operator()(Value2&& value2) { - return visitor_(value1_, ::boost::forward(value2)); - } - -#else - - template - result_type - operator()(Value2& value2) - { - return visitor_(value1_, value2); + return visitor_(value1_, std::forward(value2)); } -#endif - private: apply_visitor_binary_invoke& operator=(const apply_visitor_binary_invoke&); }; @@ -117,8 +102,6 @@ class apply_visitor_binary_unwrap public: // visitor interfaces -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template typename enable_if_c::value, result_type>::type operator()(Value1&& value1) @@ -129,7 +112,7 @@ class apply_visitor_binary_unwrap , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); - return boost::apply_visitor(invoker, ::boost::move(visitable2_)); + return boost::apply_visitor(invoker, std::move(visitable2_)); } template @@ -145,23 +128,6 @@ class apply_visitor_binary_unwrap return boost::apply_visitor(invoker, visitable2_); } -#else - - template - result_type - operator()(Value1& value1) - { - apply_visitor_binary_invoke< - Visitor - , Value1 - , false - > invoker(visitor_, value1); - - return boost::apply_visitor(invoker, visitable2_); - } - -#endif - private: apply_visitor_binary_unwrap& operator=(const apply_visitor_binary_unwrap&); @@ -173,8 +139,6 @@ class apply_visitor_binary_unwrap // nonconst-visitor version: // -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template inline typename Visitor::result_type apply_visitor( Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2) @@ -183,29 +147,13 @@ apply_visitor( Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); - return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); -} - -#else - -template -inline typename Visitor::result_type -apply_visitor( Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2) -{ - ::boost::detail::variant::apply_visitor_binary_unwrap< - Visitor, Visitable2, false - > unwrapper(visitor, visitable2); - - return boost::apply_visitor(unwrapper, visitable1); + return boost::apply_visitor(unwrapper, std::forward(visitable1)); } -#endif - // // const-visitor version: // -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline typename Visitor::result_type @@ -215,24 +163,9 @@ apply_visitor( const Visitor& visitor , Visitable1&& visitable1 , Visitable2&& v const Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); - return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); + return boost::apply_visitor(unwrapper, std::forward(visitable1)); } -#else - -template -inline typename Visitor::result_type -apply_visitor( const Visitor& visitor , Visitable1& visitable1 , Visitable2& visitable2) -{ - ::boost::detail::variant::apply_visitor_binary_unwrap< - const Visitor, Visitable2, false - > unwrapper(visitor, visitable2); - - return boost::apply_visitor(unwrapper, visitable1); -} - -#endif - #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) @@ -263,13 +196,13 @@ class apply_visitor_binary_invoke_cpp14 template decltype(auto) operator()(Value2&& value2, typename enable_if_c::value, bool>::type = true) { - return visitor_(::boost::move(value1_), ::boost::forward(value2)); + return visitor_(std::move(value1_), std::forward(value2)); } template decltype(auto) operator()(Value2&& value2, typename disable_if_c::value, bool>::type = true) { - return visitor_(value1_, ::boost::forward(value2)); + return visitor_(value1_, std::forward(value2)); } private: @@ -301,7 +234,7 @@ class apply_visitor_binary_unwrap_cpp14 , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); - return boost::apply_visitor(invoker, ::boost::move(visitable2_)); + return boost::apply_visitor(invoker, std::move(visitable2_)); } template @@ -333,7 +266,7 @@ inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1&& visitable1, V Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); - return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); + return boost::apply_visitor(unwrapper, std::forward(visitable1)); } template @@ -347,7 +280,7 @@ inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1&& visitab const Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); - return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); + return boost::apply_visitor(unwrapper, std::forward(visitable1)); } diff --git a/include/boost/variant/detail/apply_visitor_delayed.hpp b/include/boost/variant/detail/apply_visitor_delayed.hpp index 0a900629..9b35c8a1 100644 --- a/include/boost/variant/detail/apply_visitor_delayed.hpp +++ b/include/boost/variant/detail/apply_visitor_delayed.hpp @@ -15,7 +15,7 @@ #include #include -#include // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include #include @@ -57,8 +57,6 @@ class apply_visitor_delayed_t { } -#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - public: // N-ary visitor interface template result_type operator()(Visitables&... visitables) const @@ -66,26 +64,6 @@ class apply_visitor_delayed_t return apply_visitor(visitor_, visitables...); } -#else // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - -public: // unary visitor interface - - template - result_type operator()(Visitable& visitable) const - { - return apply_visitor(visitor_, visitable); - } - -public: // binary visitor interface - - template - result_type operator()(Visitable1& visitable1, Visitable2& visitable2) const - { - return apply_visitor(visitor_, visitable1, visitable2); - } - -#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - private: apply_visitor_delayed_t& operator=(const apply_visitor_delayed_t&); @@ -100,8 +78,7 @@ inline typename boost::enable_if< return apply_visitor_delayed_t(visitor); } -#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) \ - && !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) template class apply_visitor_delayed_cpp14_t @@ -137,8 +114,7 @@ inline typename boost::disable_if< return apply_visitor_delayed_cpp14_t(visitor); } -#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) - // && !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) +#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) } // namespace boost diff --git a/include/boost/variant/detail/apply_visitor_unary.hpp b/include/boost/variant/detail/apply_visitor_unary.hpp index 7574b44e..dc73f90a 100644 --- a/include/boost/variant/detail/apply_visitor_unary.hpp +++ b/include/boost/variant/detail/apply_visitor_unary.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 Eric Friedman -// Copyright (c) 2014-2023 Antony Polukhin +// Copyright (c) 2014-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -14,7 +14,7 @@ #define BOOST_VARIANT_DETAIL_APPLY_VISITOR_UNARY_HPP #include -#include +#include #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) # include @@ -40,41 +40,23 @@ namespace boost { // nonconst-visitor version: // -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline typename Visitor::result_type apply_visitor(Visitor& visitor, Visitable&& visitable) { - return ::boost::forward(visitable).apply_visitor(visitor); + return std::forward(visitable).apply_visitor(visitor); } -#else -template -inline typename Visitor::result_type -apply_visitor(Visitor& visitor, Visitable& visitable) -{ - return visitable.apply_visitor(visitor); -} -#endif // // const-visitor version: // -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline typename Visitor::result_type apply_visitor(const Visitor& visitor, Visitable&& visitable) { - return ::boost::forward(visitable).apply_visitor(visitor); + return std::forward(visitable).apply_visitor(visitor); } -#else -template -inline typename Visitor::result_type -apply_visitor(const Visitor& visitor, Visitable& visitable) -{ - return visitable.apply_visitor(visitor); -} -#endif #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) @@ -116,12 +98,12 @@ struct result_wrapper1 Visitor&& visitor_; explicit result_wrapper1(Visitor&& visitor) BOOST_NOEXCEPT - : visitor_(::boost::forward(visitor)) + : visitor_(std::forward(visitor)) {} template result_type operator()(T&& val) const { - return visitor_(::boost::forward(val)); + return visitor_(std::forward(val)); } }; @@ -134,8 +116,8 @@ inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable, bool >::type = true) { - boost::detail::variant::result_wrapper1 cpp14_vis(::boost::forward(visitor)); - return ::boost::forward(visitable).apply_visitor(cpp14_vis); + boost::detail::variant::result_wrapper1 cpp14_vis(std::forward(visitor)); + return std::forward(visitable).apply_visitor(cpp14_vis); } #endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) diff --git a/include/boost/variant/detail/config.hpp b/include/boost/variant/detail/config.hpp index efc48a5c..236cc982 100644 --- a/include/boost/variant/detail/config.hpp +++ b/include/boost/variant/detail/config.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2003 Eric Friedman -// Copyright (c) 2016-2023 Antony Polukhin +// Copyright (c) 2016-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -16,22 +16,4 @@ #include #include -#include -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ - defined(BOOST_NO_CXX11_FINAL) || \ - defined(BOOST_NO_CXX11_ALIGNOF) || \ - defined(BOOST_NO_CXX11_STATIC_ASSERT) || \ - defined(BOOST_NO_CXX11_SMART_PTR) || \ - defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \ - defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Variant 1.82 and will be removed in Boost.Variant 1.84.") - -#endif - #endif // BOOST_VARIANT_DETAIL_CONFIG_HPP diff --git a/include/boost/variant/detail/element_index.hpp b/include/boost/variant/detail/element_index.hpp index 06cf06d7..8b529cb7 100644 --- a/include/boost/variant/detail/element_index.hpp +++ b/include/boost/variant/detail/element_index.hpp @@ -3,7 +3,7 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2014-2023 Antony Polukhin +// Copyright (c) 2014-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/detail/forced_return.hpp b/include/boost/variant/detail/forced_return.hpp index 6d8911b1..75904f84 100644 --- a/include/boost/variant/detail/forced_return.hpp +++ b/include/boost/variant/detail/forced_return.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2003 Eric Friedman -// Copyright (c) 2015-2023 Antony Polukhin +// Copyright (c) 2015-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/detail/has_result_type.hpp b/include/boost/variant/detail/has_result_type.hpp index e1ca5b40..973b36d2 100644 --- a/include/boost/variant/detail/has_result_type.hpp +++ b/include/boost/variant/detail/has_result_type.hpp @@ -3,7 +3,7 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2014-2023 Antony Polukhin +// Copyright (c) 2014-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/detail/hash_variant.hpp b/include/boost/variant/detail/hash_variant.hpp index 4eb83772..469bc81b 100644 --- a/include/boost/variant/detail/hash_variant.hpp +++ b/include/boost/variant/detail/hash_variant.hpp @@ -3,7 +3,7 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2011-2023 Antony Polukhin +// Copyright (c) 2011-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/detail/initializer.hpp b/include/boost/variant/detail/initializer.hpp index 4a54c273..331f375b 100644 --- a/include/boost/variant/detail/initializer.hpp +++ b/include/boost/variant/detail/initializer.hpp @@ -22,7 +22,6 @@ #include #include -#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) # include # include # include @@ -30,12 +29,7 @@ # include # include # include -#else -# include -# include -# include -# include -#endif + namespace boost { namespace detail { namespace variant { @@ -53,8 +47,6 @@ namespace detail { namespace variant { // size of the variant's psuedo-variadic template parameter list. // -#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - // (detail) quoted metafunction make_initializer_node // // Exposes a pair whose first type is a node in the initializer hierarchy. @@ -81,7 +73,6 @@ struct make_initializer_node typedef typename unwrap_recursive::type public_T; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES typedef boost::is_reference is_reference_content_t; @@ -92,10 +83,6 @@ struct make_initializer_node typedef typename boost::mpl::if_, public_T&& >::type param2_T; -#else - typedef typename call_traits::param_type - param_T; -#endif public: // static functions @@ -111,7 +98,6 @@ struct make_initializer_node return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES static int initialize(void* dest, param2_T operand) { // This assert must newer trigger, because all the reference contents are @@ -122,7 +108,6 @@ struct make_initializer_node new(dest) value_T( boost::detail::variant::move(operand) ); return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which } -#endif }; friend class initializer_node; @@ -150,61 +135,6 @@ class initializer_root }; -#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - - // Obsolete. Remove. - #define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_PARAMS \ - BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) \ - /**/ - - // Obsolete. Remove. - #define BOOST_VARIANT_AUX_PP_INITIALIZER_DEFINE_PARAM_T(N) \ - typedef typename unwrap_recursive< \ - BOOST_PP_CAT(recursive_enabled_T,N) \ - >::type BOOST_PP_CAT(public_T,N); \ - typedef typename call_traits< \ - BOOST_PP_CAT(public_T,N) \ - >::param_type BOOST_PP_CAT(param_T,N); \ - /**/ - -template < BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) > -struct preprocessor_list_initializer -{ -public: // static functions - - #define BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION(z,N,_) \ - typedef typename unwrap_recursive< \ - BOOST_PP_CAT(recursive_enabled_T,N) \ - >::type BOOST_PP_CAT(public_T,N); \ - typedef typename call_traits< \ - BOOST_PP_CAT(public_T,N) \ - >::param_type BOOST_PP_CAT(param_T,N); \ - static int initialize( \ - void* dest \ - , BOOST_PP_CAT(param_T,N) operand \ - ) \ - { \ - typedef typename boost::detail::make_reference_content< \ - BOOST_PP_CAT(recursive_enabled_T,N) \ - >::type internal_T; \ - \ - new(dest) internal_T(operand); \ - return (N); /*which*/ \ - } \ - /**/ - - BOOST_PP_REPEAT( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION - , _ - ) - - #undef BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION - -}; - -#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround - }} // namespace detail::variant } // namespace boost @@ -216,8 +146,6 @@ struct preprocessor_list_initializer // most appropriate to the current compiler. // -#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - #define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \ ::boost::mpl::iter_fold< \ mpl_seq \ @@ -231,19 +159,4 @@ struct preprocessor_list_initializer >::type::first \ /**/ -#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - - // Obsolete. Remove. - #define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_ARGS(typename_base) \ - BOOST_VARIANT_ENUM_PARAMS(typename_base) \ - /**/ - -#define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \ - ::boost::detail::variant::preprocessor_list_initializer< \ - BOOST_VARIANT_ENUM_PARAMS(typename_base) \ - > \ - /**/ - -#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround - #endif // BOOST_VARIANT_DETAIL_INITIALIZER_HPP diff --git a/include/boost/variant/detail/make_variant_list.hpp b/include/boost/variant/detail/make_variant_list.hpp index bd786158..eafe1cb7 100644 --- a/include/boost/variant/detail/make_variant_list.hpp +++ b/include/boost/variant/detail/make_variant_list.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 Eric Friedman, Itay Maman -// Copyright (c) 2013-2023 Antony Polukhin +// Copyright (c) 2013-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -19,8 +19,7 @@ #include #include -namespace boost { -namespace detail { namespace variant { +namespace boost { namespace detail { namespace variant { /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction make_variant_list @@ -32,42 +31,12 @@ namespace detail { namespace variant { // declaration workaround (below). // -#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - template < typename... T > struct make_variant_list { typedef typename mpl::list< T... >::type type; }; -#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - -template < BOOST_VARIANT_ENUM_PARAMS(typename T) > -struct make_variant_list -{ -public: // metafunction result - - // [Define a macro to convert any void(NN) tags to mpl::void...] -# define BOOST_VARIANT_AUX_CONVERT_VOID(z, N,_) \ - typename convert_void< BOOST_PP_CAT(T,N) >::type - - // [...so that the specified types can be passed to mpl::list...] - typedef typename mpl::list< - BOOST_PP_ENUM( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_AUX_CONVERT_VOID - , _ - ) - >::type type; - - // [...and, finally, the conversion macro can be undefined:] -# undef BOOST_VARIANT_AUX_CONVERT_VOID - -}; - -#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround - -}} // namespace detail::variant -} // namespace boost +}}} // namespace boost::detail::variant #endif // BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP diff --git a/include/boost/variant/detail/move.hpp b/include/boost/variant/detail/move.hpp index 58661383..9788e133 100644 --- a/include/boost/variant/detail/move.hpp +++ b/include/boost/variant/detail/move.hpp @@ -5,7 +5,7 @@ // // Copyright (c) 2002-2003 Eric Friedman // Copyright (c) 2002 by Andrei Alexandrescu -// Copyright (c) 2013-2023 Antony Polukhin +// Copyright (c) 2013-2024 Antony Polukhin // // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file @@ -22,12 +22,11 @@ #include #include -#include // for boost::move -#include +#include namespace boost { namespace detail { namespace variant { -using boost::move; +using std::move; ////////////////////////////////////////////////////////////////////////// // function template move_swap @@ -39,7 +38,8 @@ using boost::move; template inline void move_swap(T& lhs, T& rhs) { - ::boost::adl_move_swap(lhs, rhs); + using std::swap; + swap(lhs, rhs); } }}} // namespace boost::detail::variant diff --git a/include/boost/variant/detail/std_hash.hpp b/include/boost/variant/detail/std_hash.hpp index 3e05c5c9..7335902e 100644 --- a/include/boost/variant/detail/std_hash.hpp +++ b/include/boost/variant/detail/std_hash.hpp @@ -3,7 +3,7 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2018-2023 Antony Polukhin +// Copyright (c) 2018-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/detail/substitute_fwd.hpp b/include/boost/variant/detail/substitute_fwd.hpp index cc490744..2c5637fb 100644 --- a/include/boost/variant/detail/substitute_fwd.hpp +++ b/include/boost/variant/detail/substitute_fwd.hpp @@ -18,25 +18,12 @@ #include -/////////////////////////////////////////////////////////////////////////////// -// BOOST_VARIANT_DETAIL_NO_SUBSTITUTE -// -// Defined if 'substitute' is not implementable on the current compiler. -// - #include #include -#if defined(BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS) \ - && !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) -# define BOOST_VARIANT_DETAIL_NO_SUBSTITUTE -#endif - namespace boost { namespace detail { namespace variant { -#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) - /////////////////////////////////////////////////////////////////////////////// // metafunction substitute // @@ -50,8 +37,6 @@ template < > struct substitute; -#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) - }} // namespace detail::variant } // namespace boost diff --git a/include/boost/variant/detail/variant_io.hpp b/include/boost/variant/detail/variant_io.hpp index 63df74f2..9e560f4e 100644 --- a/include/boost/variant/detail/variant_io.hpp +++ b/include/boost/variant/detail/variant_io.hpp @@ -16,8 +16,6 @@ #include // for std::basic_ostream forward declare #include - -#include #include namespace boost { @@ -29,14 +27,9 @@ namespace boost { // // forward declare (allows output of embedded variant< variant< ... >, ... >) -template < - BOOST_TEMPLATED_STREAM_ARGS(E,T) - BOOST_TEMPLATED_STREAM_COMMA - BOOST_VARIANT_ENUM_PARAMS(typename U) - > -inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( - BOOST_TEMPLATED_STREAM(ostream, E,T)& out - , const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs +template +inline std::basic_ostream& operator<<( + std::basic_ostream& out, const variant& rhs ); namespace detail { namespace variant { @@ -71,18 +64,13 @@ class printer }} // namespace detail::variant -template < - BOOST_TEMPLATED_STREAM_ARGS(E,T) - BOOST_TEMPLATED_STREAM_COMMA - BOOST_VARIANT_ENUM_PARAMS(typename U) - > -inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( - BOOST_TEMPLATED_STREAM(ostream, E,T)& out - , const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs +template +inline std::basic_ostream& operator<<( + std::basic_ostream& out, const variant& rhs ) { detail::variant::printer< - BOOST_TEMPLATED_STREAM(ostream, E,T) + std::basic_ostream > visitor(out); rhs.apply_visitor(visitor); diff --git a/include/boost/variant/detail/visitation_impl.hpp b/include/boost/variant/detail/visitation_impl.hpp index c3d91b81..13fa9214 100644 --- a/include/boost/variant/detail/visitation_impl.hpp +++ b/include/boost/variant/detail/visitation_impl.hpp @@ -18,7 +18,7 @@ #include #include #include -#include // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include #include #include @@ -47,22 +47,10 @@ // #if !defined(BOOST_VARIANT_VISITATION_UNROLLING_LIMIT) -#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES # include # define BOOST_VARIANT_VISITATION_UNROLLING_LIMIT \ BOOST_MPL_LIMIT_LIST_SIZE -#else -# define BOOST_VARIANT_VISITATION_UNROLLING_LIMIT \ - BOOST_VARIANT_LIMIT_TYPES -#endif - -#endif -// Define a compiler generic null pointer value -#if defined(BOOST_NO_CXX11_NULLPTR) -#define BOOST_VARIANT_NULL 0 -#else -#define BOOST_VARIANT_NULL nullptr #endif namespace boost { @@ -184,7 +172,7 @@ inline typename Visitor::result_type visitation_impl( int, int, Visitor&, VPCV , mpl::true_ // is_apply_visitor_unrolled - , NBF, W* = BOOST_VARIANT_NULL, S* = BOOST_VARIANT_NULL + , NBF, W* = nullptr, S* = nullptr ) { // should never be here at runtime! @@ -203,7 +191,7 @@ visitation_impl( , Visitor& visitor, VoidPtrCV storage , mpl::false_ // is_apply_visitor_unrolled , NoBackupFlag no_backup_flag - , Which* = BOOST_VARIANT_NULL, step0* = BOOST_VARIANT_NULL + , Which* = nullptr, step0* = nullptr ) { // Typedef apply_visitor_unrolled steps and associated types... diff --git a/include/boost/variant/get.hpp b/include/boost/variant/get.hpp index 62fca60c..085c6f23 100644 --- a/include/boost/variant/get.hpp +++ b/include/boost/variant/get.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2003 Eric Friedman, Itay Maman -// Copyright (c) 2014-2023 Antony Polukhin +// Copyright (c) 2014-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/variant/recursive_wrapper_fwd.hpp b/include/boost/variant/recursive_wrapper_fwd.hpp index b5d7e719..b8b59ee6 100644 --- a/include/boost/variant/recursive_wrapper_fwd.hpp +++ b/include/boost/variant/recursive_wrapper_fwd.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002 Eric Friedman, Itay Maman -// Copyright (c) 2016-2023 Antony Polukhin +// Copyright (c) 2016-2024 Antony Polukhin // // Portions Copyright (C) 2002 David Abrahams // diff --git a/include/boost/variant/variant.hpp b/include/boost/variant/variant.hpp index 9a79264a..f28a0120 100644 --- a/include/boost/variant/variant.hpp +++ b/include/boost/variant/variant.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 Eric Friedman, Itay Maman -// Copyright (c) 2012-2023 Antony Polukhin +// Copyright (c) 2012-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -40,8 +40,6 @@ #include #include #include -#include -#include #include #include #include @@ -221,7 +219,6 @@ struct find_fallback_type }; -#ifndef BOOST_NO_CXX11_NOEXCEPT /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction is_variant_move_noexcept_constructible // @@ -255,7 +252,6 @@ struct is_variant_move_noexcept_assignable { iterator_t, end_t >::type type; }; -#endif // BOOST_NO_CXX11_NOEXCEPT /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction is_variant_constructible_from @@ -308,8 +304,6 @@ struct is_variant_constructible_from< boost::variant, Types > {}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template struct is_variant_constructible_from< boost::variant&& , Types >: is_variant_constructible_from, Types > @@ -320,8 +314,6 @@ struct is_variant_constructible_from< boost::variant, Types > {}; -#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCE - /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction make_storage @@ -466,7 +458,6 @@ class copy_into // // Internal visitor that moves the value it visits into the given buffer. // -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES class move_into : public static_visitor<> { @@ -495,7 +486,6 @@ class move_into new(storage_) T(::boost::detail::variant::move(operand)); } }; -#endif /////////////////////////////////////////////////////////////////////////////// // (detail) class assign_storage @@ -1012,13 +1002,11 @@ class invoke_visitor public: // internal visitor interfaces -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template typename enable_if_c::value, result_type>::type internal_visit(T&& operand, int) { - return visitor_(::boost::move(operand)); + return visitor_(std::move(operand)); } //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work @@ -1028,24 +1016,6 @@ class invoke_visitor return visitor_(operand); } -#else - - template - result_type internal_visit(T& operand, int) - { - return visitor_(operand); - } - -# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564)) - template - result_type internal_visit(const T& operand, int) - { - return visitor_(operand); - } -# endif //BORLAND - -#endif //RVALUE REFERENCES - public: // internal visitor interfaces, cont. template @@ -1124,8 +1094,6 @@ class variant { }; -#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) - private: // helpers, for typedefs (below) typedef typename mpl::eval_if< @@ -1169,82 +1137,6 @@ class variant internal_types >::type internal_T0; -#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) - -private: // helpers, for typedefs (below) - - typedef unwrapped_T0_ T0; - - #define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \ - typedef typename mpl::eval_if< \ - is_recursive_ \ - , detail::variant::enable_recursive< \ - BOOST_PP_CAT(T,N) \ - , wknd_self_t \ - > \ - , mpl::identity< BOOST_PP_CAT(T,N) > \ - >::type BOOST_PP_CAT(recursive_enabled_T,N); \ - /**/ - - BOOST_PP_REPEAT( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS - , _ - ) - - #undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS - - #define BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS(z,N,_) \ - typedef typename unwrap_recursive< \ - BOOST_PP_CAT(recursive_enabled_T,N) \ - >::type BOOST_PP_CAT(public_T,N); \ - /**/ - - BOOST_PP_REPEAT( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS - , _ - ) - - #undef BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS - -public: // public typedefs - - typedef typename detail::variant::make_variant_list< - BOOST_VARIANT_ENUM_PARAMS(public_T) - >::type types; - -private: // helpers, for internal typedefs (below) - - #define BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS(z,N,_) \ - typedef detail::make_reference_content< \ - BOOST_PP_CAT(recursive_enabled_T,N) \ - >::type BOOST_PP_CAT(internal_T,N); \ - /**/ - - BOOST_PP_REPEAT( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS - , _ - ) - - #undef BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS - -private: // internal typedefs - - typedef typename detail::variant::make_variant_list< - BOOST_VARIANT_ENUM_PARAMS(internal_T) - >::type internal_types; - -private: // static precondition assertions - - // NOTE TO USER : - // variant< type-sequence > syntax is not supported on this compiler! - // - BOOST_MPL_ASSERT_NOT(( is_sequence_based_ )); - -#endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround - private: // helpers, for representation (below) typedef typename detail::variant::find_fallback_type< @@ -1270,7 +1162,6 @@ class variant internal_types, never_uses_backup_flag >::type storage_t; -#ifndef BOOST_NO_CXX11_NOEXCEPT typedef typename detail::variant::is_variant_move_noexcept_constructible< internal_types > variant_move_noexcept_constructible; @@ -1279,8 +1170,6 @@ class variant internal_types > variant_move_noexcept_assignable; -#endif - private: // helpers, for representation (below) // which_ on: @@ -1471,7 +1360,6 @@ class variant friend class convert_copy_into; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES class convert_move_into : public static_visitor { @@ -1537,7 +1425,6 @@ class variant }; friend class convert_move_into; -#endif private: // helpers, for structors, below @@ -1561,7 +1448,6 @@ class variant ); } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template typename boost::enable_if >::type convert_construct( T&& operand @@ -1581,7 +1467,6 @@ class variant ) ); } -#endif template void convert_construct( @@ -1596,7 +1481,6 @@ class variant ); } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template typename boost::enable_if >::type convert_construct( Variant&& operand @@ -1609,7 +1493,6 @@ class variant operand.internal_apply_visitor(visitor) ); } -#endif template void convert_construct_variant(Variant& operand) @@ -1638,7 +1521,6 @@ class variant ); } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template typename boost::enable_if >::type convert_construct_variant(Variant&& operand) { @@ -1665,7 +1547,6 @@ class variant , is_foreign_variant() ); } -#endif template typename boost::enable_if typename boost::enable_if, variant>, @@ -1703,7 +1583,6 @@ class variant { convert_construct_variant( detail::variant::move(operand) ); } -#endif public: // structors, cont. @@ -1736,7 +1615,6 @@ class variant convert_construct(operand, 1L); } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template variant(T&& operand, typename boost::enable_if friend class detail::variant::backup_assigner; -# endif // class assigner // @@ -1933,7 +1806,6 @@ class variant friend class assigner; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES // class move_assigner // // Internal visitor that "move assigns" the visited value to the given variant @@ -2051,7 +1923,6 @@ class variant }; friend class move_assigner; -#endif // BOOST_NO_CXX11_RVALUE_REFERENCES void variant_assign(const variant& rhs) { @@ -2070,7 +1941,6 @@ class variant } } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES void variant_assign(variant&& rhs) { // If the contained types are EXACTLY the same... @@ -2087,7 +1957,6 @@ class variant rhs.internal_apply_visitor(visitor); } } -#endif // BOOST_NO_CXX11_RVALUE_REFERENCES private: // helpers, for modifiers (below) @@ -2109,7 +1978,6 @@ class variant } } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template void move_assign(T&& rhs) { @@ -2127,12 +1995,10 @@ class variant variant_assign( detail::variant::move(temp) ); } } -#endif // BOOST_NO_CXX11_RVALUE_REFERENCES public: // modifiers -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - (!BOOST_WORKAROUND(BOOST_CLANG_VERSION, BOOST_TESTED_AT(150000)) || BOOST_CXX_VERSION <= 202002L) +#if !BOOST_WORKAROUND(BOOST_CLANG_VERSION, BOOST_TESTED_AT(150000)) || BOOST_CXX_VERSION <= 202002L template typename boost::enable_if< boost::mpl::and_< @@ -2146,7 +2012,7 @@ class variant move_assign( detail::variant::move(rhs) ); return *this; } -#endif // BOOST_NO_CXX11_RVALUE_REFERENCES +#endif template typename boost::enable_if< @@ -2168,7 +2034,6 @@ class variant return *this; } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES variant& operator=(variant&& rhs) #if !defined(__GNUC__) || (__GNUC__ != 4) || (__GNUC_MINOR__ > 6) || defined(__clang__) BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value && variant_move_noexcept_assignable::type::value) @@ -2177,7 +2042,6 @@ class variant variant_assign( detail::variant::move(rhs) ); return *this; } -#endif // BOOST_NO_CXX11_RVALUE_REFERENCES void swap(variant& rhs) { @@ -2363,8 +2227,6 @@ class variant public: // visitation support -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - template typename Visitor::result_type apply_visitor(Visitor& visitor) && @@ -2381,14 +2243,9 @@ class variant return this->internal_apply_visitor(invoker); } -#endif - template typename Visitor::result_type - apply_visitor(Visitor& visitor) -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - & -#endif + apply_visitor(Visitor& visitor) & { detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); @@ -2396,10 +2253,7 @@ class variant template typename Visitor::result_type - apply_visitor(Visitor& visitor) const -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - & -#endif + apply_visitor(Visitor& visitor) const & { detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); diff --git a/include/boost/variant/variant_fwd.hpp b/include/boost/variant/variant_fwd.hpp index 613bcb67..c5f80024 100644 --- a/include/boost/variant/variant_fwd.hpp +++ b/include/boost/variant/variant_fwd.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2003 Eric Friedman, Itay Maman -// Copyright (c) 2013-2023 Antony Polukhin +// Copyright (c) 2013-2024 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -25,15 +25,6 @@ #include #include -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT -// -// Defined if variant does not support make_variant_over (see below). -// -#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) -# define BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT -#endif - /////////////////////////////////////////////////////////////////////////////// // macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT // @@ -45,37 +36,6 @@ #include -#if defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) \ - && !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT) -# define BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -// - -/* - GCC before 4.0 had no variadic tempaltes; - GCC 4.6 has incomplete implementation of variadic templates. - - MSVC2015 Update 1 has variadic templates, but they have issues. - - NOTE: Clang compiler defines __GNUC__ -*/ -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \ - || (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)) \ - || (defined(_MSC_VER) && (_MSC_VER <= 1900)) \ - || defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) \ - || defined (BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) - -#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -# define BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -#endif - -#endif - -#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) #include #define BOOST_VARIANT_CLASS_OR_TYPENAME_TO_SEQ_class class)( @@ -108,9 +68,6 @@ // Rationale: Cleaner, simpler code for clients of variant library. Minimal // code modifications to move from C++03 to C++11. // -// With BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES defined -// will be used BOOST_VARIANT_ENUM_PARAMS and BOOST_VARIANT_ENUM_SHIFTED_PARAMS from below `#else` -// #define BOOST_VARIANT_ENUM_PARAMS(x) \ x ## 0, \ @@ -121,49 +78,6 @@ BOOST_VARIANT_MAKE_VARIADIC( (BOOST_VARIANT_CLASS_OR_TYPENAME_TO_SEQ_ ## x), x) \ /**/ -#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_LIMIT_TYPES -// -// Implementation-defined preprocessor symbol describing the actual -// length of variant's pseudo-variadic template parameter list. -// -#include -#define BOOST_VARIANT_LIMIT_TYPES \ - BOOST_MPL_LIMIT_LIST_SIZE - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY -// -// Exposes maximum allowed arity of class templates with recursive_variant -// arguments. That is, -// make_recursive_variant< ..., T<[1], recursive_variant_, ... [N]> >. -// -#include -#define BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY \ - BOOST_MPL_LIMIT_METAFUNCTION_ARITY - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_ENUM_PARAMS -// -// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES params. -// -// Rationale: Cleaner, simpler code for clients of variant library. -// -#define BOOST_VARIANT_ENUM_PARAMS( param ) \ - BOOST_PP_ENUM_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param) - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_ENUM_SHIFTED_PARAMS -// -// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES-1 params. -// -#define BOOST_VARIANT_ENUM_SHIFTED_PARAMS( param ) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param) - -#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround - namespace boost { @@ -195,75 +109,9 @@ struct convert_void< void_ > typedef mpl::na type; }; -/////////////////////////////////////////////////////////////////////////////// -// (workaround) BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE -// -// Needed to work around compilers that don't support using-declaration -// overloads. (See the variant::initializer workarounds below.) -// - -#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) -// (detail) tags voidNN -- NN defined on [0, BOOST_VARIANT_LIMIT_TYPES) -// -// Defines void types that are each unique and specializations of -// convert_void that yields mpl::na for each voidNN type. -// - -#define BOOST_VARIANT_DETAIL_DEFINE_VOID_N(z,N,_) \ - struct BOOST_PP_CAT(void,N); \ - \ - template <> \ - struct convert_void< BOOST_PP_CAT(void,N) > \ - { \ - typedef mpl::na type; \ - }; \ - /**/ - -BOOST_PP_REPEAT( - BOOST_VARIANT_LIMIT_TYPES - , BOOST_VARIANT_DETAIL_DEFINE_VOID_N - , _ - ) - -#undef BOOST_VARIANT_DETAIL_DEFINE_VOID_N - -#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround - }} // namespace detail::variant -#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) -# define BOOST_VARIANT_AUX_DECLARE_PARAMS BOOST_VARIANT_ENUM_PARAMS(typename T) -#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) - -/////////////////////////////////////////////////////////////////////////////// -// (detail) macro BOOST_VARIANT_AUX_DECLARE_PARAM -// -// Template parameter list for variant and recursive_variant declarations. -// - -#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - -# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \ - typename BOOST_PP_CAT(T,N) = detail::variant::void_ \ - /**/ - -#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) - -# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \ - typename BOOST_PP_CAT(T,N) = BOOST_PP_CAT(detail::variant::void,N) \ - /**/ - -#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround - -#define BOOST_VARIANT_AUX_DECLARE_PARAMS \ - BOOST_PP_ENUM( \ - BOOST_VARIANT_LIMIT_TYPES \ - , BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL \ - , T \ - ) \ - /**/ - -#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround +#define BOOST_VARIANT_AUX_DECLARE_PARAMS BOOST_VARIANT_ENUM_PARAMS(typename T) /////////////////////////////////////////////////////////////////////////////// // class template variant (concept inspired by Andrei Alexandrescu) diff --git a/include/boost/version.hpp b/include/boost/version.hpp index c3960095..a74f1874 100644 --- a/include/boost/version.hpp +++ b/include/boost/version.hpp @@ -19,7 +19,7 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 108300 +#define BOOST_VERSION 108700 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION @@ -27,6 +27,6 @@ // number, y is the minor version number, and z is the patch level if not 0. // This is used by to select which library version to link to. -#define BOOST_LIB_VERSION "1_83" +#define BOOST_LIB_VERSION "1_87" #endif diff --git a/package-lock.json b/package-lock.json index 6db47cbd..a0d4b5f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,18 +10,18 @@ "license": "Apache-2.0", "dependencies": { "bindings": "^1.5.0", - "nan": "^2.18.0" + "nan": "^2.22.0" }, "devDependencies": { - "@commitlint/cli": "^17.7.1", - "@commitlint/config-conventional": "^17.7.0", + "@commitlint/cli": "^19.6.1", + "@commitlint/config-conventional": "^19.6.0", "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^10.0.4", + "@semantic-release/commit-analyzer": "^13.0.1", "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^11.0.7", + "@semantic-release/release-notes-generator": "^14.0.3", "cz-conventional-changelog": "^3.3.0", - "eslint": "^8.49.0", - "node-gyp": "^9.4.0", + "eslint": "^9.17.0", + "node-gyp": "^11.0.0", "semantic-release-config-kuzzle": "^1.0.0", "semantic-release-slack-bot": "^4.0.2" }, @@ -229,61 +229,63 @@ } }, "node_modules/@commitlint/cli": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.7.1.tgz", - "integrity": "sha512-BCm/AT06SNCQtvFv921iNhudOHuY16LswT0R3OeolVGLk8oP+Rk9TfQfgjH7QPMjhvp76bNqGFEcpKojxUNW1g==", + "version": "19.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.6.1.tgz", + "integrity": "sha512-8hcyA6ZoHwWXC76BoC8qVOSr8xHy00LZhZpauiD0iO0VYbVhMnED0da85lTfIULxl7Lj4c6vZgF0Wu/ed1+jlQ==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/format": "^17.4.4", - "@commitlint/lint": "^17.7.0", - "@commitlint/load": "^17.7.1", - "@commitlint/read": "^17.5.1", - "@commitlint/types": "^17.4.4", - "execa": "^5.0.0", - "lodash.isfunction": "^3.0.9", - "resolve-from": "5.0.0", - "resolve-global": "1.0.0", + "@commitlint/format": "^19.5.0", + "@commitlint/lint": "^19.6.0", + "@commitlint/load": "^19.6.1", + "@commitlint/read": "^19.5.0", + "@commitlint/types": "^19.5.0", + "tinyexec": "^0.3.0", "yargs": "^17.0.0" }, "bin": { "commitlint": "cli.js" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/config-conventional": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-17.7.0.tgz", - "integrity": "sha512-iicqh2o6et+9kWaqsQiEYZzfLbtoWv9uZl8kbI8EGfnc0HeGafQBF7AJ0ylN9D/2kj6txltsdyQs8+2fTMwWEw==", + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.6.0.tgz", + "integrity": "sha512-DJT40iMnTYtBtUfw9ApbsLZFke1zKh6llITVJ+x9mtpHD08gsNXaIRqHTmwTZL3dNX5+WoyK7pCN/5zswvkBCQ==", "dev": true, + "license": "MIT", "dependencies": { - "conventional-changelog-conventionalcommits": "^6.1.0" + "@commitlint/types": "^19.5.0", + "conventional-changelog-conventionalcommits": "^7.0.2" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/config-validator": { - "version": "17.6.7", - "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-17.6.7.tgz", - "integrity": "sha512-vJSncmnzwMvpr3lIcm0I8YVVDJTzyjy7NZAeXbTXy+MPUdAr9pKyyg7Tx/ebOQ9kqzE6O9WT6jg2164br5UdsQ==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.5.0.tgz", + "integrity": "sha512-CHtj92H5rdhKt17RmgALhfQt95VayrUo2tSqY9g2w+laAXyk7K/Ef6uPm9tn5qSIwSmrLjKaXK9eiNuxmQrDBw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^17.4.4", + "@commitlint/types": "^19.5.0", "ajv": "^8.11.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/ensure": { - "version": "17.6.7", - "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-17.6.7.tgz", - "integrity": "sha512-mfDJOd1/O/eIb/h4qwXzUxkmskXDL9vNPnZ4AKYKiZALz4vHzwMxBSYtyL2mUIDeU9DRSpEUins8SeKtFkYHSw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-19.5.0.tgz", + "integrity": "sha512-Kv0pYZeMrdg48bHFEU5KKcccRfKmISSm9MvgIgkpI6m+ohFTB55qZlBW6eYqh/XDfRuIO0x4zSmvBjmOwWTwkg==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^17.4.4", + "@commitlint/types": "^19.5.0", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", "lodash.snakecase": "^4.1.1", @@ -291,199 +293,369 @@ "lodash.upperfirst": "^4.3.1" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/execute-rule": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-17.4.0.tgz", - "integrity": "sha512-LIgYXuCSO5Gvtc0t9bebAMSwd68ewzmqLypqI2Kke1rqOqqDbMpYcYfoPfFlv9eyLIh4jocHWwCK5FS7z9icUA==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.5.0.tgz", + "integrity": "sha512-aqyGgytXhl2ejlk+/rfgtwpPexYyri4t8/n4ku6rRJoRhGZpLFMqrZ+YaubeGysCP6oz4mMA34YSTaSOKEeNrg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/format": { - "version": "17.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-17.4.4.tgz", - "integrity": "sha512-+IS7vpC4Gd/x+uyQPTAt3hXs5NxnkqAZ3aqrHd5Bx/R9skyCAWusNlNbw3InDbAK6j166D9asQM8fnmYIa+CXQ==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.5.0.tgz", + "integrity": "sha512-yNy088miE52stCI3dhG/vvxFo9e4jFkU1Mj3xECfzp/bIS/JUay4491huAlVcffOoMK1cd296q0W92NlER6r3A==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^17.4.4", - "chalk": "^4.1.0" + "@commitlint/types": "^19.5.0", + "chalk": "^5.3.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" + } + }, + "node_modules/@commitlint/format/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/@commitlint/is-ignored": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-17.7.0.tgz", - "integrity": "sha512-043rA7m45tyEfW7Zv2vZHF++176MLHH9h70fnPoYlB1slKBeKl8BwNIlnPg4xBdRBVNPaCqvXxWswx2GR4c9Hw==", + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.6.0.tgz", + "integrity": "sha512-Ov6iBgxJQFR9koOupDPHvcHU9keFupDgtB3lObdEZDroiG4jj1rzky60fbQozFKVYRTUdrBGICHG0YVmRuAJmw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^17.4.4", - "semver": "7.5.4" + "@commitlint/types": "^19.5.0", + "semver": "^7.6.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/lint": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.7.0.tgz", - "integrity": "sha512-TCQihm7/uszA5z1Ux1vw+Nf3yHTgicus/+9HiUQk+kRSQawByxZNESeQoX9ujfVd3r4Sa+3fn0JQAguG4xvvbA==", + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.6.0.tgz", + "integrity": "sha512-LRo7zDkXtcIrpco9RnfhOKeg8PAnE3oDDoalnrVU/EVaKHYBWYL1DlRR7+3AWn0JiBqD8yKOfetVxJGdEtZ0tg==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/is-ignored": "^17.7.0", - "@commitlint/parse": "^17.7.0", - "@commitlint/rules": "^17.7.0", - "@commitlint/types": "^17.4.4" + "@commitlint/is-ignored": "^19.6.0", + "@commitlint/parse": "^19.5.0", + "@commitlint/rules": "^19.6.0", + "@commitlint/types": "^19.5.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/load": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-17.7.1.tgz", - "integrity": "sha512-S/QSOjE1ztdogYj61p6n3UbkUvweR17FQ0zDbNtoTLc+Hz7vvfS7ehoTMQ27hPSjVBpp7SzEcOQu081RLjKHJQ==", + "version": "19.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.6.1.tgz", + "integrity": "sha512-kE4mRKWWNju2QpsCWt428XBvUH55OET2N4QKQ0bF85qS/XbsRGG1MiTByDNlEVpEPceMkDr46LNH95DtRwcsfA==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/config-validator": "^17.6.7", - "@commitlint/execute-rule": "^17.4.0", - "@commitlint/resolve-extends": "^17.6.7", - "@commitlint/types": "^17.4.4", - "@types/node": "20.4.7", - "chalk": "^4.1.0", - "cosmiconfig": "^8.0.0", - "cosmiconfig-typescript-loader": "^4.0.0", + "@commitlint/config-validator": "^19.5.0", + "@commitlint/execute-rule": "^19.5.0", + "@commitlint/resolve-extends": "^19.5.0", + "@commitlint/types": "^19.5.0", + "chalk": "^5.3.0", + "cosmiconfig": "^9.0.0", + "cosmiconfig-typescript-loader": "^6.1.0", "lodash.isplainobject": "^4.0.6", "lodash.merge": "^4.6.2", - "lodash.uniq": "^4.5.0", - "resolve-from": "^5.0.0", - "ts-node": "^10.8.1", - "typescript": "^4.6.4 || ^5.0.0" + "lodash.uniq": "^4.5.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/load/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@commitlint/load/node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-6.1.0.tgz", + "integrity": "sha512-tJ1w35ZRUiM5FeTzT7DtYWAFFv37ZLqSRkGi2oeCK1gPhvaWjkAtfXvLmvE1pRfxxp9aQo6ba/Pvg1dKj05D4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "jiti": "^2.4.1" }, "engines": { - "node": ">=v14" + "node": ">=v18" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=9", + "typescript": ">=5" } }, "node_modules/@commitlint/message": { - "version": "17.4.2", - "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-17.4.2.tgz", - "integrity": "sha512-3XMNbzB+3bhKA1hSAWPCQA3lNxR4zaeQAQcHj0Hx5sVdO6ryXtgUBGGv+1ZCLMgAPRixuc6en+iNAzZ4NzAa8Q==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.5.0.tgz", + "integrity": "sha512-R7AM4YnbxN1Joj1tMfCyBryOC5aNJBdxadTZkuqtWi3Xj0kMdutq16XQwuoGbIzL2Pk62TALV1fZDCv36+JhTQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/parse": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.7.0.tgz", - "integrity": "sha512-dIvFNUMCUHqq5Abv80mIEjLVfw8QNuA4DS7OWip4pcK/3h5wggmjVnlwGCDvDChkw2TjK1K6O+tAEV78oxjxag==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.5.0.tgz", + "integrity": "sha512-cZ/IxfAlfWYhAQV0TwcbdR1Oc0/r0Ik1GEessDJ3Lbuma/MRO8FRQX76eurcXtmhJC//rj52ZSZuXUg0oIX0Fw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^17.4.4", - "conventional-changelog-angular": "^6.0.0", - "conventional-commits-parser": "^4.0.0" + "@commitlint/types": "^19.5.0", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-parser": "^5.0.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/read": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-17.5.1.tgz", - "integrity": "sha512-7IhfvEvB//p9aYW09YVclHbdf1u7g7QhxeYW9ZHSO8Huzp8Rz7m05aCO1mFG7G8M+7yfFnXB5xOmG18brqQIBg==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.5.0.tgz", + "integrity": "sha512-TjS3HLPsLsxFPQj6jou8/CZFAmOP2y+6V4PGYt3ihbQKTY1Jnv0QG28WRKl/d1ha6zLODPZqsxLEov52dhR9BQ==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/top-level": "^17.4.0", - "@commitlint/types": "^17.4.4", - "fs-extra": "^11.0.0", - "git-raw-commits": "^2.0.11", - "minimist": "^1.2.6" + "@commitlint/top-level": "^19.5.0", + "@commitlint/types": "^19.5.0", + "git-raw-commits": "^4.0.0", + "minimist": "^1.2.8", + "tinyexec": "^0.3.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/resolve-extends": { - "version": "17.6.7", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-17.6.7.tgz", - "integrity": "sha512-PfeoAwLHtbOaC9bGn/FADN156CqkFz6ZKiVDMjuC2N5N0740Ke56rKU7Wxdwya8R8xzLK9vZzHgNbuGhaOVKIg==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.5.0.tgz", + "integrity": "sha512-CU/GscZhCUsJwcKTJS9Ndh3AKGZTNFIOoQB2n8CmFnizE0VnEuJoum+COW+C1lNABEeqk6ssfc1Kkalm4bDklA==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/config-validator": "^17.6.7", - "@commitlint/types": "^17.4.4", - "import-fresh": "^3.0.0", + "@commitlint/config-validator": "^19.5.0", + "@commitlint/types": "^19.5.0", + "global-directory": "^4.0.1", + "import-meta-resolve": "^4.0.0", "lodash.mergewith": "^4.6.2", - "resolve-from": "^5.0.0", - "resolve-global": "^1.0.0" + "resolve-from": "^5.0.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/rules": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-17.7.0.tgz", - "integrity": "sha512-J3qTh0+ilUE5folSaoK91ByOb8XeQjiGcdIdiB/8UT1/Rd1itKo0ju/eQVGyFzgTMYt8HrDJnGTmNWwcMR1rmA==", + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.6.0.tgz", + "integrity": "sha512-1f2reW7lbrI0X0ozZMesS/WZxgPa4/wi56vFuJENBmed6mWq5KsheN/nxqnl/C23ioxpPO/PL6tXpiiFy5Bhjw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/ensure": "^17.6.7", - "@commitlint/message": "^17.4.2", - "@commitlint/to-lines": "^17.4.0", - "@commitlint/types": "^17.4.4", - "execa": "^5.0.0" + "@commitlint/ensure": "^19.5.0", + "@commitlint/message": "^19.5.0", + "@commitlint/to-lines": "^19.5.0", + "@commitlint/types": "^19.5.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/to-lines": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-17.4.0.tgz", - "integrity": "sha512-LcIy/6ZZolsfwDUWfN1mJ+co09soSuNASfKEU5sCmgFCvX5iHwRYLiIuoqXzOVDYOy7E7IcHilr/KS0e5T+0Hg==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.5.0.tgz", + "integrity": "sha512-R772oj3NHPkodOSRZ9bBVNq224DOxQtNef5Pl8l2M8ZnkkzQfeSTr4uxawV2Sd3ui05dUVzvLNnzenDBO1KBeQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=v14" + "node": ">=v18" } }, "node_modules/@commitlint/top-level": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-17.4.0.tgz", - "integrity": "sha512-/1loE/g+dTTQgHnjoCy0AexKAEFyHsR2zRB4NWrZ6lZSMIxAhBJnmCqwao7b4H8888PsfoTBCLBYIw8vGnej8g==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.5.0.tgz", + "integrity": "sha512-IP1YLmGAk0yWrImPRRc578I3dDUI5A2UBJx9FbSOjxe9sTlzFiwVJ+zeMLgAtHMtGZsC8LUnzmW1qRemkFU4ng==", "dev": true, + "license": "MIT", "dependencies": { - "find-up": "^5.0.0" + "find-up": "^7.0.0" }, "engines": { - "node": ">=v14" + "node": ">=v18" } }, - "node_modules/@commitlint/types": { - "version": "17.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-17.4.4.tgz", - "integrity": "sha512-amRN8tRLYOsxRr6mTnGGGvB5EmW/4DDjLMgiwK3CCVEmN6Sr/6xePGEpWaspKkckILuUORCwe6VfDBw6uj4axQ==", + "node_modules/@commitlint/top-level/node_modules/find-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^4.1.0" + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": ">=v14" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "node_modules/@commitlint/top-level/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" + "p-locate": "^6.0.0" }, "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@commitlint/top-level/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@commitlint/top-level/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@commitlint/top-level/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/@commitlint/top-level/node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@commitlint/types": { + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.5.0.tgz", + "integrity": "sha512-DSHae2obMSMkAtTBSOulg5X7/z+rGLxcXQIkg3OmWvY6wifojge5uVMydfhUvs7yQj+V7jNmRZ2Xzl8GJyqRgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/conventional-commits-parser": "^5.0.0", + "chalk": "^5.3.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/types/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/@eslint-community/eslint-utils": { @@ -502,24 +674,54 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.1.tgz", - "integrity": "sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", + "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.5", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", + "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -527,7 +729,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -538,6 +740,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -553,29 +756,78 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@eslint/js": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", - "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", + "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", "dev": true, + "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", + "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", + "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.11", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", - "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" }, "engines": { - "node": ">=10.10.0" + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, "node_modules/@humanwhocodes/module-importer": { @@ -591,17 +843,26 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -615,10 +876,11 @@ } }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -631,6 +893,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -642,13 +905,15 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -666,6 +931,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -681,6 +947,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -693,29 +960,17 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", "dev": true, + "license": "ISC", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" } }, "node_modules/@nodelib/fs.scandir": { @@ -723,6 +978,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, + "peer": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -736,6 +992,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, + "peer": true, "engines": { "node": ">= 8" } @@ -745,6 +1002,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, + "peer": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -753,16 +1011,34 @@ "node": ">= 8" } }, - "node_modules/@npmcli/fs": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", - "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", + "node_modules/@npmcli/agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", + "integrity": "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q==", "dev": true, + "license": "ISC", "dependencies": { - "semver": "^7.3.5" - }, + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/fs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-4.0.0.tgz", + "integrity": "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/@octokit/auth-token": { @@ -929,6 +1205,7 @@ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "dev": true, + "license": "MIT", "optional": true, "engines": { "node": ">=14" @@ -998,87 +1275,55 @@ } }, "node_modules/@semantic-release/commit-analyzer": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-10.0.4.tgz", - "integrity": "sha512-pFGn99fn8w4/MHE0otb2A/l5kxgOuxaaauIh4u30ncoTJuqWj4hXTgEJ03REqjS+w1R2vPftSsO26WC61yOcpw==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-13.0.1.tgz", + "integrity": "sha512-wdnBPHKkr9HhNhXOhZD5a2LNl91+hs8CC2vsAVYxtZH3y0dV3wKn+uZSN61rdJQZ8EGxzWB3inWocBHV9+u/CQ==", "dev": true, + "license": "MIT", "dependencies": { - "conventional-changelog-angular": "^6.0.0", - "conventional-commits-filter": "^3.0.0", - "conventional-commits-parser": "^5.0.0", + "conventional-changelog-angular": "^8.0.0", + "conventional-changelog-writer": "^8.0.0", + "conventional-commits-filter": "^5.0.0", + "conventional-commits-parser": "^6.0.0", "debug": "^4.0.0", - "import-from": "^4.0.0", + "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.2" }, "engines": { - "node": ">=18" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, - "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-commits-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", - "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-changelog-angular": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.0.0.tgz", + "integrity": "sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==", "dev": true, + "license": "ISC", "dependencies": { - "is-text-path": "^2.0.0", - "JSONStream": "^1.3.5", - "meow": "^12.0.1", - "split2": "^4.0.0" - }, - "bin": { - "conventional-commits-parser": "cli.mjs" + "compare-func": "^2.0.0" }, "engines": { - "node": ">=16" + "node": ">=18" } }, - "node_modules/@semantic-release/commit-analyzer/node_modules/is-text-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", - "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-commits-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.0.0.tgz", + "integrity": "sha512-TbsINLp48XeMXR8EvGjTnKGsZqBemisPoyWESlpRyR8lif0lcwzqz+NMtYSj1ooF/WYjSuu7wX0CtdeeMEQAmA==", "dev": true, + "license": "MIT", "dependencies": { - "text-extensions": "^2.0.0" + "meow": "^13.0.0" }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/commit-analyzer/node_modules/meow": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", - "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", - "dev": true, - "engines": { - "node": ">=16.10" + "bin": { + "conventional-commits-parser": "dist/cli/index.js" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/commit-analyzer/node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "dev": true, - "engines": { - "node": ">= 10.x" - } - }, - "node_modules/@semantic-release/commit-analyzer/node_modules/text-extensions": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", - "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", - "dev": true, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=18" } }, "node_modules/@semantic-release/error": { @@ -1454,133 +1699,82 @@ } }, "node_modules/@semantic-release/release-notes-generator": { - "version": "11.0.7", - "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-11.0.7.tgz", - "integrity": "sha512-T09QB9ImmNx7Q6hY6YnnEbw/rEJ6a+22LBxfZq+pSAXg/OL/k0siwEm5cK4k1f9dE2Z2mPIjJKKohzUm0jbxcQ==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-14.0.3.tgz", + "integrity": "sha512-XxAZRPWGwO5JwJtS83bRdoIhCiYIx8Vhr+u231pQAsdFIAbm19rSVJLdnBN+Avvk7CKvNQE/nJ4y7uqKH6WTiw==", "dev": true, + "license": "MIT", "dependencies": { - "conventional-changelog-angular": "^6.0.0", - "conventional-changelog-writer": "^6.0.0", - "conventional-commits-filter": "^4.0.0", - "conventional-commits-parser": "^5.0.0", + "conventional-changelog-angular": "^8.0.0", + "conventional-changelog-writer": "^8.0.0", + "conventional-commits-filter": "^5.0.0", + "conventional-commits-parser": "^6.0.0", "debug": "^4.0.0", "get-stream": "^7.0.0", - "import-from": "^4.0.0", + "import-from-esm": "^2.0.0", "into-stream": "^7.0.0", "lodash-es": "^4.17.21", - "read-pkg-up": "^10.0.0" + "read-package-up": "^11.0.0" }, "engines": { - "node": ">=18" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, - "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-filter": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-4.0.0.tgz", - "integrity": "sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==", + "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-changelog-angular": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.0.0.tgz", + "integrity": "sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==", "dev": true, + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", - "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.0.0.tgz", + "integrity": "sha512-TbsINLp48XeMXR8EvGjTnKGsZqBemisPoyWESlpRyR8lif0lcwzqz+NMtYSj1ooF/WYjSuu7wX0CtdeeMEQAmA==", "dev": true, + "license": "MIT", "dependencies": { - "is-text-path": "^2.0.0", - "JSONStream": "^1.3.5", - "meow": "^12.0.1", - "split2": "^4.0.0" + "meow": "^13.0.0" }, "bin": { - "conventional-commits-parser": "cli.mjs" + "conventional-commits-parser": "dist/cli/index.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, - "node_modules/@semantic-release/release-notes-generator/node_modules/is-text-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", - "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "node_modules/@types/conventional-commits-parser": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.1.tgz", + "integrity": "sha512-7uz5EHdzz2TqoMfV7ee61Egf5y6NkcO4FB/1iCCQnbeiI1F3xzv3vK5dBCXUCLQgGYS+mUeigK1iKQzvED+QnQ==", "dev": true, + "license": "MIT", "dependencies": { - "text-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/meow": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", - "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", - "dev": true, - "engines": { - "node": ">=16.10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "dev": true, - "engines": { - "node": ">= 10.x" + "@types/node": "*" } }, - "node_modules/@semantic-release/release-notes-generator/node_modules/text-extensions": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", - "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, - "node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "license": "MIT" }, "node_modules/@types/mdast": { "version": "3.0.12", @@ -1592,22 +1786,36 @@ } }, "node_modules/@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "dev": true, + "license": "MIT", + "peer": true }, "node_modules/@types/node": { - "version": "20.4.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.7.tgz", - "integrity": "sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==", - "dev": true + "version": "22.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", + "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } }, "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true, + "license": "MIT" }, "node_modules/@types/unist": { "version": "2.0.8", @@ -1616,16 +1824,21 @@ "dev": true }, "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", + "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1638,44 +1851,21 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/agent-base": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", - "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", "dev": true, - "peer": true, - "dependencies": { - "debug": "^4.3.4" - }, + "license": "MIT", "engines": { "node": ">= 14" } }, - "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "dev": true, - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1690,15 +1880,16 @@ } }, "node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -1765,45 +1956,6 @@ "dev": true, "peer": true }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true - }, - "node_modules/are-we-there-yet": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", - "dev": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/are-we-there-yet/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1821,13 +1973,16 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -1971,26 +2126,27 @@ } }, "node_modules/cacache": { - "version": "17.1.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", - "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", + "version": "19.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", + "integrity": "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==", "dev": true, + "license": "ISC", "dependencies": { - "@npmcli/fs": "^3.1.0", + "@npmcli/fs": "^4.0.0", "fs-minipass": "^3.0.0", "glob": "^10.2.2", - "lru-cache": "^7.7.1", + "lru-cache": "^10.0.1", "minipass": "^7.0.3", - "minipass-collect": "^1.0.2", + "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", - "ssri": "^10.0.0", - "tar": "^6.1.11", - "unique-filename": "^3.0.0" + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/cacache/node_modules/brace-expansion": { @@ -1998,46 +2154,38 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/cacache/node_modules/glob": { - "version": "10.3.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.4.tgz", - "integrity": "sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, + "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, "bin": { - "glob": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=16 || 14 >=14.17" + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/cacache/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, "node_modules/cacache/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -2048,25 +2196,14 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/cacache/node_modules/minipass": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", - "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/cacache/node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", + "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", "dev": true, - "dependencies": { - "aggregate-error": "^3.0.0" - }, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2095,6 +2232,8 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=6" } @@ -2104,6 +2243,8 @@ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "camelcase": "^5.3.1", "map-obj": "^4.0.0", @@ -2193,12 +2334,13 @@ "dev": true }, "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", "dev": true, + "license": "BlueOak-1.0.0", "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/clean-stack": { @@ -2300,15 +2442,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "bin": { - "color-support": "bin.js" - } - }, "node_modules/commitizen": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-4.3.0.tgz", @@ -2377,6 +2510,7 @@ "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", "dev": true, + "license": "MIT", "dependencies": { "array-ify": "^1.0.0", "dot-prop": "^5.1.0" @@ -2399,55 +2533,50 @@ "proto-list": "~1.2.1" } }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "dev": true - }, "node_modules/conventional-changelog-angular": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", - "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", "dev": true, + "license": "ISC", "dependencies": { "compare-func": "^2.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-conventionalcommits": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-6.1.0.tgz", - "integrity": "sha512-3cS3GEtR78zTfMzk0AizXKKIdN4OvSh7ibNz6/DPbhWWQu7LqE/8+/GqSodV+sywUR2gpJAdP/1JFf4XtN7Zpw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", + "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", "dev": true, + "license": "ISC", "dependencies": { "compare-func": "^2.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-writer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-6.0.1.tgz", - "integrity": "sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.0.0.tgz", + "integrity": "sha512-TQcoYGRatlAnT2qEWDON/XSfnVG38JzA7E0wcGScu7RElQBkg9WWgZd1peCWFcWDh1xfb2CfsrcvOn1bbSzztA==", "dev": true, + "license": "MIT", "dependencies": { - "conventional-commits-filter": "^3.0.0", - "dateformat": "^3.0.3", + "@types/semver": "^7.5.5", + "conventional-commits-filter": "^5.0.0", "handlebars": "^4.7.7", - "json-stringify-safe": "^5.0.1", - "meow": "^8.1.2", - "semver": "^7.0.0", - "split": "^1.0.1" + "meow": "^13.0.0", + "semver": "^7.5.2" }, "bin": { - "conventional-changelog-writer": "cli.js" + "conventional-changelog-writer": "dist/cli/index.js" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/conventional-commit-types": { @@ -2457,34 +2586,45 @@ "dev": true }, "node_modules/conventional-commits-filter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", - "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-5.0.0.tgz", + "integrity": "sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==", "dev": true, - "dependencies": { - "lodash.ismatch": "^4.4.0", - "modify-values": "^1.0.1" - }, + "license": "MIT", "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/conventional-commits-parser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", - "integrity": "sha512-WRv5j1FsVM5FISJkoYMR6tPk07fkKT0UodruX4je86V4owk451yjXAKzKAPOs9l7y59E2viHUS9eQ+dfUA9NSg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", "dev": true, + "license": "MIT", "dependencies": { - "is-text-path": "^1.0.1", + "is-text-path": "^2.0.0", "JSONStream": "^1.3.5", - "meow": "^8.1.2", - "split2": "^3.2.2" + "meow": "^12.0.1", + "split2": "^4.0.0" }, "bin": { - "conventional-commits-parser": "cli.js" + "conventional-commits-parser": "cli.mjs" }, "engines": { - "node": ">=14" + "node": ">=16" + } + }, + "node_modules/conventional-commits-parser/node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/core-util-is": { @@ -2498,6 +2638,7 @@ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", "dev": true, + "peer": true, "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", @@ -2519,32 +2660,12 @@ } } }, - "node_modules/cosmiconfig-typescript-loader": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.4.0.tgz", - "integrity": "sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==", - "dev": true, - "engines": { - "node": ">=v14.21.3" - }, - "peerDependencies": { - "@types/node": "*", - "cosmiconfig": ">=7", - "ts-node": ">=10", - "typescript": ">=4" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -2675,12 +2796,16 @@ } }, "node_modules/dargs": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", - "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", + "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/dateformat": { @@ -2688,6 +2813,8 @@ "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": "*" } @@ -2714,6 +2841,8 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -2723,6 +2852,8 @@ "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "decamelize": "^1.1.0", "map-obj": "^1.0.0" @@ -2739,6 +2870,8 @@ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -2777,12 +2910,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", - "dev": true - }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", @@ -2808,15 +2935,6 @@ "node": ">=8" } }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -2829,23 +2947,12 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "dev": true, + "license": "MIT", "dependencies": { "is-obj": "^2.0.0" }, @@ -2867,7 +2974,8 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -3043,7 +3151,8 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/error-ex": { "version": "1.3.2", @@ -3076,70 +3185,77 @@ } }, "node_modules/eslint": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", - "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", + "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.49.0", - "@humanwhocodes/config-array": "^0.11.11", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.17.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3173,6 +3289,19 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3180,17 +3309,31 @@ "dev": true }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3227,6 +3370,7 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -3248,6 +3392,7 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } @@ -3385,11 +3530,29 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fast-uri": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.5.tgz", + "integrity": "sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, + "peer": true, "dependencies": { "reusify": "^1.0.4" } @@ -3425,15 +3588,16 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, + "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/file-uri-to-path": { @@ -3485,6 +3649,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-up-simple": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz", + "integrity": "sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/find-versions": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", @@ -3517,30 +3694,32 @@ } }, "node_modules/flat-cache": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", - "integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, + "license": "MIT", "dependencies": { - "flatted": "^3.2.7", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "flatted": "^3.2.9", + "keyv": "^4.5.4" }, "engines": { - "node": ">=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true, + "license": "ISC" }, "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", "dev": true, + "license": "ISC", "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -3557,6 +3736,7 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, + "license": "ISC", "engines": { "node": ">=14" }, @@ -3593,6 +3773,7 @@ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", "dev": true, + "license": "ISC", "dependencies": { "minipass": "^7.0.3" }, @@ -3600,15 +3781,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", - "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3616,34 +3788,20 @@ "dev": true }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/gauge": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", - "dev": true, - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" @@ -3698,22 +3856,34 @@ } }, "node_modules/git-raw-commits": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", - "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", + "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", "dev": true, + "license": "MIT", "dependencies": { - "dargs": "^7.0.0", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "split2": "^3.0.0", - "through2": "^4.0.0" + "dargs": "^8.0.0", + "meow": "^12.0.1", + "split2": "^4.0.0" }, "bin": { - "git-raw-commits": "cli.js" + "git-raw-commits": "cli.mjs" }, "engines": { - "node": ">=10" + "node": ">=16" + } + }, + "node_modules/git-raw-commits/node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/glob": { @@ -3748,16 +3918,30 @@ "node": ">=10.13.0" } }, - "node_modules/global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==", + "node_modules/global-directory": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", + "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==", "dev": true, + "license": "MIT", "dependencies": { - "ini": "^1.3.4" + "ini": "4.1.1" }, "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/global-directory/node_modules/ini": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", + "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/global-modules": { @@ -3803,15 +3987,13 @@ } }, "node_modules/globals": { - "version": "13.21.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", - "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3843,17 +4025,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dev": true, + "license": "MIT", "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", @@ -3875,22 +4052,12 @@ "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=6" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3900,11 +4067,19 @@ "node": ">=8" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "dev": true + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/homedir-polyfill": { "version": "1.0.3", @@ -3932,29 +4107,30 @@ } }, "node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", "dev": true, + "license": "ISC", "dependencies": { - "lru-cache": "^6.0.0" + "lru-cache": "^10.0.1" }, "engines": { - "node": ">=10" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/http-proxy-agent": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", "dev": true, - "peer": true, "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -3968,7 +4144,6 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", "dev": true, - "peer": true, "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -3986,15 +4161,6 @@ "node": ">=10.17.0" } }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dev": true, - "dependencies": { - "ms": "^2.0.0" - } - }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -4067,6 +4233,8 @@ "resolved": "https://registry.npmjs.org/import-from/-/import-from-4.0.0.tgz", "integrity": "sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=12.2" }, @@ -4074,6 +4242,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-from-esm": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-from-esm/-/import-from-esm-2.0.0.tgz", + "integrity": "sha512-YVt14UZCgsX1vZQ3gKjkWVdBdHQ6eu3MPU1TBgL1H5orXe2+jWD006WCPPtOuwlQm10NuzOW5WawiF1Q9veW8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "import-meta-resolve": "^4.0.0" + }, + "engines": { + "node": ">=18.20" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -4092,6 +4285,19 @@ "node": ">=8" } }, + "node_modules/index-to-position": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-0.1.2.tgz", + "integrity": "sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -4207,11 +4413,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "dev": true + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } }, "node_modules/is-alphabetical": { "version": "1.0.4", @@ -4267,12 +4481,17 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4337,12 +4556,6 @@ "node": ">=8" } }, - "node_modules/is-lambda": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", - "dev": true - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4357,15 +4570,7 @@ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4375,6 +4580,8 @@ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4402,15 +4609,16 @@ } }, "node_modules/is-text-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", - "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", "dev": true, + "license": "MIT", "dependencies": { - "text-extensions": "^1.0.0" + "text-extensions": "^2.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, "node_modules/is-unicode-supported": { @@ -4471,16 +4679,14 @@ } }, "node_modules/jackspeak": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz", - "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" }, - "engines": { - "node": ">=14" - }, "funding": { "url": "https://github.com/sponsors/isaacs" }, @@ -4498,6 +4704,16 @@ "node": ">= 0.6.0" } }, + "node_modules/jiti": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4516,11 +4732,19 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true, + "license": "MIT" + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-parse-better-errors": { "version": "1.0.2", @@ -4539,7 +4763,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -4551,7 +4776,9 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true + "dev": true, + "license": "ISC", + "peer": true }, "node_modules/jsonfile": { "version": "6.1.0", @@ -4572,13 +4799,15 @@ "dev": true, "engines": [ "node >= 0.2.0" - ] + ], + "license": "MIT" }, "node_modules/JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", "dev": true, + "license": "(MIT OR Apache-2.0)", "dependencies": { "jsonparse": "^1.2.0", "through": ">=2.2.7 <3" @@ -4591,10 +4820,11 @@ } }, "node_modules/keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, + "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } @@ -4604,6 +4834,8 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4688,7 +4920,8 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.capitalize": { "version": "4.2.1", @@ -4704,17 +4937,13 @@ "dev": true, "peer": true }, - "node_modules/lodash.isfunction": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", - "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", - "dev": true - }, "node_modules/lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", - "dev": true + "dev": true, + "license": "MIT", + "peer": true }, "node_modules/lodash.isplainobject": { "version": "4.0.6", @@ -4733,7 +4962,8 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.map": { "version": "4.6.0", @@ -4751,19 +4981,22 @@ "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.snakecase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.startcase": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.uniq": { "version": "4.5.0", @@ -4782,7 +5015,8 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-symbols": { "version": "4.1.0", @@ -4832,116 +5066,56 @@ } }, "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "license": "ISC" }, "node_modules/make-fetch-happen": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", - "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-14.0.3.tgz", + "integrity": "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==", "dev": true, + "license": "ISC", "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", "http-cache-semantics": "^4.1.1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^5.0.0", - "minipass-fetch": "^3.0.0", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^10.0.0" + "ssri": "^12.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/make-fetch-happen/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", "dev": true, - "dependencies": { - "debug": "4" - }, + "license": "MIT", + "peer": true, "engines": { - "node": ">= 6.0.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-fetch-happen/node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "node_modules/markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", "dev": true, "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/make-fetch-happen/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/make-fetch-happen/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/markdown-table": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", - "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", - "dev": true, - "dependencies": { - "repeat-string": "^1.0.0" + "repeat-string": "^1.0.0" }, "funding": { "type": "github", @@ -5128,166 +5302,13 @@ } }, "node_modules/meow": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", - "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", - "dev": true, - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "node_modules/meow/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5455,6 +5476,8 @@ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=4" } @@ -5485,6 +5508,8 @@ "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "arrify": "^1.0.1", "is-plain-obj": "^1.1.0", @@ -5495,69 +5520,52 @@ } }, "node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, + "license": "ISC", "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-collect/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==", "dev": true, + "license": "ISC", "dependencies": { - "yallist": "^4.0.0" + "minipass": "^7.0.3" }, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/minipass-fetch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", - "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.0.tgz", + "integrity": "sha512-2v6aXUXwLP1Epd/gc32HAMIWoczx+fZwEPRHm/VwtrJzRGwR1qGZXEYV3Zp8ZjjbwaZhMrM6uHV4KVkk+XCc2w==", "dev": true, + "license": "MIT", "dependencies": { "minipass": "^7.0.3", "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" + "minizlib": "^3.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" }, "optionalDependencies": { "encoding": "^0.1.13" } }, - "node_modules/minipass-fetch/node_modules/minipass": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", - "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/minipass-flush": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", "dev": true, + "license": "ISC", "dependencies": { "minipass": "^3.0.0" }, @@ -5570,6 +5578,7 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -5577,11 +5586,19 @@ "node": ">=8" } }, + "node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/minipass-pipeline": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", "dev": true, + "license": "ISC", "dependencies": { "minipass": "^3.0.0" }, @@ -5594,6 +5611,7 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -5601,11 +5619,19 @@ "node": ">=8" } }, + "node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/minipass-sized": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", "dev": true, + "license": "ISC", "dependencies": { "minipass": "^3.0.0" }, @@ -5618,6 +5644,7 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -5625,41 +5652,41 @@ "node": ">=8" } }, + "node_modules/minipass-sized/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz", + "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==", "dev": true, + "license": "MIT", "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" + "minipass": "^7.0.4", + "rimraf": "^5.0.5" }, "engines": { - "node": ">= 8" + "node": ">= 18" } }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", "dev": true, + "license": "MIT", "bin": { - "mkdirp": "bin/cmd.js" + "mkdirp": "dist/cjs/src/bin.js" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/modify-values": { @@ -5667,6 +5694,8 @@ "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -5684,9 +5713,10 @@ "dev": true }, "node_modules/nan": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", + "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", + "license": "MIT" }, "node_modules/natural-compare": { "version": "1.4.0", @@ -5695,10 +5725,11 @@ "dev": true }, "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5707,7 +5738,8 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nerf-dart": { "version": "1.0.0", @@ -5747,58 +5779,132 @@ } }, "node_modules/node-gyp": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", - "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-11.0.0.tgz", + "integrity": "sha512-zQS+9MTTeCMgY0F3cWPyJyRFAkVltQ1uXm+xXu/ES6KFgC6Czo1Seb9vQW2wNxSX2OrDTiqL0ojtkFxBQ0ypIw==", "dev": true, + "license": "MIT", "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", + "glob": "^10.3.10", "graceful-fs": "^4.2.6", - "make-fetch-happen": "^11.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", + "make-fetch-happen": "^14.0.3", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" + "tar": "^7.4.3", + "which": "^5.0.0" }, "bin": { "node-gyp": "bin/node-gyp.js" }, "engines": { - "node": "^12.13 || ^14.13 || >=16" + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/node-gyp/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/node-gyp/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/nopt": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", - "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-8.0.0.tgz", + "integrity": "sha512-1L/fTJ4UmV/lUxT2Uf006pfZKTvAgCF+chz+0OgBHO8u2Z67pE7AaAUUj7CJy0lXqHmymUvGFt6NE9R3HER0yw==", "dev": true, + "license": "ISC", "dependencies": { - "abbrev": "^1.0.0" + "abbrev": "^2.0.0" }, "bin": { "nopt": "bin/nopt.js" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" }, "engines": { - "node": ">=10" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/normalize-url": { @@ -9191,21 +9297,6 @@ "license": "ISC", "peer": true }, - "node_modules/npmlog": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", - "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", - "dev": true, - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -9448,10 +9539,19 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9540,33 +9640,27 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "dev": true, + "license": "MIT", + "peer": true }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -9694,6 +9788,16 @@ "node": ">= 0.8.0" } }, + "node_modules/proc-log": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", + "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -9705,6 +9809,7 @@ "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", "dev": true, + "license": "MIT", "dependencies": { "err-code": "^2.0.2", "retry": "^0.12.0" @@ -9747,13 +9852,16 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "peer": true }, "node_modules/quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -9784,11 +9892,68 @@ "node": ">=0.10.0" } }, + "node_modules/read-package-up": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz", + "integrity": "sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up-simple": "^1.0.0", + "read-pkg": "^9.0.0", + "type-fest": "^4.6.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-package-up/node_modules/parse-json": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", + "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.22.13", + "index-to-position": "^0.1.2", + "type-fest": "^4.7.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-package-up/node_modules/read-pkg": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", + "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/normalize-package-data": "^2.4.3", + "normalize-package-data": "^6.0.0", + "parse-json": "^8.0.0", + "type-fest": "^4.6.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/read-pkg": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", "dev": true, + "peer": true, "dependencies": { "@types/normalize-package-data": "^2.4.1", "normalize-package-data": "^6.0.0", @@ -9807,6 +9972,7 @@ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-10.1.0.tgz", "integrity": "sha512-aNtBq4jR8NawpKJQldrQcSW9y/d+KWH4v24HWkHljOZ7H0av+YTGANBzRh9A5pw7v/bLVsLVPpOhJ7gHNVy8lA==", "dev": true, + "peer": true, "dependencies": { "find-up": "^6.3.0", "read-pkg": "^8.1.0", @@ -9824,6 +9990,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", "dev": true, + "peer": true, "dependencies": { "locate-path": "^7.1.0", "path-exists": "^5.0.0" @@ -9840,6 +10007,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", "dev": true, + "peer": true, "dependencies": { "p-locate": "^6.0.0" }, @@ -9855,6 +10023,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "peer": true, "dependencies": { "yocto-queue": "^1.0.0" }, @@ -9870,6 +10039,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, + "peer": true, "dependencies": { "p-limit": "^4.0.0" }, @@ -9885,27 +10055,17 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", "dev": true, + "peer": true, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.3.1.tgz", - "integrity": "sha512-pphNW/msgOUSkJbH58x8sqpq8uQj6b0ZKGxEsLKMUnGorRcDjrUaLS+39+/ub41JNTwrrMyJcUB8+YZs3mbwqw==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/read-pkg-up/node_modules/yocto-queue": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, + "peer": true, "engines": { "node": ">=12.20" }, @@ -9913,23 +10073,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/read-pkg/node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, "node_modules/read-pkg/node_modules/json-parse-even-better-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz", "integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==", "dev": true, + "peer": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } @@ -9939,39 +10088,17 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.3.tgz", "integrity": "sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w==", "dev": true, + "peer": true, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/read-pkg/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.0.tgz", - "integrity": "sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==", - "dev": true, - "dependencies": { - "hosted-git-info": "^7.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, "node_modules/read-pkg/node_modules/parse-json": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.0.tgz", "integrity": "sha512-ihtdrgbqdONYD156Ap6qTcaGcGdkdAxodO1wLqQ/j7HP1u2sFYppINiq4jyC8F+Nm+4fVufylCV00QmkTHkSUg==", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.21.4", "error-ex": "^1.3.2", @@ -9991,6 +10118,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", "dev": true, + "peer": true, "engines": { "node": ">=14.16" }, @@ -9998,18 +10126,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.3.1.tgz", - "integrity": "sha512-pphNW/msgOUSkJbH58x8sqpq8uQj6b0ZKGxEsLKMUnGorRcDjrUaLS+39+/ub41JNTwrrMyJcUB8+YZs3mbwqw==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -10030,6 +10146,8 @@ "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" @@ -10124,23 +10242,29 @@ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/resolve": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", - "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { - "is-core-module": "^2.13.0", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -10167,18 +10291,6 @@ "node": ">=8" } }, - "node_modules/resolve-global": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", - "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", - "dev": true, - "dependencies": { - "global-dirs": "^0.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -10197,6 +10309,7 @@ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -10206,21 +10319,70 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, + "peer": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", "dev": true, + "license": "ISC", "dependencies": { - "glob": "^7.1.3" + "glob": "^10.3.7" }, "bin": { - "rimraf": "bin.js" + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -10254,6 +10416,7 @@ "url": "https://feross.org/support" } ], + "peer": true, "dependencies": { "queue-microtask": "^1.2.2" } @@ -10365,6 +10528,29 @@ "node": ">=8" } }, + "node_modules/semantic-release/node_modules/@semantic-release/commit-analyzer": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-10.0.4.tgz", + "integrity": "sha512-pFGn99fn8w4/MHE0otb2A/l5kxgOuxaaauIh4u30ncoTJuqWj4hXTgEJ03REqjS+w1R2vPftSsO26WC61yOcpw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "conventional-changelog-angular": "^6.0.0", + "conventional-commits-filter": "^3.0.0", + "conventional-commits-parser": "^5.0.0", + "debug": "^4.0.0", + "import-from": "^4.0.0", + "lodash-es": "^4.17.21", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, "node_modules/semantic-release/node_modules/@semantic-release/error": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", @@ -10375,6 +10561,57 @@ "node": ">=18" } }, + "node_modules/semantic-release/node_modules/@semantic-release/release-notes-generator": { + "version": "11.0.7", + "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-11.0.7.tgz", + "integrity": "sha512-T09QB9ImmNx7Q6hY6YnnEbw/rEJ6a+22LBxfZq+pSAXg/OL/k0siwEm5cK4k1f9dE2Z2mPIjJKKohzUm0jbxcQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "conventional-changelog-angular": "^6.0.0", + "conventional-changelog-writer": "^6.0.0", + "conventional-commits-filter": "^4.0.0", + "conventional-commits-parser": "^5.0.0", + "debug": "^4.0.0", + "get-stream": "^7.0.0", + "import-from": "^4.0.0", + "into-stream": "^7.0.0", + "lodash-es": "^4.17.21", + "read-pkg-up": "^10.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/semantic-release/node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-filter": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-4.0.0.tgz", + "integrity": "sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/semantic-release/node_modules/@semantic-release/release-notes-generator/node_modules/get-stream": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-7.0.1.tgz", + "integrity": "sha512-3M8C1EOFN6r8AMUhwUAACIoXZJEOufDU5+0gFFN5uNs6XYOralD2Pqkl7m046va6x77FwposWXbAhPPIOus7mQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/semantic-release/node_modules/aggregate-error": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", @@ -10408,6 +10645,58 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semantic-release/node_modules/conventional-changelog-angular": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", + "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/semantic-release/node_modules/conventional-changelog-writer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-6.0.1.tgz", + "integrity": "sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "conventional-commits-filter": "^3.0.0", + "dateformat": "^3.0.3", + "handlebars": "^4.7.7", + "json-stringify-safe": "^5.0.1", + "meow": "^8.1.2", + "semver": "^7.0.0", + "split": "^1.0.1" + }, + "bin": { + "conventional-changelog-writer": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/semantic-release/node_modules/conventional-commits-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", + "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/semantic-release/node_modules/escape-string-regexp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", @@ -10458,6 +10747,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semantic-release/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/semantic-release/node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -10471,19 +10775,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semantic-release/node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", - "dev": true, - "peer": true, - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, "node_modules/semantic-release/node_modules/human-signals": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", @@ -10520,14 +10811,89 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semantic-release/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/semantic-release/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, + "license": "ISC", "peer": true, + "dependencies": { + "yallist": "^4.0.0" + }, "engines": { - "node": "14 || >=16.14" + "node": ">=10" + } + }, + "node_modules/semantic-release/node_modules/meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/meow/node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "peer": true, + "engines": { + "node": ">=8" } }, "node_modules/semantic-release/node_modules/mimic-fn": { @@ -10543,6 +10909,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semantic-release/node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semantic-release/node_modules/normalize-package-data/node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/semantic-release/node_modules/npm-run-path": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", @@ -10566,39 +10963,131 @@ "dev": true, "peer": true, "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semantic-release/node_modules/p-reduce": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", + "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semantic-release/node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/semantic-release/node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" } }, - "node_modules/semantic-release/node_modules/p-reduce": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", - "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", + "node_modules/semantic-release/node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "semver": "bin/semver" } }, - "node_modules/semantic-release/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "node_modules/semantic-release/node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, + "license": "(MIT OR CC0-1.0)", "peer": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/semantic-release/node_modules/signal-exit": { @@ -10627,14 +11116,34 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "node_modules/semantic-release/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" + "license": "(MIT OR CC0-1.0)", + "peer": true, + "engines": { + "node": ">=10" }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -10671,12 +11180,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -10843,49 +11346,40 @@ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" } }, "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", "dev": true, + "license": "MIT", "dependencies": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, "node_modules/socks-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", - "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", - "dev": true, - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/socks-proxy-agent/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "4" + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" }, "engines": { - "node": ">= 6.0.0" + "node": ">= 14" } }, "node_modules/source-map": { @@ -10893,6 +11387,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -10941,6 +11436,8 @@ "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "through": "2" }, @@ -10949,47 +11446,33 @@ } }, "node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", "dev": true, - "dependencies": { - "readable-stream": "^3.0.0" + "license": "ISC", + "engines": { + "node": ">= 10.x" } }, - "node_modules/split2/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } + "license": "BSD-3-Clause" }, "node_modules/ssri": { - "version": "10.0.5", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", - "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-12.0.0.tgz", + "integrity": "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==", "dev": true, + "license": "ISC", "dependencies": { "minipass": "^7.0.3" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/ssri/node_modules/minipass": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", - "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/stream-combiner2": { @@ -11032,6 +11515,7 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -11059,6 +11543,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -11090,6 +11575,8 @@ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { "min-indent": "^1.0.0" }, @@ -11140,6 +11627,8 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">= 0.4" }, @@ -11148,44 +11637,21 @@ } }, "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "dev": true, - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", + "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", "dev": true, + "license": "ISC", "dependencies": { - "yallist": "^4.0.0" + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" } }, "node_modules/temp-dir": { @@ -11244,48 +11710,30 @@ } }, "node_modules/text-extensions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", - "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/through2": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", - "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", - "dev": true, - "dependencies": { - "readable-stream": "3" - } - }, - "node_modules/through2/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } + "license": "MIT" }, "node_modules/tmp": { "version": "0.0.33", @@ -11332,6 +11780,8 @@ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true, + "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -11346,49 +11796,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -11408,12 +11815,13 @@ } }, "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", + "integrity": "sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=10" + "node": ">=16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -11424,6 +11832,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -11433,10 +11842,11 @@ } }, "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "bin": { "uglifyjs": "bin/uglifyjs" @@ -11445,6 +11855,26 @@ "node": ">=0.8.0" } }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/unified": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", @@ -11473,27 +11903,29 @@ } }, "node_modules/unique-filename": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", - "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-4.0.0.tgz", + "integrity": "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ==", "dev": true, + "license": "ISC", "dependencies": { - "unique-slug": "^4.0.0" + "unique-slug": "^5.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/unique-slug": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", - "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-5.0.0.tgz", + "integrity": "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg==", "dev": true, + "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/unique-string": { @@ -11618,12 +12050,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -11704,15 +12130,6 @@ "node": ">= 8" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -11726,7 +12143,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/wrap-ansi": { "version": "7.0.0", @@ -11751,6 +12169,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -11789,10 +12208,14 @@ } }, "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } }, "node_modules/yargs": { "version": "17.7.2", @@ -11817,6 +12240,8 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, + "license": "ISC", + "peer": true, "engines": { "node": ">=10" } @@ -11830,15 +12255,6 @@ "node": ">=12" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 7afc7c23..e095e7de 100644 --- a/package.json +++ b/package.json @@ -22,18 +22,18 @@ }, "dependencies": { "bindings": "^1.5.0", - "nan": "^2.18.0" + "nan": "^2.22.0" }, "devDependencies": { - "@commitlint/cli": "^17.7.1", - "@commitlint/config-conventional": "^17.7.0", + "@commitlint/cli": "^19.6.1", + "@commitlint/config-conventional": "^19.6.0", "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^10.0.4", + "@semantic-release/commit-analyzer": "^13.0.1", "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^11.0.7", + "@semantic-release/release-notes-generator": "^14.0.3", "cz-conventional-changelog": "^3.3.0", - "eslint": "^8.49.0", - "node-gyp": "^9.4.0", + "eslint": "^9.17.0", + "node-gyp": "^11.0.0", "semantic-release-config-kuzzle": "^1.0.0", "semantic-release-slack-bot": "^4.0.2" }, From 6a64c3ef1f8698b3ccb456a410db72459c9203ff Mon Sep 17 00:00:00 2001 From: rolljee Date: Mon, 6 Jan 2025 17:59:40 +0100 Subject: [PATCH 2/2] eslint back to v8.49.0, fix all versions --- package-lock.json | 379 +++++++++++++++++++--------------------------- package.json | 26 ++-- 2 files changed, 173 insertions(+), 232 deletions(-) diff --git a/package-lock.json b/package-lock.json index a0d4b5f7..3909be76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,21 +9,21 @@ "version": "1.2.0", "license": "Apache-2.0", "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.22.0" + "bindings": "1.5.0", + "nan": "2.22.0" }, "devDependencies": { - "@commitlint/cli": "^19.6.1", - "@commitlint/config-conventional": "^19.6.0", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^13.0.1", - "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^14.0.3", - "cz-conventional-changelog": "^3.3.0", - "eslint": "^9.17.0", - "node-gyp": "^11.0.0", - "semantic-release-config-kuzzle": "^1.0.0", - "semantic-release-slack-bot": "^4.0.2" + "@commitlint/cli": "19.6.1", + "@commitlint/config-conventional": "19.6.0", + "@semantic-release/changelog": "6.0.3", + "@semantic-release/commit-analyzer": "13.0.1", + "@semantic-release/git": "10.0.1", + "@semantic-release/release-notes-generator": "14.0.3", + "cz-conventional-changelog": "3.3.0", + "eslint": "8.49.0", + "node-gyp": "11.0.0", + "semantic-release-config-kuzzle": "1.0.0", + "semantic-release-slack-bot": "4.0.2" }, "engines": { "node": ">= 4.4.5", @@ -683,45 +683,17 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/config-array": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", - "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.5", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", - "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@eslint/eslintrc": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", - "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", + "espree": "^9.6.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -729,7 +701,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -760,74 +732,29 @@ "license": "MIT" }, "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", + "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", "dev": true, "license": "MIT", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", - "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", - "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" }, "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "node": ">=10.10.0" } }, "node_modules/@humanwhocodes/module-importer": { @@ -843,19 +770,13 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", - "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } + "license": "BSD-3-Clause" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -978,7 +899,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, - "peer": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -992,7 +912,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, - "peer": true, "engines": { "node": ">= 8" } @@ -1002,7 +921,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, - "peer": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -1762,20 +1680,6 @@ "@types/node": "*" } }, - "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/mdast": { "version": "3.0.12", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.12.tgz", @@ -2947,6 +2851,19 @@ "node": ">=8" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -3185,69 +3102,65 @@ } }, "node_modules/eslint": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", - "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", + "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.17.0", - "@eslint/plugin-kit": "^0.2.3", - "@humanfs/node": "^0.16.6", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.49.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.1", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", + "cross-spawn": "^7.0.2", "debug": "^4.3.2", + "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.2.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esquery": "^1.5.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", + "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3" + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-scope": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", - "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -3255,7 +3168,7 @@ "estraverse": "^5.2.0" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3289,19 +3202,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3309,31 +3209,18 @@ "dev": true }, "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.14.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3552,7 +3439,6 @@ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, - "peer": true, "dependencies": { "reusify": "^1.0.4" } @@ -3588,16 +3474,16 @@ } }, "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "license": "MIT", "dependencies": { - "flat-cache": "^4.0.0" + "flat-cache": "^3.0.4" }, "engines": { - "node": ">=16.0.0" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/file-uri-to-path": { @@ -3694,17 +3580,35 @@ } }, "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.4" + "keyv": "^4.5.3", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=16" + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/flatted": { @@ -3987,13 +3891,29 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=18" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4025,6 +3945,13 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -4575,6 +4502,16 @@ "node": ">=8" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -9852,8 +9789,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "peer": true + ] }, "node_modules/quick-lru": { "version": "4.0.1", @@ -10319,7 +10255,6 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, - "peer": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -10416,7 +10351,6 @@ "url": "https://feross.org/support" } ], - "peer": true, "dependencies": { "queue-microtask": "^1.2.2" } @@ -11722,6 +11656,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index e095e7de..4c1419eb 100644 --- a/package.json +++ b/package.json @@ -21,21 +21,21 @@ "url": "git://github.com/kuzzleio/boost-geospatial-index.git" }, "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.22.0" + "bindings": "1.5.0", + "nan": "2.22.0" }, "devDependencies": { - "@commitlint/cli": "^19.6.1", - "@commitlint/config-conventional": "^19.6.0", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^13.0.1", - "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^14.0.3", - "cz-conventional-changelog": "^3.3.0", - "eslint": "^9.17.0", - "node-gyp": "^11.0.0", - "semantic-release-config-kuzzle": "^1.0.0", - "semantic-release-slack-bot": "^4.0.2" + "@commitlint/cli": "19.6.1", + "@commitlint/config-conventional": "19.6.0", + "@semantic-release/changelog": "6.0.3", + "@semantic-release/commit-analyzer": "13.0.1", + "@semantic-release/git": "10.0.1", + "@semantic-release/release-notes-generator": "14.0.3", + "cz-conventional-changelog": "3.3.0", + "eslint": "8.49.0", + "node-gyp": "11.0.0", + "semantic-release-config-kuzzle": "1.0.0", + "semantic-release-slack-bot": "4.0.2" }, "engines": { "node": ">= 4.4.5",