473,382 Members | 1,445 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,382 software developers and data experts.

Can I use a local struct to store data in the "set" conatiner?

5
Can I use a local struct to store data in the "set" conatiner? If so, what is the correct method to do so?

Compiler: Sun Studio 10 on Unix (Sun Solaris)

Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<set>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.   struct product
  9.   {
  10.     int id;
  11.     string desc;
  12.     double amt;
  13.   } prdt;
  14.  
  15.   prdt.id = 1234;
  16.   prdt.desc = "Credit Card";
  17.   prdt.amt = 1000.00 ;
  18.  
  19.   cout << " This is a program to test set conatainer. " << endl
  20.        << " Product ID is: " << prdt.id 
  21.        << ", Product Desc is : " << prdt.desc 
  22.        << ", Credit Card Limit is : " << prdt.amt << endl ;
  23.  
  24.  
  25. [COLOR="DarkRed"]// Test program for 'set' container with a struct
  26.  typedef std::set< product, std::less< int > > product_set;[/COLOR]
  27.  
  28.   return 0;
  29. }
  30.  
  31.  

Error Message:[COLOR="DarkRed"]"testSet.c", line 26: Error: The local type "product" cannot be used as a template argument.
"/opt/SunStudio10/SUNWspro/prod/include/CC/Cstd/./set", line 83: Error: The local type "product" cannot be used as a template argument.[/COLOR]
Dec 6 '06 #1
1 1966
Banfa
9,065 Expert Mod 8TB
basically, yes but it would help if you could post your code at least up to line 26 where the error occurs.
Dec 7 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil Powell | last post by:
print_r("From index.php 20: $prefix: stateXML = $stateXML<P>"); foreach (array('state', 'country') as $prefix) { print_r("From index.php 21: stateXML = $stateXML<P>"); ${$prefix . 'XML'} =...
3
by: Skip Montanaro | last post by:
I use sets a lot in my Python 2.3 code at work and have been using this hideous import to make the future move to 2.4's set type transparent: try: x = set except NameError: from sets import...
0
by: Peter Steele | last post by:
I want to create a local admin account programmatically and set it so that it to have "Logon as Service" rights and not be able to be logged on interactively. How are these extended rights...
3
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that...
10
by: Mart | last post by:
What class does everyone out there use if they want to store a set of values efficiently? In java I use a HashSet, but there is no equivalent in C#. Even worse, the lowest level interface to...
3
by: Mike L | last post by:
This is a WinForm. After the code below is executed, my data grid only shows a plus sign. I click the plus sign and the word table is shown. I click on the word table, and my columns are shown...
23
by: Phil Powell | last post by:
// OBTAINED FROM http://www.javascripter.net/faq/settinga.htm // NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY AND THUS EXPIRE function setCookie(name, value, days, docObj)...
9
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
5
by: rkwan | last post by:
Hi, I got a message from W2K as below. "Null data set can not replace EMS data !" what is the meaning of it, does this related to SQL server. Thanks
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...

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.