From b6b7ff57c081da37e8eeb4ae36052c618b9062c4 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 2 Apr 2022 13:30:54 -0500 Subject: [PATCH] Fix msvc compile by avoiding tuples. --- src/engine/function.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/engine/function.cpp b/src/engine/function.cpp index ee94bcca2..b5c3ea6a3 100644 --- a/src/engine/function.cpp +++ b/src/engine/function.cpp @@ -296,9 +296,8 @@ struct _stack // err_flush(); while ( cleanups.size() > 0 ) { - std::get<0>(cleanups.back())( - std::get<1>(cleanups.back()), - std::get<2>(cleanups.back()) ); + cleanups.back().function( + cleanups.back().stack, cleanups.back().count ); cleanups.pop_back(); } // err_printf( "STACK: %d, ITEMS: %d\n", (char*)end - (char*)data, cleanups.size() ); @@ -333,7 +332,7 @@ struct _stack check_alignment(); data = (char *)data - sizeof(U); check_alignment(); - cleanups.push_back(std::make_tuple(&_stack::cleanup_item, this, 1)); + cleanups.push_back(cleanup_info{&_stack::cleanup_item, this, 1}); return top() = v; } @@ -347,7 +346,7 @@ struct _stack data = (char *)data - ( n * sizeof(U) ); check_alignment(); std::uninitialized_fill_n( reinterpret_cast( data ), n, v ); - cleanups.push_back(std::make_tuple(&_stack::cleanup_item, this, n)); + cleanups.push_back(cleanup_info{&_stack::cleanup_item, this, n}); return reinterpret_cast( data ); } @@ -380,7 +379,13 @@ struct _stack void * end = nullptr; void * data = nullptr; using cleanup_f = void(*)( _stack*, int32_t ); - std::vector> cleanups; + struct cleanup_info + { + cleanup_f function; + _stack* stack; + int32_t count; + }; + std::vector cleanups; template void do_cleanup(int32_t) {}