Use NULL instead of polyfill, if nullptr is not available
Part of fixing https://github.com/behdad/harfbuzz/issues/585
This commit is contained in:
parent
17f40b7cad
commit
62e312ead8
|
@ -80,25 +80,9 @@ extern "C" void hb_free_impl(void *ptr);
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
#if __cplusplus < 201103L
|
||||||
|
|
||||||
// Null pointer literal
|
#ifndef nullptr
|
||||||
// Source: SC22/WG21/N2431 = J16/07-0301
|
#define nullptr NULL
|
||||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
|
#endif
|
||||||
|
|
||||||
const // this is a const object...
|
|
||||||
class {
|
|
||||||
public:
|
|
||||||
template<class T> // convertible to any type
|
|
||||||
operator T*() const { // of null non-member
|
|
||||||
return 0; // pointer...
|
|
||||||
}
|
|
||||||
template<class C, class T> // or any type of null
|
|
||||||
operator T C::*() const { // member pointer...
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
void operator&() const; // whose address can't be taken
|
|
||||||
} _hb_nullptr = {}; // and whose name is nullptr
|
|
||||||
#define nullptr _hb_nullptr
|
|
||||||
|
|
||||||
// Static assertions
|
// Static assertions
|
||||||
#ifndef static_assert
|
#ifndef static_assert
|
||||||
|
|
Loading…
Reference in New Issue