does composite_key_compare support an interface that enables comparsion of the whole tuple
Hi,
Here is what I am trying to do
typedef DWORD DSIid;
enum DSType
{
DSTypeNone = 0,
DSTypeBegin,
DSTypeRoot
}
struct SDSIOwnedByKey
{
SDSIOwnedByKey(DSType DSTypeOwned, DSIid DSIidOwned,
DSType DSTypeOwner, DSIid DSIidOwner)
: m_DSTypeOwned(DSTypeOwned),
m_DSIidOwned(DSIidOwned), m_DSTypeOwner(DSTypeOwner),
m_DSIidOwner(DSIidOwner)
{
}
bool operator == (const SDSIOwnedByKey &rcComp) const
{
return m_DSTypeOwned ==
rcComp.m_DSTypeOwned &&
m_DSIidOwned ==
rcComp.m_DSIidOwned &&
m_DSTypeOwner ==
rcComp.m_DSTypeOwner &&
m_DSIidOwner ==
rcComp.m_DSIidOwner;
}
DSType m_DSTypeOwned;
DSIid m_DSIidOwned;
DSType m_DSTypeOwner;
DSIid m_DSIidOwner;
};
class DataStore
{
typedef boost::multi_index_container<
SDSIOwnedByKey,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique
TOwnedBySort;
typedef typename
TOwnedBySort::index<ByOwnedTypeOwnerTypeOwnerIdOwnedId>::type
OwnedBySort_ByOwnedTypeOwnerTypeOwnerId;
TOwnedBySort m_oOwnedBySort;
};
Instead of
>,
boost::multi_index::composite_key_compare
El 13/06/2011 19:54, brijesh.sharma@thomsonreuters.commailto:brijesh.sharma@thomsonreuters.com escribió:
Hi,
Hi Brijesh,
Next time please include [multi_index] in the subject line so that people
in a position to help can quickly spot your post:
http://www.boost.org/community/policy.html#subject-line
Here is what I am trying to do
typedef DWORD DSIid;
enum DSType
{
DSTypeNone = 0,
DSTypeBegin,
DSTypeRoot
}
struct SDSIOwnedByKey
{
SDSIOwnedByKey(DSType DSTypeOwned, DSIid DSIidOwned, DSType DSTypeOwner, DSIid DSIidOwner)
: m_DSTypeOwned(DSTypeOwned), m_DSIidOwned(DSIidOwned), m_DSTypeOwner(DSTypeOwner), m_DSIidOwner(DSIidOwner)
{
}
bool operator == (const SDSIOwnedByKey &rcComp) const
{
return m_DSTypeOwned == rcComp.m_DSTypeOwned &&
m_DSIidOwned == rcComp.m_DSIidOwned &&
m_DSTypeOwner == rcComp.m_DSTypeOwner &&
m_DSIidOwner == rcComp.m_DSIidOwner;
}
DSType m_DSTypeOwned;
DSIid m_DSIidOwned;
DSType m_DSTypeOwner;
DSIid m_DSIidOwner;
};
class DataStore
{
typedef boost::multi_index_container<
SDSIOwnedByKey,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique
TOwnedBySort;
typedef typename TOwnedBySort::index<ByOwnedTypeOwnerTypeOwnerIdOwnedId>::type OwnedBySort_ByOwnedTypeOwnerTypeOwnerId;
TOwnedBySort m_oOwnedBySort;
};
Instead of
>, boost::multi_index::composite_key_compare
TOwnedBySort;
The drawback is that when you use the lookup functions of TOwnedBySort you can no longer pass tuples (or partial tuples) of (m_DSTypeOwned,m_DSTypeOwner, m_DSIidOwner, m_DSIidOwned) values but have to pass whole SDSIOwnedByKey's instead. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo ________________________________ Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo. This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at. http://www.tid.es/ES/PAGINAS/disclaimer.aspx
participants (2)
-
brijesh.sharma@thomsonreuters.com
-
joaquin@tid.es