Hi,
Having problem with boost and stuck.
I have the following:
std::map <std::string, boost::anybinar yHeader;
and somewere else I write:
---------------
binaryHeader.in sert(make_pair( "job", 0));
binaryHeader.in sert(make_pair( "line", 0));
binaryHeader.in sert(make_pair( "reel", 0));
binaryHeader.in sert(make_pair( "Ensemble", 0));
---------------
further down in another function the following does not work:
---------------
for( map<std::string , boost::any>::it erator iter =
binaryHeader.be gin(); iter != binaryHeader.en d(); iter++)
cout << any_cast<string >((*iter).first ) << " is " <<
boost::any_cast <short>((*iter) .second) << endl;
---------------
whereis this works perfectly(repla cing <shortwith <int>):
---------------
for( map<std::string , boost::any>::it erator iter =
binaryHeader.be gin(); iter != binaryHeader.en d(); iter++) {
cout << any_cast<string >((*iter).first ) << " is " <<
boost::any_cast <int>((*iter).s econd) << endl;
----------------
What is wrong ? Isn't "boost::any " supposed to take 'any' type ?
Thanks in advance
Kamran 7 1659
Kamran wrote:
Hi,
Having problem with boost and stuck.
[..]
Did you know that Boost has its own online forum? Just checking...
Kamran wrote:
Having problem with boost and stuck.
I have the following:
std::map <std::string, boost::anybinar yHeader;
and somewere else I write:
---------------
binaryHeader.in sert(make_pair( "job", 0));
binaryHeader.in sert(make_pair( "line", 0));
binaryHeader.in sert(make_pair( "reel", 0));
binaryHeader.in sert(make_pair( "Ensemble", 0));
---------------
further down in another function the following does not work:
---------------
for( map<std::string , boost::any>::it erator iter =
binaryHeader.be gin(); iter != binaryHeader.en d(); iter++)
cout << any_cast<string >((*iter).first ) << " is " <<
boost::any_cast <short>((*iter) .second) << endl;
---------------
whereis this works perfectly(repla cing <shortwith <int>):
---------------
for( map<std::string , boost::any>::it erator iter =
binaryHeader.be gin(); iter != binaryHeader.en d(); iter++) {
cout << any_cast<string >((*iter).first ) << " is " <<
boost::any_cast <int>((*iter).s econd) << endl;
----------------
What is wrong ? Isn't "boost::any " supposed to take 'any' type ?
For help with portions of Boost that are not part of TR1, you should
ask on the Boost User list. See this FAQ for what is on-topic here: http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
<OT>The second loop is correct because you made pairs of strings and
integers (the default type for numeric literals). If you do something
like 'make_pair( "hi", short(0) )', then the first loop should
work.</OT>
Cheers! --M
mlimber wrote:
Kamran wrote:
>>Having problem with boost and stuck. I have the following:
std::map <std::string, boost::anybinar yHeader;
and somewere else I write: --------------- binaryHeader. insert(make_pai r("job", 0)); binaryHeader. insert(make_pai r("line", 0)); binaryHeader. insert(make_pai r("reel", 0)); binaryHeader. insert(make_pai r("Ensemble", 0)); --------------- further down in another function the following does not work: --------------- for( map<std::string , boost::any>::it erator iter = binaryHeader. begin(); iter != binaryHeader.en d(); iter++) cout << any_cast<string >((*iter).first ) << " is " << boost::any_cast <short>((*iter) .second) << endl; --------------- whereis this works perfectly(repla cing <shortwith <int>): --------------- for( map<std::string , boost::any>::it erator iter = binaryHeader. begin(); iter != binaryHeader.en d(); iter++) { cout << any_cast<string >((*iter).first ) << " is " << boost::any_cast <int>((*iter).s econd) << endl; ---------------- What is wrong ? Isn't "boost::any " supposed to take 'any' type ?
For help with portions of Boost that are not part of TR1, you should
ask on the Boost User list. See this FAQ for what is on-topic here:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
<OT>The second loop is correct because you made pairs of strings and
integers (the default type for numeric literals). If you do something
like 'make_pair( "hi", short(0) )', then the first loop should
work.</OT>
Cheers! --M
Thanks a lot. It worked. And sorry, I was not aware that there was a
mailing list for boost though I should have known.
Kamran
Thanks a lot. It worked. And sorry, I was not aware that there was a
mailing list for boost though I should have known.
you shouldn't have to sign up for a stinkin mailing list for every tool
you want help with. If I did then I'd be subscribed to several hundred
and would never get thru all the irrelevant emails. projects SHOULD use
USENET as a preferred support forum.
* noone:
>Thanks a lot. It worked. And sorry, I was not aware that there was a mailing list for boost though I should have known.
you shouldn't have to sign up for a stinkin mailing list for every tool
you want help with. If I did then I'd be subscribed to several hundred
and would never get thru all the irrelevant emails. projects SHOULD use
USENET as a preferred support forum.
<url: news://news.gmane.org/gmane.comp.lib. boost.devel>
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
On Sat, 29 Jul 2006 09:24:32 +0200, Alf P. Steinbach wrote:
* noone:
>>Thanks a lot. It worked. And sorry, I was not aware that there was a mailing list for boost though I should have known.
you shouldn't have to sign up for a stinkin mailing list for every tool you want help with. If I did then I'd be subscribed to several hundred and would never get thru all the irrelevant emails. projects SHOULD use USENET as a preferred support forum.
<url: news://news.gmane.org/gmane.comp.lib. boost.devel>
lemme rephrase, projects should allow ANONYMOUS USENET as a preferred
support forum.
* noone:
On Sat, 29 Jul 2006 09:24:32 +0200, Alf P. Steinbach wrote:
>* noone:
>>>Thanks a lot. It worked. And sorry, I was not aware that there was a mailing list for boost though I should have known. you shouldn't have to sign up for a stinkin mailing list for every tool you want help with. If I did then I'd be subscribed to several hundred and would never get thru all the irrelevant emails. projects SHOULD use USENET as a preferred support forum.
<url: news://news.gmane.org/gmane.comp.lib. boost.devel>
lemme rephrase, projects should allow ANONYMOUS USENET as a preferred
support forum.
Well, I don't know what "anonymous usenet" is and I'm an old hand.
Anyway, it's off-topic. <g>
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rex_chaos |
last post by:
Hi all,
I am looking for a high-performance container(matrix and vector) for
numerical computation. Someone recommended the boost::multi_array. After
having looked at the documentation, I know several more candidates from it. They
are : MTL, blitz++, boost::ublas. I have no idea which one is the best.
The documentation of these packages are trying to convince me that they
are free from drawback :)) I need someone to tell me the experience...
|
by: Dan Trowbridge |
last post by:
He everyone,
I am just getting started with .NET and I am having a porting problem.
I get and error in code that lookssomething like this (really stripped down
but you get the idea)...
class dt
{
std::deque< class dt > dtdq;
};
|
by: MeganTSU |
last post by:
Hey yall! I am trying to get this program finished for class.... It
says that you are suppposed to write a program that will display a
check formatted out put (the output looks like a check). I got
everything to work and it will compile and run......
BUT.... I dont know how to turn the 'Amount' into a charater string
that puts the number into words.... It is supposed to show the name,
then the amount, and then on the next line write out...
|
by: Jef Driesen |
last post by:
I'm trying to create a graph from an image, where pixel values are
regions labels. I have defined my graph to use lists instead of the
vectors (because I need to add/remove vertices and edges) and one extra
property for the vertex (the region label):
typedef boost::adjacency_list<
boost::listS, // Adjacency list
boost::listS, // Vertex list
boost::undirectedS, // Undirected graph
unsigned int, // Vertex property...
|
by: Lighter |
last post by:
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;
using namespace boost;
void hello()
{
cout << "Hello world, I'm a thread!" << endl;
}
| |
by: tkirke |
last post by:
How does one transfer a buffer object from python -c and back again
(assuming the data gets modified)?
I can't seem to get this or anything else to work, but am clueless as
to what I'm doing wrong
using namespace boost::python;
static PyObject * proc_buf(PyObject *self, PyObject *args) {
PyObject *resultobj;
|
by: TonyHa |
last post by:
Hello
I try to install boost_1_33_1 on RedHat Linux.
I have downloaded boost into /user/dtgtools/tmp and I try to install it
into
/user/dtgtools/packages/boost.
I use the following commands:
export PYTHON_ROOT="/user/dtgtools/packages/python/2.5"
|
by: Stephen Torri |
last post by:
Below is a class that is suppose to represent a segment of memory or a
contents of a binary image (e.g. ELF executable). I have started to read
Modern C++ Design and thought the best way to ensure I was understanding
the chapter on policy classes was to attempt to apply them to my project.
I understand the general concept of policies but I lack the knowledge and
wisdom of how to identify them in an existing project. So I figured to get
an...
|
by: alan |
last post by:
I have a set of classes, cell, cell_body, and cell_internal.
cell_internal is an abstract base class, intended to encapsulate
deferred computation.
cell is just a wrapped pointer around cell_body; this is the user's
interface to this code.
When a cell is created, it creates a cell_body and attaches a
shared_ptr member (value_) to the body. This shared_ptr should never
be changed; the cell can only have one cell_body during its...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |