Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2008-02-25 15:00:53


Author: steven_watanabe
Date: 2008-02-25 15:00:53 EST (Mon, 25 Feb 2008)
New Revision: 43413
URL: http://svn.boost.org/trac/boost/changeset/43413

Log:
Minor compile time optimization
Text files modified:
   sandbox/switch/libs/switch/alternate/switch/switch.hpp | 18 +++++++++++++++++-
   1 files changed, 17 insertions(+), 1 deletions(-)

Modified: sandbox/switch/libs/switch/alternate/switch/switch.hpp
==============================================================================
--- sandbox/switch/libs/switch/alternate/switch/switch.hpp (original)
+++ sandbox/switch/libs/switch/alternate/switch/switch.hpp 2008-02-25 15:00:53 EST (Mon, 25 Feb 2008)
@@ -63,11 +63,27 @@
     return(t.template apply<R>(L()));
 }
 
+template<int N>
+struct mpl_at_c_impl {
+ template<class T>
+ struct apply {
+ typedef typename mpl::next<typename mpl_at_c_impl<N - 1>::template apply<T>::type>::type type;
+ };
+};
+
+template<>
+struct mpl_at_c_impl<0> {
+ template<class T>
+ struct apply {
+ typedef T type;
+ };
+};
+
 template<class T, class R>
 struct internal_at {
     template<int N>
     struct apply {
- typedef typename mpl::at_c<typename T::labels, N>::type label;
+ typedef typename mpl::deref<typename mpl_at_c_impl<N>::template apply<typename mpl::begin<typename T::labels>::type>::type>::type label;
         static R call(T& t) {
             return(do_call<R, label>(t));
         }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk