Fix compile errors for NDK (#82)

make_unique<TableView> causes ambiguous call with NDK's default gnustl.
Compiler fails to decide which constructor of Query to use.
This commit is contained in:
Chen Mulong 2016-06-06 18:27:05 +08:00
parent c35b7d9d19
commit 64e733e4d7
2 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,8 @@
#include <realm/util/assert.hpp> #include <realm/util/assert.hpp>
#include <algorithm>
using namespace realm; using namespace realm;
using namespace realm::_impl; using namespace realm::_impl;
@ -49,7 +51,7 @@ void CollectionChangeBuilder::merge(CollectionChangeBuilder&& c)
// First update any old moves // First update any old moves
if (!c.moves.empty() || !c.deletions.empty() || !c.insertions.empty()) { if (!c.moves.empty() || !c.deletions.empty() || !c.insertions.empty()) {
auto it = remove_if(begin(moves), end(moves), [&](auto& old) { auto it = std::remove_if(begin(moves), end(moves), [&](auto& old) {
// Check if the moved row was moved again, and if so just update the destination // Check if the moved row was moved again, and if so just update the destination
auto it = find_if(begin(c.moves), end(c.moves), [&](auto const& m) { auto it = find_if(begin(c.moves), end(c.moves), [&](auto const& m) {
return old.to == m.from; return old.to == m.from;
@ -79,7 +81,7 @@ void CollectionChangeBuilder::merge(CollectionChangeBuilder&& c)
// Ignore new moves of rows which were previously inserted (the implicit // Ignore new moves of rows which were previously inserted (the implicit
// delete from the move will remove the insert) // delete from the move will remove the insert)
if (!insertions.empty() && !c.moves.empty()) { if (!insertions.empty() && !c.moves.empty()) {
c.moves.erase(remove_if(begin(c.moves), end(c.moves), c.moves.erase(std::remove_if(begin(c.moves), end(c.moves),
[&](auto const& m) { return insertions.contains(m.from); }), [&](auto const& m) { return insertions.contains(m.from); }),
end(c.moves)); end(c.moves));
} }
@ -124,7 +126,7 @@ void CollectionChangeBuilder::clean_up_stale_moves()
// Look for moves which are now no-ops, and remove them plus the associated // Look for moves which are now no-ops, and remove them plus the associated
// insert+delete. Note that this isn't just checking for from == to due to // insert+delete. Note that this isn't just checking for from == to due to
// that rows can also be shifted by other inserts and deletes // that rows can also be shifted by other inserts and deletes
moves.erase(remove_if(begin(moves), end(moves), [&](auto const& move) { moves.erase(std::remove_if(begin(moves), end(moves), [&](auto const& move) {
if (move.from - deletions.count(0, move.from) != move.to - insertions.count(0, move.to)) if (move.from - deletions.count(0, move.from) != move.to - insertions.count(0, move.to))
return false; return false;
deletions.remove(move.from); deletions.remove(move.from);

View File

@ -446,7 +446,7 @@ Query Results::get_query() const
// The TableView has no associated query so create one with no conditions that is restricted // The TableView has no associated query so create one with no conditions that is restricted
// to the rows in the TableView. // to the rows in the TableView.
m_table_view.sync_if_needed(); m_table_view.sync_if_needed();
return Query(*m_table, std::make_unique<TableView>(m_table_view)); return Query(*m_table, std::unique_ptr<TableViewBase>(new TableView(m_table_view)));
} }
case Mode::LinkView: case Mode::LinkView:
return m_table->where(m_link_view); return m_table->where(m_link_view);