Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10614
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Ian Collins <ian-news@hotmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: Half templates does not work. |
| Date | Sat, 01 Oct 2011 09:08:23 +1300 |
| Lines | 56 |
| Message-ID | <9emltoFudmU1@mid.individual.net> (permalink) |
| References | <d82bd711-cf85-4a8b-acda-cbd4482f2f4d@18g2000yqz.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net 0DiRSeAH3h4zC8WC4XwL5QuCjw11cZbwupsuzgrRtsTh6atQU0 |
| Cancel-Lock | sha1:svVSWqnLfr2UpOGSsBZF9hK/ovw= |
| User-Agent | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 |
| In-Reply-To | <d82bd711-cf85-4a8b-acda-cbd4482f2f4d@18g2000yqz.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:10614 |
Show key headers only | View raw
On 09/30/11 12:25 PM, Nephi Immortal wrote:
> I created two templates. First template is like trait types. Second
> template includes first template. Everything works fine except second
> template.
>
> The error message reports:
>
> Main.cpp
> c:\my projects\main.cpp(230): fatal error C1001: An internal error has
> occurred in the compiler.
> (compiler file 'msc1.cpp', line 1420)
> To work around this problem, try simplifying or changing the
> program near the locations listed above.
> Please choose the Technical Support command on the Visual C++
> Help menu, or open the Technical Support help file for more
> information
>
> I searched several websites. I was unable to find the solution. I
> checked C++ Template - The Complete Guide book and the section shows
> 4.3 Restrictions for Nontype Template Parameters.
>
> Do you have the solution? Is there another way to change the code in
> order to work?
>
> enum ETypes
> {
> e_Type1,
> e_Type2
> };
>
> template< ETypes Type>
> struct Types;
>
> template<>
> struct Types< e_Type1>
> {
> typedef char value_type;
> value_type x;
> };
>
> template<>
> struct Types< e_Type2>
> {
> typedef short value_type;
> value_type x;
> };
>
> template< ETypes Type, typename Traits = Types< Type> >
> struct t_Type
> {
> typename typedef Traits::value_type value_type;
Try changing all occurrences of "typename typedef" to "typedef typename".
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
Half templates does not work. Nephi Immortal <immortalnephi@gmail.com> - 2011-09-29 16:25 -0700
Re: Half templates does not work. red floyd <no.spam.here@its.invalid> - 2011-09-29 21:16 -0700
Re: Half templates does not work. Nephi Immortal <immortalnephi@gmail.com> - 2011-09-30 05:15 -0700
Re: Half templates does not work. Miles Bader <miles@gnu.org> - 2011-10-01 07:35 +0900
Re: Half templates does not work. Noah Roberts <roberts.noah@gmail.com> - 2011-09-30 09:25 -0700
Re: Half templates does not work. Nephi Immortal <immortalnephi@gmail.com> - 2011-09-30 12:17 -0700
Re: Half templates does not work. Ian Collins <ian-news@hotmail.com> - 2011-10-01 09:08 +1300
csiph-web