onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

Use inline variable to simplify C++ API header

Open RyanUnderhill opened this issue 3 years ago • 2 comments

Description: The header was originally written for pre C++17, but with C++17 we can just use an inline variable and avoid the template approach.

I was tempted to replace all GetApi() calls with just 'api'. I'd probably leave the 'GetApi()' method as it's documented and people are likely using it for C/C++ interop. No need to break them over one line of header savings.

Motivation and Context A simpler and easier to read public header is always better.

RyanUnderhill avatar Jun 09 '22 00:06 RyanUnderhill

We can't require all our customers using C++17. While we can choose which C++ standard to use for our code, we can't make the decision for our customers.

snnn avatar Jun 09 '22 04:06 snnn

We can't require all our customers using C++17. While we can choose which C++ standard to use for our code, we can't make the decision for our customers.

Darn, I knew builds required a C++17 compiler. Where do we say the minimum C++ version to include our headers?

RyanUnderhill avatar Jun 09 '22 04:06 RyanUnderhill