Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
3d077f09
"Python/convert.py" did not exist on "22aaadc3fbd2bd784eacd9837726806746044cbb"
Commit
3d077f09
authored
Oct 13, 2011
by
Davis King
Browse files
Added the is_array2d template.
parent
0957c144
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
dlib/array2d/array2d_kernel_1.h
dlib/array2d/array2d_kernel_1.h
+8
-0
dlib/is_kind.h
dlib/is_kind.h
+13
-0
dlib/test/array2d.cpp
dlib/test/array2d.cpp
+4
-0
No files found.
dlib/array2d/array2d_kernel_1.h
View file @
3d077f09
...
@@ -487,6 +487,14 @@ namespace dlib
...
@@ -487,6 +487,14 @@ namespace dlib
}
}
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
typename
MM
>
struct
is_array2d
<
array2d
<
T
,
MM
>
>
{
const
static
bool
value
=
true
;
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/is_kind.h
View file @
3d077f09
...
@@ -59,6 +59,19 @@ namespace dlib
...
@@ -59,6 +59,19 @@ namespace dlib
ASSERT_ARE_SAME_TYPE
(
helper
,
void
);
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
>
template
<
typename
T
>
...
...
dlib/test/array2d.cpp
View file @
3d077f09
...
@@ -548,6 +548,10 @@ namespace
...
@@ -548,6 +548,10 @@ namespace
DLIB_TEST
((
char
*
)
&
img
[
0
][
0
]
+
img
.
width_step
()
==
(
char
*
)
&
img
[
1
][
0
]);
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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment