Category : nullptr

So I am trying to implement a linked-list from scratch, and it compiles and runs fine with optimizations turned on or when compiling with the -g flag. It also works on Visual Studio under all configurations. However when compiling with the g++ command, with optimizations and -g flag off, I get: *** Error in `a.out’: ..

Read more

enter image description here I’ve been working on this assignment, and been running into this bug I haven’t been able to fix for hours. It’s saying unhandled exception thrown, read access violation. I heard you’re not suppose to deference nullptrs, however I don’t believe that’s what I’m doing. void Linkedlist::insertnode(string key, string value) { Node* ..

Read more

I have a const z* zs = nullptr; I want to convert zs to std::span When I try to do std::span<const z>(zs) I get an error saying error: no matching function for call to ‘std::span::span(const z* const&)’ How do I convert to zs to std::span I tried std::span<const z>(zs[0]) it seems to compile. Is that ..

Read more

I’m a newbie in c++11 and I’m aware of typeid().name() and nullptr. I was just having some fun with a code but i found out that sizeof(nullptr) is 4 and moreover typeid(str).name() is something complex set of characters NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE #include<iostream> #include<string> #include<typeinfo> int main(){ std::string str; std::cout<<sizeof(nullptr)<<std::endl; std::cout<<typeid(str).name(); return 0; } I’m a bit confused ..

Read more