Login Page - Create Account

Support Board


Date/Time: Thu, 26 Dec 2024 17:08:07 +0000



how to passing dynamically allocated vectors in preferred ascil syntax to functions

View Count: 723

[2015-12-18 04:14:21]
enemyspy - Posts: 306
Just one more question this year about specific to syntax for passing dynamically allocated vectors to function could not find solution on stack overflow or youtube:

now using this syntax:
std::vector <int> *SwingIndex = (std::vector <int>*)sc.GetPersistentPointer(1);
instead of this previous syntax:
static std::vector<int> SwingIndex;
Example below is what would work to get the whole vector accessible within the function. Need to figure out how to do this with the persistent pointer syntax.
void myfunction(std::vector<int>& SwingIndex)
{
int x=SwingIndex.at(5);
}

int y = myfunction(SwingIndex);

followed examples to initialize in the Http request example study, and works great when not being passed to function swapping . with -> ....My backtests hull ass now but a big compenent of a study is missing until I get this figured out.
Date Time Of Last Edit: 2015-12-18 04:30:49

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account