-2

I am trying to write a class that should require the concept Container with gcc 6.

What I tried is:

class MyContainer { ... };
static_assert(std::Container<MyContainer>);

But I can't manage to make it compile.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Brahim
  • 808
  • 1
  • 8
  • 17
  • Hello, that(your comment and the duplicate topic) does not answer my question, how to make my program compiles? what is the correct syntax? – Brahim Jul 17 '16 at 12:26
  • So... where does `std::Container` come from? – Nicol Bolas Jul 17 '16 at 19:39
  • 3
    You should read the first few paragraphs of your link; they explain that the "concepts" listed there are only for explaining how that type of object should behave and does not define tangible objects or language constructs. You may be confusing it with the Concepts TS explained here: http://en.cppreference.com/w/cpp/language/constraints – kmdreko Jul 17 '16 at 20:01
  • @Nicol I wanted to use the Container concept (look at the link) – Brahim Jul 18 '16 at 13:05
  • By the way, why did I have a negative score? Is my question not clear? Thanks – Brahim Jul 18 '16 at 13:06
  • 1
    "can't manage to make it compile" is *not* something a question with positive score might say. – ams Jul 18 '16 at 15:05

1 Answers1

1

Concepts TS does not come with any actual concepts in it. It's just the language feature. The "concepts" used by the C++ standard are not implemented by Concepts TS.

So this std::Container you're trying to access doesn't exist. You can read the requirements the standard uses and create one.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982