Boost logo

Boost Users :

Subject: Re: [Boost-users] my experience with boost::mpl programming
From: peter_foelsche_at_[hidden]
Date: 2008-10-07 13:35:26


> Could you please redo your diffs in unified format (diff -u on *NIX)
> and send
> them to the list again?
>
> Regards,
> Ravi

I only added some attribute so that all the functions called by for_each are inlined.
My changes work only with g++.
Other compiler use other attributes to force inlining.

Peter

-wru /users/pfoelsch/boost_1_35_0.saved/boost_1_35_0/boost/mpl/for_each.hpp ./mpl/for_each.hpp
--- /users/pfoelsch/boost_1_35_0.saved/boost_1_35_0/boost/mpl/for_each.hpp 2004-09-03 18:33:47.000000000 -0700
+++ ./mpl/for_each.hpp 2008-10-03 13:35:07.649710000 -0700
@@ -38,7 +38,8 @@
         , typename TransformFunc
         , typename F
>
- static void execute(
+__attribute__ ((__always_inline__))
+ inline static void execute(
           Iterator*
         , LastIterator*
         , TransformFunc*
@@ -57,7 +58,8 @@
         , typename TransformFunc
         , typename F
>
- static void execute(
+__attribute__ ((__always_inline__))
+ inline static void execute(
           Iterator*
         , LastIterator*
         , TransformFunc*
@@ -69,8 +71,8 @@
     
         // dwa 2002/9/10 -- make sure not to invoke undefined behavior
         // when we pass arg.
- value_initialized<arg> x;
- aux::unwrap(f, 0)(boost::get(x));
+ //value_initialized<arg> x;
+ aux::unwrap(f, 0)(arg());
         
         typedef typename mpl::next<Iterator>::type iter;
         for_each_impl<boost::is_same<iter,LastIterator>::value>
@@ -87,6 +89,7 @@
     , typename TransformOp
     , typename F
>
+__attribute__ ((__always_inline__))
 inline
 void for_each(F f, Sequence* = 0, TransformOp* = 0)
 {
@@ -101,6 +104,7 @@
       typename Sequence
     , typename F
>
+__attribute__ ((__always_inline__))
 inline
 void for_each(F f, Sequence* = 0)
 {


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net