T * data ()
pvector_info pinfo = ngGet_Vec_Info();double * pMyVector = pinfo->v_realdata; //указатель на нужную область памяти//хотелось бы что то на подобии этогоQVector<double> data(30000, pMyVector); //!!! нет такого, а хочется//а потом, например, отсортироватьsort(data);
double * pMyVector = new double[30000];QVector<double> data(30000);data.data() = pMyVector;
std::vector<double> tmpData; tmpData.assign(array, array + numberOfElementsInArray); myData.fromStdVector(tmpData);
C++ (Qt) static inline QVector<T> fromStdVector(const std::vector<T> &vector) { QVector<T> tmp; tmp.reserve(int(vector.size())); qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
C++ (Qt)myData.reserve(numberOfElementsInArray);memcpy(myData.data(), array, sizeof(double) * numberOfElementsInArray);
pvector_info pinfo = ngGet_Vec_Info(*currV); std::vector<double> tmpData(pinfo->v_length); tmpData.assign(pinfo->v_realdata, pinfo->v_realdata + pinfo->v_length); QVector<double> data = QVector<double>::fromStdVector(tmpData); double * newData = data.data(); double * newData2 = tmpData.data(); msgOut << "value : " << data[0]<< endl; msgOut << "value located : " << (long)pinfo->v_realdata << endl; msgOut << "value 1 located : " << (long)newData << endl; msgOut << "value 2 located : " << (long)newData2 << endl;
value : 1.38062e-23value located : 6683232value 1 located : 6812160value 2 located : 6812112
pvector_info pinfo = ngGet_Vec_Info(*currV); QVector<double> data(pinfo->v_length); memcpy(data.data(), pinfo->v_realdata, pinfo->v_length * sizeof(double));
myData.reserve(numberOfElementsInArray);memcpy(myData.data(), array, sizeof(double) * numberOfElementsInArray);