|
Bugzilla – Full Text Bug Listing |
| Summary: | Smart pointers don't interact well with STL containers | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Gustavo J. A. M. Carneiro <gjcarneiro> |
| Component: | core | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P1 | ||
| Version: | pre-release | ||
| Hardware: | PC | ||
| OS: | All | ||
| Attachments: | test program | ||
|
Description
Gustavo J. A. M. Carneiro
2007-10-05 14:04:40 UTC
Created attachment 72 [details]
test program
OK, it really was operator < missing. OK to commit this?
template <typename T>
bool operator < (Ptr<T> const &lhs, Ptr<T> const &rhs)
{
return PeekPointer<T> (lhs) < PeekPointer<T> (rhs);
}
Looks OK to me. Looks good to me although we have agreed to use the "const Foo" syntax rather than the "Foo const" syntax, so, the operator declaration should look like this:
template <typename T>
bool operator < (const Ptr<T> &lhs, const Ptr<T> &rhs)
{
return PeekPointer<T> (lhs) < PeekPointer<T> (rhs);
}
It is Foo const because of copy-pasting similar code already in ptr.h :-) I prefer const Foo as well; highlights better in gnu emacs ;-) |