2013-07-24 07:41:39 +00: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-01 20:16:17 +00: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 17:09:11 +00:00
|
|
|
/* Implements a mozilla::IsNullPointer<T> type trait. */
|
2012-09-01 20:16:17 +00:00
|
|
|
|
2013-07-24 07:41:39 +00:00
|
|
|
#ifndef mozilla_NullPtr_h
|
|
|
|
#define mozilla_NullPtr_h
|
2012-09-01 20:16:17 +00:00
|
|
|
|
2015-01-14 17:09:11 +00:00
|
|
|
#include "mozilla/TypeTraits.h"
|
2012-09-01 20:16:17 +00:00
|
|
|
|
2014-01-02 23:27:41 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
2012-09-01 20:16:17 +00:00
|
|
|
/**
|
2015-01-14 17:09:11 +00:00
|
|
|
* IsNullPointer<T>::value is true iff T is decltype(nullptr).
|
2014-01-02 23:27:41 +00:00
|
|
|
*
|
|
|
|
* Ideally this would be in TypeTraits.h, but C++11 omitted std::is_null_pointer
|
2015-01-14 17:09:11 +00:00
|
|
|
* (fixed in C++14), so in the interests of easing a switch to <type_traits>,
|
2014-01-02 23:27:41 +00:00
|
|
|
* this trait lives elsewhere.
|
2012-09-01 20:16:17 +00:00
|
|
|
*/
|
2014-01-02 23:27:41 +00:00
|
|
|
template <typename T>
|
2015-01-14 17:09:11 +00:00
|
|
|
struct IsNullPointer : FalseType {};
|
2014-01-02 23:27:41 +00:00
|
|
|
|
2014-06-13 06:34:08 +00:00
|
|
|
template <>
|
2015-01-14 17:09:11 +00:00
|
|
|
struct IsNullPointer<decltype(nullptr)> : TrueType {};
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2012-09-01 20:16:17 +00:00
|
|
|
|
2013-07-24 07:41:39 +00:00
|
|
|
#endif /* mozilla_NullPtr_h */
|