Rashmistrz Temat założony przez niniejszego użytkownika |
Inicjalizacja stałej statycznej w danej klasie. » 2016-03-28 14:14:17 Po prostu błąd kompilacji, według mnie "powinno" być wszystko dobrze, a nie jest. Oto błędy: ||=== Build file: "no target" in "no project" (compiler: unknown) ===| E:\CACHE\011\XOXOXO\bitcounter.hpp|8|error: 'constexpr' needed for in-class initialization of static data member 'const char bitcounter::ptr [33]' of non-integral type [-fpermissive]| E:\CACHE\011\XOXOXO\bitcounter.hpp|12|error: 'constexpr' needed for in-class initialization of static data member 'const char* bitcounter::belongs_to [9]' of non-integral type [-fpermissive]| ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Oto kod: class bitcounter { static const char ptr[ 33 ] = { 3, 1, 4, 7, 2, 1, 5, 3, 1, 6, 8, 2, 2, 4, 4, 2, 5, 7, 8, 2, 2, 6, 3, 3, 4, 8, 2, 3, 5, 3, 3, 6, 7 }; static const char * belongs_to[ 9 ] = { ptr + 0, ptr + 4, ptr + 7, ptr + 11, ptr + 14, ptr + 19, ptr + 22, ptr + 26, ptr + 29 }; char linie = 0; short liczniki = 0xFFFF; public: char increment( int ); };
|