headmyshoulder / odeint-v2

odeint - solving ordinary differential equations in c++ v2
http://headmyshoulder.github.com/odeint-v2/
Other
340 stars 101 forks source link

Error C2582 with msvc-10 when using iterator-based integration #149

Open mariomulansky opened 9 years ago

mariomulansky commented 9 years ago

See http://stackoverflow.com/questions/28069165/error-c2582-boost-odeint-when-using-iterator-based-integration

The following code snippet fails to compile with msvc-10:

{
    bulirsch_stoer<state_type> stepper(1e-9, 0.0, 0.0, 0.0);        
    state_type x = {{ 10.0 , 10.0 , 10.0 }};

    auto iter = boost::find_if( make_adaptive_time_range( stepper , lorenz() , x , 0.0 , 1.0 , 0.01 ) ,
                                 []( const std::pair< const state_type & , double > &x ) {
                                    return ( x.first[0] < 0.0 ); } );

            cout << iter->second << "\t" << iter->first[0] << "\t" << iter->first[1] << "\t" << iter->first[2] << "\n";
}

while it compiles without problems with gcc. Also, using the cash-karp stepper instead of the bulirsch-stoer does work with msvc-10

mariomulansky commented 9 years ago

I've added a test case based on this code snippet, and as expected it compiles fine under Linux using gcc-4.8, clang-3.4 and icc-15.0. I will try to find a windows machine and check with msvc.

mariomulansky commented 9 years ago

I'm very sorry but I still couldnt get hands on a windows machine.

However, I tried to look into it and I found a possible problem and tried to fix it. Maybe you can check if the latest commit fixes the issue?