eo-cxx: Added default-constructor to wref type

This commit is contained in:
Felipe Magno de Almeida 2014-07-17 15:29:31 -03:00
parent e256a92eb1
commit df1c03b56b
1 changed files with 13 additions and 4 deletions

View File

@ -18,8 +18,16 @@ namespace efl { namespace eo {
/// @brief Weak references to an <em>EO Object</em>. /// @brief Weak references to an <em>EO Object</em>.
/// ///
template<typename T> template<typename T>
struct wref { struct wref
{
/// @brief Default constructor.
///
/// Create a empty weak reference.
///
wref() : _eo_wref(nullptr)
{
}
/// @brief Class constructor. /// @brief Class constructor.
/// ///
/// @param obj The <em>EO Object</em> to be referenced. /// @param obj The <em>EO Object</em> to be referenced.
@ -46,8 +54,9 @@ struct wref {
/// ///
~wref() ~wref()
{ {
if(eina::optional<T> p = lock()) if(_eo_wref)
_del(); if(eina::optional<T> p = lock())
_del();
} }
/// @brief Try to acquire a strong reference to the underlying /// @brief Try to acquire a strong reference to the underlying