mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-16 21:00:14 +00:00
Enable cpp20 builds for DML EP and WinML API 1) Missing typename for templated types 2) unmove helper for inline references to rvalue temporaries This is okay since per the standard a temporary bound to a reference parameter in a function call exists until the end of the full expression containing that function call: if the function returns a reference, which outlives the full expression, it becomes a dangling reference. 3) static now not needed for template specializations --------- Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
// STL
|
|
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
|
#define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
|
|
|
|
#include <algorithm>
|
|
#include <cassert>
|
|
#include <codecvt>
|
|
#include <functional>
|
|
#include <iterator>
|
|
#include <locale>
|
|
#include <numeric>
|
|
#include <sstream>
|
|
#include <tuple>
|
|
#include <type_traits>
|
|
#include <unordered_map>
|
|
#include <utility>
|
|
#include <variant>
|
|
#include <vector>
|
|
#include <thread>
|
|
#include <tuple>
|
|
|
|
// WIL
|
|
#include <wil/cppwinrt.h>
|
|
#include <wil/result.h>
|
|
#include <wil/winrt.h>
|
|
|
|
// Windows pollutes with preprocessor that redefine OPTIONAL.
|
|
// Undefine OPTIONAL to get onnx macros to resolve correctly.
|
|
#ifdef OPTIONAL
|
|
#undef OPTIONAL
|
|
#endif
|
|
|
|
#pragma warning(disable : 4100)
|
|
|
|
// Telemetry
|
|
#include "WinMLTelemetryHelper.h"
|
|
// Declare global telemetry helper
|
|
extern WinMLTelemetryHelper telemetry_helper;
|
|
#ifndef WINML_TELEMETRY_DISABLED
|
|
// Declare TraceLogging provider
|
|
TRACELOGGING_DECLARE_PROVIDER(winml_trace_logging_provider);
|
|
#endif //WINML_TELEMETRY_DISABLED
|
|
|
|
// WinML
|
|
#include "errors.h"
|
|
#include "NamespaceAliases.h"
|
|
#include "StringHelpers.h"
|
|
#include "WinML_Lock.h"
|
|
|
|
template <typename T>
|
|
auto unmove_ptr(T&& t) {
|
|
return &static_cast<T&>(t);
|
|
}
|