Why is nullptr a part of the core language, but nullptr_t is a part of STL?Why can I use nullptr without including STL?Pretty-print C++ STL containersIs the safe-bool idiom obsolete in C++11?Is nullptr_t a default constructible type?Xcode 4.5 and C++11 headers not foundWhy can't you take the address of nullptr?Where is the difference between between memory header in VS2010 and VS2012 regarding smart pointers?Simulating nullptr & nullptr_t for GCC 4.5.3Apply using statement to the return type of a function without applying to the entire namespaceAre objects of type nullptr_t ever needed?
Is there any way to keep a player from killing an NPC?
Is there any method of inflicting the incapacitated condition and no other condition?
Is there any music source code for sound chips?
Why did they avoid parodying Martian Manhunter?
What is the difference between "Grippe" and "Männergrippe"?
Dealing with an extrovert co-worker
Is "The life is beautiful" incorrect or just very non-idiomatic?
Why in most German places is the church the tallest building?
LeetCode: Group Anagrams C#
What does "set -x" do in a bash script?
Is gzip atomic?
Numbers Decrease while Letters Increase
Are there any elected officials in the U.S. who are not legislators, judges, or constitutional officers?
Algorithms vs LP or MIP
Non-visual Computers - thoughts?
How to prevent clipped screen edges on my TV, HDMI-connected?
How do I request a longer than normal leave of absence period for my wedding?
Why isn't "I've" a proper response?
I don't have the theoretical background in my PhD topic. I can't justify getting the degree
Drawing 3 circle (diagram) in Latex
Did the British navy fail to take into account the ballistics correction due to Coriolis force during WW1 Falkland Islands battle?
Thank God it's Friday, tomorrow is THE weekend. Why the definite article?
The Knight's estate
Is for(( ... )) ... ; a valid shell syntax? In which shells?
Why is nullptr a part of the core language, but nullptr_t is a part of STL?
Why can I use nullptr without including STL?Pretty-print C++ STL containersIs the safe-bool idiom obsolete in C++11?Is nullptr_t a default constructible type?Xcode 4.5 and C++11 headers not foundWhy can't you take the address of nullptr?Where is the difference between between memory header in VS2010 and VS2012 regarding smart pointers?Simulating nullptr & nullptr_t for GCC 4.5.3Apply using statement to the return type of a function without applying to the entire namespaceAre objects of type nullptr_t ever needed?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
As far as I'm aware nullptr is a part of the core language.
Quoting C++11: (18.2/9)
nullptr_tis defined as follows:
namespace std typedef decltype(nullptr) nullptr_t;
and is defined in the header <cstddef>.
c++ c++11 nullptr
add a comment |
As far as I'm aware nullptr is a part of the core language.
Quoting C++11: (18.2/9)
nullptr_tis defined as follows:
namespace std typedef decltype(nullptr) nullptr_t;
and is defined in the header <cstddef>.
c++ c++11 nullptr
3
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
4
You don't neednullptr_tif you are willing to live withdecltype(nullptr).nullptr_tisn't a core concept, it's a helper.
– François Andrieux
10 hours ago
You neednullptr_tsometimes: "If two or more overloads accept different pointer types, an overload forstd::nullptr_tis necessary to accept a null pointer argument." (cppreference for std::nullptr_t).
– Adrian
10 hours ago
2
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't neednullptr_tif you are willing to live withdecltype(nullptr). You can usedecltype(nullptr)instead ofnullptr_t.nullptr_tis just a convenient alias fordecltype(nullptr);. You should usenullptr_t, my comment is meant to indicate whynullptr_tmight not be part of the core language.
– François Andrieux
10 hours ago
add a comment |
As far as I'm aware nullptr is a part of the core language.
Quoting C++11: (18.2/9)
nullptr_tis defined as follows:
namespace std typedef decltype(nullptr) nullptr_t;
and is defined in the header <cstddef>.
c++ c++11 nullptr
As far as I'm aware nullptr is a part of the core language.
Quoting C++11: (18.2/9)
nullptr_tis defined as follows:
namespace std typedef decltype(nullptr) nullptr_t;
and is defined in the header <cstddef>.
c++ c++11 nullptr
c++ c++11 nullptr
edited 10 hours ago
Jarod42
129k12 gold badges115 silver badges202 bronze badges
129k12 gold badges115 silver badges202 bronze badges
asked 10 hours ago
embedcembedc
68712 bronze badges
68712 bronze badges
3
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
4
You don't neednullptr_tif you are willing to live withdecltype(nullptr).nullptr_tisn't a core concept, it's a helper.
– François Andrieux
10 hours ago
You neednullptr_tsometimes: "If two or more overloads accept different pointer types, an overload forstd::nullptr_tis necessary to accept a null pointer argument." (cppreference for std::nullptr_t).
– Adrian
10 hours ago
2
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't neednullptr_tif you are willing to live withdecltype(nullptr). You can usedecltype(nullptr)instead ofnullptr_t.nullptr_tis just a convenient alias fordecltype(nullptr);. You should usenullptr_t, my comment is meant to indicate whynullptr_tmight not be part of the core language.
– François Andrieux
10 hours ago
add a comment |
3
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
4
You don't neednullptr_tif you are willing to live withdecltype(nullptr).nullptr_tisn't a core concept, it's a helper.
– François Andrieux
10 hours ago
You neednullptr_tsometimes: "If two or more overloads accept different pointer types, an overload forstd::nullptr_tis necessary to accept a null pointer argument." (cppreference for std::nullptr_t).
– Adrian
10 hours ago
2
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't neednullptr_tif you are willing to live withdecltype(nullptr). You can usedecltype(nullptr)instead ofnullptr_t.nullptr_tis just a convenient alias fordecltype(nullptr);. You should usenullptr_t, my comment is meant to indicate whynullptr_tmight not be part of the core language.
– François Andrieux
10 hours ago
3
3
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
4
4
You don't need
nullptr_t if you are willing to live with decltype(nullptr). nullptr_t isn't a core concept, it's a helper.– François Andrieux
10 hours ago
You don't need
nullptr_t if you are willing to live with decltype(nullptr). nullptr_t isn't a core concept, it's a helper.– François Andrieux
10 hours ago
You need
nullptr_t sometimes: "If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument." (cppreference for std::nullptr_t).– Adrian
10 hours ago
You need
nullptr_t sometimes: "If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument." (cppreference for std::nullptr_t).– Adrian
10 hours ago
2
2
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't need
nullptr_t if you are willing to live with decltype(nullptr). You can use decltype(nullptr) instead of nullptr_t. nullptr_t is just a convenient alias for decltype(nullptr);. You should use nullptr_t, my comment is meant to indicate why nullptr_t might not be part of the core language.– François Andrieux
10 hours ago
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't need
nullptr_t if you are willing to live with decltype(nullptr). You can use decltype(nullptr) instead of nullptr_t. nullptr_t is just a convenient alias for decltype(nullptr);. You should use nullptr_t, my comment is meant to indicate why nullptr_t might not be part of the core language.– François Andrieux
10 hours ago
add a comment |
3 Answers
3
active
oldest
votes
Because it can. A central aim in the C++ standardization process is to alter the core language as little as possible when adding to the language.
nullptr usurps the use of 0 to mean both a null pointer and, er, zero. Using 0 for both caused problems for obvious reasons, does f(0) call f(int) or f(int*)? So a brand new literal was added to the core language: nullptr. Its type is simply decltype(nullptr) so nullptr_t was added as a short cut:
namespace std
using nullptr_t = decltype(nullptr);
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Anystdtypedefs like e.g.std::stize_tare provided through headers, so what?
– πάντα ῥεῖ
10 hours ago
2
@embedcnullptris a literal like5,'a'or"hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having anullptr-like object instd. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to takenullptr's address. It would be like gettingtrue's address.
– François Andrieux
10 hours ago
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
add a comment |
The proposal that introduced nullptr, N2431, indicates in section 1.1 that it was desirable to not force users to include a header in order to use nullptr.
It also remarks, "We do not expect to see much direct use of nullptr_t in real programs". Thus, it was considered preferable to add nullptr_t to the library rather than create a new keyword only to be used for this obscure purpose. In addition, if you don't want to include the header, you can always just write decltype(nullptr) yourself.
this actually answers the question.
– bolov
8 hours ago
add a comment |
From cppreference.com:
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
You can then solve overloaded function call ambiguity with std::nullptr_t.
For example:
void Foo(int* ptr)
void Foo(double* ptr)
void Foo(std::nullptr_t ptr) // This overload is called if Foo(nullptr) is invoked
Read more about std::nullptr_t here: https://en.cppreference.com/w/cpp/types/nullptr_t
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57628496%2fwhy-is-nullptr-a-part-of-the-core-language-but-nullptr-t-is-a-part-of-stl%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Because it can. A central aim in the C++ standardization process is to alter the core language as little as possible when adding to the language.
nullptr usurps the use of 0 to mean both a null pointer and, er, zero. Using 0 for both caused problems for obvious reasons, does f(0) call f(int) or f(int*)? So a brand new literal was added to the core language: nullptr. Its type is simply decltype(nullptr) so nullptr_t was added as a short cut:
namespace std
using nullptr_t = decltype(nullptr);
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Anystdtypedefs like e.g.std::stize_tare provided through headers, so what?
– πάντα ῥεῖ
10 hours ago
2
@embedcnullptris a literal like5,'a'or"hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having anullptr-like object instd. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to takenullptr's address. It would be like gettingtrue's address.
– François Andrieux
10 hours ago
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
add a comment |
Because it can. A central aim in the C++ standardization process is to alter the core language as little as possible when adding to the language.
nullptr usurps the use of 0 to mean both a null pointer and, er, zero. Using 0 for both caused problems for obvious reasons, does f(0) call f(int) or f(int*)? So a brand new literal was added to the core language: nullptr. Its type is simply decltype(nullptr) so nullptr_t was added as a short cut:
namespace std
using nullptr_t = decltype(nullptr);
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Anystdtypedefs like e.g.std::stize_tare provided through headers, so what?
– πάντα ῥεῖ
10 hours ago
2
@embedcnullptris a literal like5,'a'or"hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having anullptr-like object instd. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to takenullptr's address. It would be like gettingtrue's address.
– François Andrieux
10 hours ago
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
add a comment |
Because it can. A central aim in the C++ standardization process is to alter the core language as little as possible when adding to the language.
nullptr usurps the use of 0 to mean both a null pointer and, er, zero. Using 0 for both caused problems for obvious reasons, does f(0) call f(int) or f(int*)? So a brand new literal was added to the core language: nullptr. Its type is simply decltype(nullptr) so nullptr_t was added as a short cut:
namespace std
using nullptr_t = decltype(nullptr);
Because it can. A central aim in the C++ standardization process is to alter the core language as little as possible when adding to the language.
nullptr usurps the use of 0 to mean both a null pointer and, er, zero. Using 0 for both caused problems for obvious reasons, does f(0) call f(int) or f(int*)? So a brand new literal was added to the core language: nullptr. Its type is simply decltype(nullptr) so nullptr_t was added as a short cut:
namespace std
using nullptr_t = decltype(nullptr);
edited 9 hours ago
answered 10 hours ago
Paul EvansPaul Evans
22.2k3 gold badges24 silver badges43 bronze badges
22.2k3 gold badges24 silver badges43 bronze badges
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Anystdtypedefs like e.g.std::stize_tare provided through headers, so what?
– πάντα ῥεῖ
10 hours ago
2
@embedcnullptris a literal like5,'a'or"hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having anullptr-like object instd. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to takenullptr's address. It would be like gettingtrue's address.
– François Andrieux
10 hours ago
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
add a comment |
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Anystdtypedefs like e.g.std::stize_tare provided through headers, so what?
– πάντα ῥεῖ
10 hours ago
2
@embedcnullptris a literal like5,'a'or"hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having anullptr-like object instd. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to takenullptr's address. It would be like gettingtrue's address.
– François Andrieux
10 hours ago
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
Thank you, but the nullptr itself can be a part of the STL... Is nullptr included in the core language to not require developers to include any header files?
– embedc
10 hours ago
@embedc Any
std typedefs like e.g. std::stize_tare provided through headers, so what?– πάντα ῥεῖ
10 hours ago
@embedc Any
std typedefs like e.g. std::stize_tare provided through headers, so what?– πάντα ῥεῖ
10 hours ago
2
2
@embedc
nullptr is a literal like 5, 'a' or "hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having a nullptr-like object in std. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to take nullptr's address. It would be like getting true's address.– François Andrieux
10 hours ago
@embedc
nullptr is a literal like 5, 'a' or "hello". While I can't imagine what it is, I would bet there is a good technical reason why a null pointer literal is better than having a nullptr-like object in std. Edit : For one thing, being a literal it's a prvalue so you can't take it's address. It would seem strange to me to be able to take nullptr's address. It would be like getting true's address.– François Andrieux
10 hours ago
1
1
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
No headers are required. It is a built-in keyword / pointer literal.
– Ron
10 hours ago
add a comment |
The proposal that introduced nullptr, N2431, indicates in section 1.1 that it was desirable to not force users to include a header in order to use nullptr.
It also remarks, "We do not expect to see much direct use of nullptr_t in real programs". Thus, it was considered preferable to add nullptr_t to the library rather than create a new keyword only to be used for this obscure purpose. In addition, if you don't want to include the header, you can always just write decltype(nullptr) yourself.
this actually answers the question.
– bolov
8 hours ago
add a comment |
The proposal that introduced nullptr, N2431, indicates in section 1.1 that it was desirable to not force users to include a header in order to use nullptr.
It also remarks, "We do not expect to see much direct use of nullptr_t in real programs". Thus, it was considered preferable to add nullptr_t to the library rather than create a new keyword only to be used for this obscure purpose. In addition, if you don't want to include the header, you can always just write decltype(nullptr) yourself.
this actually answers the question.
– bolov
8 hours ago
add a comment |
The proposal that introduced nullptr, N2431, indicates in section 1.1 that it was desirable to not force users to include a header in order to use nullptr.
It also remarks, "We do not expect to see much direct use of nullptr_t in real programs". Thus, it was considered preferable to add nullptr_t to the library rather than create a new keyword only to be used for this obscure purpose. In addition, if you don't want to include the header, you can always just write decltype(nullptr) yourself.
The proposal that introduced nullptr, N2431, indicates in section 1.1 that it was desirable to not force users to include a header in order to use nullptr.
It also remarks, "We do not expect to see much direct use of nullptr_t in real programs". Thus, it was considered preferable to add nullptr_t to the library rather than create a new keyword only to be used for this obscure purpose. In addition, if you don't want to include the header, you can always just write decltype(nullptr) yourself.
answered 9 hours ago
BrianBrian
71.5k7 gold badges104 silver badges202 bronze badges
71.5k7 gold badges104 silver badges202 bronze badges
this actually answers the question.
– bolov
8 hours ago
add a comment |
this actually answers the question.
– bolov
8 hours ago
this actually answers the question.
– bolov
8 hours ago
this actually answers the question.
– bolov
8 hours ago
add a comment |
From cppreference.com:
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
You can then solve overloaded function call ambiguity with std::nullptr_t.
For example:
void Foo(int* ptr)
void Foo(double* ptr)
void Foo(std::nullptr_t ptr) // This overload is called if Foo(nullptr) is invoked
Read more about std::nullptr_t here: https://en.cppreference.com/w/cpp/types/nullptr_t
add a comment |
From cppreference.com:
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
You can then solve overloaded function call ambiguity with std::nullptr_t.
For example:
void Foo(int* ptr)
void Foo(double* ptr)
void Foo(std::nullptr_t ptr) // This overload is called if Foo(nullptr) is invoked
Read more about std::nullptr_t here: https://en.cppreference.com/w/cpp/types/nullptr_t
add a comment |
From cppreference.com:
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
You can then solve overloaded function call ambiguity with std::nullptr_t.
For example:
void Foo(int* ptr)
void Foo(double* ptr)
void Foo(std::nullptr_t ptr) // This overload is called if Foo(nullptr) is invoked
Read more about std::nullptr_t here: https://en.cppreference.com/w/cpp/types/nullptr_t
From cppreference.com:
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
You can then solve overloaded function call ambiguity with std::nullptr_t.
For example:
void Foo(int* ptr)
void Foo(double* ptr)
void Foo(std::nullptr_t ptr) // This overload is called if Foo(nullptr) is invoked
Read more about std::nullptr_t here: https://en.cppreference.com/w/cpp/types/nullptr_t
edited 3 hours ago
Remy Lebeau
360k21 gold badges287 silver badges485 bronze badges
360k21 gold badges287 silver badges485 bronze badges
answered 9 hours ago
Adrien GivryAdrien Givry
6773 silver badges10 bronze badges
6773 silver badges10 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57628496%2fwhy-is-nullptr-a-part-of-the-core-language-but-nullptr-t-is-a-part-of-stl%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
related/maybe dupe: stackoverflow.com/questions/39080709/…
– NathanOliver
10 hours ago
4
You don't need
nullptr_tif you are willing to live withdecltype(nullptr).nullptr_tisn't a core concept, it's a helper.– François Andrieux
10 hours ago
You need
nullptr_tsometimes: "If two or more overloads accept different pointer types, an overload forstd::nullptr_tis necessary to accept a null pointer argument." (cppreference for std::nullptr_t).– Adrian
10 hours ago
2
@Adrian I'm assuming you meant to reply to my comment. If so, I said you don't need
nullptr_tif you are willing to live withdecltype(nullptr). You can usedecltype(nullptr)instead ofnullptr_t.nullptr_tis just a convenient alias fordecltype(nullptr);. You should usenullptr_t, my comment is meant to indicate whynullptr_tmight not be part of the core language.– François Andrieux
10 hours ago