template <typename T_TYPE, typename T_RET, typename T_DELETE_POLICY> class ToRef: public boost::tuple<T_TYPE*const&, T_RET, T_DELETE_POLICY> { public: ToRef<T_TYPE, T_RET, T_DELETE_POLICY>(T_TYPE*const& p_type, const T_DELETE_POLICY delete_policy) : boost::tuple<T_TYPE*const&, T_RET, T_DELETE_POLICY>(p_type, p_type!=NULL, delete_policy) { } }; template <typename T_TYPE> class ToRef<T_TYPE, bool, bool>: public boost::tuple<T_TYPE*const&, bool, bool> { public: explicit ToRef<T_TYPE, bool, bool>(T_TYPE*const& p_type, const bool delete_policy) :boost::tuple<T_TYPE*const&, bool, bool>(p_type, p_type!=NULL, delete_policy) { } ~ToRef() {
In your case, this may work as follows
int returnLength() { if (!next) return 1; sa::ToRef<Stest, bool, bool> testRef(sTest, false); safe_access_start(testRef) return 1 + testRef.r_get().returnLength(); safe_access_end return 1; }
source share