Copied parts of the detection idiom library to the utils.h.
Copied parts of the detection idiom library to the utils.h.

Due to lack of C++17 support of the std library currently used.

erikvalkering/smartref,erikvalkering/smartref,erikvalkering/smartref