diff options
| author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-25 10:15:20 -0400 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-01-05 19:34:44 +0200 |
| commit | bedd3da7c60c1615cd5102438822e8f186d4426a (patch) | |
| tree | 3ed789e04e5a01f20fc0f122aaf79198eaf34ebc /indra | |
| parent | 3fc5b69b2a6c04db9854f0758ecbb03f6da22a13 (diff) | |
Explain why apparently redundant LLPointer methods are necessary.
Given templated constructors and assignment operators, it's tempting to remove
specific constructors and assignment operators with the same LLPointer<Type>
parameters. That turns out to be a mistake. Add comments to warn future
maintainers.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llcommon/llpointer.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index c5dd5532cc..71c955c4c5 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -61,6 +61,13 @@ public: ref(); } + // Even though the template constructors below accepting + // (const LLPointer<Subclass>&) and (LLPointer<Subclass>&&) appear to + // subsume these specific (const LLPointer<Type>&) and (LLPointer<Type>&&) + // constructors, the compiler recognizes these as The Copy Constructor and + // The Move Constructor, respectively. In other words, even in the + // presence of the LLPointer<Subclass> constructors, we still must specify + // the LLPointer<Type> constructors. LLPointer(const LLPointer<Type>& ptr) : mPointer(ptr.mPointer) { @@ -126,6 +133,13 @@ public: return *this; } + // Even though the template assignment operators below accepting + // (const LLPointer<Subclass>&) and (LLPointer<Subclass>&&) appear to + // subsume these specific (const LLPointer<Type>&) and (LLPointer<Type>&&) + // assignment operators, the compiler recognizes these as Copy Assignment + // and Move Assignment, respectively. In other words, even in the presence + // of the LLPointer<Subclass> assignment operators, we still must specify + // the LLPointer<Type> operators. LLPointer<Type>& operator =(const LLPointer<Type>& ptr) { LLPointer temp(ptr); |
