hex
头文件“boost/algorithm/hex.hpp” 包含了两个算法:hex、unhex以及他们各自的三个版本的变体。hex将一个序列元素转换为十六进制数,unhex功能正好相反。hex 和 unhex ,来源于MySQL,原来他们用在数据库中做查询和保存程序用。
接口
hex函数带一个值序列,并写入十六进制字符。有是三个不同的接口,这些接口仅仅是传入传入参数有所不同。第一个接口带一对迭代器做形参;第二个接口带一个指针,该指针指向以0结尾的序列的起始位置,就是指向一个类似C格式的字符串的起始位置;第三个接口带一个通过Boost.Range库限定的一个集合。
官方接口
template <typename InputIterator, typename OutputIterator>
OutputIterator hex ( InputIterator first, InputIterator last, OutputIterator out );
template <typename T, typename OutputIterator>
OutputIterator hex ( const T *ptr,