If I have an object like this:
struct Bar {
std::string const& property();
};
I can create a multi-index container for it like this:
struct tag_prop {};
typedef boost::multi_index_container<
Bar,
boost::multi_index::indexed_by<
boost::multi_index::ordered_non_unique<
boost::multi_index::tag<tag_prop>,
boost::multi_index...
Hi,
I have a problem getting boost::multi_index_container work with random-access and with orderd_unique at the same time. (I'm sorry for the lengthly question, but I think I should use an example..)
Here an example: Suppose I want to produce N objects in a factory and for each object I have a demand to fulfill (this demand is known at...
Hi,
as I've just learned in in my other question, I could use a composite_key for a struct, which has a std::vector and an integer. Now my question is: Can I use this somehow to work with hashed_indecies?
Here an example similar to THIS:
struct unique_property
{
//the pair of int and std::vector<int> shall be unique
int my_int;
...
Hello,
I learned in THIS THREAD how a hashed_unique<> index can be used with a composite_key using an int and a std::vector<int>. But unfortunately the following code produces quite an error message:
1> boost/multi_index/hashed_index.hpp(439) : error C2784: 'size_t .. composite_key_hash<...>::operator ()(const boost::tuples::tuple<......
Hi,
how do I limit the search in a boost::multi_index by the result of a previous search?
As an example: suppose I have a rectangle class with an internal value like this:
class MyRect
{
public:
int width;
int height;
double value;
}
and I need a data structure of such object to answ...
I have the following code:
#include <iostream>
#include "boost/unordered_map.hpp"
using namespace std;
using namespace boost;
int main()
{
typedef unordered_map<int, int> Map;
typedef Map::const_iterator It;
Map m;
m[11] = 0;
m[0] = 1;
m[21] = 2;
for (It it (m.begin()); it!=m.end(); ++it)
cout << i...
Hello, assume that we have a data1 and data2. How can I intersect them with std::set_intersect()?
struct pID
{
int ID;
unsigned int IDf;// postition in the file
pID(int id,const unsigned int idf):ID(id),IDf(idf){}
bool operator<(const pID& p)const { return ID<p.ID;}
};
struct ID{};
struct IDf{};
typedef mul...
Hello, I am trying to use elements of meta programming, but hit the wall with the first trial.
I would like to have a comparator structure which can be used as following:
intersect_by<ID>(L1.data, L2.data, "By ID: ");
intersect_by<IDf>(L1.data, L2.data, "By IDf: ");
Where:
struct ID{};// Tag used for original IDs
struct IDf{};/...
Is there anyway to loop through an index in a boost::multi_index and perform a replace?
#include <iostream>
#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
using namespace boost::multi_index...
I would like to quickly retrieve the median value from a boost multi_index container with an ordered_unique index, however the index iterators aren't random access (I don't understand why they can't be, though this is consistent with std::set...).
Is there a faster/neater way to do this other than incrementing an iterator container.size...
I have a struct to store info about persons and multi_index_contaider to store such objects. Mult-index uses for search by different criteria.
I've added several persons into container and want to find person by lastname. It works great, if I use whole lastname. But it returns nothig if I try to find person by a part of a lastname (firs...
I googled and searched in the boost's man, but didn't find any examples. May be it's a stupid question...anyway.
So we have the famous phonebook from the man:
typedef multi_index_container<
phonebook_entry,
indexed_by<
ordered_non_unique<
composite_key<
phonebook_entry,
member<phonebook_entry,std::string,&...
I stumbled upon multi_index on a lark last night while pounding my had against a collection that I need to access by 3 different key values, and also to have rebalancing array semantics. Well I got one of my two wishes (3 different key values) in boost::multi_index.
I'm curious if anything similar exists in the Java world.
...
I'm currently using Boost's multi-index to help keep track of how many times a packet passes through a system.
Each time a system touches the packet, its IP address is added to a string, separated by commas. I go through that string then, tokenize it and add each IP found to a multi-index. Since the IPs are set to be unique right now, ...
I initially started out using a std::multimap to store many values with the same key, but then I discovered that it doesn't preserve the insertion order among values with the same key. This answer claims it can be done with boost::multi_index::multi_index_container, but gives no example. Looking through the docs, there are no examples ...
Hi,
In boost multi-index, can i verify whether a particular index type is ordered/not through meta programming?
There are the ordered indexes, hash indexes, sequence indexes etc. Can i find them out through meta programming?
suppose there is a index like
int main()
{
typedef multi_index_container<double> double_set;
r...
so you have a class employee
class employee {
public:
employee(const string &name, int id) : m_name(name) , m_id(id) {}
const string &getName() const { return m_name; }
int getID() const { return m_id; }
private:
string &m_name;
int m_id;
};
and you have private data members for encapsulation. But now you want to...
Sorry I can't be more specific in the title.
Let's say I have a class Foo
class Foo {
public:
Foo() { m_bitset.reset(); }
void set_i(int i) {
m_bitset.set(1);
m_i = i;
}
void set_j(int j) {
m_bitset.set(2);
m_j = j;
}
bool i_set() { return m_bitset(1); }
bool j_set() { retur...
I need a muti index container based on red-black trees (something like boost::multi_index::multi_index_container) for the case of the harddisk storage. All data must be store on hard disk rather than in memory.
Is there an open source container such that described conditions hold?
Note. I use C++.
...
Is there anything like boost::multi_index but for ruby. Basically taking some
container of objects and having it indexed N different ways with N different query methods.
I guess you could use DataMapper with the SQLite in memory database but I was
wondering if there is anything pure ruby around.
Below is an imagined example of what thi...