add FbTk::makeRef function, for easier construction of RefCount pointers

This commit is contained in:
Pavel Labath 2011-07-10 14:20:18 +02:00
parent cfcc4d44aa
commit 2e75d238ab

View file

@ -134,6 +134,26 @@ void RefCount<Pointer>::incRefCount() {
(*m_refcount)++; (*m_refcount)++;
} }
template <typename Pointer>
inline RefCount<Pointer> makeRef() {
return RefCount<Pointer>(new Pointer);
}
template <typename Pointer, typename Arg1>
inline RefCount<Pointer> makeRef(const Arg1 &arg1) {
return RefCount<Pointer>(new Pointer(arg1));
}
template <typename Pointer, typename Arg1, typename Arg2>
inline RefCount<Pointer> makeRef(const Arg1 &arg1, const Arg2 &arg2) {
return RefCount<Pointer>(new Pointer(arg1, arg2));
}
template <typename Pointer, typename Arg1, typename Arg2, typename Arg3>
inline RefCount<Pointer> makeRef(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) {
return RefCount<Pointer>(new Pointer(arg1, arg2, arg3));
}
} // end namespace FbTk } // end namespace FbTk
#endif // FBTK_REFCOUNT_HH #endif // FBTK_REFCOUNT_HH