2010-07-19 09:57:32 +00:00
|
|
|
#include "pugixml.hpp"
|
|
|
|
|
|
|
|
#include <new>
|
|
|
|
|
2015-03-21 21:03:01 -07:00
|
|
|
// tag::decl[]
|
2010-07-19 09:57:32 +00:00
|
|
|
void* custom_allocate(size_t size)
|
|
|
|
{
|
|
|
|
return new (std::nothrow) char[size];
|
|
|
|
}
|
|
|
|
|
|
|
|
void custom_deallocate(void* ptr)
|
|
|
|
{
|
|
|
|
delete[] static_cast<char*>(ptr);
|
|
|
|
}
|
2015-03-21 21:03:01 -07:00
|
|
|
// end::decl[]
|
2010-07-19 09:57:32 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2015-03-21 21:03:01 -07:00
|
|
|
// tag::call[]
|
2010-07-19 09:57:32 +00:00
|
|
|
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);
|
2015-03-21 21:03:01 -07:00
|
|
|
// end::call[]
|
2010-07-19 09:57:32 +00:00
|
|
|
|
|
|
|
pugi::xml_document doc;
|
2014-11-17 19:52:23 -08:00
|
|
|
doc.load_string("<node/>");
|
2010-07-19 09:57:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim:et
|