moved all refptr functions into util/refptr.h since they are templated, deleted util/refptr.cc, updated test/tests.cc to test refptr functionality

git-svn-id: svn://anubis/fart/trunk@92 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-02-10 00:10:04 +00:00
1 parent 498d35274d
commit e2424337d6
3 files changed
+81 -68

No files matched your search

+24 -10
View File
@@ -3,19 +3,33 @@
#include <cassert>
#include "util/Transform.h"
#include "shapes/Sphere.h"
#include "util/refptr.h"
using namespace std;
class S
{
public:
S(int val)
{
cout << "S constructor, val " << val << endl;
this->val = val;
}
~S() { cout << "S destructor, val " << val << endl; }
int val;
};
int main()
{
Sphere s(1.0);
Ray ray(Vector(0, -2.5, 0), Vector(0, 1, 0));
Shape::IntersectList res = s.intersect(ray);
for (unsigned int i = 0; i < res.size(); i++)
{
cout << "t: " << res[i] << endl;
}
S * a = new S(42);
S * b = new S(33);
cout << "a: " << a << endl;
cout << "b: " << b << endl;
cout << "Creating arp" << endl;
refptr<S> arp(a);
cout << "Creating brp" << endl;
refptr<S> brp(b);
cout << "Going to assign brp to arp" << endl;
arp = brp;
cout << "ok, exiting" << endl;
return 0;
}