https://github.com/j209446/BST_bag_class-c-/blob/master/main.cpp This is my cpp file. When I built it on VS2015, I got a C2668 error An error occurs in the new operator, but I don't know why.
node->set_left(new binary_tree_node<item> ) If I do this, it comes out as ambiguous, and even if I do it like this, it's ambiguous. How do I solve it?
c++ visual-studio-2015 new operator-overloading
This is because there is a problem with the constructor declaration of binary_tree_node
.
If you look at the constructor part in the code you showed me, it is as follows.
binary_tree_node();
binary_tree_node<T>(const binary_tree_node& copy);
binary_tree_node<T>(const T& init_data = T(), binary_tree_node* init_left = NULL, binary_tree_node* init_right = NULL);
If you look at the third constructor, the default values are applied to all call factors.
binary_tree_node<int>()
This could be the first constructor, or the third constructor with all the default values applied.
To resolve the problem, remove the default values for the init_data
variable as shown below.
binary_tree_node<T>(const T& init_data, binary_tree_node* init_left = NULL, binary_tree_node* init_right = NULL);
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
578 Understanding How to Configure Google API Key
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.