I tried changing some of my code that used std::vector to using
boost::ptr_vector<foo> (to get automatic deallocation and the slightly
nicer syntax), but the resulting compiled code seems oddly bloated
compared to the original code using std::vector. My intuition is that
the two should generally compile to largely equivalent object code,
except where there's a necessary functional difference.
Some of the problem seems to be that it does null-pointer checking at
_access_ time, instead of when adding new entries. The result is that
(for instance) calls to operator[] end up with an "unnecessary" null
check, which drags in tons of stuff related to the accompanying
assertion failure, some of which is apparently unshared across object
files, like the long __PRETTY_FUNCTION__ strings passed to the assertion
failure call.
What's the general impression people have of boost::ptr_vector and
related classes? Do people use it? Does it have a "bloat" reputation?
Thanks,
-Miles
--
"Suppose we've chosen the wrong god. Every time we go to church we're
just making him madder and madder." -- Homer Simpson