0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
openvpn3/test/misc/rc.cpp

41 lines
653 B
C++
Raw Normal View History

#include <iostream>
#include <openvpn/log/logsimple.hpp>
#include <openvpn/common/types.hpp>
#include <openvpn/common/exception.hpp>
#include <openvpn/common/rc.hpp>
using namespace openvpn;
class Test : public RC<thread_safe_refcount>
{
public:
typedef boost::intrusive_ptr<Test> Ptr;
Test()
{
OPENVPN_LOG("Test()");
}
~Test()
{
OPENVPN_LOG("~Test()");
}
};
int main(int /*argc*/, char* /*argv*/[])
{
try {
Test::Ptr t1 = new Test();
Test::Ptr t2(t1);
Test::Ptr t3(t2);
}
catch (const std::exception& e)
{
std::cerr << "Exception: " << e.what() << std::endl;
return 1;
}
return 0;
}