From 74a7f5d06569d49ad5f09e3ef8c7dcd0cd71165a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 11 Feb 2008 05:11:45 +0100 Subject: [PATCH] add big warning --- src/core/value.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/core/value.cc b/src/core/value.cc index 7248b3022..478a29b99 100644 --- a/src/core/value.cc +++ b/src/core/value.cc @@ -26,6 +26,27 @@ Value::ConvertFrom (PValue value, Ptr spec) return false; } +/*************************************************************** + * Big interesting warning. + * ------------------------ + * + * One might wonder why we re-implement a smart pointer below + * in the PValue class. This is a very good question and the answer + * is unfortunately pretty complicated. + * + * 1) We could have requested the user to use Ptr and save us + * a lot of pain. This, however, does not work because our smart + * pointer needs a special constructor which can be used to convert + * objects of type Ptr into a PtrValue to hold the pointer. + * + * 2) We could have made the m_value member variable below a Ptr + * rather than store a raw pointer. This, however, does not work + * because this would mean that the constructor PValue (Value *) + * should be morphed into PValue (Ptr) which, unfortunately, + * would conflict with the template constructor PValue (Ptr)... + * + * This is definitely not fun. + */ PValue::PValue () : m_value (0) {}