URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
struct __shared_count {
|
struct __shared_count {
|
__shared_count() { _M_pi = new int; }
|
__shared_count() { _M_pi = new int; }
|
int * _M_pi;
|
int * _M_pi;
|
};
|
};
|
template
|
template
|
class __shared_ptr {
|
class __shared_ptr {
|
public:
|
public:
|
__shared_ptr(_Tp* __p);
|
__shared_ptr(_Tp* __p);
|
void reset(int * __p) {
|
void reset(int * __p) {
|
__shared_ptr(__p).swap(*this);
|
__shared_ptr(__p).swap(*this);
|
}
|
}
|
void swap(__shared_ptr<_Tp>& __other) {
|
void swap(__shared_ptr<_Tp>& __other) {
|
__other._M_refcount._M_pi = _M_refcount._M_pi;
|
__other._M_refcount._M_pi = _M_refcount._M_pi;
|
}
|
}
|
__shared_count _M_refcount;
|
__shared_count _M_refcount;
|
};
|
};
|
template class shared_ptr : public __shared_ptr<_Tp> {};
|
template class shared_ptr : public __shared_ptr<_Tp> {};
|
int main() {
|
int main() {
|
for (shared_ptr *iter;;)
|
for (shared_ptr *iter;;)
|
{
|
{
|
try {
|
try {
|
(iter++)->reset(new int);
|
(iter++)->reset(new int);
|
}
|
}
|
catch (...) {
|
catch (...) {
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.