 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Rolf Magnus Guest
|
Posted: Tue Oct 26, 2004 6:54 pm Post subject: Re: typen ohne bindung als template parameter |
|
|
Daniel Schüle wrote:
| Quote: | Hallo NG
#include <stack
int main()
{
struct x{int a, b;};
std::stack
/**/
}
VC6 meldet Fehler ..
Typen ohne Bindung koennen nicht als Vorlagenargumente verwendet werden
ist es eine Macke des Compilers oder muss es so sein,
|
Es muss.
| Quote: | und wenn ... wieso ist es so?
|
Keine Ahnung. Falls du Englisch kannst, könntest du mal in comp.std.c++
nachfragen. Da müßte man das wissen.
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Torsten Robitzki Guest
|
Posted: Tue Oct 26, 2004 7:47 pm Post subject: Re: typen ohne bindung als template parameter |
|
|
Daniel Schüle wrote:
| Quote: | Hallo NG
#include <stack
int main()
{
struct x{int a, b;};
std::stack
/**/
}
VC6 meldet Fehler ..
Typen ohne Bindung koennen nicht als Vorlagenargumente verwendet werden
ist es eine Macke des Compilers oder muss es so sein, und wenn ... wieso ist
es so?
|
Es soll so sein und gibt den Compiler Herstellern mehr Möglichkeiten
templates zu implementieren. Dec/Compaq C++ z.B. implementiert
templates, in dem jede Funktion in eine seperate Objektdatei geschrieben
wird. Für das spätere Linken müssen diese Funktionen dann externe
Bindung haben.
mfg Torsten
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Daniel Sch374le Guest
|
Posted: Tue Oct 26, 2004 9:58 pm Post subject: typen ohne bindung als template parameter |
|
|
Hallo NG
#include <stack>
int main()
{
struct x{int a, b;};
std::stack<x> st;
/**/
}
VC6 meldet Fehler ..
Typen ohne Bindung koennen nicht als Vorlagenargumente verwendet werden
ist es eine Macke des Compilers oder muss es so sein, und wenn ... wieso ist
es so?
MfG
Daniel
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Heiko Bauke Guest
|
Posted: Sat Oct 30, 2004 9:22 am Post subject: Re: typen ohne bindung als template parameter |
|
|
Hi,
On Tue, 26 Oct 2004 23:58:17 +0200
"Daniel Schüle" <uval (AT) rz (DOT) uni-karlsruhe.de> wrote:
| Quote: | #include <stack
int main()
{
struct x{int a, b;};
std::stack
/**/
}
|
gcc 3.3.3 sagt dazu
foo.cc: In function `int main()':
foo.cc:6: error: template-argument `main(): ' uses local type
`main(): ' foo.cc:6: error: template argument 2 is invalid
foo.cc:6: error: ISO C++ forbids declaration of `st' with no type
icc 8.0 meckert
foo.cc(6): error: a template argument may not reference a local type
std::stack<x> st;
^
compilation aborted for foo.cc (code 2)
Wahrscheinlich liegt hier tatsächlich ein Verstoß gegen den Standard
vor. Mache den Typ struct x global sichtbar, dann geht's.
#include <stack>
struct x{int a, b;};
int main() {
std::stack<x> st;
}
Heiko
--
-- Mit einem kurzen Schweifwedeln kann ein Hund mehr Gefühl
-- ausdrücken, als mancher Mensch mit stundenlangem Gerede.
-- (Louis Armstrong, 1900-1971)
-- Heiko Bauke @ http://www.uni-magdeburg.de/bauke
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|