The classic interview trap applies even at compile time: checking only child against parent is NOT enough — a grandchild can violate the order against the grandparent. The correct check carries an allowed (lo, hi) range down the recursion. Here the recursion runs on types and the ranges are template parameters.
A binary tree is encoded in types: TreeNode<5, TreeNode<3>, TreeNode<8>>. Implement is_bst_v<Tree> — a compile-time check that the tree is a valid binary search tree: everything in the left subtree is smaller, everything in the right is larger, recursively.
Carry two bounds through the recursion: the left child must fit in (lo, V), the right in (V, hi).
Make the bounds long long and start wider than any int — then the root accepts every int value.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.