metaforce/Runtime/rstl.hpp

28 lines
483 B
C++
Raw Normal View History

2015-08-21 18:58:41 -07:00
#ifndef __RSTL_HPP__
#define __RSTL_HPP__
#include <vector>
#include <stdlib.h>
2016-04-29 03:08:46 -07:00
#include "optional.hpp"
2015-08-21 18:58:41 -07:00
namespace rstl
{
2016-04-29 03:08:46 -07:00
template <typename T>
using optional_object = std::experimental::optional<T>;
2015-08-21 18:58:41 -07:00
/**
* @brief Vector reserved on construction
*/
template <class T, size_t N>
class reserved_vector : public std::vector<T>
{
public:
reserved_vector() {this->reserve(N);}
2016-09-09 21:50:00 -07:00
reserved_vector(size_t n, const T& val) : std::vector<T>(n, val) { }
2015-08-21 18:58:41 -07:00
};
}
#endif // __RSTL_HPP__