Topic: function templates in C++. using MSVCv6.0


Author: Rob Stewart <donotspamme@giage.com>
Date: 2000/06/30
Raw View
Francis Glassborow wrote:
>
> In article <8ivtf4$2r2$1@nnrp1.deja.com>, obhiee@my-deja.com writes
> >I seem to be running into a problem when my function template prototype
> >is not IMMEDIATELY followed by its body.
> > a) Is this behaviour by design?
>
> In a sense, yes. Because separate compilation is so difficult for
> compilers/linkers the default is that the body of the function must be
> visible at the point of instantiation.  There is a keyword 'export' to
> over-rule this default but I do not know of any compiler that yet
> supports that.

I took the question to be about the MSVC limitation that a
template member function's body must be in the class definition
rather than defining the function outside the class definition.

That is not required by the standard; it is a limitation of the
compiler.

--
Robert Stewart     |  rob-at-giage-dot-com
Software Engineer  |  using std::disclaimer;
Giage, Inc.        |  http://www.giage.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: obhiee@my-deja.com
Date: 2000/06/24
Raw View

Hello.
Three questions please :)

I seem to be running into a problem when my function template prototype
is not IMMEDIATELY followed by its body.
 a) Is this behaviour by design?
 b) Does it conform to the '98 recommendations?
 c) Is there an online copy of ARM someplace?

TIA,
Abhi


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: comeau@panix.com (Greg Comeau)
Date: 2000/06/24
Raw View
In article <8ivtf4$2r2$1@nnrp1.deja.com>,  <obhiee@my-deja.com> wrote:
>Three questions please :)
>
>I seem to be running into a problem when my function template prototype
>is not IMMEDIATELY followed by its body.
> a) Is this behaviour by design?
> b) Does it conform to the '98 recommendations?
> c) Is there an online copy of ARM someplace?

You might want to check out
   http://www.comeaucomputing.com/techtalk/templates/#whylinkerror

- Greg
--
Comeau Computing / Comeau C/C++ 4.2.42 (4.2.44 expected soon)
TRY Comeau C++ ONLINE at http://www.comeaucomputing.com/tryitout
Email: comeau@comeaucomputing.com / WEB: http://www.comeaucomputing.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Francis Glassborow <francis@robinton.demon.co.uk>
Date: 2000/06/25
Raw View
In article <8ivtf4$2r2$1@nnrp1.deja.com>, obhiee@my-deja.com writes
>I seem to be running into a problem when my function template prototype
>is not IMMEDIATELY followed by its body.
> a) Is this behaviour by design?

In a sense, yes. Because separate compilation is so difficult for
compilers/linkers the default is that the body of the function must be
visible at the point of instantiation.  There is a keyword 'export' to
over-rule this default but I do not know of any compiler that yet
supports that.

> b) Does it conform to the '98 recommendations?

See above

> c) Is there an online copy of ARM someplace?

What has this got to do with anything.  The ARM is a book which is the
intellectual property of the authors (and I think, AT&T) which the
Standards bodies were allowed to use as a base document in the
development of ISO C++. The C++ Standard is the intellectual property of
a considerable number of people who developed and wrote it, under
international treaty sale rights are conditionally ceded to ISO who in
turn passes these on to National Bodies for us as their own National
Standards.  Why would you want an online copy? You can always buy (for a
minimalist $18) an electronic version from ANSI.


Francis Glassborow      Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]