X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fcml%2Fcore%2Fmeta%2Fswitch.h;fp=src%2Fmoof%2Fcml%2Fcore%2Fmeta%2Fswitch.h;h=0000000000000000000000000000000000000000;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hp=736e21a5b97763789c0535709062aee7d942383f;hpb=85783316365181491a3e3c0c63659972477cebba;p=chaz%2Fyoink diff --git a/src/moof/cml/core/meta/switch.h b/src/moof/cml/core/meta/switch.h deleted file mode 100644 index 736e21a..0000000 --- a/src/moof/cml/core/meta/switch.h +++ /dev/null @@ -1,116 +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 - , NilCase - > > > > > > /* 6 */ - > > > > > > > > > > /* 10 */ - ::template match::result result; -}; - -} // namespace cml - -#endif - -// ------------------------------------------------------------------------- -// vim:ft=cpp