Commit 5ffa95da by Jamie Madill

Don't call std::is_fundamental on OSX.

We can't use this method on OSX due to missing c++11 STL support. Instead use a helper function to replace it. BUG=angle:773 Change-Id: Iddcd2705792217e6356f51e4bb9dce248d7c3be2 Reviewed-on: https://chromium-review.googlesource.com/238447Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5fd0b2d9
...@@ -17,6 +17,17 @@ ...@@ -17,6 +17,17 @@
#include <vector> #include <vector>
#include <stdint.h> #include <stdint.h>
template <typename T>
void StaticAssertIsFundamental()
{
#ifndef ANGLE_PLATFORM_APPLE
META_ASSERT(std::is_fundamental<T>::value);
#else
union { T dummy; } dummy;
static_cast<void>(dummy);
#endif
}
namespace gl namespace gl
{ {
...@@ -131,7 +142,7 @@ class BinaryInputStream ...@@ -131,7 +142,7 @@ class BinaryInputStream
template <typename T> template <typename T>
void read(T *v, size_t num) void read(T *v, size_t num)
{ {
META_ASSERT(std::is_fundamental<T>::value); StaticAssertIsFundamental<T>();
size_t length = num * sizeof(T); size_t length = num * sizeof(T);
...@@ -197,7 +208,7 @@ class BinaryOutputStream ...@@ -197,7 +208,7 @@ class BinaryOutputStream
template <typename T> template <typename T>
void write(const T *v, size_t num) void write(const T *v, size_t num)
{ {
META_ASSERT(std::is_fundamental<T>::value); StaticAssertIsFundamental<T>();
const char *asBytes = reinterpret_cast<const char*>(v); const char *asBytes = reinterpret_cast<const char*>(v);
mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T)); mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment