本文整理汇总了C++中From::size方法的典型用法代码示例。如果您正苦于以下问题:C++ From::size方法的具体用法?C++ From::size怎么用?C++ From::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类From
的用法示例。
在下文中一共展示了From::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
To operator ()(From &arr) const
{
typename remove_const<To>::type res(arr.size());
for(std::size_t i = 0, size = arr.size(); i != size; ++i)
{
res[i] = numeric::promote<typename To::value_type>(arr[i]);
}
return res;
}
示例2: get_block
std::vector< char > get_block(
std::vector<char>::const_iterator prefix_begin, std::vector<char>::const_iterator prefix_end,
const From &from_string, typename From::size_type head_pos ) {
typename From::size_type block_size = std::min( from_string.size() * sizeof( typename From::value_type ) - head_pos, block_size );
std::vector< char > block( prefix_begin, prefix_end );
block.resize( block.size() + block_size );
std::vector< char >::iterator output_head = block.begin();
std::advance( output_head, std::distance( prefix_begin, prefix_end ) );
std::copy( reinterpret_cast<const char*>( from_string.c_str() ) + head_pos, reinterpret_cast<const char*>( from_string.c_str() ) + head_pos + block_size, output_head );
return block;
}
示例3: operator
To operator()( const From &from_string ) {
To to_string;
typename From::size_type head_pos = 0;
std::vector< char > partial_sequence;
while( 1 ) {
const std::vector< char > input_block = get_block( partial_sequence.begin(), partial_sequence.end(), from_string, head_pos );
head_pos += input_block.size() - partial_sequence.size();
const std::pair< std::vector< char >, std::vector< char > > output_block = convert_block< block_size >( cd, input_block );
const To temp = set_block( output_block.first );
partial_sequence = output_block.second;
to_string += temp;
if( head_pos == from_string.size() * sizeof( typename From::value_type ) )
break;
}
return to_string;
}