source: opengl-game/utils.h@ d9b6a1c

feature/imgui-sdl points-test
Last change on this file since d9b6a1c was caa2359, checked in by Dmitry Portnoy <dmp1488@…>, 6 years ago

Fix some logging code errors

  • Property mode set to 100644
File size: 564 bytes
RevLine 
[caa2359]1// Code for offset_of function from https://gist.github.com/graphitemaster/494f21190bb2c63c5516
[7e10667]2
3template <typename T1, typename T2>
4struct 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};
11template <typename T1, typename T2>
12T2 offset_of_impl<T1, T2>::object;
13
14template <typename T1, typename T2>
15inline 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.