C++ doesn't know what a key is. C++ has no concept of the keyboard. Even if it did, the OS is in charge of hardware so the OS moderates everything to do with hardware.
If you want to know something about the keyboard, you have to ask the OS about it. This can only be done through the OS API. Maybe you call the OS API, maybe you call some other function which calls the OS API, but however it's done, it goes through the OS.
this looks like gaming stuff.
gaming stuff may prefer to use directinput or xinput or whatever it is called now to get real time keyboard controls. I believe you can simply at any time find out what the device is saying right now. This is different from getch because it can also give you the state of shift or alt or similar keys that getch cannot read.