This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[Q] BUG ??? std::vector(size,value) ctor or what
- To: egcs at cygnus dot com, egcs-bugs at cygnus dot com
- Subject: [Q] BUG ??? std::vector(size,value) ctor or what
- From: gcl++ Library Development <m dot cvjetko_nO_spaM at rt dot e-technik dot uni-erlangen dot de>
- Date: Mon, 10 May 1999 17:45:53 +0200
- Newsgroups: comp.lang.c++
- Organization: gcl++ Library Development Uni Erlangen
- Reply-To: m dot cvjetko_nO_spam at rt dot e-technik dot uni-erlangen dot dot de
/*
newsgroups:
comp.lang.c++
mailing lists:
egcs@cygnus.com
egcs-bugs@cygnus.com
reply to :
vcvjetko@linux.rulz.zg.tel.hr
m.cvjetko@linux.rulz.rt.e-technik.uni-erlangen.de
by removing praising the best OS
[Q] BUG ??? std::vector(size,value) ctor or what
Hi again!
I have tried to construct vector of doubles, whereby the size
will be given thorugh unsigned long int, but all I get is ambiguity
error.
Why is vector ctor declared and defined as it is??
/usr/include/g++/stl_vector.h
vector(size_type n, const T& value) { fill_initialize(n, value); }
vector(int n, const T& value) { fill_initialize(n, value); }
vector(long n, const T& value) { fill_initialize(n, value); }
Is it a specialization??
Thanx a lot
Miljenko
*/
# include <vector>
int
main ()
{
unsigned long dim = 10;
double value = 1.1;
vector<double> v(dim,value);
return 0;
};
/*
gcl@moljac:~/gcl/src/example/Tests/syntax_standard_comformance > g++ -v
-I ~/gcl/src/include STL_egcs-1.1.2.vector_specializations_TO_REPORT.cpp
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
/usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cpp -lang-c++ -v -I
/home/gcl/gcl/src/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__
-D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux
-Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586
-D__i586__ -D__pentium -D__pentium__
STL_egcs-1.1.2.vector_specializations_TO_REPORT.cpp /tmp/ccc9FoTl.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/home/gcl/gcl/src/include
/usr/include/g++
/usr/local/include
/usr/i586-pc-linux-gnu/include
/usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cc1plus
/tmp/ccc9FoTl.ii -quiet -dumpbase
STL_egcs-1.1.2.vector_specializations_TO_REPORT.cc -version -o
/tmp/ccewKOm3.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(i586-pc-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).
STL_egcs-1.1.2.vector_specializations_TO_REPORT.cpp: In function `int
main()':
STL_egcs-1.1.2.vector_specializations_TO_REPORT.cpp:17: call of
overloaded `vector(long unsigned int &, double &)' is ambiguous
/usr/include/g++/stl_vector.h:98: candidates are:
vector<double,__default_alloc_template<true,0> >::vector<double,
alloc>(unsigned int, const double &)
/usr/include/g++/stl_vector.h:99:
vector<double,__default_alloc_template<true,0> >::vector<double,
alloc>(int, const double &)
/usr/include/g++/stl_vector.h:100:
vector<double,__default_alloc_template<true,0> >::vector<double,
alloc>(long int, const double &)
*/