Click here to Skip to main content
13,897,968 members

C / C++ / MFC

 
QuestionHow can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w5-Apr-18 21:46
memberarnold_w5-Apr-18 21:46 
AnswerRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Richard MacCutchan5-Apr-18 23:26
protectorRichard MacCutchan5-Apr-18 23:26 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 0:31
memberarnold_w6-Apr-18 0:31 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt6-Apr-18 0:55
mveJochen Arndt6-Apr-18 0:55 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 1:30
memberarnold_w6-Apr-18 1:30 
AnswerRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt5-Apr-18 23:36
mveJochen Arndt5-Apr-18 23:36 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 0:32
memberarnold_w6-Apr-18 0:32 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt6-Apr-18 1:13
mveJochen Arndt6-Apr-18 1:13 
Then I know only four ways:
  1. Like you have done with multiple preprocessor #if statements.
  2. Using weird preprocessor macros to create a loop.
  3. Initialising by code using a loop.
  4. Writing a helper program that creates a file with the relevant code lines that can then be included in a source file or even linked when declaring the struct as extern. The helper program must then be executed by the make file (or a corresponding custom build option when using an IDE) before compiling.

AnswerRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Joe Woodbury6-Apr-18 6:06
professionalJoe Woodbury6-Apr-18 6:06 
Questionwhy ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
Tarun Jha3-Apr-18 7:53
memberTarun Jha3-Apr-18 7:53 
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
Victor Nijegorodov3-Apr-18 9:03
memberVictor Nijegorodov3-Apr-18 9:03 
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
David Crow3-Apr-18 10:41
memberDavid Crow3-Apr-18 10:41 
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
leon de boer3-Apr-18 13:48
memberleon de boer3-Apr-18 13:48 
QuestionHelp compiling OpenCV Pin
_Flaviu2-Apr-18 23:25
member_Flaviu2-Apr-18 23:25 
AnswerRe: Help compiling OpenCV Pin
Victor Nijegorodov3-Apr-18 2:04
memberVictor Nijegorodov3-Apr-18 2:04 
GeneralRe: Help compiling OpenCV Pin
_Flaviu3-Apr-18 2:08
member_Flaviu3-Apr-18 2:08 
GeneralRe: Help compiling OpenCV Pin
_Flaviu3-Apr-18 2:08
member_Flaviu3-Apr-18 2:08 
GeneralRe: Help compiling OpenCV Pin
Victor Nijegorodov3-Apr-18 4:08
memberVictor Nijegorodov3-Apr-18 4:08 
AnswerRe: Help compiling OpenCV Pin
Jochen Arndt3-Apr-18 23:02
mveJochen Arndt3-Apr-18 23:02 
QuestionCreating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 0:53
memberTarun Jha2-Apr-18 0:53 
SuggestionRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 0:57
protectorRichard MacCutchan2-Apr-18 0:57 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 0:59
memberTarun Jha2-Apr-18 0:59 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 1:10
protectorRichard MacCutchan2-Apr-18 1:10 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 2:32
memberTarun Jha2-Apr-18 2:32 
AnswerRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 1:19
protectorRichard MacCutchan2-Apr-18 1:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190306.1 | Last Updated 21 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid