Added image_traits specializations for const types because it makes

certain compiler errors you get when accidentally trying to mutate
a const image a little easier to understand.
This commit is contained in:
Davis King 2014-12-29 17:26:14 -05:00
parent 7cc653deda
commit 201c1601c8
2 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,11 @@ namespace dlib
{
typedef T pixel_type;
};
template <typename T, typename mm>
struct image_traits<const array2d<T,mm> >
{
typedef T pixel_type;
};
template <typename T, typename mm>
inline long num_rows( const array2d<T,mm>& img) { return img.nr(); }

View File

@ -19,6 +19,17 @@ namespace dlib
typedef T pixel_type;
};
template <
typename T,
long NR,
long NC,
typename MM
>
struct image_traits<const matrix<T,NR,NC,MM> >
{
typedef T pixel_type;
};
template <
typename T,
long NR,