I saw similar examples, but didn't understand them fully so please don't mark this as duplicate straight away.
I think there's a simple solution for my problem, and I'm only learning C++.
I want to use:
template<class T, std::size_t N>
class arnas_array {
//a copy of std:array functionality, basically, here.
};
in another class header, another file, example:
class options_databaze {
public:
struct options_to_save{
arnas_array<char, 123> option_name;
//char option_name[103];
int * option_value_pointer;
};
};
And I can't get it to work. Forward declaration like this won't work:
template<class T, std::size_t N>
class arnas_array;
I don't know much about this problem, first time I'm stuck here, any examples are gold.
error C2079: 'options_databaze::options_to_save::option_name' uses undefined class 'arnas_array<char,123>'
struct options_to_save). You can declare a member that's a pointer to that type, however (data pointers are all the same size regardless of their type). (And you're missing a;at the end of your class definition, but I'm sure that's just a copy-paste error.)arnas_arrayin a header (I'm assuming that's already the case since it's templated) and include that header before you defineoptions_databaze.