Hi Marcus,
some weeks back you opened ticket #200 with a patch to make boost::bind
work with OpenSG. The ticket says this is for 1.8, is that correct?
Do you have some more information on why that patch is necessary, I've
looked over the documentation of boost::bind and could not find any
mention of the need to provide a get_pointer function.
Anyway the attached test compiles, if get_pointer overloads for
FCPtr<FCPtrType, FCType> and NodePtr are added, but it crashes at
runtime in FieldContainerPtrBase::operator =.
Do you have a small example that shows how to use boost::bind correctly?
Thanks,
Carsten
#include <OpenSG/OSGConfig.h>
#include <OpenSG/OSGBaseFunctions.h>
#include <OpenSG/OSGNode.h>
#include <boost/bind.hpp>
#include <algorithm>
OSG_BEGIN_NAMESPACE
Node* get_pointer(const OSG::NodePtr &p)
{
return p.getCPtr();
}
template <class FCType, class FCPtrType>
FCType* get_pointer(const OSG::FCPtr<FCPtrType, FCType>& p)
{
return p.getCPtr();
}
OSG_END_NAMESPACE
OSG_USING_NAMESPACE
int main(int argc, char *argv[])
{
osgInit(argc, argv);
NodePtr n0 = Node::create();
NodePtr n1 = Node::create();
NodePtr n2 = Node::create();
NodePtr n3 = Node::create();
beginEditCP(n0);
n0->addChild(n1);
n0->addChild(n2);
n0->addChild(n3);
endEditCP (n0);
NodePtr n4 = Node::create();
MFNodePtr *n0Children = n0->getMFChildren();
beginEditCP(n4);
std::for_each(n0Children->begin(), n0Children->end(),
boost::bind(&Node::insertChild, boost::ref(n4), 0, _1));
// std::for_each(n0Children->begin(), n0Children->end(),
// boost::bind<void (OSG::Node::*)(OSG::UInt32, const OSG::NodePtr&)>(&Node::insertChild, boost::ref(n4), 0, _1));
endEditCP (n4);
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core