Commit 843bf2b5 authored by Michaël Roynard's avatar Michaël Roynard
Browse files

Fix pixel return types

parent 14f37391
......@@ -29,8 +29,8 @@ namespace mln::concepts
!std::is_const_v<pixel_value_t<Pix>> &&
!std::is_reference_v<pixel_value_t<Pix>> &&
requires(const Pix cpix) {
{ cpix.point() } -> stl::Same<pixel_point_t<Pix>>&&;
{ cpix.val() } -> stl::Same<pixel_reference_t<Pix>>&&;
{ cpix.point() } -> stl::ConvertibleTo<pixel_point_t<Pix>>&&;
{ cpix.val() } -> stl::ConvertibleTo<pixel_reference_t<Pix>>&&;
};
......@@ -38,11 +38,12 @@ namespace mln::concepts
{
// WritablePixel
template <typename Pix>
template <typename WPix>
concept WritablePixel =
Pixel<Pix> &&
requires(const Pix cpix, pixel_value_t<Pix> v) {
{ cpix.val() = v }; // Not deep-const, view-semantic.
Pixel<WPix> &&
requires(const WPix cpix, pixel_value_t<WPix> v) {
// Not deep-const, view-semantic.
{ cpix.val() = v } -> stl::ConvertibleTo<pixel_reference_t<WPix>>&&;
};
} // namespace mln::concepts::detail
......
......@@ -34,25 +34,25 @@ TEST(Core, Image_Image3D)
#endif // PYLENE_CONCEPT_TS_ENABLED
}
/*
#ifdef PYLENE_CONCEPT_TS_ENABLED
template <concepts::RawImage Ima>
template <concepts::detail::WritableImage Ima>
void foo(Ima)
{
}
template <concepts::Pixel Pix>
void bar(Pix)
{
}
#endif // PYLENE_CONCEPT_TS_ENABLED
TEST(Core, Image_OutputImage2D)
{
#ifdef PYLENE_CONCEPT_TS_ENABLED
foo(mln::image2d<int>{});
// foo(mln::image2d<int>{});
// bar(mln::details::ndpix<int, 2>{});
static_assert(concepts::Image<mln::image2d<int>>);
static_assert(concepts::IndexableImage<mln::image2d<int>>);
static_assert(concepts::AccessibleImage<mln::image2d<int>>);
static_assert(concepts::BidirectionalImage<mln::image2d<int>>);
static_assert(concepts::RawImage<mln::image2d<int>>);
// static_assert(concepts::OutputImage<mln::image2d<int>>);
#endif // PYLENE_CONCEPT_TS_ENABLED
}
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment