Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Cannot find class domain_error in Standard C++ library
From Moo & Koenig, "Accelerated C++: 1: // source file for the `median' function 2: #include <algorithm> // to get the declaration of `sort' 3: #include <stdexcept> // to get the declaration of `domain_error' 4: #include <vector> // to get the declaration of `vector' 5: 6: using std::domain_error; using std::sort; using std::vector; 7: 8: #include "median.h" 9: 10: // compute the median of a `vector<double>' 11: // note that calling this function copies the entire argument `vector' 12: double median(vector<double> vec) 13: { 14: typedef vector<double>::size_type vec_sz; 15: 16: vec_sz size = vec.size(); 17: if (size == 0) 18: throw domain_error("median of an empty vector"); 19: 20: sort(vec.begin(), vec.end()); 21: 22: vec_sz mid = size/2; 23: 24: return size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid]; 25: } 26: 27: throw domain_error("median of an empty vector"); ^ median.cpp(18) : Error: cannot find constructor for class matching std::domain_error::std::domain_error(char *) --- errorlevel 1 C:\dm\stlport\stlport\stdexcept, lines 88-94 /*... class _STLP_CLASS_DECLSPEC domain_error : public logic_error { public: domain_error(const string& __arg) : logic_error(__arg) {} # ifdef _STLP_OWN_IOSTREAMS ~domain_error() _STLP_NOTHROW_INHERENTLY; # endif }; ...*/ Mar 28 2003
In article <b62vcc$1oqn$1 digitaldaemon.com>, Jim Jennings says...From Moo & Koenig, "Accelerated C++: Mar 29 2003
"Richard Grant" <fractal clark.net> wrote in message news:b65csj$gpq$1 digitaldaemon.com...In article <b62vcc$1oqn$1 digitaldaemon.com>, Jim Jennings says... Add this to your code: #include <string> Why? Probably a problem with typedefed, namespace qualified, forward Mar 29 2003
"Jim Jennings" <jwjenn mindspring.com> wrote in message news:b65hbp$jqa$1 digitaldaemon.com..."Richard Grant" <fractal clark.net> wrote in message news:b65csj$gpq$1 digitaldaemon.com...In article <b62vcc$1oqn$1 digitaldaemon.com>, Jim Jennings says... Add this to your code: #include <string> Why? Probably a problem with typedefed, namespace qualified, forward Mar 29 2003
"Richard Grant" <fractal clark.net> wrote in message news:b65csj$gpq$1 digitaldaemon.com...In article <b62vcc$1oqn$1 digitaldaemon.com>, Jim Jennings says...From Moo & Koenig, "Accelerated C++: Mar 29 2003
In article <b65qcc$pnm$1 digitaldaemon.com>, Jim Jennings says...BTW, I added it to Fomitchev's code where it belongs. ;o) Jim Mar 30 2003
"Richard Grant" <fractal clark.net> wrote in message news:b6758n$1kbo$1 digitaldaemon.com...In article <b65qcc$pnm$1 digitaldaemon.com>, Jim Jennings says...BTW, I added it to Fomitchev's code where it belongs. ;o) Jim Mar 30 2003
"Jim Jennings" <jwjenn mindspring.com> wrote in message news:b65qcc$pnm$1 digitaldaemon.com..."Richard Grant" <fractal clark.net> wrote in message news:b65csj$gpq$1 digitaldaemon.com...In article <b62vcc$1oqn$1 digitaldaemon.com>, Jim Jennings says...From Moo & Koenig, "Accelerated C++: Mar 30 2003
|