Questions tagged as 'c++11'

1
answer

Using std :: less with std :: function

I'm trying to meter std::function< > into a std::set< > . For this, we need a function that compares the values entered. As std::function does not provide any comparison operator, I thought about this: #inc...
asked by 08.01.2018 / 15:34
2
answers

C ++ no match for 'operator + =' (operand types are 'float' and 'std :: chrono :: durationlong int')

I am trying to calculate the average execution time of a program, for 10 executions, for this I use the library chrono of C ++ 11, however, I'm getting an error that says there is no operator to make += , I understand that variables...
asked by 22.11.2018 / 22:14
1
answer

Avoid temporary copies in call to lambdas

I have the following class: class Utf8Writer { struct ZoneData { uint32_t begin; // codepoint inicial. uint32_t end; // codepoint final. }; const ZoneData *findCodepoint( uint32_t cp, FontId fid ); }; const ZoneData *Utf8Writer...
asked by 14.05.2018 / 11:15
2
answers

Doubt about the class vector

In an array the name of the array is a pointer to the array. So in iArray and &iArray[0] you get the same value. What I do not understand very well, is that it is happening when I try to repeat this same with myvector ....
asked by 10.05.2018 / 00:58
2
answers

Validate an object within set, list, map

class Coordenada(){ int fila; int columna; //los getter and setter } int main(){ std::set<Coordena> coordenadaSet(Coordenada(4,6)); Coordenada coordenada(5,6); if(coordendaSet.find(coordenada) != coordenadaSet.end()){...
asked by 08.10.2018 / 11:10
1
answer

Motion constructor in C ++

I am studying the movement constructor in C ++ that receives a reference to an r-value of the type of the class. The problem is that despite seeing several C ++ Deitel books and several others, I can not find anything of the movement builder...
asked by 17.01.2018 / 12:49
1
answer

You doubt how the return works

I have a question, I've been going around for a few days, and I can not understand how it works or what I'm doing wrong. Starting point: Suppose we have the following function: ArrayWrapper f(ArrayWrapper arr){ return arr }...
asked by 25.05.2018 / 01:49
2
answers

Avoid unnecessary copies

I have an object that internally stores a rather heavy collection of objects. This collection is filled on demand, that is, if the collection is not necessary it will not be filled in life: class Objeto { std::vector<int> coleccion;...
asked by 30.08.2017 / 13:26
2
answers

Pass a std :: vector by reference (Avoid Copy)

I am developing a mini-game. The classes involved in this question are: PlayState IA Terrorist. PlayState gives a Terrorist Vector to IA . Intelligence = new IA(terrorists, p->getRigidBody(), _world); The definiti...
asked by 04.07.2017 / 10:52
1
answer

Poor handling of events [SFML]

Nesesito know why my program exploits for no reason, and how could I solve it, I'm moving in the architecture of a game, very simple, for now I only have the class Stage that serves as the main event which drew in the window everything th...
asked by 05.11.2017 / 17:58