How could i sort vector of structures right after creating them by their int value using lower_bound function combined with lambda ? ( 1 line function )
vector<test*> v;
val = 10;
test * tmp = new test ( val, "Alex" );
/* something like this :
* auto it = lower_bound ( v . begin (), v . end (), val , [&] ( ) -> bool {} );
*/
v . insert ( it, tmp );
Structure:
class test
{
test ( int val , string name ) : val ( val ), name ( name ) { }
int val;
string name;
};