Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
llvm-epi
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Roger Ferrer
llvm-epi
Commits
709b108a
"README.md" did not exist on "5fa97f021cb8829c1310790a566b34407280b831"
Commit
709b108a
authored
14 years ago
by
Howard Hinnant
Browse files
Options
Downloads
Patches
Plain Diff
Corrected const-correctness on nullptr type_traits, and beefed up the test for nullptr_t.
llvm-svn: 127338
parent
20cbd059
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcxx/include/type_traits
+11
-4
11 additions, 4 deletions
libcxx/include/type_traits
libcxx/test/language.support/support.types/nullptr_t.pass.cpp
+15
-0
15 additions, 0 deletions
...xx/test/language.support/support.types/nullptr_t.pass.cpp
with
26 additions
and
4 deletions
libcxx/include/type_traits
+
11
−
4
View file @
709b108a
...
...
@@ -211,6 +211,14 @@ template <> struct __is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_void
: public __is_void<typename remove_cv<_Tp>::type> {};
// __is_nullptr_t
template <class _Tp> struct ____is_nullptr_t : public false_type {};
template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
// is_integral
template <class _Tp> struct __is_integral : public false_type {};
...
...
@@ -392,18 +400,17 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
// is_fundamental
template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
: public integral_constant<bool, is_void<_Tp>::value ||
: public integral_constant<bool, is_void<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
is_arithmetic<_Tp>::value> {};
template <> struct _LIBCPP_VISIBLE is_fundamental<nullptr_t>
: public true_type {};
// is_scalar
template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
: public integral_constant<bool, is_arithmetic<_Tp>::value ||
is_member_pointer<_Tp>::value ||
is_pointer<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
is_enum<_Tp>::value > {};
template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
...
...
This diff is collapsed.
Click to expand it.
libcxx/test/language.support/support.types/nullptr_t.pass.cpp
+
15
−
0
View file @
709b108a
...
...
@@ -41,4 +41,19 @@ int main()
assert
(
!
(
nullptr
!=
nullptr
));
assert
(
!
(
nullptr
<
nullptr
));
assert
(
!
(
nullptr
>
nullptr
));
A
*
a
=
nullptr
;
assert
(
a
==
nullptr
);
assert
(
a
<=
nullptr
);
assert
(
a
>=
nullptr
);
assert
(
!
(
a
!=
nullptr
));
assert
(
!
(
a
<
nullptr
));
assert
(
!
(
a
>
nullptr
));
assert
(
nullptr
==
a
);
assert
(
nullptr
<=
a
);
assert
(
nullptr
>=
a
);
assert
(
!
(
nullptr
!=
a
));
assert
(
!
(
nullptr
<
a
));
assert
(
!
(
nullptr
>
a
));
std
::
ptrdiff_t
i
=
reinterpret_cast
<
std
::
ptrdiff_t
>
(
nullptr
);
assert
(
i
==
0
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment