Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1236 - unit.internals.exe compiles on latest MSVC #1458

Merged
merged 5 commits into from
Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ build_script:
- cmake -G "Visual Studio 17 2022" -A x64 ..
- cmake --build . --target unit.arch.exe --verbose --config Release
- cmake --build . --target unit.meta.exe --verbose --config Release
- cmake --build . --target unit.internals.exe --verbose --config Release

test_script:
- ctest -C Release -VV -R ^unit.arch.*.exe
- ctest -C Release -VV -R ^unit.meta.*.exe
- ctest -C Release -VV -R ^unit.internals.*.exe
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ find_optimized_shuffle_pattern()
{
return bound {broadcast_group, st->first, st->second, sz};
}
else if constexpr( constexpr auto s = is_slide_left<I0, I...>; s != 0 )
else if constexpr(is_slide_left<I0, I...> != 0 )
{
return bound {slide_left, index<s>};
return bound {slide_left, index<is_slide_left<I0, I...>>};
}
else if constexpr( constexpr auto s = is_slide_right<I0, I...>; s != 0 )
else if constexpr(is_slide_right<I0, I...> != 0 )
{
return bound {slide_right, index<s>};
return bound {slide_right, index<is_slide_right<I0, I...>>};
}
else if constexpr( is_reverse<InCardinal, I0, I...> ) return bound {reverse};
else if constexpr( is_deinterleave_groups_shuffle<I0, I...> != sz )
Expand Down
46 changes: 27 additions & 19 deletions include/eve/traits/value_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,38 @@ namespace eve
{
namespace detail
{
template<std::input_or_output_iterator T>
constexpr auto value_type_impl()
{
return std::type_identity<typename std::iterator_traits<T>::value_type>{};
}

template <typename T>
constexpr auto value_type_impl()
{
if constexpr (range<T>)
{
using ref = std::add_lvalue_reference_t<T>;
return value_type_impl<decltype(std::begin(std::declval<ref>()))>();
}
else if constexpr (std::input_or_output_iterator<T>)
{
return std::type_identity<typename std::iterator_traits<T>::value_type>{};
}
else if constexpr ( requires { typename T::value_type; } )
if constexpr ( requires { typename T::value_type; } )
{
return std::type_identity<typename T::value_type>{};
}
// Maybe this should be deleted
else if constexpr ( kumi::product_type<T> )
{
auto mapper = []<typename U>(U) {
auto mapper = []<typename U>(U)
{
return typename decltype( value_type_impl<U>() )::type{};
};

return std::type_identity<kumi::result::map_t<decltype(mapper), T>>{};
}
}

template<range T>
constexpr auto value_type_impl()
{
using ref = std::add_lvalue_reference_t<T>;
return value_type_impl<decltype(std::begin(std::declval<ref>()))>();
}

}

//================================================================================================
Expand All @@ -54,15 +60,17 @@ namespace eve
//!
//! @brief A meta function for getting an associated value_type for a relaxed iterator/range.
//!
//! If T has begin/end - value_type_t for return type of begin
//! If T is std::iterator -> returns iterator_traits<T>::value_type
//! If T has nested `value_type` -> returns it
//! If T is a product type and all elements have value_type_t defined for them -
//! kumi::tuple for the individual product types.
//! Otherwise it's undefined.
//! value_type_t<T> is computed as follows:
//! - If T has begin/end - value_type_t for return type of begin
//! - If T is std::iterator -> returns iterator_traits<T>::value_type
//! - If T has nested `value_type` -> returns it
//! - If T is a product type and all elements have value_type_t defined for them -
//! - kumi::tuple for the individual product types.
//! - Otherwise it's undefined.
//!
//! @tparam T Type to process
//!
//! **Required header:** `#include <eve/traits/value_type.hpp>`,
//! `#include <eve/traits.hpp>`
//! **Required header:** `#include <eve/traits.hpp>`
//! @}
//================================================================================================

Expand Down
2 changes: 1 addition & 1 deletion test/unit/internals/compress/compress_mask_num.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TTS_CASE_TPL("compress_store_swizzle_mask_num 4 elements",eve::test::scalar::all
auto [actual_num, actual_count] = eve::detail::compress_store_swizzle_mask_num(ignore, mask);
TTS_EQUAL(expected_num, actual_num);

int expected_count = eve::count_true(mask_with_ignore);
std::ptrdiff_t expected_count = eve::count_true(mask_with_ignore);
TTS_EQUAL(expected_count, actual_count);
}
}
Expand Down