473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to Inlcude STL::Map

How do I go about including an STL::Map in a C file?

Doing:
#include <map>
using namespace std;

gives me a lot of errors in VC7... Ofcourse it is because <map> is a
C++ header file...
Is there anything else I can do to use this STL map here...?

- Vivek

Dec 22 '05 #1
2 1417
vi***********@gmail.com wrote:
How do I go about including an STL::Map in a C file?


You don't.

If you want to use C code in a C++ program, C++ has features for doing
so. C has no features for going the other way.

Richard
Dec 22 '05 #2

vi***********@gmail.com wrote:
How do I go about including an STL::Map in a C file?

Doing:
#include <map>
using namespace std;

gives me a lot of errors in VC7... Ofcourse it is because <map> is a
C++ header file...
You have your answer. Why would you include a C++ header in a C file?
C and C++ are two different languages.
Is there anything else I can do to use this STL map here...?


Yes, implementing in C your own associative container.

A+
Regis

Dec 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: yccheok | last post by:
I have an immutable object, where I do not provide implementation on =operator. However, I am facing a problem when trying to use it with stl map. stl map requires the object to have =operator...
18
by: Jan | last post by:
Hi there, i've got an STL map with something like this ( map<string, Object*> xyz; ) What happens when I call xyz.clear()? Is only the map cleared or the map and the Objects, so that the memory...
5
by: vin b | last post by:
Hi, How would I invoke a method on a reference to an STL object (STL map in this case) In this contrived example, I want to invoke the insert() method on localmap? Thanks, Vin
2
by: Allerdyce.John | last post by:
I have a a stl map which use stl pair as the key class A; type map< pair<int, int>, A> MyMap; if I have function which add entry to the map: void func(int x, int y, MyMap& map, A& a) {...
8
by: olanglois | last post by:
Hi, I was asking myself to following question. What is better to erase an element from a STL map: calling (option #1) size_type erase(const key_type& k) or calling (option #2)
7
by: Christian Christmann | last post by:
Hi, I've profiled one of my C++ projects and figured out that the program spends a lot of time with STL map's function "find". One of my classes possesses an STL map of the structure map<...
2
by: rockkyy | last post by:
Hi all, ok here it goes.. I am going to implement a STL MAP.. say 'mapToken'..this is a GLOBAL map. This mapToken has many nodes with its keys ranging from t1,t2,t3 ....t100 . Now in...
7
by: Alexander Kotelnikov | last post by:
Hello. I faced the same problem which arose before Message-ID: <1124162913.832263.262410@g14g2000cwa.googlegroups.com>...
2
by: Rakesh Kumar | last post by:
I am encountering the following issue with STL map iterator - wrapped within a template. ( I am wrapping it withing a template since I want to hide the map implementation from the user . At a later...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.