5#ifndef BOOST_SQLITE_MEMORY_HPP
6#define BOOST_SQLITE_MEMORY_HPP
8#include <boost/sqlite/detail/config.hpp>
12BOOST_SQLITE_BEGIN_NAMESPACE
16BOOST_SQLITE_END_NAMESPACE
21 using namespace boost::sqlite;
22 return sqlite3_malloc64(size);
26 using namespace boost::sqlite;
27 return sqlite3_malloc64(size);
32 using namespace boost::sqlite;
33 return sqlite3_free(ptr);
36BOOST_SQLITE_BEGIN_NAMESPACE
68 static_assert(std::is_trivially_destructible<T>::value,
"T[] needs to be trivially destructible");
78 void operator()(
void* t)
86using unique_ptr = std::unique_ptr<T, detail::deleter<T>>;
89inline std::size_t msize(
const unique_ptr<T> & ptr)
91 return sqlite3_msize(ptr.get());
94template<
typename T,
typename ... Args>
95unique_ptr<T> make_unique(Args && ... args)
97 unique_ptr<void> up{sqlite3_malloc64(
sizeof(T))};
98 unique_ptr<T> res{
new (up.get()) T(std::forward<Args>(args)...)};
103BOOST_SQLITE_END_NAMESPACE