Skip to content

Commit

Permalink
Fix make_scan_args by forcing scan_arg_store to use guaranteed copy e…
Browse files Browse the repository at this point in the history
…lision
  • Loading branch information
eliaskosunen committed May 20, 2024
1 parent 2077b46 commit ac55dd3
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions include/scn/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -5135,6 +5135,12 @@ struct scan_arg_store<scan_arg_store_kind::builtin, Context, Args...> {
{
}

scan_arg_store(const scan_arg_store&) = delete;
scan_arg_store& operator=(const scan_arg_store&) = delete;
scan_arg_store(scan_arg_store&&) = delete;
scan_arg_store& operator=(scan_arg_store&&) = delete;
~scan_arg_store() = default;

template <typename... A>
static constexpr std::array<void*, sizeof...(A)> make_data_array(A&... a)
{
Expand Down Expand Up @@ -5169,6 +5175,12 @@ struct scan_arg_store<scan_arg_store_kind::packed, Context, Args...> {
{
}

scan_arg_store(const scan_arg_store&) = delete;
scan_arg_store& operator=(const scan_arg_store&) = delete;
scan_arg_store(scan_arg_store&&) = delete;
scan_arg_store& operator=(scan_arg_store&&) = delete;
~scan_arg_store() = default;

template <typename... A>
static constexpr std::array<arg_value, sizeof...(A)> make_data_array(
A&... a)
Expand Down Expand Up @@ -5203,6 +5215,12 @@ struct scan_arg_store<scan_arg_store_kind::unpacked, Context, Args...> {
{
}

scan_arg_store(const scan_arg_store&) = delete;
scan_arg_store& operator=(const scan_arg_store&) = delete;
scan_arg_store(scan_arg_store&&) = delete;
scan_arg_store& operator=(scan_arg_store&&) = delete;
~scan_arg_store() = default;

template <typename... A>
static constexpr std::array<basic_scan_arg<Context>, sizeof...(A)>
make_data_array(A&... a)
Expand All @@ -5227,17 +5245,6 @@ struct scan_arg_store<scan_arg_store_kind::unpacked, Context, Args...> {
std::array<basic_scan_arg<Context>, sizeof...(Args)> data;
};

template <typename Context, std::size_t NumArgs>
struct scan_arg_store_base {
protected:
static constexpr std::size_t num_args = NumArgs;
static constexpr bool is_packed = num_args <= detail::max_packed_args;

using value_type = std::
conditional_t<is_packed, detail::arg_value, basic_scan_arg<Context>>;
using value_array_type = std::array<value_type, num_args>;
};

template <typename CharT>
constexpr bool all_types_builtin()
{
Expand Down

0 comments on commit ac55dd3

Please sign in to comment.