Strange “no matching function for call to …” error on MacOS

Error appear when using BOOST::fusion::map<....>

Error message:

In file included from axOrm/ormObject/ormObject.test.cpp:5:
axOrm/ormObject/testObjects/objContactAndAddress.h: In member function 'void Atomix::Orm::Tests::CBaseOrmContact::SetName(XString)':
axOrm/ormObject/testObjects/objContactAndAddress.h:92: error: no matching function for call to 'Atomix::Orm::Tests::CBaseOrmContact::GetPropertyHolder()'

Invalid source code

template <class TNameParam> typename fus::result_of::at_key< TmapAssociations,TNameParam>::type & GetAssociationHolder()
{ return fus::at_key<TNameParam>(m_mapAssociations); }

for fix simply change result_of::at_key to result_of::value_at_key

template <class TNameParam> typename fus::result_of::value_at_key<TmapAssociations,TNameParam>::type & GetAssociationHolder()

After fixing this error, you can achieved problem with const modifier. Correct syntax for const definition is:

template typename fus::result_of::value_at_key::type const & GetPropertyHolder() const
{ return fus::at_key(m_mapProperties); }

g++ error: conversion from XTestObjectA to non-scalar type XTestObjectBase requested

//error
XTestObjectBase objTestObjectBase1 = objTestObjectA;

//ok
XTestObjectBase objTestObjectBase2(objTestObjectA);

//ok
XTestObjectBase objTestObjectBase3; objTestObjectBase3 = objTestObjectA;

cite from: http://stackoverflow.com/questions/6120240/why-constructor-is-not-called-for-given-casting-operator

The problem is that the number of user-defined conversions that are invoked implicitly is limited (to 1) by the Standard.

B ob = a;
implies two user conversions:

on a: Wrap::operator A*() should be called
on the result: B::B(A*) should be called

The solution is to use explicit conversion

//now ok
XTestObjectBase objTestObjectBase1 = XTestObjectBase(objTestObjectA);

g++ error: expected primary-expression before > token

For g++ compiler is sometimes necessary to specify more typename / template keywords than for Visual Studio. This is one of examples.

To the following code it’s necessary to add template keyword:

TMemoryManager & memMngr = GetMemoryManager();
m_pObject = 
  memMngr.CreateObject<TObject>(this, m_pContainerOwner);

use

TMemoryManager & memMngr = GetMemoryManager();
m_pObject = 
  memMngr.template CreateObject<TObject>(this, m_pContainerOwner);