I have code that dynamically allocates a a struct containing an std::map. This works fine on Mac and Linux but aborts the program on Windows (compiled with VC 2017). Any idea why this would be?
Partial struct definition:
typedef struct trie_node_temporary_struct {
...
std::map<char, struct trie_node_temporary_struct*> child_node_map;
} trie_node_temporary_struct;
In the function:
*node = (struct trie_node_temporary_struct*)malloc(sizeof(struct trie_node_temporary_struct));
if (*node == NULL)
{
...
}
memset(*node, 0, sizeof(struct trie_node_temporary_struct));
// Initialize map
(*node)->child_node_map = std::map<char, struct trie_node_temporary_struct*>(); // <-- aborts here