element_type& operator*() const noexcept;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// shared_ptr::operator*
#include <iostream>
#include <memory>
int main () {
std::shared_ptr<int> foo (new int);
std::shared_ptr<int> bar (new int (100));
*foo = *bar * 2;
std::cout << "foo: " << *foo << '\n';
std::cout << "bar: " << *bar << '\n';
return 0;
}
foo: 200 bar: 100