Skip to content

Unify channel index type in nth_channel_view and image_view::num_channels #373

@mloskot

Description

@mloskot

Actual behavior

  • image_view::num_channels() returns size_t
  • nth_channel_view(View, int n) expects int for index

Apart from signed and unsigned mix-up causing the annoying compilation warnings,
if no rationale of the mix is provided, it's a sloppy design of the interface.

Expected behavior

Use of common type for indexing of image_view channels.

C++ Minimal Working Example

#include <boost/gil.hpp>
namespace gil = boost::gil;
int main
{
    gil::rgb8_image_t img;
    auto v = gil::view(img);
    for (std::size_t i = 0; i < v.num_channels(); i++)
        auto _ = nth_channel_view(v, i);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat/annoyanceNot a bug, not a feature, but something that should be improvedcoreboost/gil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions