Category : c++20

Since I have declared a move constructor for a class, I can’t copy it, what can I do? struct T { T(T&&) {} T() {} }; int main(int argc, char** argv) { T* t = new T(); T t2 = T(); *t = t2; // error: constexpr T& T::operator=(const T&)’ is implicitly declared as deleted ..

Read more

A quote from the standard regarding std::basic_string_view equality comparison operators (see http://eel.is/c++draft/string.view#comparison): [Example 1: A sample conforming implementation for operator== would be: template<class charT, class traits> constexpr bool operator==(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs) noexcept { return lhs.compare(rhs) == 0; } template<class charT, class traits> constexpr bool operator==(basic_string_view<charT, traits> lhs, type_identity_t<basic_string_view<charT, traits>> rhs) noexcept { ..

Read more

A quote from the standard regarding std::basic_string_view equality comparison operators (see http://eel.is/c++draft/string.view#comparison): [Example 1: A sample conforming implementation for operator== would be: template<class charT, class traits> constexpr bool operator==(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs) noexcept { return lhs.compare(rhs) == 0; } template<class charT, class traits> constexpr bool operator==(basic_string_view<charT, traits> lhs, type_identity_t<basic_string_view<charT, traits>> rhs) noexcept { ..

Read more

i’m working on C++20 standard but a weird scenario happens when I started using import statement instead of #include suddenly namespace highlighting is not working properly. working: not working: I don’t know what is going on here I suspect it highlights according to a different thing now Source: Windows Que..

Read more

I thought g++ 10.3 should have supported the C++20 feature of atomic shared_ptr? But I am still getting the following error #include <atomic> #include <thread> #include <memory> int main() { std::atomic<std::shared_ptr<int>> a = std::make_shared<int>(1); } In file included from test.cc:1: /usr/include/c++/10/atomic: In instantiation of ‘struct std::atomic<std::shared_ptr<int> >’: test.cc:6:37: required from here /usr/include/c++/10/atomic:195:21: error: static assertion ..

Read more