X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcml%2Fcore%2Fmeta%2Fswitch.h;h=736e21a5b97763789c0535709062aee7d942383f;hb=85783316365181491a3e3c0c63659972477cebba;hp=6f4383aae5035de429468dddc46cc7481eb6eb11;hpb=0fffd0097d7b496454413e57b398c903ecc252e4;p=chaz%2Fyoink diff --git a/src/cml/core/meta/switch.h b/src/cml/core/meta/switch.h deleted file mode 100644 index 6f4383a..0000000 --- a/src/cml/core/meta/switch.h +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- C++ -*- ------------------------------------------------------------ - -Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/ - -The Configurable Math Library (CML) is distributed under the terms of the -Boost Software License, v1.0 (see cml/LICENSE for details). - - *-----------------------------------------------------------------------*/ -/** @file - * @brief - */ - -#ifndef meta_switch_h -#define meta_switch_h - -#include -#include - -namespace cml { - -struct NilCase {}; /* For terminating the case list. */ -struct Default {}; /* For indicating the default result. */ - -/* The working parts of the meta-switch go into namespace meta: */ -namespace meta { - -/* "Interior" case statements: */ -template -struct select_case -{ - template struct match { - typedef typename select_if< - same_type::is_true, - Result, - typename NextCase::template match::result - >::result result; - }; -}; - -/* Default case, returned when no match is found in a previous case: */ -template -struct select_case -{ - template struct match { - typedef Result result; - }; -}; - -/* The last case statement (if no match until now, the result is 'void'): */ -template -struct select_case -{ - template struct match { - typedef typename select_if< - same_type::is_true, - Result, - void - >::result result; - }; -}; - -} // namespace meta - -/** Return the matched type (like a switch/case statement). - * - * This is a convenience wrapper to avoid having to explicitly type out - * select_case for each case in the list of types to match against. - */ -template struct select_switch -{ - typedef typename - meta::select_case< T1,R1 - , meta::select_case< T2,R2 - , meta::select_case< T3,R3 - , meta::select_case< T4,R4 - , meta::select_case< T5,R5 - , meta::select_case< T6,R6 - , meta::select_case< T7,R7 - , meta::select_case< T8,R8 - , meta::select_case< T9,R9 - , meta::select_case< T10,R10 - , meta::select_case< T11,R11 - , meta::select_case< T12,R12 - , meta::select_case< T13,R13 - , meta::select_case< T14,R14 - , meta::select_case< T15,R15 - , meta::select_case< T16,R16 -#if !defined(_MSC_VER) - , meta::select_case< T17,R17 - , meta::select_case< T18,R18 - , meta::select_case< T19,R19 - , meta::select_case< T20,R20 - , meta::select_case< T21,R21 - , meta::select_case< T22,R22 - , meta::select_case< T23,R23 - , meta::select_case< T24,R24 - , meta::select_case< T25,R25 - , meta::select_case< T26,R26 - , meta::select_case< T27,R27 - , meta::select_case< T28,R28 - , meta::select_case< T29,R29 - , meta::select_case< T30,R30 - , meta::select_case< T31,R31 - , meta::select_case< T32,R32 - , meta::select_case< T33,R33 - , meta::select_case< T34,R34 - , meta::select_case< T35,R35 - , meta::select_case< T36,R36 - , meta::select_case< T37,R37 - , meta::select_case< T38,R38 - , meta::select_case< T39,R39 - , meta::select_case< T40,R40 - , NilCase - > > > > > > > > > > /* 10 */ - > > > > > > > > > > /* 10 */ - > > > > /* 4 */ -#else - , NilCase -#endif - > > > > > > /* 6 */ - > > > > > > > > > > /* 10 */ - ::template match::result result; -}; - -} // namespace cml - -#endif - -// ------------------------------------------------------------------------- -// vim:ft=cpp