verloc
02-03-2003, 15:00
Questo è l'esempio che ho fatto
// file: es_accum.cpp
#include <stdio.h>
#include <iostream.h>
#include <vector>
#include <algorithm>
#include <numeric> //for accumulate
#include <functional> // for greater<>
main()
{
double stuff[]={3.23,4.23,5.23};
vector<double> vStuff(stuff,stuff+3);
cout<<"Vector vStuff= [ ";
copy(vStuff.begin(),vStuff.end(),ostream_iterator<double>(cout, " ")); //'\n'
cout<<" ]"<<endl;
cout<<"Accumulate sample:sum vStuff elements"<<endl;
double SumvStuff=accumulate(vStuff.begin(),vStuff.end(),0);
cout<<"Sum="<<SumvStuff<<endl;
getchar();
}
//Output12
bcc 5.5 log:
Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland
es_accum.cpp:
Warning W8008 C:\Programmi\Borland\CBuilder5\Include\vector.h 213: Condition is always false in function __init_aux<double *>(double *,double *,_RW_is_not_integer)
Warning W8066 C:\Programmi\Borland\CBuilder5\Include\vector.h 214: Unreachable code in function __init_aux<double *>(double *,double *,_RW_is_not_integer)
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Capisco che il problema è in _RW_is_not_integer
Ma come risolverlo?
nota .Presumo che RW stia per Rogue Wave cioè la company che ha implementato la libreria
// file: es_accum.cpp
#include <stdio.h>
#include <iostream.h>
#include <vector>
#include <algorithm>
#include <numeric> //for accumulate
#include <functional> // for greater<>
main()
{
double stuff[]={3.23,4.23,5.23};
vector<double> vStuff(stuff,stuff+3);
cout<<"Vector vStuff= [ ";
copy(vStuff.begin(),vStuff.end(),ostream_iterator<double>(cout, " ")); //'\n'
cout<<" ]"<<endl;
cout<<"Accumulate sample:sum vStuff elements"<<endl;
double SumvStuff=accumulate(vStuff.begin(),vStuff.end(),0);
cout<<"Sum="<<SumvStuff<<endl;
getchar();
}
//Output12
bcc 5.5 log:
Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland
es_accum.cpp:
Warning W8008 C:\Programmi\Borland\CBuilder5\Include\vector.h 213: Condition is always false in function __init_aux<double *>(double *,double *,_RW_is_not_integer)
Warning W8066 C:\Programmi\Borland\CBuilder5\Include\vector.h 214: Unreachable code in function __init_aux<double *>(double *,double *,_RW_is_not_integer)
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Capisco che il problema è in _RW_is_not_integer
Ma come risolverlo?
nota .Presumo che RW stia per Rogue Wave cioè la company che ha implementato la libreria