WPILibC++  2018.4.1-1228-gb9fa3a4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
memory.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef WPIUTIL_WPI_MEMORY_H_
9 #define WPIUTIL_WPI_MEMORY_H_
10 
11 #include <cstdlib>
12 
13 namespace wpi {
14 
21 void* CheckedCalloc(size_t num, size_t size);
22 
28 void* CheckedMalloc(size_t size);
29 
36 void* CheckedRealloc(void* ptr, size_t size);
37 
38 } // namespace wpi
39 
40 #endif // WPIUTIL_WPI_MEMORY_H_
void * CheckedRealloc(void *ptr, size_t size)
Wrapper around std::realloc that calls std::terminate on out of memory.
void * CheckedCalloc(size_t num, size_t size)
Wrapper around std::calloc that calls std::terminate on out of memory.
WPILib C++ utilities (wpiutil) namespace.
Definition: SmallString.h:21
void * CheckedMalloc(size_t size)
Wrapper around std::malloc that calls std::terminate on out of memory.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
Definition: STLExtras.h:999