Boost logo

Boost Users :

Subject: [Boost-users] const native arrays at compile time
From: Hicham Mouline (finjulhich_at_[hidden])
Date: 2012-07-12 03:07:45


Hello,
I have a number of questions, some of which are boost specific.

1. const std::string cols[] = { "col1", "col2", "col3" };
Is the const native array cols completely a compile-time construct or are
std::string objects constructed at runtime?
I would guess the latter?

2. const char const* cols[] = { "col1", "col2", "col3" };
This on the other hand would be pure compile time?

3.
struct S1 {
const char const* cols[] = { "col1", "col2", "col3" };
};
struct S2 {
const char const* cols[] = { "colx", "coly", "coly" };
};

template <typename T> /// T is either S1 or S2
struct S {

  const char const* col1s[] = { "othercol", /// elements of T::cols };
};

Is there a way to build col1s at compile time?

MM


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net