dimanche 10 avril 2022

use of deleted function 'std::pair

I am using std::pair<string, string> and make_pair() to create a std::map using this pair of strings. But I am getting the following compilation error:

/opt/rh/devtoolset-7/root/usr/include/c++/7/ext/new_allocator.h:140:22: error: use of deleted function 'std::pair<const std::pair<std::basic_string<char>, std::basic_string<char> >, firmware_data>::~pair()'
  destroy(_Up* __p) { __p->~_Up(); }

The declarations I have done is as follows:

typedef std::pair<std::string, string> FirmwareKey_t;
typedef std::map<FirmwareKey_t, firmware_data_t> FirmwareDataMap_t;

Where firmware_data_t is a struct object, defined as:

typedef struct firmware_data {
  string name;
  value_t abc; // value_t is of union type
  bool configurable;
  update_status_t def; //update_status_t is of enum type

} firmware_data_t;

Aucun commentaire:

Enregistrer un commentaire