Pol
Pol

Reputation: 1

How do I use <uint64_t> in an array

i'm pretty new to C++ and am trying to make an array in which every element is of a specific bit-size. I've tried doing this: Sequence<uint64_t>; In which Sequence would be the array name and every element would have a size of 64 bits. However get the following error: "error: ‘Sequence’ does not name a type" Thanks in advance!

Upvotes: 0

Views: 654

Answers (1)

wohlstad
wohlstad

Reputation: 29382

std::vector and std::array are the recomended array containers in C++.

You can use std::vector if you need a dynamic size array, e.g.:

#include <cstdint>
#include <vector>
std::vector<uint64_t> v;

And use std::array for a fixed size array, e.g.:

#include <cstdint>
#include <array>
std::array<uint64_t, 10> a;

You can see in the links above how to use these containers.

Upvotes: 5

Related Questions