fmt_unveil<> fix

This commit is contained in:
Nekotekina 2016-08-07 16:59:46 +03:00
parent 4438163da1
commit 1a7ea2d235
8 changed files with 29 additions and 17 deletions

View file

@ -2,6 +2,7 @@
#include <exception>
#include <string>
#include <memory>
#include "Platform.h"
#include "types.h"
@ -23,6 +24,24 @@ struct fmt_unveil
{
return reinterpret_cast<std::uintptr_t>(&arg);
}
// Temporary value container (can possibly be created by other fmt_unveil<> specializations)
struct u64_wrapper
{
T arg;
// Allow implicit conversion
operator u64() const
{
return reinterpret_cast<std::uintptr_t>(&arg);
}
};
// This overload resolution takes the precedence
static inline u64_wrapper get(T&& arg)
{
return {std::move(arg)};
}
};
template<typename T>