Article View: pl.comp.lang.c
Article #309707futures, wielokrotne templaty, lambdy i standard c++17
From: Borneq
Date: Wed, 20 Jun 2018 23:21
Date: Wed, 20 Jun 2018 23:21
115 lines
6067 bytes
6067 bytes
Potrzebuję do zarządzania bazą HBase z kodu C++ skompilować klienta
natywnego c++. To są bardzo stare źródła, od lat nie modyfikowane,
korzystają z facebookowych bibliotek (dla Ubuntu) folly i wangle.
Kiedyś udało się i nawet działa HBase 1.3.1
Teraz chcę uruchomić HBase 2.0.0
Biblioteki folly i wangle stały się nowe.
Natywny klient HBase znajduje się na github w źródłach Apache Hbase w
gałęzi HBASE-14850.
Jest problem kompilacji:
```
template <typename F, typename R = futures::detail::callableResult<T, F>>
typename R::Return then(F&& func) {
return this->template thenImplementation<F, R>(
std::forward<F>(func), typename R::Arg());
}
```
plik /usr/local/include/folly/futures/Future.h
to odwołuje się do folly:
```
// mimic: std::invoke_result_t, C++17
template <typename F, typename... Args>
using invoke_result_t = typename invoke_result<F, Args...>::type;
```
plik /usr/local/include/folly/functional/Invoke.h
aż do mojego projektu ze źródłami klienta:
```
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;
```
plik
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc
włączyłem -std=gnu++17
Jest błąd i uwagi:
====================================================
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|error:
no matching function for call to
‘folly::Future<std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> > >::then(hbase::AsyncBatchRpcRetryingCaller<REQ,
RESP>::GroupAndSend(const std::vector<std::shared_ptr<hbase::Action> >&,
int32_t) [with REQ = std::shared_ptr<hbase::Row>; RESP =
std::shared_ptr<hbase::Result>; int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>)’|
/usr/local/include/folly/futures/Future.h|737|note: candidate:
template<class F, class R> typename R::Return
folly::Future<T>::then(F&&) [with F = F; R = R; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|737|note: substitution of
deduced template arguments resulted in errors seen above|
/usr/local/include/folly/futures/Future.h|753|note: candidate:
template<class R, class Caller, class ... Args> folly::Future<typename
folly::isFuture<F>::Inner> folly::Future<T>::then(R (Caller::*)(Args
...), Caller*) [with R = R; Caller = Caller; Args = {Args ...}; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|753|note: template argument
deduction/substitution failed:|
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|note:
mismatched types ‘R (Caller::*)(Args ...)’ and
‘hbase::AsyncBatchRpcRetryingCaller<REQ, RESP>::GroupAndSend(const
std::vector<std::shared_ptr<hbase::Action> >&, int32_t) [with REQ =
std::shared_ptr<hbase::Row>; RESP = std::shared_ptr<hbase::Result>;
int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>’|
/usr/local/include/folly/futures/Future.h|770|note: candidate:
template<class Executor, class Arg, class ... Args> auto
folly::Future<T>::then(Executor*, Arg&&, Args&& ...) [with Executor =
Executor; Arg = Arg; Args = {Args ...}; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|770|note: template argument
deduction/substitution failed:|
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|note:
mismatched types ‘Executor*’ and
‘hbase::AsyncBatchRpcRetryingCaller<REQ, RESP>::GroupAndSend(const
std::vector<std::shared_ptr<hbase::Action> >&, int32_t) [with REQ =
std::shared_ptr<hbase::Row>; RESP = std::shared_ptr<hbase::Result>;
int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>’|
/usr/local/include/folly/futures/Future-inl.h|975|note: candidate:
folly::Future<folly::Unit> folly::Future<T>::then() [with T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future-inl.h|975|note: candidate
expects 0 arguments, 1 provided|
====================================================
Tutaj w pliku async-batch-rpc-retrying-caller.cc brakuje mu odpowiedniej
wersji "then", mimo że w folly jest wiele.
Ale jak to zmienić nie w folly ale w kliencie
Czy nowa wersja gcc c++17 ma obługę futures, która nie potrzebuje tej z
folly, włączone są pewne rzeczy do może eksperymentalnej biblioteki
standardowej?
Nowy gcc-6 i g++-6 ma jakieś rzeczy w swojej bibliotece standardowej,
tak że nie kompiluje się z folly bo jest konflikt,
może to jest rozwiązanie - przejść na testowy , eksperymentalny gcc i
wyrzucić niektóre headery od folly?
Technical Details
Message-ID:
<pgenie$nce$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-mailShow 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: futures, wielokrotne templaty, lambdy i standard c++17 Date: Thu, 21 Jun 2018 01:21:49 +0200 Organization: ATMAN - ATM S.A. Lines: 116 Message-ID: <pgenie$nce$1@node2.news.atman.pl> NNTP-Posting-Host: public-gprs351009.centertel.pl Mime-Version: 1.0 X-Trace: node2.news.atman.pl 1529536910 23950 37.47.2.98 (20 Jun 2018 23:21:50 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Wed, 20 Jun 2018 23:21:50 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Mozilla-News-Host: news://news.atman.pl:119 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit