Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:00:16+00:00 2026-05-27T03:00:16+00:00

Is it not possible to fill a map like this: void Spel::Fill( void )

  • 0

Is it not possible to fill a map like this:

void Spel::Fill( void )
{
    int buildslist[] = {3,3,2,2,2,2,3,2,2,2,2,3,3,2,2,2,2,1,1,1,1,1};
    Building::buildings p;

    for( int i = Building::INDIGOK; i < Building::STADSHUIS; i++)
    {
        p = (Building::buildings) i;
        gebouwenMap[p] = buildslist[i];

    }
}

This gives all 0. Building::buildings is an enum with some building names. The buildslist is a list of how many people could join that building.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:00:16+00:00Added an answer on May 27, 2026 at 3:00 am

    First, there is not enough code to give an actual answer. Please improve your question so that we can help you properly.

    Second, the title is misleading “Find function doesn’t return the right value”. There is no “find” function and there is no “return value” because the only function you show returns void.

    Now thet this is sorted out, let me try to help you:

        p = (Building::buildings) i;
    

    This is a cast from int to enum. I think this is bad C++ (probably undefined as in might work for some compiler but not as a rule of thumb). You would have to use a switch here I think.

    Please write code in English. Do you imagine if someone you work with is Japanese and would write the code with japanese variable names? Even if the project is in Dutch, write code in English including comments.

    EDIT: You might want to use strings instead of an enum here.

    Try using a std::map<std::string, int> to encode your building names instead of an enum, then use an std::map::iterator to iterate through it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably not possible, but I have this class: public class Metadata<DataType> where
I know it's not possible on the client to fill a DIV with content
I thought I can fill a typed dataset , which I created like this:
Possible Duplicate: Not possible to launch a file on a network using Java Desktop?
It is not possible to check out a single file. The finest level of
It is not possible to fire an event in C# that has no handlers
Why is not possible to initialize a property to a function when you declare
Since it's really not possible to return a single embedded document (yet), what is
Why is it not possible to overload a function just by changing the return
I think it's not possible, but I want to make sure.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.