🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309708

Re: futures, wielokrotne templaty, lambdy i standard c++17

#309708
From: Borneq
Date: Thu, 21 Jun 2018 14:30
37 lines
2416 bytes
Myślę że problem może polegać na tym że mamy szablon, a tam dwa typy od 
których zależy. Realizacja tego szablonu wymaga dedukcji dwóch typów. 
Jeden można wydedukować z typu wyniku, a drugi - właśnie jak?

    GetRegionLocations(actions, locate_timeout_ns)
         .then([=](std::vector<Try<std::shared_ptr<RegionLocation>>> &loc) {
           std::lock_guard<std::recursive_mutex> lck(multi_mutex_);
           ActionsByServer actions_by_server;
           std::vector<std::shared_ptr<Action>> locate_failed;

Metoda GetRegionLocations zwraca AsyncBatchRpcRetryingCaller<REQ, RESP>
mamy dwa argumenty do instantiacji (realizacji) szablonu:
argumenty to REQ i RESP

RESP jest zdefiniowane w Call() AsyncBatchRpcRetryingCaller'a
folly::Future<std::vector<folly::Try<RESP>>> Call();
we have std::vector<Try<std::shared_ptr<RegionLocation>>> jako parametr

Ale parametr REQ zdefiniowany jest dla konstruktora 
AsyncBatchRpcRetryingCaller'a

REQ nie jest znane przy wyniku
musi być chyba std::vector<std::shared_ptr<Action>>

Metoda GetRegionLocations nie jest szablonem , ma ten typ REQ na stałe.

Jak powiedzieć kompilatorowi że typ REQ musi być
std::vector<std::shared_ptr<Action>>
?
Czy jest możliwe wskazanie explicite w kodzie?
Być może zamieniając GetRegionLocations ma szablon?

Ale jak w
    GetRegionLocations(actions, locate_timeout_ns)
         .then([=](std::vector<Try<std::shared_ptr<RegionLocation>>>

Wskazać REQ=std::vector<std::shared_ptr<Action>> ?
Technical Details
Message-ID: <pggcqu$7jl$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <pgenie$nce$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Borneq <borneq@antyspam.hidden.pl>
Newsgroups: pl.comp.lang.c
Subject: Re: futures, wielokrotne templaty, lambdy i standard c++17
Date: Thu, 21 Jun 2018 16:30:56 +0200
Organization: ATMAN - ATM S.A.
Lines: 37
Message-ID: <pggcqu$7jl$1@node2.news.atman.pl>
References: <pgenie$nce$1@node2.news.atman.pl>
NNTP-Posting-Host: public-gprs640547.centertel.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1529591454 7797 5.184.45.100 (21 Jun 2018 14:30:54 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Thu, 21 Jun 2018 14:30:54 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
In-Reply-To: <pgenie$nce$1@node2.news.atman.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit