// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // all.h // Neal Binnendyk, nealabq -at- gmail, nealabq.com // Copyright (c) 2010. All rights reserved. // # pragma once # ifndef ALL_H # define ALL_H // _______________________________________________________________________________________________ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # include "debug.h" # include # include # include # include # include # include // boost::integer_traits< int >::const_min // boost::integer_traits< int >::const_max # include using boost::uint8_t; using boost::uint16_t; using boost::uint32_t; using boost::uint64_t; using boost::int8_t; using boost::int16_t; using boost::int32_t; using boost::int64_t; # include # include # include # include # include # include # include using boost::tuples::tuple; using boost::tuples::get; // _______________________________________________________________________________________________ // General macro utility. // Always use X_CONCAT..(..) with only simple, one-token params. // It's simpler to just always use CONCAT..(..), below. # define X_CONCAT_2( A, B) A ## B # define X_CONCAT_3( A, B, C) A ## B ## C # define X_CONCAT_4( A, B, C, D) A ## B ## C ## D # define X_CONCAT_5( A, B, C, D, E) A ## B ## C ## D ## E // Use CONCAT..(..) to force parameter evaluation. // Params are fully eval'ed ahead of time so you don't have to restrict yourself to // simple one-token params. # define CONCAT_2( A, B) X_CONCAT_2( A, B) # define CONCAT_3( A, B, C) X_CONCAT_3( A, B, C) # define CONCAT_4( A, B, C, D) X_CONCAT_4( A, B, C, D) # define CONCAT_5( A, B, C, D, E) X_CONCAT_5( A, B, C, D, E) // _______________________________________________________________________________________________ template< typename T > inline void maybe_unused( T x) { (void) x; } # ifdef NDEBUG # define maybe_used_only_for_debug( x) maybe_unused( x) # else # define maybe_used_only_for_debug( x) ((void)0) # endif // _______________________________________________________________________________________________ inline bool implies( bool a, bool b) { return (! a) || b; } // _______________________________________________________________________________________________ template< typename TRG_T, typename SRC_T > inline TRG_T implicit_cast( SRC_T p) { return p; } // _______________________________________________________________________________________________ // Class (and ooak object) used as param to ctors where you do not want to go thru the usual initialization. class do_not_init_type { public: do_not_init_type( ) { } }; static do_not_init_type const do_not_init; // _______________________________________________________________________________________________ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # endif // ifndef ALL_H // // all.h - End of File // _______________________________________________________________________________________________ // |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||