null - The concept of `Nil` in C++ -


you remember undergrad lectures in algorithms it's handy have concept of nil, can assigned or compared with. (by way never did undergrad in computer science.) in python can use none; in scala there nothing (which subobject of if i'm understanding correctly). question is, how can have nil in c++? below thoughts.

we define singleton object using singleton design pattern, current impression of wince @ thought of that.

or define global or static.

my problem in either of these cases, can't think of way of being able assign variable of type nil, or being able compare object of type nil. python's none useful because python dynamically typed; scala's nothing (not confused scala nil, means empty list) solves elegantly because nothing subobject of everything. there elegant way of having nil in c++?

no, there no such thing universal nil value in c++. verbatim, c++ types unrelated , not share common values.

you can achieve some form of shareable values using inheritance, must explicitly, , can done user-defined types.


Popular posts from this blog