C++ type_traits in kernel mode

Hi all,

As an experiment, I’m writing a toy KMDF driver in C++. I understand that there’s no STL in kernel mode, so I’ve been rolling my own type_traits-like classes. However, I’m hitting a brick wall when it comes to traits requiring compiler support, like is_final or is_union.

Would anyone know if there are plans for any sort of type_traits support in the WDK, or if I can use the MSVC’s trait intrinsics (E.g. __is_final()) in kernel mode? (I suspect doing the latter is probably UB, but one can hope…)

Thanks and best!

I would start with the intrinsics. If they don’t require rrti you should be fine. And from the looks of them, they don’t generate code outside of true/false so I don’t see a km compatibility issue unless there are other dependencies

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Thursday, February 16, 2017 1:38:44 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] C++ type_traits in kernel mode

Hi all,

As an experiment, I’m writing a toy KMDF driver in C++. I understand that there’s no STL in kernel mode, so I’ve been rolling my own type_traits-like classes. However, I’m hitting a brick wall when it comes to traits requiring compiler support, like is_final or is_union.

Would anyone know if there are plans for any sort of type_traits support in the WDK, or if I can use the MSVC’s trait intrinsics (E.g. __is_final()) in kernel mode? (I suspect doing the latter is probably UB, but one can hope…)

Thanks and best!


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

That’s great to hear - thanks Doron!