Sponsored Content
Top Forums Programming Map with struct as key and vector as value Post 302917411 by yifangt on Tuesday 16th of September 2014 01:12:39 PM
Old 09-16-2014
Then comes to a new thing if two maps are used------they need share the key. While student_names only contains 3 unique entries(structure), student_courses contains 12 entries (structure) that are pushed into three vectors each for a student_names.
Do you mean to assign a new integer to both map?
The next step is to calculate the total credit of courses for each student; calculate the average grades for each student on his/her courses taken so far. So that I though use the string(or student ID) as key for retrieval and calculation.
The compiling error indicated the problem is the map iterator, which seems should be overloaded.
Code:
error: no match for 'operator=' in map_itr=mymap.std::map<_Key, _Tp, _Compare, _Alloc>::begin....
candidate is:
In file included from /usr/include/c++/4.7/map:60:0,
......

This challenge is too big for me at this moment. Thanks anyway!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

2. Programming

Vector Traversing

Hi i have the following structure struct S { char Mod_num; char val; char chr_nm_cd; } I am reading a 2GB file and inserting into the structure and writing into a vector. I feel like only vector will be a right option. I tried with multimap but it is memory intensive and hence i... (1 Reply)
Discussion started by: dhanamurthy
1 Replies

3. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

4. Programming

C++ Map using a Vector as a Value Type?

I modified some code I found on Wikipedia concerning maps to see if it would work before applying it to a project I'm working on that has a similar idea. What I would want is for a user to be able to enter sentences and then be able to distinguish how many times a the person entered a word in a... (4 Replies)
Discussion started by: kcgb20
4 Replies

5. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

6. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

7. Programming

Array and Vector

Hi all, from my understanding I understand that I can use array in this manner. struct test { int a; int b; int c; }; test testing; //creating an array with the structer type testing.a=1; testing.b=2; testing.c=3; If I'm not wrong we can use array in this manner,... (12 Replies)
Discussion started by: vinzping
12 Replies

8. Programming

vector c++

hello guys. i'm new to c++. i've problem using two dimensional vector. i've a project of making conway's game of life. this is the code that i have made so far. my problem is how can i give a two dimensional vector through main. glider.vec1 = vec; is not correct way to give a two... (2 Replies)
Discussion started by: nishrestha
2 Replies

9. Shell Programming and Scripting

Vector normalisation

In AWK For 3 individual vectors of the form: -2.772 -9.341 -2.857 -5.140 -6.597 -1.823 -2.730 -5.615 1.159 I would like to write a script that parses line by line to (i) normalise, (ii) divide by the norm for *each* vector. I.e. sqrt(-2.772^2 + -9.341^2 + -2.857^2)=10.154 ... (4 Replies)
Discussion started by: chrisjorg
4 Replies
rmallocmap(9F)						   Kernel Functions for Drivers 					    rmallocmap(9F)

NAME
rmallocmap, rmallocmap_wait, rmfreemap - allocate and free resource maps SYNOPSIS
#include <sys/ddi.h> #include <sys/sunddi.h> struct map *rmallocmap(size_t mapsize); struct map *rmallocmap_wait(size_t mapsize); void rmfreemap(struct map *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mapsize Number of entries for the map. mp A pointer to the map structure to be deallocated. DESCRIPTION
rmallocmap() dynamically allocates a resource map structure. The argument mapsize defines the total number of entries in the map. In par- ticular, it is the total number of allocations that can be outstanding at any one time. rmallocmap() initializes the map but does not associate it with the actual resource. In order to associate the map with the actual resource, a call to rmfree(9F) is used to make the entirety of the actual resource available for allocation, starting from the first index into the resource. Typically, the call to rmallocmap() is followed by a call to rmfree(9F), passing the address of the map returned from rmallocmap(), the total size of the resource, and the first index into the actual resource. The resource map allocated by rmallocmap() can be used to describe an arbitrary resource in whatever allocation units are appropriate, such as blocks, pages, or data structures. This resource can then be managed by the system by subsequent calls to rmalloc(9F), rmal- loc_wait(9F), and rmfree(9F). rmallocmap_wait() is similar to rmallocmap(), with the exception that it will wait for space to become available if necessary. rmfreemap() deallocates a resource map structure previously allocated by rmallocmap() or rmallocmap_wait(). The argument mp is a pointer to the map structure to be deallocated. RETURN VALUES
Upon successful completion, rmallocmap() and rmallocmap_wait() return a pointer to the newly allocated map structure. Upon failure, rmal- locmap() returns a NULL pointer. CONTEXT
rmallocmap() and rmfreemap() can be called from user, kernel, or interrupt context. rmallocmap_wait() can only be called from user or kernel context. SEE ALSO
rmalloc(9F), rmalloc_wait(9F), rmfree(9F) Writing Device Drivers SunOS 5.11 20 Nov 1996 rmallocmap(9F)
All times are GMT -4. The time now is 09:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy