是否有valarray的连续内存对齐? [英] Does valarray have contiguous memory alignment?

查看:116
本文介绍了是否有valarray的连续内存对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确实的valarray 要有连续的内存对齐?

Does valarray have contiguous memory alignment?

我要valarray中传递(从IPPS)的函数,它只需指针,通过传递&放大器; myValarray [0] 。但因此,我应该是肯定的,那的valarray的内存对齐是连续的。

I want to pass a valarray to a function (from IPPS), which only takes pointers, by passing &myValarray[0]. But therefore I should be sure, that valarray's memory alignment is contiguous.

谢谢!

推荐答案

假设你问一个valarray的管理的内存是否被保证的连续的,那么答案是肯定的,至少如果对象不是常量(C ++ 03,§26.3.2.3/ 3或C ++ 11,§26.6.2.4/ 2):

Assuming you're asking whether the memory managed by a valarray is guaranteed to be contiguous, then the answer is yes, at least if the object isn't const (C++03, §26.3.2.3/3 or C++11, §26.6.2.4/2):

这位前pression&放大器;一个[I + J] ==&放大器;一个由[i] + j的评估所有为size_t作为真正的我,并为size_tĴ这样
  条件是i + j是小于非恒定阵列的长度的

The expression &a[i+j] == &a[i] + j evaluates as true for all size_t i and size_t j such that i+j is less than the length of the non-constant array a.

这篇关于是否有valarray的连续内存对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆