Skip to content

Commit cb71b70

Browse files
committed
Replace std::result_of with decltype
std::result_of is deprecated in C++17 and removed in C++20. This could be replaced by a wrapper type trait that dispatches to std::invoke_result_t for C++17 and later or to std::result_of for earlier versions but since it is only used in one place for nullary functors, decltype will be simpler.
1 parent f7919cb commit cb71b70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/cinder/app/AppBase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ class CI_API AppBase {
408408
void dispatchAsync( const std::function<void()> &fn );
409409

410410
template<typename T>
411-
typename std::result_of<T()>::type dispatchSync( T fn );
411+
decltype(std::declval<T>()()) dispatchSync( T fn );
412412

413413
//! Returns the default Renderer which will be used when creating a new Window. Set by the app instantiation macro automatically.
414414
RendererRef getDefaultRenderer() const { return mDefaultRenderer; }
@@ -614,12 +614,12 @@ inline ::CGContextRef createWindowCgContext() { return (std::dynamic_pointer_cas
614614
//@}
615615

616616
template<typename T>
617-
typename std::result_of<T()>::type AppBase::dispatchSync( T fn )
617+
decltype(std::declval<T>()()) AppBase::dispatchSync( T fn )
618618
{
619619
if( isMainThread() )
620620
return fn();
621621
else {
622-
typedef typename std::result_of<T()>::type result_type;
622+
typedef decltype(std::declval<T>()()) result_type;
623623
std::packaged_task<result_type()> task( std::move( fn ) );
624624

625625
auto fute = task.get_future();

0 commit comments

Comments
 (0)