Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Oct 21, 2019
1 parent 0c8ed29 commit 2a97d48
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 88 deletions.
20 changes: 18 additions & 2 deletions include/tao/json/basic_value.hpp
Expand Up @@ -14,6 +14,7 @@
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>

#include "events/virtual_base.hpp"
Expand All @@ -24,9 +25,9 @@
#include "internal/pair.hpp"
#include "internal/single.hpp"
#include "internal/type_traits.hpp"
#include "internal/value_union.hpp"

#include "binary_view.hpp"
#include "forward.hpp"
#include "message_extension.hpp"
#include "pointer.hpp"
#include "type.hpp"
Expand All @@ -48,7 +49,22 @@ namespace tao::json
using object_t = std::map< std::string, basic_value, std::less<> >;

private:
internal::value_union< basic_value > m_variant;
using variant_t = std::variant< uninitialized_t,
null_t,
bool,
std::int64_t,
std::uint64_t,
double,
std::string,
std::string_view,
tao::binary,
tao::binary_view,
array_t,
object_t,
const basic_value*,
internal::opaque_ptr_t >;

variant_t m_variant;

public:
basic_value() noexcept = default;
Expand Down
24 changes: 15 additions & 9 deletions include/tao/json/forward.hpp
Expand Up @@ -19,8 +19,23 @@ namespace tao

} // namespace events

template< typename T, typename = void >
struct traits
{};

template< template< typename... > class Traits >
class basic_value;

using producer_t = void ( * )( events::virtual_base&, const void* );

namespace internal
{
struct opaque_ptr_t
{
const void* data;
producer_t producer;
};

template< template< typename... > class Traits >
struct single;

Expand All @@ -29,15 +44,6 @@ namespace tao

} // namespace internal

template< typename T, typename = void >
struct traits
{};

template< template< typename... > class Traits >
class basic_value;

using producer_t = void ( * )( events::virtual_base&, const void* );

} // namespace json

} // namespace tao
Expand Down
45 changes: 0 additions & 45 deletions include/tao/json/internal/value_union.hpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/perf/json/print_sizes.cpp

This file was deleted.

7 changes: 5 additions & 2 deletions src/perf/json/sizes.cpp
Expand Up @@ -10,10 +10,13 @@

int main( int /*unused*/, char** /*unused*/ )
{
PRINT_SIZE( std::string );
PRINT_SIZE( tao::json::internal::value_union< tao::json::value > );
PRINT_SIZE( tao::json::value );
PRINT_SIZE( std::vector< tao::json::value > );
PRINT_SIZE( std::string );
PRINT_SIZE( std::string_view );
PRINT_SIZE( tao::binary );
PRINT_SIZE( tao::binary_view );
PRINT_SIZE( std::vector< tao::json::value > );
PRINT_SIZE( std::map< std::string, tao::json::value > );
PRINT_SIZE( tao::json::token );
PRINT_SIZE( tao::json::pointer );
Expand Down

0 comments on commit 2a97d48

Please sign in to comment.