Is not just a pointer a pointer when you are not referencing it?
No, the pointer contains a value that is interpreted as a memory address. (Is it containing a value that is actually a valid memory address is another question)
- , .
int i = 5;
int* p = &i; // The value in p is the address that i is stored at.
int& r = i; // The value in r is 5, because r is an alias of i.
// Whenever you use r, it as if you typed i, and vice versa.
// (In this scope, anyway).
int sum = i + r; // Identical to i + i or r + i or r + r.
Edit:
list1 , ...?
. , , :
std::list<int>* list1 = user_defined_func();
std::list<int>& list1ref = *list1;
BOOST_CHECK_PREDICATE( validate_list, list1ref );
delete list1;
, :
std::list<int>* list1 = user_defined_func();
BOOST_CHECK_PREDICATE( validate_list, *list1 );
delete list1;
( L1. {something} L1 β {something}):
bool validate_list(std::list<int>* L1) { ... }