charconv icon indicating copy to clipboard operation
charconv copied to clipboard

C++20 module support

Open anarthal opened this issue 11 months ago • 5 comments

Adds support for import boost.charconv. This pull request is intended to get feedback and support discussion in the ML. It depends on changes in Boost.CMake, Boost.Core, Boost.ThrowException and Boost.Assert that aren't in develop. Any feedback is welcome.

anarthal avatar Jan 12 '25 13:01 anarthal

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.85%. Comparing base (dacb62a) to head (65e5356).

Files with missing lines Patch % Lines
...st/charconv/detail/fast_float/digit_comparison.hpp 50.00% 1 Missing :warning:
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #255   +/-   ##
========================================
  Coverage    94.85%   94.85%           
========================================
  Files           69       69           
  Lines         9077     9077           
========================================
  Hits          8610     8610           
  Misses         467      467           
Files with missing lines Coverage Δ
include/boost/charconv/detail/apply_sign.hpp 100.00% <ø> (ø)
include/boost/charconv/detail/buffer_sizing.hpp 100.00% <ø> (ø)
include/boost/charconv/detail/compute_float32.hpp 100.00% <ø> (ø)
include/boost/charconv/detail/compute_float64.hpp 74.07% <ø> (ø)
include/boost/charconv/detail/compute_float80.hpp 91.30% <ø> (ø)
...lude/boost/charconv/detail/dragonbox/dragonbox.hpp 97.68% <ø> (ø)
...ost/charconv/detail/dragonbox/dragonbox_common.hpp 100.00% <ø> (ø)
include/boost/charconv/detail/dragonbox/floff.hpp 87.10% <ø> (ø)
include/boost/charconv/detail/emulated128.hpp 100.00% <100.00%> (ø)
...nclude/boost/charconv/detail/fallback_routines.hpp 84.61% <ø> (ø)
... and 51 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dacb62a...65e5356. Read the comment docs.

codecov[bot] avatar Jan 12 '25 14:01 codecov[bot]

This is cool progress. Thanks for continuing to plug away on it.

mborland avatar Jan 13 '25 14:01 mborland

I think, instead of adding a bunch of headers in include/boost/config/std, a different approach would be better.

Add a new macro in Boost.Config:

#if defined(BOOST_USE_MODULES)
#define BOOST_STD_HEADER(x) <boost/config/detail/import_std.hpp>
#else
#define BOOST_STD_HEADER(x) <x>
#endif

and a new boost/config/detail/import_std.hpp header:

#ifndef BOOST_CONFIG_DETAIL_IMPORT_STD_HPP_INCLUDED_
#define BOOST_CONFIG_DETAIL_IMPORT_STD_HPP_INCLUDED_

import std;

#endif // BOOST_CONFIG_DETAIL_IMPORT_STD_HPP_INCLUDED_

Then in libraries standard headers can be included as such:

#include <boost/config.hpp> // for BOOST_STD_HEADER

#include BOOST_STD_HEADER(utility)

This approach requires less maintenance and is forward compatible with std headers that might be added in the future.

The above assumes that BOOST_STD_HEADER and boost/config/detail/import_std.hpp are added to Boost.Config, but this doesn't have to be the case. It can be a separate Boost library, if needed.

Lastique avatar Apr 07 '25 20:04 Lastique

I think I prefer the normal #include, for aesthetic reasons if nothing else.

pdimov avatar Apr 07 '25 23:04 pdimov

I'm good with any of the two approaches.

anarthal avatar Apr 08 '25 10:04 anarthal