I have the following code:
// For each trigger model (_1) (which is just a CString), do:
// m_triggers.push_back(triggers.GetTrigger(static_cast<char const*>(_1)))
boost::transform(
model.Triggers(),
std::back_inserter(m_triggers),
phx::bind(&CTriggerController::GetTrigger, phx::ref(triggers),
phx::static_cast_<char const*>(_1)));
m_triggers
is a vector of pointers to trigger objects:
std::vector<CTrigger*> m_triggers;
If the call to CTriggerController::GetTrigger()
returns NULL (which means no trigger by that name could be found), I do not want to push anything to my m_triggers
vector.
Is there a straightforward way of doing this through some minor modification to my code above?
I'm using Boost 1.55.0 on MSVC9 (C++03 only)