Are there any good examples of C++ generation of tiles on tilemaps?

I’m working on a hex based wargame and am looking for any good examples or tutorials of how to programmatically generate maps using tilemaps. I found examples on how to do that using the UI, but I haven’t been able to find anything about how to do that using C++.

I plan to populate multiple layers of a tilemap using tiles specified by C++ code as well as creating an editor to allow the user to create their own maps. The multiple layers are needed for terrain/roads/rivers/units/etc.

Thanks,
Ralph