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 8234313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:25:56+00:00 2026-06-07T18:25:56+00:00

I am writting a C++ program which checks if some words exist in Catalan,

  • 0

I am writting a C++ program which checks if some words exist in Catalan, so I have a vector with the Catalan dictionary:

const vector<string> dict={"aaron","ababol","abac","abaca","abacallanada","abacallanava","abacas","abacial", ... ,"zum-zum","zur","zuric","zwitterio"};

The problem is that the dictionary has 107776 entries, so when I attempt to compile the file:

g++ -Wall file.cc -std=c++0x -o file.exe

it does nothing during a while and then Windows says that it isn’t responding and closes it.

How can I compile it? Is there a better way of storing this type of data (arrays, …)?

  • 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-06-07T18:25:58+00:00Added an answer on June 7, 2026 at 6:25 pm

    You may well have more luck with old-school built-in arrays:

    char const * const dict[] = {"aaron",...};
    

    This will generate a load of string literals and an array of pointers to them, which shouldn’t be too much of a strain for the compiler. This will also use no more memory than necessary, with little or no work at runtime.

    Alternatively, std::array<char const *> should be just as efficient, with more of a C++ look and feel.

    Your version also has to generate an enormous amount of code to build an initializer_list from those, construct a string from each, and add each string to the vector. It will also require more than twice as much memory as each string literal needs to be copied into memory allocated at runtime, and then all those pointers need to be stored in another run-time allocated array.

    The disadvantage is that you may end up constructing a temporary string each time you read from the dictionary. If that’s a concern, then an array of std::string might be a reasonable compromise.

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

Sidebar

Related Questions

I am writing a program in which at some point a graph is plotted
I am writing a program which will tokenize the input text depending upon some
I have a C program which has multiple worker threads. There is a main
We have a program that the installer checks for the existence of a config
I in the process of writting a simple java program which reads the contents
I am writing a program which needs to be run in Android 2.0. I
I am writing a program which needs to access data in a web server.
I m writing a program which involves converting java.util.Date to java.sql.Date... I've done it
I am writing a program which collects lots of individual pieces of data from
I'm writing a program which has both an ASP.NET configuration system and a Silverlight

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.