CppCon 2017: Walter E. Brown “Programming with C++ Constraints: Background, Utility, and Gotchas"

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024

ความคิดเห็น • 14

  • @jankodedic3130
    @jankodedic3130 7 ปีที่แล้ว +16

    Great talk by Walter, as always!

  • @mrlithium69
    @mrlithium69 7 ปีที่แล้ว +3

    Awesome use of the new word "subsume" which was re-used in another context by the smart questioner at the end : )

  • @Radioguy00
    @Radioguy00 7 ปีที่แล้ว

    As usual very clear presentation. Content is great, slides have the right level of complexity.

  • @MaceUA
    @MaceUA 7 ปีที่แล้ว +7

    Writing
    template requires C ...
    instead of
    template ...
    is just like writing
    void foo(auto x) requires int(x) ...
    instead of
    void foo(int x) ...
    when declaring a function.
    Hope they standardize the latter form.

    • @N00byEdge
      @N00byEdge 7 ปีที่แล้ว +2

      MaceUA well template... and so on still need to be a thing. But yeah, it needs to improve but these are just proposals so far.
      template looks fine to me though

    • @christophrcr
      @christophrcr 6 ปีที่แล้ว +1

      I think the first form is more versatile.
      Consider for example that you want to have a type that satisfies more than one concept,
      like you want to have a default-constructable Bi-Directional container:
      template
      requires DefaultConstructable
      requires BiDirectionalContainer
      T gimmeMyList();
      Or you want to impose restrictions not on the type T itself, but on a type that depends on T:
      template
      requires ForwardContainer
      requires Printable
      void printAll(const T &myItems);
      For the case of several concepts, I could imagine a syntax like
      template
      But I don't think there would be a natural looking syntax that supports constraints on dependent types (Like T::value_type) in a simmilar way.

  • @sideparting6845
    @sideparting6845 6 ปีที่แล้ว

    Very interesting and well presented, thank you.

  • @zhaoli2984
    @zhaoli2984 6 ปีที่แล้ว

    wonderful, great talk.

  • @maximchetrusca3301
    @maximchetrusca3301 6 ปีที่แล้ว

    very good talk!

  • @-taz-
    @-taz- 7 ปีที่แล้ว +1

    Is there a constant expression ternary operator: "constexpr(a) ? b : c"?

    • @vittorioromeo1
      @vittorioromeo1 7 ปีที่แล้ว +2

      Nope, was thinking about proposing it...

  • @IllumTheMessage
    @IllumTheMessage 7 ปีที่แล้ว

    How would the power example be used? What would calling it look like?

    • @vittorioromeo1
      @vittorioromeo1 7 ปีที่แล้ว +2

      Like any normal template function call: power(some_number)

  • @CharIie83
    @CharIie83 6 ปีที่แล้ว

    lower level logic, or higher?