STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
Concurrency::_Radix_sort_default_function< _DataType > Struct Template Reference

#include <ppl.h>

Public Member Functions

size_t operator() (const _DataType &val) const
 

Member Function Documentation

template<typename _DataType>
size_t Concurrency::_Radix_sort_default_function< _DataType >::operator() ( const _DataType &  val) const
inline
5641  {
5642  // An instance of the type predicate returns the value if the type _DataType is one of the integral types, otherwise it
5643  // statically asserts.
5644  // An integral type is one of: bool, char, unsigned char, signed char, wchar_t, short, unsigned short, int, unsigned int, long,
5645  // and unsigned long.
5646  // In addition, with compilers that provide them, an integral type can be one of long long, unsigned long long, __int64, and
5647  // unsigned __int64
5648  static_assert(std::is_integral<_DataType>::value,
5649  "Type should be integral to use default radix function. For more information on integral types, please refer to http://msdn.microsoft.com/en-us/library/bb983099.aspx.");
5650  static_assert((sizeof(_DataType) <= sizeof(size_t)), "Passed Type is bigger than size_t.");
5651 
5652  if (std::is_unsigned<_DataType>::value)
5653  {
5654  return val;
5655  }
5656  else
5657  {
5658  // The default function needs to take the signed integer-like representation and map it to an unsigned one. The
5659  // following code will take the midpoint of the unsigned representable range (SIZE_MAX/2)+1 and does an unsigned
5660  // add of the value. Thus, it maps a [-signed_min,+signed_max] range into a [0, unsigned_max] range.
5661  return (((SIZE_MAX/2) + 1) + static_cast<size_t>(val));
5662  }
5663  }
#define SIZE_MAX
Definition: limits.h:81

The documentation for this struct was generated from the following file: