It's a bit of a struggle, and I've been using C++ since '92. My problem is I haven't used C++23 yet. But I'll give my best guess. You might want to skip to the end of my comment and then work backwards. ;)

The first bit on template mut<T>:

mut<X> is a subclass of X so inherits all the methods like foo() and bar(). as_const() converts an X or mut<X> to X& so you can't call bar() because bar's this is of type mut<X>&. This is like Rust and other languages where variables are immutable by default until you declare a mutable reference (mut<> in this example). The bar method is using a new (C++23 I think) feature that unifies function call syntax so that "x.bar()" is the same as "bar(x)". So "void bar(this mut<X>&)" is explicitly declaring the type of "this" instead of the default X*.

The second part is about possibly extending the Boost Metaprogramming Library to support new qualifiers (typical C++ qualifiers being "const" and "volatile"). That library does compile time computation using template metaprogramming. Essentially, the compiler has to be so smart to infer types that you can use recursively defined templates and template specialisation to compute values (not just types) at compile time using recursive algorithms.

Here, the author is using C++23 concepts. Those are constraints on template parameters and the syntax is to use the concept name where you would normally write "class" or "typename" in a template declaration, hence "template<is_mut Self> void bar(this Self&&) {}".

The author is using variadic templates (all the ... stuff) to define new concepts that reflect on whether a type has a specified qualifier (for his own idea of what a qualifier is). "is_mut" is the concept (read "requirement for template instantiation") that a type T has the "mut" qualifier, and "is_synchronized" is the concept that the type has the "synchronized" qualifier.

The "qualified<T,...>" variadic concept takes a type and a list of qualifier types and is true if T is in the list of qualifiers[1] specified by the "...". The implementation of concept is_mut is "qualified<T,mut>" and the list of qualifiers in that case is just "mut".

The implementation of concept qualified<T,...> expects T::qualifier_list to be the list of qualifiers bound to T. "access<T,...>" creates a new type that inherits from T and has all the qualifiers in the "..." list, and that new type stores the list of qualifiers as typedef member "qualifier_list".

When you instantiate "access<T,Q1,Q2>" for qualifiers Q1 and Q2, you are defining a new type that provides access to the methods of T that require access to all the qualifiers Q1 and Q2. Or more qualifiers if you instantiate "access<>" with more.

So, to bring it back to the initial point: C++ has a couple of qualifiers: const and volatile. You can't call a non-"const" method of a class through a "const"-qualified "this" pointer. That effectively partitions the interface of the C++ class into disjoint sets of "const" and non-"const" methods. And a similar thing is happening here, where the author is using "access<X,Q1>" to specify the qualifier Q1 applied to the this pointer, which then allows him to call those methods that require the Q1 qualifier.

[1] https://www.boost.org/doc/libs/1_83_0/libs/mp11/doc/html/sim...