Boost logo

Boost :

From: tom.widmer_at_[hidden]
Date: 2001-08-24 12:11:19


--- In boost_at_y..., John Maddock <John_Maddock_at_c...> wrote:
>
> >Would I be right in saying that a std::pair<int, int> is a POD type?<
>
> On second thoughts, std::pair is required to have three overloaded
> constructors, so it can never be a POD, of course some of the
> has_trivial_XXX cases may be true (but not has_trivial_constructor
> obviously) but only in specific cases, and possibly implementation
> dependent....

Ahh, I see - I'll have to check out the definition of POD when I get home - I suppose they can't have any user defined constructors then. But all I really need is has_trivial_copy and I suppose has_trivial_destructor, so I can memcpy into an already constructed pair (is that necessary and sufficient to allow memcpy?)

I suppose std::pair could legally (but perversely) be implemented holding its members as pointers to heap allocated objects. std::swap would be fast at least! So would we need a BOOST_TRIVIAL_PAIR config define, presumably valid for all current std libs?

Tom


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk