[Ns-developers] CreateObject and non-default constructors
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Mon Jun 8 05:22:04 PDT 2009
hi,
Recently, someone pointed out to me privately that we poorly support
calling non-default constructors with CreateObject. In fact, we don't
support it. I will skip over the lengthy discussion of how we ended up
where we are today, and, instead, will get to what we could do to
support this: 2 options (patches attached).
1. compatible option (a.patch)
2. less compatible option (b.patch)
1) compatible option: introduce CreateObjectNoAttributes:
template <typename T>
Ptr<T> CreateObjectNoAttributes (void);
template <typename T, typename T1>
Ptr<T> CreateObjectNoAttributes (T1 a1);
template <typename T, typename T1, typename T2>
Ptr<T> CreateObjectNoAttributes (T1 a1, T2 a2);
...
It's not very pretty for something which appears to be regularly
complained about by users.
2) less compatible option: modify CreateObject, introduce
CreateObjectWithAttributes
Despite not being fully compatible with existing code, I expect the
fallout on users to be minimal because, frankly, no one calls
CreateObject<> with construction-time attributes so, almost no one will
notice this change.
If I hear no comments within 2 days, I will proceed with applying these
two patches to ns-3-dev together with the associated CHANGES.html notes.
regards,
Mathieu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.patch
Type: text/x-patch
Size: 2589 bytes
Desc: not available
Url : http://mailman.isi.edu/pipermail/ns-developers/attachments/20090608/08ba3d87/a.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.patch
Type: text/x-patch
Size: 9116 bytes
Desc: not available
Url : http://mailman.isi.edu/pipermail/ns-developers/attachments/20090608/08ba3d87/b.bin
More information about the Ns-developers
mailing list