Constrain `protocol`'s constructors and converting assignment on constructibility of the stored type
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 62/100
Direzione di ricerca
Start with the protocol value constructors, in-place constructors and converting assignment, and compare them with the polymorphic constructors, which already constrain on is_constructible_v. Add std::constructible_from constraints to the overloads the issue lists, and check that the converting assignment matches the change in #499. Done when the issue's static_asserts hold and protocol<MI> rejects MoveOnly at overload resolution instead of failing inside construct_at.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
protocol's value, in-place and converting-assignment overloads check conformance and the interface's special members, but not that the stored type can be constructed from the arguments. Type traits report them as available, and calling one fails inside the allocator:
struct I { int value() const; };
struct MI {
MI() = default;
MI(MI&&) = default;
MI(const MI&) = delete;
int value() const;
};
struct MoveOnly { std::unique_ptr<int> p; int value() const; };
struct Small { int v; int value() const; };
static_assert(std::is_constructible_v<xyz::protocol<MI>, MoveOnly&>);
static_assert(std::is_assignable_v<xyz::protocol<MI>&, MoveOnly&>);
static_assert(std::is_constructible_v<xyz::protocol<I>,
std::in_place_type_t<Small>, std::string>);
MoveOnly m;
xyz::protocol<MI> p(m); // error: no matching function for call to construct_at
Generic code that branches on these traits gets a hard error instead of the other branch.
polymorphic constrains its value constructor on is_constructible_v<UU, U> and its in-place constructors on is_constructible_v<U, Ts...>. Proposal: add std::constructible_from<TNorm, T> to the value constructors and the converting assignment (#499), and std::constructible_from<T, Args...> (plus the initializer_list form) to the in-place constructors.
- Lingua principale
- C++
- Stelle
- 12
- Fork
- 4
- Merge medio
- 1g 11h
- PR unite (30g)
- 15
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jbcoe/cc-protocol
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jbcoe/cc-protocol#507 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jbcoe/cc-protocol#455 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jbcoe/cc-protocol#407 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
jbcoe/cc-protocol#194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
jbcoe/cc-protocol#513 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di jbcoe/cc-protocol
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
ai_p1 comp-sql-syntax
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ClickHouse/ClickHouse#133888 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno