2013-07-24 11:41:39 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-09-02 00:16:17 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-01-14 20:09:11 +03:00
|
|
|
/* Implements a mozilla::IsNullPointer<T> type trait. */
|
2012-09-02 00:16:17 +04:00
|
|
|
|
2013-07-24 11:41:39 +04:00
|
|
|
#ifndef mozilla_NullPtr_h
|
|
|
|
#define mozilla_NullPtr_h
|
2012-09-02 00:16:17 +04:00
|
|
|
|
2015-01-14 20:09:11 +03:00
|
|
|
#include "mozilla/TypeTraits.h"
|
2012-09-02 00:16:17 +04:00
|
|
|
|
2014-01-03 03:27:41 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2012-09-02 00:16:17 +04:00
|
|
|
/**
|
2015-01-14 20:09:11 +03:00
|
|
|
* IsNullPointer<T>::value is true iff T is decltype(nullptr).
|
2014-01-03 03:27:41 +04:00
|
|
|
*
|
|
|
|
* Ideally this would be in TypeTraits.h, but C++11 omitted std::is_null_pointer
|
2015-01-14 20:09:11 +03:00
|
|
|
* (fixed in C++14), so in the interests of easing a switch to <type_traits>,
|
2014-01-03 03:27:41 +04:00
|
|
|
* this trait lives elsewhere.
|
2012-09-02 00:16:17 +04:00
|
|
|
*/
|
2014-01-03 03:27:41 +04:00
|
|
|
template<typename T>
|
2015-01-14 20:09:11 +03:00
|
|
|
struct IsNullPointer : FalseType {};
|
2014-01-03 03:27:41 +04:00
|
|
|
|
2014-06-13 10:34:08 +04:00
|
|
|
template<>
|
2015-01-14 20:09:11 +03:00
|
|
|
struct IsNullPointer<decltype(nullptr)> : TrueType {};
|
|
|
|
|
2014-06-13 10:34:08 +04:00
|
|
|
}
|
2012-09-02 00:16:17 +04:00
|
|
|
|
2013-07-24 11:41:39 +04:00
|
|
|
#endif /* mozilla_NullPtr_h */
|