Results 1 to 4 of 4

Thread: Is it possible to house a collection within a struct?

  1. #1
    Gravitas is offline Registered User
    Name: Shane Tolmie
    Organization: NeuralFutures LLC
    Project: Server modules in C++, C# and Java, to client.
    Join Date
    Feb 2011
    Posts
    40

    Is it possible to house a collection within a struct?

    Hi,

    Whenever I attempt to place a squence within a struct, it gives a syntax error - is there any possible way to place a sequence within a struct?

    ["clr:generic:List"] sequence<string> StringSeq; // works

    ["clr:class"] struct Wrapper
    {
    ["clr:generic:List"] sequence<string> StringSeq; // gives syntax error
    string symbol;
    };

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,445
    Hi,

    User-defined types (structures, classes, sequences, dictionaries, exceptions, and enumerations) can only be defined at module scope.

    Regards,
    Mark

  3. #3
    Gravitas is offline Registered User
    Name: Shane Tolmie
    Organization: NeuralFutures LLC
    Project: Server modules in C++, C# and Java, to client.
    Join Date
    Feb 2011
    Posts
    40
    No problem, I can easily adjust the interface slightly to eliminate this problem.

  4. #4
    Gravitas is offline Registered User
    Name: Shane Tolmie
    Organization: NeuralFutures LLC
    Project: Server modules in C++, C# and Java, to client.
    Join Date
    Feb 2011
    Posts
    40
    Quote Originally Posted by Gravitas View Post
    No problem, I can easily adjust the interface slightly to eliminate this problem.
    To clarify, this doesn't provide any limitation at all. The Slice file will handle any combination of nested structs that are possible in C++. All I need to do is define a new type which is a list of an existing type, at the global scope, then include that in the new structure. No limitations is good.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Struct - inheritance
    By razvic in forum Help Center
    Replies: 1
    Last Post: 06-09-2009, 03:08 PM
  2. About return struct
    By billwillman in forum Help Center
    Replies: 7
    Last Post: 10-16-2006, 02:39 AM
  3. Garbage Collection Troubles
    By Nis Baggesen in forum Help Center
    Replies: 8
    Last Post: 02-15-2006, 10:46 AM
  4. Problem with classes in struct
    By kovacm in forum Help Center
    Replies: 9
    Last Post: 10-06-2005, 01:49 AM
  5. is there any way to use my own struct in slice?
    By pi1ot in forum Help Center
    Replies: 1
    Last Post: 02-20-2005, 11:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •