Hi NorbertSz,

you'll need to learn more about C++ string literals and pointers.

char* is a pointer so it has an address in memory.

Two different locations in memory might have the value but different addresses.

This is what happening with your code char* Asset has one address and the literal string "EURUSD" has another address, they are treated as different keys when used with the map.

E.g check this
Code
  printf("\n%s %s", Asset, "EURUSD");
  printf("\n%p %p", Asset, "EURUSD");


You probably need to cast them to std::string and use it as a key in your map.

e.g.
Code
std::string key1(Asset);
std::string key2("EURUSD");

map<string, map<int, deque<double>>> prices;
prices[key1] = ...;
... = prices[key2];


C++ also converts char* to string automatically. So this code works the same way:

Code
prices[Asset] = ...;
... = prices["EURUSD"];


example

P.S. concurrency issue with Andrew above laugh

Last edited by alun; 09/18/22 16:56.