// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_C_CALLBACK_SUPPORT_H_ #define LIB_JXL_BASE_C_CALLBACK_SUPPORT_H_ #include namespace jxl { namespace detail { template struct MethodToCCallbackHelper {}; template struct MethodToCCallbackHelper { template static R Call(void *opaque, Args... args) { return (reinterpret_cast(opaque)->*method)( std::forward(args)...); } }; } // namespace detail } // namespace jxl #define METHOD_TO_C_CALLBACK(method) \ ::jxl::detail::MethodToCCallbackHelper::Call #endif // LIB_JXL_BASE_C_CALLBACK_SUPPORT_H_