I would say it is better to keep your variable member Sequence
as a std::vector
(and not a pointer
to std::vector
). As you mentioned "vectors wrap the dynamic array allocation": std::vector
manages for you the memory (heap allocation / deallocation / reallocation) in a RAII
fashion:
When you write: std::vector<Nucleotide> Sequence
, Sequence
stores the objects Nucleotide
on the heap
(not on the stack
)
One suggestion: in your constructor, you are passing the std::vector
by value (as well as the std::string
). Passing by value is expensive if your std::vector
has a large size. You need to consider if passing by reference can be applied in your case.