Initial import of libdpf.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
e4e666f459
4563 changed files with 1690372 additions and 0 deletions
18
thirdparty/json/docs/examples/get_allocator.cpp
vendored
Normal file
18
thirdparty/json/docs/examples/get_allocator.cpp
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
int main()
|
||||
{
|
||||
auto alloc = json::get_allocator();
|
||||
using traits_t = std::allocator_traits<decltype(alloc)>;
|
||||
|
||||
json* j = traits_t::allocate(alloc, 1);
|
||||
traits_t::construct(alloc, j, "Hello, world!");
|
||||
|
||||
std::cout << *j << std::endl;
|
||||
|
||||
traits_t::destroy(alloc, j);
|
||||
traits_t::deallocate(alloc, j, 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue