Fixes compilation on OSX with gcc.

- The symbol `typeof` collides with a non-standard gcc "keyword". See https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
- Renamed to `type_of`.
pull/956/head
Adi Shavit @ MacBookPro 2016-07-25 16:33:25 +03:00
parent 5fe4b975ba
commit f119447549
1 changed files with 5 additions and 5 deletions

View File

@ -56,11 +56,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//using namespace Assimp; //using namespace Assimp;
namespace Assimp { namespace Assimp {
// make sure typeof returns consistent output across different platforms // make sure type_of returns consistent output across different platforms
// also consider using: typeid(VAR).name() // also consider using: typeid(VAR).name()
template <typename T> const char* typeof(T&) { return "unknown"; } template <typename T> const char* type_of(T&) { return "unknown"; }
template<> const char* typeof(float&) { return "float"; } template<> const char* type_of(float&) { return "float"; }
template<> const char* typeof(double&) { return "double"; } template<> const char* type_of(double&) { return "double"; }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to PLY. Prototyped and registered in Exporter.cpp // Worker function for exporting a scene to PLY. Prototyped and registered in Exporter.cpp
@ -146,7 +146,7 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
// definitely not good to always write float even if we might have double precision // definitely not good to always write float even if we might have double precision
ai_real tmp = 0.0; ai_real tmp = 0.0;
const char * typeName = typeof(tmp); const char * typeName = type_of(tmp);
mOutput << "element vertex " << vertices << endl; mOutput << "element vertex " << vertices << endl;
mOutput << "property " << typeName << " x" << endl; mOutput << "property " << typeName << " x" << endl;