Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template float_mem_cast

boost::sort::spreadsort::float_mem_cast — Casts a float to the specified integer type.

Synopsis

// In header: <boost/sort/spreadsort/float_sort.hpp>


template<typename Data_type, typename Cast_type> 
  Cast_type float_mem_cast(const Data_type & data);

Description

Example: 

struct rightshift {
  int operator()(const DATA_TYPE &x, const unsigned offset) const {
    return float_mem_cast<KEY_TYPE, CAST_TYPE>(x.key) >> offset;
  }
};

Template Parameters:

Cast_type

Integer type (same size) to which to cast.

Data_type

Floating-point IEEE 754/IEC559 type.


PrevUpHomeNext