本文整理汇总了C++中ndt::type::storage_type方法的典型用法代码示例。如果您正苦于以下问题:C++ type::storage_type方法的具体用法?C++ type::storage_type怎么用?C++ type::storage_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ndt::type
的用法示例。
在下文中一共展示了type::storage_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: type
/**
* Makes an unaligned type to view the given type without alignment requirements.
*/
inline ndt::type make_view(const ndt::type& value_type, const ndt::type& operand_type) {
if (value_type.get_kind() != expr_kind) {
return ndt::type(new view_type(value_type, operand_type), false);
} else {
// When the value type has an expr_kind, we need to chain things together
// so that the view operation happens just at the primitive level.
return value_type.extended<base_expr_type>()->with_replaced_storage_type(
ndt::type(new view_type(value_type.storage_type(), operand_type), false));
}
}
示例2: type
/**
* Makes a conversion type to convert from the operand_type to the value_type.
* If the value_type has expression_kind, it chains operand_type.value_type()
* into value_type.storage_type().
*/
inline ndt::type make_convert(const ndt::type& value_type, const ndt::type& operand_type,
assign_error_mode errmode = assign_error_default) {
if (operand_type.value_type() != value_type) {
if (value_type.get_kind() != expression_kind) {
// Create a conversion type when the value kind is different
return ndt::type(new convert_type(value_type, operand_type, errmode), false);
} else if (value_type.storage_type() == operand_type.value_type()) {
// No conversion required at the connection
return static_cast<const base_expression_type *>(
value_type.extended())->with_replaced_storage_type(operand_type);
} else {
// A conversion required at the connection
return static_cast<const base_expression_type *>(
value_type.extended())->with_replaced_storage_type(
ndt::type(new convert_type(
value_type.storage_type(), operand_type, errmode), false));
}
} else {
return operand_type;
}
}
示例3: make_unaligned
ndt::type ndt::make_unaligned(const ndt::type& value_type)
{
if (value_type.get_data_alignment() > 1) {
// Only do something if it requires alignment
if (value_type.get_kind() != expr_kind) {
return ndt::make_view(
value_type, ndt::make_fixed_bytes(value_type.get_data_size(), 1));
} else {
const ndt::type &sdt = value_type.storage_type();
return ndt::type(
value_type.extended<base_expr_type>()->with_replaced_storage_type(
ndt::make_view(sdt,
ndt::make_fixed_bytes(sdt.get_data_size(), 1))));
}
} else {
return value_type;
}
}