Closed suziW closed 1 year ago
univector does not use std::allocator by default, so you can not simply assign it to std::vector. However, you can get a univector from std::vector via make_univector. You may use std::allocator by defining KFR_USE_STD_ALLOCATION according to sources.
Pardon my ignorance, as I'm still a C++ novice. I have my own application that uses libraries that only work with std::vector, but I'd like to use KFR to do some of my DSP functions. Is there not a way to convert from std::univector back to std::vector? Also, the make_univector function appears to want double* as input and not std::vector, so can make_univector just take in a variable directly say of type std::vector
Pardon my ignorance, as I'm still a C++ novice. I have my own application that uses libraries that only work with std::vector, but I'd like to use KFR to do some of my DSP functions. Is there not a way to convert from std::univector back to std::vector? Also, the make_univector function appears to want double* as input and not std::vector, so can make_univector just take in a variable directly say of type std::vectorstd:float?
Please read the docs at https://www.kfrlib.com/newdocs/types/
univector is a std::vector sort of.
std::vector
std::copy(vector.begin(),vector,end(),uni.begin())
univector2D is just a vector of vectors
univector is std::vector internally but it uses a custom allocator that ensures that memory is properly aligned (cache line alignment is default). Instances of std::vector with different allocators are not directly assignable by C++ standards.
Another way to use std::vector in KFR is to wrap it in a univector_ref using make_univector
function. The data will be used directly without redundant copies. This works for both reading and writing external data in KFR functions.
Closed due to inactivity. Feel free to reopen if the problem still exists.
I am using kfr as an extern library, and need to expose my interface using std::vector to avoid integrate kfr in my package. How should I do the convertion?