feature/imgui-sdl
points-test
Last change
on this file since bae0911 was 7e10667, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago |
Finish switching to the new model group rendering algorithm for TYPE_EXPLOSION objects
|
-
Property mode
set to
100644
|
File size:
561 bytes
|
Rev | Line | |
---|
[7e10667] | 1 | // Code for offset_of talem from https://gist.github.com/graphitemaster/494f21190bb2c63c5516
|
---|
| 2 |
|
---|
| 3 | template <typename T1, typename T2>
|
---|
| 4 | struct offset_of_impl {
|
---|
| 5 | static T2 object;
|
---|
| 6 | static constexpr size_t offset(T1 T2::*member) {
|
---|
| 7 | return size_t(&(offset_of_impl<T1, T2>::object.*member)) -
|
---|
| 8 | size_t(&offset_of_impl<T1, T2>::object);
|
---|
| 9 | }
|
---|
| 10 | };
|
---|
| 11 | template <typename T1, typename T2>
|
---|
| 12 | T2 offset_of_impl<T1, T2>::object;
|
---|
| 13 |
|
---|
| 14 | template <typename T1, typename T2>
|
---|
| 15 | inline constexpr size_t offset_of(T1 T2::*member) {
|
---|
| 16 | return offset_of_impl<T1, T2>::offset(member);
|
---|
| 17 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.