Boost logo

Boost :

From: tom.widmer_at_[hidden]
Date: 2001-08-23 12:27:39


Would I be right in saying that a std::pair<int, int> is a POD type? Yet boost::is_POD<std::pair<int, int> >::value == false :(

Is there any chance that std::pair specialisations can be added to type_traits? Obviously, with compiler support there wouldn't be a problem, but my compiler doesn't have it yet (does anyone's?).

The obvious implementation goes something like:

template <class U, class V>
struct is_POD<std::pair<U, V> >
{
  static bool const value = boost::type_traits::ice_and<is_POD<U>::value, is_POD<V>::value >::value;
};

//same for has_trivial_copy, etc

The same could also be done for tuple perhaps (is it a POD if its members are PODs?).

In a bit of test code where messages (containing 10 element vectors of pairs) were being sent down a posix mqueue and received in the same program, adding the code above realised about a 33% speed increase (my library persists vectors of PODs using memcpy)!

Incidently, I'm finally using boost in production real-time code, and it's great! I just need to go through removing my own proprietry stuff where appropriate.

Tom


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