The code is fairly idiomatic C++, except maybe for the name of the class template (BST); hardly anybody names their classes in all capital letters (note that naming template parameters [T, MAXN in this case] in all capitals is quite common). Other than that, maybe the spaces after ( and < as well as before ) and > are a matter of taste.
hardly anybody names their classes in all capital letters (note that naming template parameters [T, MAXN in this case] in all capitals is quite common)
Agreed. My code and a lot of C++ code I've seen uses uppercase for template parameters, but never for classes/structs or methods. (Actually, I generally follow the Java conventions for capitalization of class names, method/function names, constants etc, though I use underscores in local variables.)
Comments
The code is fairly idiomatic C++, except maybe for the name of the class template (BST); hardly anybody names their classes in all capital letters (note that naming template parameters [T, MAXN in this case] in all capitals is quite common). Other than that, maybe the spaces after ( and < as well as before ) and > are a matter of taste.
hardly anybody names their classes in all capital letters (note that naming template parameters [T, MAXN in this case] in all capitals is quite common)
Agreed. My code and a lot of C++ code I've seen uses uppercase for template parameters, but never for classes/structs or methods. (Actually, I generally follow the Java conventions for capitalization of class names, method/function names, constants etc, though I use underscores in local variables.)