mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
completed 10.7.0's build pre
This commit is contained in:
parent
3f3c5a0957
commit
b8abcaaf68
5 changed files with 14 additions and 14 deletions
|
@ -47,8 +47,9 @@ tt(int) template argument. This fails:
|
|||
)
|
||||
When attempting to instantiate a tt(Class) object by passing it
|
||||
tt(Class::Iterators) the compiler cannot directly deduce from the provided
|
||||
arguments that a tt(Class<Class::Iterator::type> is to be used: tt(type) isn't
|
||||
directly available. Compare this to tt(Class's) second constructor, where
|
||||
arguments that a tt(Class<Class::Iterator::type>) is to be used: tt(type)
|
||||
isn't directly available. Compare this to tt(Class's) second constructor,
|
||||
where
|
||||
verb(
|
||||
Class intObject{12};
|
||||
)
|
||||
|
@ -78,8 +79,8 @@ which are defined as em(explicitly specified) emi(deduction rules) that are
|
|||
added to (beyond) the class's interface.
|
||||
|
||||
An explicitly specified deduction rule relates a class template constructor
|
||||
signature to a class template type (providing the template arguments for the
|
||||
class template object that is constructed using the constructor whose
|
||||
signature to a class template type. It specifies the template arguments for
|
||||
the class template object that is constructed using the constructor whose
|
||||
signature is specified. The generic syntactical form of an explicitly
|
||||
specified deduction rule looks like this:
|
||||
verb(
|
||||
|
@ -97,7 +98,7 @@ a resulting class type:
|
|||
Class<typename Iter::type>
|
||||
)
|
||||
Now combine both in an explicitly specified deduction rule (which is added
|
||||
as a separately line following tt(Class's) interface:
|
||||
as a separately line following tt(Class's) interface):
|
||||
verb(
|
||||
template <class Iter>
|
||||
Class(Iter begin, Iter end) -> Class<typename Iter::type>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// operator@= (for demonstration purposes)
|
||||
//
|
||||
// Binops is the class befriending the arithmetic operation classes
|
||||
// Derived is the class that's derived from Binops. Derived wants to offer +
|
||||
// Derived is the class that's derived from Binops. Derived wants to offer +
|
||||
// and - operators. It does so by deriving from Binops<Derived, '+', '-'>
|
||||
//
|
||||
// The design is based on the CRTP, stepping over several classes
|
||||
|
|
|
@ -66,7 +66,7 @@ commands may then be processed like this:
|
|||
)
|
||||
Note that a variable may still be defined in the actual condition clauses.
|
||||
This is true for both the extended tt(if) and tt(switch) statement. But before
|
||||
the condition clauses an initialization clause may be used to define
|
||||
using the condition clauses an initialization clause may be used to define
|
||||
additional variables (plural, as it may contain a comma-separated
|
||||
list of variables, similar to the syntax that's available for
|
||||
tt(for)-statements.
|
||||
tt(for)-statements).
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
bool more = argc > 5;
|
||||
|
||||
cout << "more than 5: " << exchange(more, argc > 2) <<
|
||||
|
||||
cout << "more than 5: " << exchange(more, argc > 2) <<
|
||||
", more than 2: " << more << '\n';
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -16,10 +16,10 @@ int constexpr (*fp)(int) = add2;
|
|||
|
||||
static_assert(fp(3) == add2(3), "");
|
||||
|
||||
auto monoid = [](auto v)
|
||||
auto monoid = [](auto v)
|
||||
{
|
||||
return [=]
|
||||
{ return v;
|
||||
return [=]
|
||||
{ return v;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -56,4 +56,3 @@ int main()
|
|||
fun<4>();
|
||||
}
|
||||
//=
|
||||
|
||||
|
|
Loading…
Reference in a new issue