Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13807 > unrolled thread

struct error

Started byBrad Tilley <kj4eit@gmail.com>
First post2012-02-06 12:32 -0800
Last post2012-02-06 17:14 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.c++


Contents

  struct error Brad Tilley <kj4eit@gmail.com> - 2012-02-06 12:32 -0800
    Re: struct error Brad Tilley <kj4eit@gmail.com> - 2012-02-06 12:48 -0800
    Re: struct error 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-06 17:14 -0800

#13807 — struct error

FromBrad Tilley <kj4eit@gmail.com>
Date2012-02-06 12:32 -0800
Subjectstruct error
Message-ID<c924f8b1-e576-43b4-aaaf-cbc2bc7aba32@k6g2000vbz.googlegroups.com>
I'm experimenting with using a struct within a vector located in a
different struct. I'm getting a compiler error. Here are the
structures:

struct shelf_item
{
    std::string name;
    int weight;
};

struct shelf
{
    std::string location;

    // compiler error occurs here
    std::vector<shelf_item>;
};

The compiler error reads: "a template-id may not appear in a using-
declaration"

Standard types (string, int, etc.) work fine, but my struct doesn't.
There's likely a better way to approach this, but having never tried
it before I wanted to ask here. Not sure it matters, but I'm using g++
4.6.2.

Thanks for any advice.

[toc] | [next] | [standalone]


#13808

FromBrad Tilley <kj4eit@gmail.com>
Date2012-02-06 12:48 -0800
Message-ID<38a67730-ff42-46b7-9486-a19929ad55a0@c6g2000vbk.googlegroups.com>
In reply to#13807
On Feb 6, 3:32 pm, Brad Tilley <kj4...@gmail.com> wrote:
> I'm experimenting with using a struct within a vector located in a
> different struct. I'm getting a compiler error. Here are the
> structures:
>
> struct shelf_item
> {
>     std::string name;
>     int weight;
>
> };
>
> struct shelf
> {
>     std::string location;
>
>     // compiler error occurs here
>     std::vector<shelf_item>;
>
> };
>
> The compiler error reads: "a template-id may not appear in a using-
> declaration"
>
> Standard types (string, int, etc.) work fine, but my struct doesn't.
> There's likely a better way to approach this, but having never tried
> it before I wanted to ask here. Not sure it matters, but I'm using g++
> 4.6.2.
>
> Thanks for any advice.


It's late and I made a typo... I figured it out:

std::vector<shelf_item> si;

Sorry for the noise.

Brad

[toc] | [prev] | [next] | [standalone]


#13809

From88888 Dihedral <dihedral88888@googlemail.com>
Date2012-02-06 17:14 -0800
Message-ID<7819486.3.1328577256203.JavaMail.geo-discussion-forums@pbgc9>
In reply to#13807
Copying any object stored as a tree like data structures of more than two digit 
levels is really slow for the spread blocks in the heap space.


Anyway DRAM is getting cheap so fast, thus the operator reloading is getting 
cheaper more and more in the 16 to 64 giga heap sace and the tera bytes 
in the HD.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web