Commit 201c1601 authored by Davis King's avatar Davis King

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.
parent 7cc653de
...@@ -13,6 +13,11 @@ namespace dlib ...@@ -13,6 +13,11 @@ namespace dlib
{ {
typedef T pixel_type; 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> template <typename T, typename mm>
inline long num_rows( const array2d<T,mm>& img) { return img.nr(); } inline long num_rows( const array2d<T,mm>& img) { return img.nr(); }
......
...@@ -19,6 +19,17 @@ namespace dlib ...@@ -19,6 +19,17 @@ namespace dlib
typedef T pixel_type; 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 < template <
typename T, typename T,
long NR, long NR,
......
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