Add get() functionality to static_pointer
This commit is contained in:
parent
eef2e1318c
commit
0ba9416a57
@ -8,8 +8,11 @@
|
||||
#ifndef SKULLC_UTILITY_STATICPOINTER_HPP_
|
||||
#define SKULLC_UTILITY_STATICPOINTER_HPP_
|
||||
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
#include <utility_assert.hpp>
|
||||
|
||||
namespace Utility
|
||||
{
|
||||
|
||||
@ -57,6 +60,17 @@ struct StaticPointer
|
||||
return initialized_;
|
||||
}
|
||||
|
||||
value_type* get()
|
||||
{
|
||||
SKULLC_ASSERT_DEBUG(initialized_);
|
||||
return reinterpret_cast<value_type*>(storage);
|
||||
}
|
||||
|
||||
const value_type* get() const
|
||||
{
|
||||
SKULLC_ASSERT_DEBUG(initialized_);
|
||||
return reinterpret_cast<const value_type*>(storage);
|
||||
}
|
||||
private:
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
@ -9,4 +9,4 @@
|
||||
#define SKULLC_CONCAT(x, y) SKULLC_CONCAT_IMPL(x, y)
|
||||
#define SKULLC_TAG struct SKULLC_CONCAT(SkullCTag_, __COUNTER__)
|
||||
|
||||
#endif // SKULLC_UTILITY_TAG_HPP_
|
||||
#endif// SKULLC_UTILITY_TAG_HPP_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user