c++ - Error: Assigning to an array from an initializer list -


i have class such as:

class dialog {     public:     double dreturntype[][5][3]; }; 

 

#include <cstdlib> #include <iostream> include <string>  using namespace std; #include "dialog.h";  int main(int argc, char *argv[]) {     dialog people;     people.dreturntype[0][1] = {1.2,2.3,6.6};     return 0; } 

it returns:

[warning] extended initializer lists available -std=c++11 or -std=gnu11 [enabled default] [error]: assigning array initializer list

i've looked online bit , couldn't find way around this. i'd prefer not editing class within it's on class file (kinda defeats purpose). help?

note: class in separate project file

initializer lists usable during initialization.

if want use std::initializer_list after initialization:

auto init = std::initializer_list<double>({1.2,2.3,6.6}); std::copy(init.begin(), init.end(), your_array); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -