Skip to content

Questions about const #1

@CloneWolf-Jiang

Description

@CloneWolf-Jiang

Sorry, I don't speak English..............

Code:

struct WIFI_List_Struct {
  const size_t bufferSize = JSON_OBJECT_SIZE(6) + 64;
  String SSID;
  String MAC;
  int Channel;
  bool isHidden;
  int RSSI;
  String Encrypt;

  void save(const JsonVariant &obj);
  void load(JsonVariant &obj) const;
};


struct WIFI_Scan_Struct {
  int State;
  int Num;
  ArrayList<WIFI_List_Struct> WIFI_List;


  void save(const JsonVariant &obj);
  void load(JsonVariant &obj) const;
};

Error:

sketch\ArrayList.h: In instantiation of 'bool ArrayList<T>::reallocate(size_t) [with T = WIFI_List_Struct; size_t = unsigned int]':

sketch\ArrayList.h:36:9:   required from 'ArrayList<T>::ArrayList() [with T = WIFI_List_Struct]'

sketch\WIFI_Scan.h:22:8:   required from here
ArrayList.h:285:29: error: use of deleted function 'WIFI_List_Struct& WIFI_List_Struct::operator=(const WIFI_List_Struct&)'

  285 |                 newBlock[i] = m_Data[i];
      |                 ~~~~~~~~~~~~^~~~~~~~~
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions