medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 019addb26c500bc68ed344efa94fc5bbcea09749
parent 9da810e7ffd85a1ed612686edaed39ac723ab0eb
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Dec 22 22:26:14 +0200

Add primitive visitors to intrinsics.h

Diffstat:
intrinsics.h | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/intrinsics.h b/intrinsics.h @@ -194,4 +194,21 @@ inline u8 * file_get_contents( const char * path, size_t * out_len = NULL ) { return contents; } +#define DEF_VISIT( T ) \ + template< typename F > inline void visit( T & x, F f ) { f( x ); } \ + template< typename F > inline void visit( const T & x, F f ) { f( x ); } + +DEF_VISIT( u8 ) +DEF_VISIT( u16 ) +DEF_VISIT( u32 ) +DEF_VISIT( u64 ) +DEF_VISIT( s8 ) +DEF_VISIT( s16 ) +DEF_VISIT( s32 ) +DEF_VISIT( s64 ) +DEF_VISIT( float ) +DEF_VISIT( double ) + +#undef DEF_VISIT + #endif // _INTRINSICS_H_