This makes using returning strings much simpler to use from C++ code as the returned pointers don't have to be deleted manually -- although, of course, this does require an extra allocation and copy and so should be avoided for the very long strings. Add a new runtime test showing how simple and convenient it is to use the functions working with string using the C++ wrappers now.
15 lines
369 B
C++
15 lines
369 B
C++
#include "li_boost_shared_ptr_wrap.h"
|
|
#include <assert.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
{
|
|
li_boost_shared_ptr::Klass k("me oh my");
|
|
assert( k.getValue() == "me oh my" );
|
|
}
|
|
|
|
{
|
|
li_boost_shared_ptr::Klass k{li_boost_shared_ptr_factorycreate()};
|
|
assert( k.getValue() == "factorycreate" );
|
|
}
|
|
}
|