G
Giuseppe:G:
Hi,
I have a function defined as follows:
bool observe(const WordID* dataword);
bool observe(const Word* dataword);
where Word and WordID are respectively
typedef std::string Word;
typedef uint32_t WordID;
My purpose is to use this function with some different data I already
have: the problem is, this data is NOT in the WordID/Word format.
What I have is *pairs* of values, that I would like to input together
into observe(). In other words, I have pairs of numbers whose type is size_t
(size_t, size_t), (size_t, size_t), ... etc.
How can I input one of these pairs into observe()? I was thinking of
creating a pair like in
X = make_pair(a,b)
and then use some kind of cast in order to have
WordID* dataword = dynamic_cast<WordID*>(X)
But I'm not really sure if what I'm saying sounds reasonable or whether
there are better ways to achieve this?Such as chaining the two size_t
into a string and returning a pointer maybe?
Thanks!
Giuseppe
I have a function defined as follows:
bool observe(const WordID* dataword);
bool observe(const Word* dataword);
where Word and WordID are respectively
typedef std::string Word;
typedef uint32_t WordID;
My purpose is to use this function with some different data I already
have: the problem is, this data is NOT in the WordID/Word format.
What I have is *pairs* of values, that I would like to input together
into observe(). In other words, I have pairs of numbers whose type is size_t
(size_t, size_t), (size_t, size_t), ... etc.
How can I input one of these pairs into observe()? I was thinking of
creating a pair like in
X = make_pair(a,b)
and then use some kind of cast in order to have
WordID* dataword = dynamic_cast<WordID*>(X)
But I'm not really sure if what I'm saying sounds reasonable or whether
there are better ways to achieve this?Such as chaining the two size_t
into a string and returning a pointer maybe?
Thanks!
Giuseppe