Hi all,
I'm making a neural network and wanted to use a hash_map to keep weight references for output neurons for each neuron:
class Neuron; //forward declaration was there (sorry I forgot to show it earlier)
typedef double WEIGHT;
typedef stdext::hash_map<boost::shared_ptr<Neuron>,WEIGHT> NeuronWeightMap;
class Neuron
{
private:
N...
Using the STL C++ hash_map...
class MyKeyObject
{
std::string str1;
std::string str2;
bool operator==(...) { this.str1 == that.str1 ... }
};
class MyData
{
std::string data1;
int data2;
std::string etcetc;
};
like this...
MyKeyObject a = MyKeyObject(...);
MyData b = MyData(...);
stdext::hash_map <MyKeyObjec...
vs2005 support
::stdext::hash_map
::std::map.
however it seems ::stdext::hash_map's insert and remove OP is slower then ::std::map in my test.
( less then 10000 items)
Interesting....
Can anyone offored a comparision article about them?
...
I was using std::hash_map<char*,T> and somehow managed to make it work but have now discovered that the default compare function, euqal_to<char*> does a pointer compare rather than a string compare. I've fixed this by making my own compare type (using C's strcmp and it's about 5 LOC) but I'd be slightly shocked if there wasn't one alread...
Hi,
I am porting a program to AIX which takes use of hash_map in many places.
For linux and solaris hash_map is included in _gnu_cxx package and stlport.
However, I can't find hash_map on AIX platform. Anybody know?
Btw, I have to use IBM compiler /usr/vacpp/bin/xlC.
Thanks.
...
I am not to Clojure and attempting to figure out how to do this.
I want to create a new hash-map that for a subset of the keys in the hash-map applies a function to the elements. What is the best way to do this?
(let
[my-map {:hello "World" :try "This" :foo "bar"}]
(println (doToMap my-map [:hello :foo] (fn [k] (.toUpperCase k))...
This is my first time making a hash table. I'm trying to associate strings (the keys) with pointers to objects (the data) of class Strain.
// Simulation.h
#include <ext/hash_map>
using namespace __gnu_cxx;
struct eqstr
{
bool operator()(const char * s1, const char * s2) const
{
return strcmp(s1, s2) == 0;
}
};
...
hash_map< co...
This question is an offgrowth of my previous question on creating a hash table to store string keys and pointers as data. I'm getting a seg fault post-construction when I try to add entries to my hash table. I'm still very confused about what syntax is appropriate.
I currently have (thanks to previous posters):
// Simulation.h
#include...
Hello,
In some C++ program I have two classes - Abc and Xyz. The Abc class contains an integer member Foo, like in the following listing:
class Abc
{
public:
int Foo;
Abc(int f)
{
Foo = f;
}
};
class Xyz{};
I'm using a map<Abc, Xyz> but the performance is extremly poor. That's why I'd like to use a hash_map<Abc, Xyz> (Dev-Cp...
Here's what I have, I am new to C++ so I am not sure if this is right...
typedef pair<string, int>:: make_pair;
hash_map <string, int> dict;
dict.insert(make_pair("apple", 5));
I want to give my hash_map "apple", and I want to get back 5. How do I do it?
...
I've done something wrong in defining my class which is causing Microsoft's implementation of the hash_multimap to "miss." Here is my class:
class TimeParameter {
public:
TimeParameter(int _year, int _julianDay, int _hour) : m_Year(_year),
m_JulianDay(_julianDay),
m_Hour(_hour){}
int GetHour() const {re...
Hi,
I have a question with hash_map and map in C++. I understand that map is in STL but hash_map is not a standard. What's the difference of them two?
Any insights are strongly welcomed.
Thanks!
...
Hi. I have a class like this:
class Foo
{
long long Id;
string x;
string y;
// other member variables and functions
};
I would like to store this in a hash_set (or hash_map), but use the Id member variable as the key for inserting and searching. I'm not sure how I can do this. I thought of the following ways, but none of t...