Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
0c31658d
Commit
0c31658d
authored
Dec 05, 2012
by
Sylvain Thery
Browse files
add easy type conversions ..continue
parent
6dbae9b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/Utils/convertType.h
View file @
0c31658d
...
...
@@ -26,6 +26,7 @@
#define __CONVERTTYPE_H_
#include
<assert.h>
#include
<vector>
namespace
CGoGN
{
...
...
@@ -85,6 +86,22 @@ inline const OUT* convertPtr(const IN* vec)
template
<
typename
OUT
,
typename
IN
>
inline
std
::
vector
<
OUT
>&
convertVector
(
std
::
vector
<
IN
>&
vec
)
{
assert
(
sizeof
(
IN
)
==
sizeof
(
OUT
)
||
"incompatible size cast"
);
return
*
(
reinterpret_cast
<
std
::
vector
<
OUT
>*
>
(
&
vec
));
}
template
<
typename
OUT
,
typename
IN
>
inline
const
std
::
vector
<
OUT
>&
convertVector
(
const
std
::
vector
<
IN
>&
vec
)
{
assert
(
sizeof
(
IN
)
==
sizeof
(
OUT
)
||
"incompatible size cast"
);
return
*
(
reinterpret_cast
<
const
std
::
vector
<
OUT
>*
>
(
&
vec
));
}
}
// namespace Utils
}
// namespace CGoGN
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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