Category "c++11"

Overloading the assignment operator= doesn't work for anything except the implicit object passed in c++

The comparison in the assignment operator works as expected, but when I try to use a temp variable and load then return that, all it returns is the defaults. De

Why is conversion from string constant to 'char*' valid in C but invalid in C++

The C++11 Standard (ISO/IEC 14882:2011) says in § C.1.1: char* p = "abc"; // valid in C, invalid in C++ For the C++ it's OK as a pointer to a String Lit

How can I divide the Eigen::matrix by Eigen::vector?

following is my code. Eigen::Matrix3d first_rotation = firstPoint.q.matrix(); Eigen::Vector3d first_trans= firstPoint.t; for(auto &iter:in_point

Defining an atomic<> as a static variable inside a function

C++11 mandates that static variables inside a function are atomically initialized for the first run of the function. The only way to do that efficiently is doub

Identifier "Return" is undefined in gtest?

SPIGtestMain.cpp #include "gtest/gtest.h" #include "gmock/gmock.h" TEST_F(GivenANewSPI,WhenDemoIsCalled_TheComponentGetsVal) { unsigned char const *Ptr;

Question about the declaration about the aliasing constructor for `std::shared_ptr`

I think the 8th constructor of the std::shared_ptr<T> should be decalared as template< class T, class Y > shared_ptr<T>( const shared_ptr<Y

BOOST request sending JSON data

I want to transfer json data into request of json boost in cpp. If i take json in boost int outer=2; value data = { {"dia",outer}, {"sleep_tim

Initializing container of unique_ptrs from initializer list fails with GCC 4.7

I am trying to initialise an std::vector<std::unique_ptr<std::string>> in a way that is equivalent to an example from Bjarne Stroustrup's C++11 FAQ:

Brace Initialize struct with virtual functions

Brace initialization struct A { int a; int b; void foo(){} }; A a{1, 2}; It works fine. Bu

I need a function to delete certain characters from a char array in c++ without using any index

for example: if the user enters : ( 23+22+43) I want the function to do exactly the following : for(int i =0; i <strlen(x);i ++) { if (x[i]=='+') {

MFC CMenu strange draw background behavior

I tried to draw the menu background in MFC Dlg App. But I found if I declare CMenu subMenu in OnInitDialog(), the background color works well. If I declare C

Dynamically allocated structures are well initialised?

For POD structure, could new Demo_Class[CONST_NUMBER]() guarantee the dynamically allocated structures are well initialised(i.e. not garbage) in C++11 and after

why f.seekp(f.tellg()) cannot run?

I want to finish a program which can find a string in a file and then output a char 'T' in the end of line which the string exists . And my code like below(in t

Why does string not work here while char const* does?

Why does string not work here when I catch an error, and char const* does? What is the difference between the two? try { throw "connection fail"; } catch(

program compilation c++11 extension error in c++

I am using Vscode to compile my c++ programs. I have a program in which auto keyword is used. However when I compile it gives me the error. I have installed c++

Integer literal for fixed width integer types

Is there some c++ proposal for Integer literal for fixed width integer types like this? // i's type is unsigned int auto i = 10u; // j's type is uint32_t auto j

Integer literal for fixed width integer types

Is there some c++ proposal for Integer literal for fixed width integer types like this? // i's type is unsigned int auto i = 10u; // j's type is uint32_t auto j

MQTT client waits indefinitely during publish of message

I try to implement an asynchronous MQTT client with the paho library, that receives messages on topic "request", formulates a string and puts the response out o

Error Missing Type specifer - int assumed . Note C++ does not support default init

In order to make two objects, User1 and User2, of a class User sending and receiving messages, #include <iostream> using namespace std; class reply { p

Different values for integer

Trying to insert values of square and cube of a number in set st and st1. (Let n = 10^7). After printing, set st is having negative values due to limit of integ