Help for this page

Select Code to Download


  1. or download this
    %module mycpp
    %include "std_vector.i"
    ...
    double average(std::vector<int> v) {
        return std::accumulate(v.begin(),v.end(),0.0)/v.size();
    }
    
  2. or download this
    use mycpp;
    ny $sv = mycpp::IntVector();
    ...
    $sv->push(3);
    $sv->push(4);
    $avg = average($sv);
    
  3. or download this
    Can't locate auto/mycpp/IntVector.al in @INC (@INC contains:
    /usr/perl5/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0/i386-linux
    /usr/prel5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at mycpp.pl lin
    +e 2.