Questions tagged [structure]

Structure is a fundamental, tangible or intangible notion referring to the recognition, observation, nature, and permanence of patterns and relationships of entities. DO NOT USE this tag for C or C++ struct questions!

A structure can be a:

  • A structure in mathematical logic: in universal algebra and in model theory, a structure consists of a set along with a collection of finitary operations and relations which are defined on it.

  • The structure of a program

For the following topics, use different tags as indicated below:

  • A : a particular way of storing and organizing data in a computer so that it can be used efficiently.
  • A (short for "structure") is a keyword in the C and C++ languages, used to indicate a structures record.
6561 questions
22
votes
11 answers

C++ how to delete a structure?

Structure I created: struct VideoSample { const unsigned char * buffer; int len; }; VideoSample * newVideoSample = new VideoSample; newVideoSample->buffer = buf; newVideoSample->len = size; //... How now to…
Rella
  • 65,003
  • 109
  • 363
  • 636
22
votes
2 answers

Display image of graph in TensorFlow?

I wrote a simple script to calculate the golden ratio from 1,2,5. Is there a way to actually produce a visual through tensorflow (possibly with the aid of matplotlib or networkx) of the actual graph structure? The doc of tensorflow is pretty…
O.rka
  • 29,847
  • 68
  • 194
  • 309
22
votes
4 answers

Inner class accessing outer class

I am relatively new to C++, and I have looked a lot for an answer for this thing but I never got a satisfying answer. Let's say I have a structure called FSM. Eventually in my code, multiple instances of FSM can be created. One of FSM's attributes…
Kam
  • 5,878
  • 10
  • 53
  • 97
21
votes
3 answers

Solr documents with child elements?

Is it somehow possible to create a solr document that contains sub-elements? For example, how would I represent something like this:
cambo
  • 973
  • 4
  • 11
  • 22
21
votes
3 answers

initialization of anonymous structures or unions in C1X

I have the following question: How are anonymous structures (or unions) properly initialized according to the current C1X draft? Is this legal: struct foo { int a; struct { int i; int j; }; int b; }; struct foo f = {…
jmuc
  • 1,551
  • 1
  • 14
  • 16
20
votes
5 answers

What does the underscore mean in the typedef structure?

I was reading the source code of zmq, and came across the following typedef typedef struct {unsigned char _ [32];} zmq_msg_t; I don't understand what the underscore means in this definition. Could someone please help shed some light?
Jerry Feng
  • 275
  • 2
  • 6
20
votes
2 answers

react-native project/directory structure setup

I'm learning react-native(android) on windows environment. I've manage to start a project on android(even though they only support for apple). I want some advice for naming good structures of files and folders for the project before I go deep into…
MeetMahPuppy
  • 305
  • 1
  • 3
  • 13
20
votes
4 answers

why padding is not happening in this case?

As per my knowledge, By default 4-byte alignment will be done. say typedef struct { int data7; unsigned char data8; //3 -bytes will be added here. }Sample1; so sizeof(Sample1) will be 8. But for the following structure, why…
Jeyaram
  • 9,158
  • 7
  • 41
  • 63
19
votes
3 answers

Are there any size limitations for C structures?

Are there any size limitations for C structures?
Nemo
  • 1,059
  • 3
  • 14
  • 31
19
votes
7 answers

Haskell shying away from probabilistic data structures?

If you search for skips lists implemented in Haskell, you won't find many. It is a probabilistic data structure needing a random number generator, meaning that any of these structures would need to run in the IO monad. Are Haskell folks staying away…
me2
  • 3,069
  • 2
  • 26
  • 33
19
votes
4 answers

copy a directory structure with file names without content

I have a huge directory structure of movie files. For analysis of that structure I want to copy the entire directory structure, i.e. folders and files however I don't want to copy all the movie files while I want to keep there file names. Ideally I…
Juergen Riemer
  • 1,393
  • 2
  • 13
  • 29
19
votes
2 answers

Incorrectly aligned or overlapped by a non-object field error

I'm trying to create the following structure: [StructLayout(LayoutKind.Explicit, Size=14)] public struct Message { [FieldOffset(0)] public ushort X; [FieldOffset(2)] [MarshalAs(UnmanagedType.ByValArray,…
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
19
votes
3 answers

Is it valid to use bit fields with union?

I have used bit field with a structure like this, struct { unsigned int is_static: 1; unsigned int is_extern: 1; unsigned int is_auto: 1; } flags; Now i wondered to see if this can be done with a union so i modified the code…
amin__
  • 1,018
  • 3
  • 15
  • 22
18
votes
5 answers

When should we not use #pragma pack?

In C, when we use structures, when would it be inappropriate to use #pragma pack directive..? an addition to the question..... Can someone please explain more on how might the accessing of unaligned data specially with a pointer fail?
psaw.mora
  • 868
  • 1
  • 7
  • 18
18
votes
3 answers

sorting members of structure array

Given a structure array (in C) I am attempting to print out the results in groups of gender and in sub order by numerical order. For example: struct employee{ char gender[13] char name[13]; int id; }; Say I define the structure array like…
bardockyo
  • 1,415
  • 6
  • 21
  • 32