Hi
I'm getting an error when trying to compile code in XCode:
"No matching function for call to 'caspian::World:IntersectionTest(caspian::Vector2&, float*, <unnamed>::entity_output&)'"
this function I am attempting to call is declared like so:
class World : public CodeSection
{
public:
template <typename OutputIterator>
void IntersectionTest(const Vector2& screen, float accuracy, OutputIterator iter) const
{
// do something
}
};
and called from code like the following:
WorldManager::GetCurrentWorld()->IntersectionTest(point, accuracy, entity_outputted(found, entity));
"entity_outputted" is a struct defined in the same file that the function call is made, but in an anonymous namespace.
I can compile and run the code fine in VS but not in xcode.
Any idea what the problem is and how it may be resolved?
Thanks
EDIT:
A little more code
namespace
{
struct entity_outputted
{
entity_outputted(bool& found, caspian::Entity* entity)
: found_ (&found)
, entity_(entity)
{
}
entity_outputted& operator*() { return *this; }
entity_outputted& operator++() { return *this; }
entity_outputted& operator++(int) { return *this; }
void operator=(const caspian::intersection_result& result)
{
if (result.entity_ == entity_)
*found_ = true;
}
private:
bool* found_;
caspian::Entity* entity_;
};
}
namespace caspian
{
void IsEntityUnderPoint(CScriptProcessor* processor)
{
int entity_id = processor->GetStackInt (-2);
Vector2 point = processor->GetStackVector2(-1);
float accuracy = processor->GetStackFloat (0);
CSCRIPTPROCESSOR_HALTCHECK
Entity* entity = ResourceManager::Get()->GetResource<Entity>(entity_id);
CSCRIPTENTITY_EXISTCHECK(entity, entity_id)
bool found = false;
WorldManager::GetCurrentWorld()->IntersectionTest(point, accuracy, entity_outputted(found, entity));
processor->GetFunctionReturnVariable()->SetValue(Variable::INT_TYPE, found);
}
}