Skip to content

Commit

Permalink
[utils] Deprecate allocator::Dynamic for std::allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Jul 19, 2024
1 parent 5f15719 commit 098fbda
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/modm/communication/rpr/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <modm/architecture/utils.hpp>
#include <modm/container/queue.hpp>
#include <modm/processing/timer.hpp>
#include <modm/utils/allocator/dynamic.hpp>
#include <memory>

#include "constants.hpp"

Expand Down Expand Up @@ -123,7 +123,7 @@ namespace modm
static Queue messagesToSend;
static Queue receivedMessages;

static modm::allocator::Dynamic<uint8_t> bufferAllocator;
static std::allocator<uint8_t> bufferAllocator;

static Message receiveBuffer;
static uint8_t rx_buffer[N+8];
Expand Down
4 changes: 2 additions & 2 deletions src/modm/container/doubly_linked_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define MODM_DOUBLY_LINKED_LIST_HPP

#include <stdint.h>
#include <modm/utils/allocator.hpp>
#include <memory>
#include <iterator>

namespace modm
Expand All @@ -30,7 +30,7 @@ namespace modm
* \author Fabian Greif
* \ingroup modm_container
*/
template <typename T, typename Allocator = allocator::Dynamic<T> >
template <typename T, typename Allocator = std::allocator<T> >
class DoublyLinkedList
{
public:
Expand Down
4 changes: 2 additions & 2 deletions src/modm/container/dynamic_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define MODM_DYNAMIC_ARRAY_HPP

#include <cstddef>
#include <modm/utils/allocator.hpp>
#include <memory>
#include <initializer_list>
#include <iterator>

Expand All @@ -44,7 +44,7 @@ namespace modm
* \author Fabian Greif <[email protected]>
* \ingroup modm_container
*/
template <typename T, typename Allocator = allocator::Dynamic<T> >
template <typename T, typename Allocator = std::allocator<T> >
class DynamicArray
{
public:
Expand Down
7 changes: 3 additions & 4 deletions src/modm/container/linked_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <stdint.h>
#include <iterator>
#include <modm/utils/allocator.hpp>
#include <memory>

namespace modm
{
Expand All @@ -29,13 +29,12 @@ namespace modm
* \todo implementation
*
* \tparam T Type of list entries
* \tparam Allocator Allocator used for memory allocation. See
* classes from modm::allocator namespace.
* \tparam Allocator Allocator used for memory allocation.
*
* \author Fabian Greif
* \ingroup modm_container
*/
template <typename T, typename Allocator = allocator::Dynamic<T> >
template <typename T, typename Allocator = std::allocator<T> >
class LinkedList
{
public:
Expand Down
3 changes: 1 addition & 2 deletions src/modm/container/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def init(module):
def prepare(module, options):
module.depends(
":architecture",
":io",
":utils")
":io")
return True


Expand Down
4 changes: 4 additions & 0 deletions src/modm/utils/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
namespace modm::allocator
{

// DEPRECATED: 2025q3
/**
* Base class for all allocator types
*
* @ingroup modm_utils
* @author Fabian Greif
*/
[[deprecated("Please use std::allocator<T> instead!")]]
template <typename T>
class AllocatorBase
{
Expand Down Expand Up @@ -66,6 +68,7 @@ class AllocatorBase
}
};

// DEPRECATED: 2025q3
/**
* Dynamic memory allocator
*
Expand All @@ -75,6 +78,7 @@ class AllocatorBase
* @ingroup modm_utils
* @author Fabian Greif
*/
[[deprecated("Please use std::allocator<T> instead!")]]
template <typename T>
class Dynamic : public AllocatorBase<T>
{
Expand Down

0 comments on commit 098fbda

Please sign in to comment.