Hacker News new | ask | show | jobs
by oivey 1451 days ago
Ahh you’re, right, I forgot about fully auto’d functions. I think want more structure than just auto everything, although the compilers should find mistakes with that. Concepts will be nice.
1 comments

The concept version here would look like:

    template<typename T>
    concept WesternishName = requires (T t) { 
      { t.firstName } -> convertible_to<string>; 
      { t.lastName } -> convertible_to<string>;
    };

    auto concatenate(WesternishName auto t) { return t.firstName + " " + t.lastName; }