Commit 3d077f09 authored by Davis King's avatar Davis King

Added the is_array2d template.

parent 0957c144
......@@ -487,6 +487,14 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template <typename T, typename MM>
struct is_array2d <array2d<T,MM> >
{
const static bool value = true;
};
// ----------------------------------------------------------------------------------------
}
......
......@@ -59,6 +59,19 @@ namespace dlib
ASSERT_ARE_SAME_TYPE(helper,void);
};
// ----------------------------------------------------------------------------------------
template <typename T>
struct is_array2d : public default_is_kind_value
{
/*!
- if (T is an implementation of array2d/array2d_kernel_abstract.h) then
- is_array2d<T>::value == true
- else
- is_array2d<T>::value == false
!*/
};
// ----------------------------------------------------------------------------------------
template <typename T>
......
......@@ -548,6 +548,10 @@ namespace
DLIB_TEST((char*)&img[0][0] + img.width_step() == (char*)&img[1][0]);
}
COMPILE_TIME_ASSERT(is_array2d<array2d<unsigned char> >::value == true);
COMPILE_TIME_ASSERT(is_array2d<array2d<float> >::value == true);
COMPILE_TIME_ASSERT(is_array2d<float>::value == false);
}
......
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