.
-, , NNodes . std::vector::size(). , std::vector::back() : return &N.back();.
, , , const-reference: const string& h. , * const, .
:
node n;
N.push_back(n);
N[NNodes].setname(h);
node , const string& . , node , :
node n(h);
N.push_back(n);
:
N.push_back(node(h));
.
-, , vector ; , . , reserve() , . , .
. , , . , , , . Simulator::FindNode a size_t N.size() - 1. node& GetNode(size_t index), return N[index]; ( , ). , , GetNode, node .
- . , deque. , vector. push_back pop_back O (1), - -. (, , deque push_front pop_front O (1) )
, deque push pop . , . deque ( - ), .
, , . . , std::map, , . , .
< > * : const-reference, (, int, double ..), sizeof(void*), .
:
void foo(const std::string& s)
{
std::string ss(s);
}
:
void foo(std::string s)
{
}
>