Skip to content

Commit

Permalink
still error
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Oct 26, 2023
1 parent b9888ba commit c63feb2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
18 changes: 11 additions & 7 deletions include/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class basic_value
template <typename... args_t>
basic_value(value_type type, args_t&&... args);

// Prohibit conversion of other types to basic_value
template <typename value_t, typename _ = std::enable_if_t<!std::is_convertible_v<value_t, basic_value<string_t>>>>
basic_value(value_t) = delete;

~basic_value();

bool valid() const noexcept { return _type != value_type::invalid; }
Expand Down Expand Up @@ -266,10 +270,8 @@ class basic_array
explicit basic_array(basic_value<string_t>&& val);
template <typename array_t, typename _ = std::enable_if_t<
std::is_constructible_v<value_type, typename std::decay_t<array_t>::value_type>>>
basic_array(array_t arr)
{
_array_data.assign(std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()));
}
basic_array(array_t arr) : _array_data(std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()))
{}

~basic_array() noexcept = default;

Expand Down Expand Up @@ -2611,12 +2613,14 @@ namespace _serialization_helper
void unable_to_serialize()
{
static_assert(!sizeof(T), "Unable to serialize T. "
"You can define the conversion of T to json, or overload operator<< for it.");
"You can define the conversion of T to json, or overload operator<< for it. "
#ifdef _MSC_VER
static_assert(!sizeof(T), "See T below: " __FUNCSIG__);
"See T below: " __FUNCSIG__
#else
// static_assert(!sizeof(T), "See T below: " __PRETTY_FUNCTION__);
"See T below: " __PRETTY_FUNCTION__

#endif
);
}
} // namespace _serialization_helper

Expand Down
11 changes: 10 additions & 1 deletion sample/sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <map>
#include <set>
#include <vector>
#include <filesystem>

#include "json.hpp"

Expand All @@ -24,7 +25,15 @@ void new_feature()

int main()
{
new_feature();
struct MyData
{
operator json::value() const { return "mydata"; }
} data;

json::value jdata = data;

std::filesystem::path p;
auto s = json::serialize<true>(p);

std::cout << "\n****** Parsing ******\n" << std::endl;

Expand Down

0 comments on commit c63feb2

Please sign in to comment.