Skip to content

Commit

Permalink
remove the use of small_vector
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Feb 17, 2024
1 parent 37040d2 commit 434124d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/loki/common/collections.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace loki {
/// @param vec
/// @return
template<typename Collection>
boost::container::small_vector<typename Collection::value_type,100> get_sorted_vector(const Collection& collection) {
boost::container::small_vector<typename Collection::value_type,100> result(collection.begin(), collection.end());
std::vector<typename Collection::value_type> get_sorted_vector(const Collection& collection) {
std::vector<typename Collection::value_type> result(collection.begin(), collection.end());
std::sort(result.begin(), result.end());
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions include/loki/common/pddl/persistent_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PersistentFactory {
/// @brief Returns a pointer to an existing object
/// or creates it before if it does not exist.v
template<typename SubType, typename... Args>
[[nodiscard]] HolderType const* get_or_create(Args... args) {
[[nodiscard]] HolderType const* get_or_create(Args&&... args) {
std::lock_guard<std::mutex> hold(m_mutex);
/* Construct and insert the element in persistent memory. */
size_t identifier = m_count;
Expand All @@ -78,7 +78,7 @@ class PersistentFactory {
// The pointer to the location in persistent memory.
const auto* element_ptr = static_cast<HolderType*>(nullptr);
// Explicitly call the constructor of T to give exclusive access to the factory.
auto element = HolderType(std::move(SubType(identifier, args...)));
auto element = HolderType(std::move(SubType(identifier, std::forward<Args>(args)...)));
bool overwrite_last_element = (identifier == m_persistent_vector.size() - 1);
if (overwrite_last_element) {
std::cout << "overwrite" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion include/loki/common/pddl/segmented_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SegmentedVector {
// Take ownership of memory
segment.push_back(std::move(value));
++m_size;

// Fetch return value
return segment.back();
}
Expand Down
12 changes: 6 additions & 6 deletions include/loki/domain/pddl/declarations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace loki::pddl {

class TypeImpl;
using Type = const TypeImpl*;
using TypeList = boost::container::small_vector<Type,1>; // often single type
//using TypeList = std::vector<Type>;
//using TypeList = boost::container::small_vector<Type,1>; // often single type
using TypeList = std::vector<Type>;

class ObjectImpl;
using Object = const ObjectImpl*;
Expand All @@ -49,17 +49,17 @@ namespace loki::pddl {
class TermVariableImpl;
using TermImpl = std::variant<TermObjectImpl, TermVariableImpl>;
using Term = const TermImpl*;
using TermList = boost::container::small_vector<Term, 2>; // often unary and binary predicates
//using TermList = std::vector<Term>;
//using TermList = boost::container::small_vector<Term, 2>; // often unary and binary predicates
using TermList = std::vector<Term>;

class AtomImpl;
using Atom = const AtomImpl*;
using AtomList = std::vector<Atom>;

class ParameterImpl;
using Parameter = const ParameterImpl*;
using ParameterList = boost::container::small_vector<Parameter, 10>; // often actions, quantifiers with few parameters
//using ParameterList = std::vector<Parameter>;
//using ParameterList = boost::container::small_vector<Parameter, 10>; // often actions, quantifiers with few parameters
using ParameterList = std::vector<Parameter>;
using ParameterAssignment = std::unordered_map<Parameter, Object>;

class PredicateImpl;
Expand Down

0 comments on commit 434124d

Please sign in to comment.