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

  • Home
  • SEARCH
  • 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 3614722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:17:07+00:00 2026-05-18T22:17:07+00:00

I am wondering if it is possible to create something like a predicate for

  • 0

I am wondering if it is possible to create something like a predicate for a std::map for all of its values so I don’t have to edit the values before I insert them into the map.

What I would like is something like this:

mymap["username"] = " Marlon "; // notice the space on both sides of my name
assert(mymap["username"] == "Marlon"); // no more whitespace

The context is I am creating a std::map for a .ini file and I would like it to automatically remove leading/trailing whitespace from the values when I want to retrieve them. I’ve already created a predicate to ignore casing and whitespace from the key so I want to know if it is possible to do the same for the value.

  • 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-18T22:17:07+00:00Added an answer on May 18, 2026 at 10:17 pm

    You can have a wrapper class that wraps std::string and

    1. is implicitly constructible from std::string
    2. implements a conversion operator from std::string.

    You can edit the value on the fly in either of these functions. You std::map can hen have the wrapper as a key.

    With that said, it’s still better being a little more explicit, than clever, and have a separate INI class with its own get/set interface.

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

Sidebar

Related Questions

I was wondering if it is possible to do something like this: <uc1:TestControl ID=TestControl1
I'm wondering whether something like this is possible (and relatively easy to do), and
I was wondering if it's possible to write something like this: <Window ... xmlns
So I was wondering if something like this is possible: I am a program,
I'm wondering if its possible to add new class data members at run-time in
I was wondering if its possible to inject a thread into a remote app
Is it possible to create a Git repository that saves its objects into some
Is something like this possible in Actionscript? Java: URLFetcherFactory.setCreator( new IURLFetcherCreator() { public IURLFetcher
Out of curiosity is it possible to do something like this using NHibernate 3?
I'm wondering of it's possible to create a module structure in a module (or

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.