Questions tagged as 'c++11'

2
answers

What are rvalues, lvalues, xvalues, glvalues and prvalues?

Prior to C ++ 11, there were only two value categories for expression tree types: lvalue and rvalue . In a very simplified way, the first represents a reference that can be changed and whose address can be read, while the second is a temporar...
asked by 18.02.2014 / 19:49
2
answers

How does std :: move work?

I would like to understand the operation of std::move . I noticed that with the C ++ 11 specification this new function arises, and now we have a new operator (& &). What is the semantics and use of this new function and this...
asked by 03.02.2015 / 16:04
2
answers

C ++ (basic): for, references and syntax

My teacher introduced this role to us: void escala(std::vector<double> &v, double fator) { for (auto &vi:v){ vi *= fator; } } It serves to multiply all elements of a vector by an already predefined factor. I h...
asked by 07.05.2018 / 13:20
1
answer

When to use void * and auto *?

C ++ 11 made us type auto ( automatic ). It can transfer type for the first time. But before him, people used to use void* , which you used to refer to on the pointer. Even today I use void* (Win32), but I also use auto...
asked by 14.02.2014 / 08:15
3
answers

Setting thread priority in C ++ 11

In the program I'm developing I have two std :: threads that are always active throughout the life of the program. However, I consider that the function of one of them is minor and would like to change their priority. I took a look at the doc...
asked by 05.02.2014 / 01:05
2
answers

Function print with error

I made a program that calculates the Fibonacci numbers in X and Y using Z as a helper. When I pass the Fibonacci function vector to the imprime function, it does not print. I made a test by putting cout inside the for of...
asked by 02.05.2016 / 21:23
1
answer

Analyze whether a number is even or odd

The program should do: Digite um Número: 12345 1 e ímpar 2 e par 3 e ímpar 4 e pra 5 e ímpar So far I've made the following code: void parImpar (int num) { int resto; while (num > 0) { resto = num%10;...
asked by 31.08.2018 / 05:03
1
answer

What is a shared_ptr?

If possible, with a code example, as this is missing from the reference to really understand when and how to use shared_ptr .     
asked by 16.02.2016 / 17:23
2
answers

Function library find () does not return if found or not

I'm writing a program for a college exercise and I'm not sure about find() . I must enter two integers, check if the first number exists within the set already defined previously. If it exists, I should insert the second integer in...
asked by 14.10.2018 / 00:04
1
answer

Pass lambda expression from the command line

I created a program to calculate the definite integral of a function, but I want to be able to execute it by the terminal. #include <iostream> #include <functional> #include <cmath> #define PI acos(-1) using namespace std;...
asked by 24.07.2016 / 03:04