References typically are implemented as pointers ‘under the hood’, except in some cases where the compiler can figure out what the original object was and use that directly.
Either way, you can take the address as if they were the actual object.
(Although one thing you do have to be careful of is something trying to do
map.setup(File("path"), /* et cetera*/);, I believe I know a way to prevent that though.)
Needing to use pointers internally doesn’t prevent you being able to check that the user is providing an actual array though.
(And if you know how big the array should be at compile time you can even prevent the code from compiling if the array is the wrong size.)
Using constructors doesn’t prevent that.
You can use
map = ChunkMap(file, width, height, data); to have the
map object overwritten.
(In case you’re wondering if that would be more expensive than a call to
setup, it won’t be due to copy elision and move semantics.)
If you prefer you could have
map = ChunkMap::load(file, width, height, data); instead.
Unless you meant loading a different part of the data with the same file, in which case that would be more akin to a
seek function anyway, and hence completely independent to a
loadMap function or a constructor.
Whichever direction you choose, at least you’re aware of those possibilities now, and thus free to make use of them or not. (After all, when you do come to make your decisions I may not necessarily be around to make suggestions.)