diff --git a/develop/singles/headers/meta.hpp/meta_all.hpp b/develop/singles/headers/meta.hpp/meta_all.hpp index c836cef..f4c8b06 100644 --- a/develop/singles/headers/meta.hpp/meta_all.hpp +++ b/develop/singles/headers/meta.hpp/meta_all.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -24,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -871,27 +869,6 @@ namespace meta_hpp::detail } } -namespace meta_hpp::detail -{ - template < typename Key, typename Compare, typename Allocator > - void insert_or_assign( // - std::set& set, - std::set& value - ) { - set.swap(value); - set.merge(value); - } - - template < typename Key, typename Compare, typename Allocator > - void insert_or_assign( // - std::set& set, - std::set&& value - ) { - set.swap(value); - set.merge(std::move(value)); - } -} - namespace meta_hpp::detail { template < typename Key, typename Value, typename Compare, typename Allocator > @@ -1109,32 +1086,6 @@ namespace std }; } -namespace meta_hpp::detail -{ - template < typename SortedContainerL, typename SortedContainerR, typename Compare > - bool is_disjoint(const SortedContainerL& l, const SortedContainerR& r, Compare compare) { - using std::begin; - using std::end; - - for ( auto iter_l{begin(l)}, iter_r{begin(r)}; iter_l != end(l) && iter_r != end(r); ) { - if ( compare(*iter_l, *iter_r) ) { - ++iter_l; - } else if ( compare(*iter_r, *iter_l) ) { - ++iter_r; - } else { - return false; - } - } - - return true; - } - - template < typename SortedContainerL, typename SortedContainerR > - bool is_disjoint(const SortedContainerL& l, const SortedContainerR& r) { - return is_disjoint(l, r, std::less<>{}); - } -} - namespace meta_hpp::detail { template < typename T > @@ -4223,14 +4174,14 @@ namespace meta_hpp::detail static auto data{std::make_unique(std::forward(args)...)}; const locker lock; - types_.emplace(any_type{data.get()}); + types_.emplace_back(data.get()); return data.get(); } private: std::recursive_mutex mutex_; - std::set> types_; + std::vector types_; }; } diff --git a/develop/untests/meta_base/is_disjoint.cpp b/develop/untests/meta_base/is_disjoint.cpp deleted file mode 100644 index c4ea291..0000000 --- a/develop/untests/meta_base/is_disjoint.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * This file is part of the "https://github.com/blackmatov/meta.hpp" - * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2021-2023, by Matvey Cherevko (blackmatov@gmail.com) - ******************************************************************************/ - -#include -#include - -TEST_CASE("meta/meta_base/is_disjoint") { - namespace meta = meta_hpp; - using meta::detail::is_disjoint; - - CHECK(is_disjoint(std::set{}, std::set{})); - - CHECK(is_disjoint(std::set{1}, std::set{})); - CHECK(is_disjoint(std::set{}, std::set{1})); - - CHECK_FALSE(is_disjoint(std::set{1}, std::set{1})); - - CHECK_FALSE(is_disjoint(std::set{1,2}, std::set{1})); - CHECK_FALSE(is_disjoint(std::set{1}, std::set{1,2})); - - CHECK_FALSE(is_disjoint(std::set{1,2}, std::set{1,3})); - CHECK_FALSE(is_disjoint(std::set{1,3}, std::set{1,2})); - - CHECK(is_disjoint(std::set{1,2}, std::set{3,4})); - CHECK(is_disjoint(std::set{2,3}, std::set{1,4,5})); - CHECK(is_disjoint(std::set{2,4}, std::set{1,3,5})); -} diff --git a/develop/untests/meta_features/for_each_type_tests.cpp b/develop/untests/meta_features/for_each_type_tests.cpp index 5e62bbd..7ecc4fd 100644 --- a/develop/untests/meta_features/for_each_type_tests.cpp +++ b/develop/untests/meta_features/for_each_type_tests.cpp @@ -17,30 +17,30 @@ TEST_CASE("meta/meta_features/for_each_type") { namespace meta = meta_hpp; SUBCASE("any_type") { - std::set all_types; + std::vector all_types; meta::for_each_type([&all_types](const meta::any_type& type){ - all_types.insert(type); + all_types.push_back(type); }); - CHECK_FALSE(all_types.contains(meta::resolve_type())); + CHECK_FALSE(std::find(all_types.begin(), all_types.end(), meta::resolve_type()) != all_types.end()); meta::for_each_type([&all_types](const meta::any_type& type){ - all_types.insert(type); + all_types.push_back(type); }); - CHECK(all_types.contains(meta::resolve_type())); + CHECK(std::find(all_types.begin(), all_types.end(), meta::resolve_type()) != all_types.end()); } SUBCASE("specific_type") { - std::set all_types; + std::vector all_types; meta::for_each_type([&all_types](const meta::array_type& type){ - all_types.insert(type); + all_types.push_back(type); }); - CHECK_FALSE(all_types.contains(meta::resolve_type())); + CHECK_FALSE(std::find(all_types.begin(), all_types.end(), meta::resolve_type()) != all_types.end()); meta::for_each_type([&all_types](const meta::array_type& type){ - all_types.insert(type); + all_types.push_back(type); }); - CHECK(all_types.contains(meta::resolve_type())); + CHECK(std::find(all_types.begin(), all_types.end(), meta::resolve_type()) != all_types.end()); } } diff --git a/develop/untests/meta_utilities/value_tests.cpp b/develop/untests/meta_utilities/value_tests.cpp index 5058161..f5337c4 100644 --- a/develop/untests/meta_utilities/value_tests.cpp +++ b/develop/untests/meta_utilities/value_tests.cpp @@ -7,8 +7,6 @@ #include #include -#include - namespace { struct ivec2 { diff --git a/headers/meta.hpp/meta_base.hpp b/headers/meta.hpp/meta_base.hpp index f328378..7bd1f3a 100644 --- a/headers/meta.hpp/meta_base.hpp +++ b/headers/meta.hpp/meta_base.hpp @@ -17,7 +17,6 @@ #include "meta_base/hashed_string.hpp" #include "meta_base/insert_or_assign.hpp" #include "meta_base/intrusive_ptr.hpp" -#include "meta_base/is_disjoint.hpp" #include "meta_base/is_in_place_type.hpp" #include "meta_base/memory_buffer.hpp" #include "meta_base/noncopyable.hpp" diff --git a/headers/meta.hpp/meta_base/base.hpp b/headers/meta.hpp/meta_base/base.hpp index cc65723..b50e0c3 100644 --- a/headers/meta.hpp/meta_base/base.hpp +++ b/headers/meta.hpp/meta_base/base.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -25,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/headers/meta.hpp/meta_base/insert_or_assign.hpp b/headers/meta.hpp/meta_base/insert_or_assign.hpp index 958dc15..6fc8171 100644 --- a/headers/meta.hpp/meta_base/insert_or_assign.hpp +++ b/headers/meta.hpp/meta_base/insert_or_assign.hpp @@ -38,27 +38,6 @@ namespace meta_hpp::detail } } -namespace meta_hpp::detail -{ - template < typename Key, typename Compare, typename Allocator > - void insert_or_assign( // - std::set& set, - std::set& value - ) { - set.swap(value); - set.merge(value); - } - - template < typename Key, typename Compare, typename Allocator > - void insert_or_assign( // - std::set& set, - std::set&& value - ) { - set.swap(value); - set.merge(std::move(value)); - } -} - namespace meta_hpp::detail { template < typename Key, typename Value, typename Compare, typename Allocator > diff --git a/headers/meta.hpp/meta_base/is_disjoint.hpp b/headers/meta.hpp/meta_base/is_disjoint.hpp deleted file mode 100644 index b7e7435..0000000 --- a/headers/meta.hpp/meta_base/is_disjoint.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * This file is part of the "https://github.com/blackmatov/meta.hpp" - * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2021-2023, by Matvey Cherevko (blackmatov@gmail.com) - ******************************************************************************/ - -#pragma once - -#include "base.hpp" - -namespace meta_hpp::detail -{ - template < typename SortedContainerL, typename SortedContainerR, typename Compare > - bool is_disjoint(const SortedContainerL& l, const SortedContainerR& r, Compare compare) { - using std::begin; - using std::end; - - for ( auto iter_l{begin(l)}, iter_r{begin(r)}; iter_l != end(l) && iter_r != end(r); ) { - if ( compare(*iter_l, *iter_r) ) { - ++iter_l; - } else if ( compare(*iter_r, *iter_l) ) { - ++iter_r; - } else { - return false; - } - } - - return true; - } - - template < typename SortedContainerL, typename SortedContainerR > - bool is_disjoint(const SortedContainerL& l, const SortedContainerR& r) { - return is_disjoint(l, r, std::less<>{}); - } -} diff --git a/headers/meta.hpp/meta_detail/type_registry.hpp b/headers/meta.hpp/meta_detail/type_registry.hpp index 3cfc756..149380b 100644 --- a/headers/meta.hpp/meta_detail/type_registry.hpp +++ b/headers/meta.hpp/meta_detail/type_registry.hpp @@ -164,13 +164,13 @@ namespace meta_hpp::detail static auto data{std::make_unique(std::forward(args)...)}; const locker lock; - types_.emplace(any_type{data.get()}); + types_.emplace_back(data.get()); return data.get(); } private: std::recursive_mutex mutex_; - std::set> types_; + std::vector types_; }; }