diff --git a/data/pch/mitsuba_precompiled.hpp b/data/pch/mitsuba_precompiled.hpp index cbe1e530..9d31a26d 100644 --- a/data/pch/mitsuba_precompiled.hpp +++ b/data/pch/mitsuba_precompiled.hpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/mitsuba/core/platform.h b/include/mitsuba/core/platform.h index 00c9791a..e949545e 100644 --- a/include/mitsuba/core/platform.h +++ b/include/mitsuba/core/platform.h @@ -189,6 +189,55 @@ extern MTS_EXPORT_CORE void __mts_set_appdefaults(); #define MTS_AUTORELEASE_BEGIN() #define MTS_AUTORELEASE_END() #endif + MTS_NAMESPACE_END + +/// \cond +// Try to make MSVC++ behave a bit more like C++ +// with an underlying C99 implementation +// (and dn't include this in the documentation) +#if defined(_MSC_VER) + +#include + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +namespace std { + + inline char tolower(char c) { + return ::tolower(c); + } + + inline char toupper(char c) { + return ::toupper(c); + } + + inline bool isnan(float f) { + return _isnan(f); + } + + inline bool isnan(double f) { + return _isnan(f); + } + + inline bool isfinite(float f) { + return _finite(f); + } + + inline bool isfinite(double f) { + return _finite(f); + } + + inline bool isinf(float f) { + return !_finite(f); + } + + inline bool isinf(double f) { + return !_finite(f); + } +}; +#endif + #endif /* __MITSUBA_CORE_PLATFORM_H_ */ diff --git a/include/mitsuba/core/stl.h b/include/mitsuba/core/stl.h index 05eb48ef..f12a2a6c 100644 --- a/include/mitsuba/core/stl.h +++ b/include/mitsuba/core/stl.h @@ -20,90 +20,6 @@ #if !defined(__MITSUBA_CORE_STL_H_) #define __MITSUBA_CORE_STL_H_ -/* Include some SGI STL extensions, which might be missing */ -#ifdef __GNUC__ -#include -using __gnu_cxx::select2nd; -using __gnu_cxx::compose1; -#else -#include - -/// \cond -// (Don't include in the documentation) -namespace std { - template struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { - const typename _Pair::first_type& operator()(const _Pair& __x) const { - return __x.first; - } - }; - - template struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { - const typename _Pair::second_type& operator()(const _Pair& __x) const { - return __x.second; - } - }; - - template struct select1st : public _Select1st<_Pair> {}; - template struct select2nd : public _Select2nd<_Pair> {}; - - template class unary_compose : public unary_function { - protected: - _Operation1 _M_fn1; - _Operation2 _M_fn2; - public: - unary_compose(const _Operation1& __x, const _Operation2& __y) : _M_fn1(__x), _M_fn2(__y) {} - typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const { - return _M_fn1(_M_fn2(__x)); - } - }; - - template inline unary_compose<_Operation1,_Operation2> compose1(const _Operation1& __fn1, const _Operation2& __fn2) { - return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); - } - -#if defined(_MSC_VER) - #include - - #define snprintf _snprintf - #define vsnprintf _vsnprintf - - inline char tolower(char c) { - return ::tolower(c); - } - - inline char toupper(char c) { - return ::toupper(c); - } - - inline bool isnan(float f) { - return _isnan(f); - } - - inline bool isnan(double f) { - return _isnan(f); - } - - inline bool isfinite(float f) { - return _finite(f); - } - - inline bool isfinite(double f) { - return _finite(f); - } - - inline bool isinf(float f) { - return !_finite(f); - } - - inline bool isinf(double f) { - return !_finite(f); - } -#endif -}; -using std::select2nd; -using std::compose1; -#endif - namespace mitsuba { namespace math { #if defined(__LINUX__) && defined(__x86_64__) diff --git a/src/libcore/class.cpp b/src/libcore/class.cpp index 954b4f05..5fb696df 100644 --- a/src/libcore/class.cpp +++ b/src/libcore/class.cpp @@ -78,9 +78,9 @@ void Class::initializeOnce(Class *theClass) { } void Class::staticInitialization() { - std::for_each(__classes->begin(), __classes->end(), - compose1(std::ptr_fun(initializeOnce), - select2nd())); + for (ClassMap::iterator it = __classes->begin(); + it != __classes->end(); ++it) + initializeOnce(it->second); m_isInitialized = true; }