implemented lazy loading for object_ptr and belongs_to
This commit is contained in:
@@ -70,9 +70,25 @@ record::const_iterator record::find(const std::string &column_name) const {
|
||||
return it != fields_by_name_.end() ? fields_.begin() + it->second.second : fields_.end();
|
||||
}
|
||||
|
||||
bool record::operator==(const record &rhs) const {
|
||||
if (size() != rhs.size()) {
|
||||
return false;
|
||||
}
|
||||
for(size_t i = 0; i < size(); ++i) {
|
||||
if (at(i) != rhs.at(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool record::operator!=(const record &rhs) const {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
void record::append(const field &col) {
|
||||
const auto it = fields_by_name_.emplace(col.name(), field_index_pair {col, fields_.size()});
|
||||
fields_.push_back(std::ref(it.first->second.first));
|
||||
const auto [fst, snd] = fields_by_name_.emplace(col.name(), field_index_pair {col, fields_.size()});
|
||||
fields_.push_back(std::ref(fst->second.first));
|
||||
}
|
||||
|
||||
record::iterator record::begin()
|
||||
|
||||
Reference in New Issue
Block a user