diff --git a/include/continuable/detail/traversal/traverse-async.hpp b/include/continuable/detail/traversal/traverse-async.hpp index bc67c43..b8d7f22 100644 --- a/include/continuable/detail/traversal/traverse-async.hpp +++ b/include/continuable/detail/traversal/traverse-async.hpp @@ -97,10 +97,8 @@ public: /// given iterator tuple. template auto make_resume_traversal_callable(Frame&& frame, State&& state) - -> resume_traversal_callable::type, - typename std::decay::type> { - return resume_traversal_callable::type, - typename std::decay::type>( + -> resume_traversal_callable, std::decay_t> { + return resume_traversal_callable, std::decay_t>( std::forward(frame), std::forward(state)); } @@ -291,9 +289,9 @@ struct dynamic_async_range { }; template -using dynamic_async_range_of_t = dynamic_async_range< - typename std::decay()))>::type, - typename std::decay()))>::type>; +using dynamic_async_range_of_t = + dynamic_async_range()))>, + std::decay_t()))>>; /// Returns a dynamic range for the given type template @@ -337,9 +335,8 @@ public: auto hierarchy = std::tuple_cat( std::make_tuple(std::forward(parent)), hierarchy_); - return async_traversal_point::type, - Hierarchy...>(frame_, std::move(hierarchy), - detached_); + return async_traversal_point, Hierarchy...>( + frame_, std::move(hierarchy), detached_); } /// Forks the current traversal point and continues the child @@ -405,7 +402,7 @@ public: /// Async traverse the current iterator template void async_traverse_one(Current&& current) { - using ElementType = typename std::decay::type; + using ElementType = std::decay_t; return async_traverse_one_impl(container_category_of_t{}, std::forward(current)); } @@ -453,8 +450,7 @@ public: /// given frame and hierarchy template using traversal_point_of_t = - async_traversal_point::type, - typename std::decay::type...>; + async_traversal_point, std::decay_t...>; /// A callable object which is capable of resuming an asynchronous /// pack traversal. @@ -528,8 +524,8 @@ template struct async_traversal_types { /// Deduces to the async traversal frame type of the given /// traversal arguments and mapper - using frame_t = async_traversal_frame::type, - typename std::decay::type...>; + using frame_t = + async_traversal_frame, std::decay_t...>; /// The type of the demoted visitor type using visitor_t = Visitor; diff --git a/include/continuable/detail/traversal/traverse.hpp b/include/continuable/detail/traversal/traverse.hpp index e58dbb1..9740db3 100644 --- a/include/continuable/detail/traversal/traverse.hpp +++ b/include/continuable/detail/traversal/traverse.hpp @@ -169,8 +169,7 @@ struct flat_arraylizer { /// Deduces to the array type when the array is instantiated /// with the given arguments. template - using array_type_of_t = - Type::type, 1 + sizeof...(Rest)>; + using array_type_of_t = Type, 1 + sizeof...(Rest)>; // We overload with one argument here so Clang and GCC don't // have any issues with overloading against zero arguments. @@ -407,9 +406,8 @@ using element_of_t = typename std::conditional< /// Removes all qualifier and references from the given type /// if the type is a l-value or r-value reference. template -using dereferenced_of_t = - typename std::conditional::value, - typename std::decay::type, T>::type; +using dereferenced_of_t = typename std::conditional::value, + std::decay_t, T>::type; /// Returns the type which is resulting if the mapping is applied to /// an element in the container. @@ -423,8 +421,8 @@ using mapped_type_from_t = dereferenced_of_t -using is_empty_mapped = spreading::is_empty_spread()(std::declval>()))>::type>; +using is_empty_mapped = spreading::is_empty_spread< + std::decay_t()(std::declval>()))>>; /// We are allowed to reuse the container if we map to the same /// type we are accepting and when we have @@ -472,10 +470,9 @@ template auto remap_container(container_mapping_tag, M&& mapper, T&& container) -> decltype(rebind_container>(container)) { - static_assert( - has_push_back::type, element_of_t>::value, - "Can only remap containers that provide a push_back " - "method!"); + static_assert(has_push_back, element_of_t>::value, + "Can only remap containers that provide a push_back " + "method!"); // Create the new container, which is capable of holding // the remappped types. @@ -503,7 +500,7 @@ auto remap_container(container_mapping_tag, M&& mapper, /// type we accepted such as int -> int. template auto remap_container(container_mapping_tag, M&& mapper, - T&& container) -> typename std::decay::type { + T&& container) -> std::decay_t { for (auto&& val : container_accessor_of(std::forward(container))) { val = spreading::unpack( std::forward(mapper)(std::forward(val))); @@ -629,12 +626,11 @@ struct tuple_like_remapper< /// different types. template auto remap(Strategy, T&& container, M&& mapper) -> decltype(traits::unpack( - std::declval::type, - typename std::decay::type>>(), + std::declval< + tuple_like_remapper, std::decay_t>>(), std::forward(container))) { return traits::unpack( - tuple_like_remapper::type, - typename std::decay::type>{ + tuple_like_remapper, std::decay_t>{ std::forward(mapper)}, std::forward(container)); } @@ -645,7 +641,7 @@ auto remap(Strategy, T&& container, M&& mapper) -> decltype(traits::unpack( template struct mapping_strategy_base { template - auto may_void(T&& element) const -> typename std::decay::type { + auto may_void(T&& element) const -> std::decay_t { return std::forward(element); } }; @@ -803,19 +799,19 @@ class mapping_helper : protected mapping_strategy_base { template auto traverse(Strategy, T&& element) -> decltype(std::declval().match( - std::declval::type>>(), + std::declval>>(), std::declval())); /// \copybrief traverse template auto try_traverse(Strategy, T&& element) -> decltype(std::declval().try_match( - std::declval::type>>(), + std::declval>>(), std::declval())) { // We use tag dispatching here, to categorize the type T whether // it satisfies the container or tuple like requirements. // Then we can choose the underlying implementation accordingly. - return try_match(container_category_of_t::type>{}, + return try_match(container_category_of_t>{}, std::forward(element)); } @@ -861,7 +857,7 @@ public: /// Traverses the given pack with the given mapper and strategy template decltype(auto) transform(Strategy strategy, Mapper&& mapper, T&&... pack) { - mapping_helper::type> helper( + mapping_helper> helper( std::forward(mapper)); return helper.init_traverse(strategy, std::forward(pack)...); } diff --git a/test/unit-test/single/test-continuable-traverse-async.cpp b/test/unit-test/single/test-continuable-traverse-async.cpp index 7c16b6c..d4c2b7c 100644 --- a/test/unit-test/single/test-continuable-traverse-async.cpp +++ b/test/unit-test/single/test-continuable-traverse-async.cpp @@ -43,8 +43,8 @@ using cti::async_traverse_complete_tag; using cti::async_traverse_detach_tag; using cti::async_traverse_in_place_tag; using cti::async_traverse_visit_tag; -using cti::detail::util::unused; using cti::traverse_pack_async; +using cti::detail::util::unused; /// A tag which isn't accepted by any mapper struct not_accepted_tag {}; @@ -248,7 +248,7 @@ TEST(async_traversal_tuple_like, visit_tuple_huge) { } template ::type>> + typename Vector = std::vector>> Vector vector_of(T&& first, Args&&... args) { return Vector{std::forward(first), std::forward(args)...}; } diff --git a/test/unit-test/single/test-continuable-traverse.cpp b/test/unit-test/single/test-continuable-traverse.cpp index 9ff6881..f3abd36 100644 --- a/test/unit-test/single/test-continuable-traverse.cpp +++ b/test/unit-test/single/test-continuable-traverse.cpp @@ -331,9 +331,9 @@ public: : counter_(counter) { } - template ::type, - test_tag_1>::value>::type* = nullptr> + template , test_tag_1>::value>::type* = nullptr> void operator()(T) { ++counter_.get(); } @@ -609,13 +609,13 @@ TEST(test_strategic_container_traverse, every_element_remapped_rvalue) { container.push_back(std::unique_ptr>( new std::unique_ptr(new int(7)))); - std::vector> res = map_pack( - [](std::unique_ptr> & - ref) -> std::unique_ptr&& { + std::vector> res = + map_pack([](std::unique_ptr> & + ref) -> std::unique_ptr&& { // ... return std::move(*ref); }, - container); + container); EXPECT_EQ(res.size(), 1U); EXPECT_EQ((*res[0]), 7);