Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dart/common/MemoryAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DART_API MemoryAllocator : public Castable<MemoryAllocator>
/// memory.
/// @return On failure, a null pointer
[[nodiscard]] virtual void* allocate(size_t bytes) noexcept = 0;
// TODO(JS): Make this constexpr once migrated to C++20
// Note: Virtual runtime allocation cannot be constexpr by design.

/// Allocates object(s) without calling the constructor.
///
Expand All @@ -85,7 +85,7 @@ class DART_API MemoryAllocator : public Castable<MemoryAllocator>
/// @param[in] pointer: Pointer obtained from allocate().
/// @param[in] bytes: The bytes of the allocated memory.
virtual void deallocate(void* pointer, size_t bytes) = 0;
// TODO(JS): Make this constexpr once migrated to C++20
// Note: Virtual runtime deallocation cannot be constexpr by design.

/// Allocates uninitialized storage and constructs an object of type T to the
/// allocated storage.
Expand Down
2 changes: 1 addition & 1 deletion dart/common/MemoryManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class DART_API MemoryManager final
/// @param[in] pointer: Pointer obtained from allocate().
/// @param[in] bytes: The bytes of the allocated memory.
void deallocate(Type type, void* pointer, size_t bytes);
// TODO(JS): Make this constexpr once migrated to C++20
// Note: Deallocates runtime memory; constexpr is not applicable.

void deallocateUsingFree(void* pointer, size_t bytes);

Expand Down
9 changes: 6 additions & 3 deletions dart/common/StlAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ class StlAllocator : public std::allocator<T>
///
/// @param[in] pointer: Pointer obtained from allocate().
/// @param[in] n: Number of objects earlier passed to allocate().
void deallocate(pointer pointer, size_type n);
// TODO(JS): Make this constexpr once migrated to C++20
void deallocate(pointer pointer, size_type n) noexcept;

// TODO(JS): Add size_type max_size() const noexcept;
/// Upper bound on elements that can be allocated.
[[nodiscard]] constexpr size_type max_size() const noexcept
{
return std::allocator_traits<Base>::max_size(*this);
}

/// Prints state of the memory allocator
void print(std::ostream& os = std::cout, int indent = 0) const;
Expand Down
2 changes: 1 addition & 1 deletion dart/common/detail/StlAllocator-impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typename StlAllocator<T>::pointer StlAllocator<T>::allocate(

//==============================================================================
template <typename T>
void StlAllocator<T>::deallocate(pointer pointer, size_type n)
void StlAllocator<T>::deallocate(pointer pointer, size_type n) noexcept
{
mBaseAllocator.deallocate(pointer, n * sizeof(T));
}
Expand Down
1 change: 0 additions & 1 deletion examples/heightmap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ dynamics::SimpleFramePtr createHeightmapFrame(

terrainFrame->createVisualAspect();

// TODO(JS): Remove?
auto terrainShape = createHeightmapShape(
xResolution, yResolution, xSize, ySize, zMin, zMax);
terrainFrame->setShape(terrainShape);
Expand Down
Loading