// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. #ifndef INCLUDED_GRAS_DETAIL_ELEMENT_HPP #define INCLUDED_GRAS_DETAIL_ELEMENT_HPP #include namespace gras { //! Weak element overload for the case of shared_ptr container struct WeakContainerSharedPtr : WeakContainer { WeakContainerSharedPtr(boost::weak_ptr weak_self) { _weak_self = weak_self; } boost::shared_ptr lock(void) { return _weak_self.lock(); } boost::weak_ptr _weak_self; }; template inline Element::Element(const boost::shared_ptr &elem) { //the container is a shared pointer, so save the reference elem->set_container(new WeakContainerSharedPtr(elem)); //initialize this new Element from the argument passed *this = *elem; } } //namespace gras #endif /*INCLUDED_GRAS_DETAIL_ELEMENT_HPP*/