Skip to content

Commit

Permalink
Remove use of generic lambdas
Browse files Browse the repository at this point in the history
Summary:
The use of generic lambdas caused compiler errors with gcc 4.8.2.
Fixes facebook#569.

Reviewed By: Orvid, yfeldblum

Differential Revision: D4821115

fbshipit-source-id: 8372ee7695a3d0a1df0d033623618a923c261737
  • Loading branch information
terrelln authored and facebook-github-bot committed Apr 3, 2017
1 parent 6e183a4 commit 0fdbb3d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions folly/io/Compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,14 +1599,16 @@ bool AutomaticCodec::canUncompress(
return std::any_of(
codecs_.begin(),
codecs_.end(),
[data, uncompressedLength](const auto& codec) {
[data, uncompressedLength](std::unique_ptr<Codec> const& codec) {
return codec->canUncompress(data, uncompressedLength);
});
}

void AutomaticCodec::addCodecIfSupported(CodecType type) {
const bool present =
std::any_of(codecs_.begin(), codecs_.end(), [&type](const auto& codec) {
const bool present = std::any_of(
codecs_.begin(),
codecs_.end(),
[&type](std::unique_ptr<Codec> const& codec) {
return codec->type() == type;
});
if (hasCodec(type) && !present) {
Expand All @@ -1631,17 +1633,20 @@ AutomaticCodec::AutomaticCodec(std::vector<std::unique_ptr<Codec>> customCodecs)
checkCompatibleCodecs();
}
// Check that none of the codes are are null
DCHECK(std::none_of(codecs_.begin(), codecs_.end(), [](const auto& codec) {
return codec == nullptr;
}));
DCHECK(std::none_of(
codecs_.begin(), codecs_.end(), [](std::unique_ptr<Codec> const& codec) {
return codec == nullptr;
}));

needsUncompressedLength_ =
std::any_of(codecs_.begin(), codecs_.end(), [](const auto& codec) {
needsUncompressedLength_ = std::any_of(
codecs_.begin(), codecs_.end(), [](std::unique_ptr<Codec> const& codec) {
return codec->needsUncompressedLength();
});

const auto it = std::max_element(
codecs_.begin(), codecs_.end(), [](const auto& lhs, const auto& rhs) {
codecs_.begin(),
codecs_.end(),
[](std::unique_ptr<Codec> const& lhs, std::unique_ptr<Codec> const& rhs) {
return lhs->maxUncompressedLength() < rhs->maxUncompressedLength();
});
DCHECK(it != codecs_.end());
Expand Down

0 comments on commit 0fdbb3d

Please sign in to comment.