In the example here: https://en.cppreference.com/w/cpp/chrono/high_resolution_clock/now
They declared the clock time point with auto.
auto start = std::chrono::high_resolution_clock::now();
and the doc says it returns 'A time point representing the current time.'
But I am not sure how do declare in my code below because I am used to declaring the variables at the beginning of the function and I don't know what to declare it as. Code has been simplified here to show what I mean. What do I put for the ????
I already tried auto there but the compiler won't allow it. auto orderRecvedTime; gives me this error:
error: non-static data member declared with placeholder 'auto'
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <string.h>
//#include "load_symbol.h"
//#include "check_symbol.h"
#include "windows.h"
#include <vector>
#include <chrono>
using namespace std;
 
class order {
  private:
    string orderID;
    ???    orderRecvedTime;
    char   buysell;
    string symbol;
    double price;
    int    qty;
  public:
    void newOrder(string &_orderID, char &_buysell, string &_symbol, double &_price, int &_qty){
        orderID = _orderID;
        buysell = _buysell;
        symbol = _symbol;
        price = _price;
        qty = _qty;
        orderRecvedTime = std::chrono::high_resolution_clock::now();
    }
  
};
int main() {
    cout << "!!!Hello once more" << endl; // prints !!!Hello once more
    vector<order> thebook;
    string user_order = "";
    string done = "done trading";
    string orderID;
    string orderaction;
    string orderRecvedTime;
    char buysell;
    string symbol;
    double price;
    int qty;
    while (user_order.compare(done) != 0) {
        cout << "enter order"<< endl;
        getline(cin, user_order);
        stringstream lineStream(user_order);
        lineStream >>orderaction>>orderID>> buysell >> symbol >> price>> qty;
 
        order user_order;
        if (orderaction.compare("D") == 0) {
            cout << "you are making a new order."<< endl;
            user_order.newOrder(orderID, buysell,symbol,price,qty);
            thebook.push_back(user_order);
        }
    }
}