You have to change the type your array element to something that can store integers and pointers (or preferably std::vector<std::uint64_t>). A type-safe approach is to use
boost::variant:
std::vector<boost::variant<std::uint64_t, std::vector<std::uint64_t>>> array;
array.push_back(1);
array.push_back(2);
array.push_back(std::vector<std::uint64_t>{4,5,6});
if (int* x = boost::get<std::uint64_t>(array[0])) { ... }
if (std::vector<std::uint64_t>* x
= boost::get<std::vector<std::uint64_t>>(array[2])) { ... }
If you want to use builtin arrays instead of vectors you can use unions instead of boost::variant:
struct IntOrArray
{
bool isInt;
union {
std::uint64_t int_value;
std::uint64_t* array_value;
}
};
std::vector<IntOrArray> array;
IntOrArray a1;
IntOrArray a1.isInt = true;
IntOrArray a1.int_value = 1;
array.push_back(a1);
IntOrArray a2;
IntOrArray a2.isInt = false;
IntOrArray a2.array_value = arrayYouGotElsewhere;
array.push_back(a2);
if (array[0].isInt) { ... }
C++11 allows you to put std::vectors into unions but this is not supported by all compilers.