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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:59:44+00:00 2026-06-18T11:59:44+00:00

As an example of the problem, is there any way to implement the macro

  • 0

As an example of the problem, is there any way to implement the macro partialconcat in the following code?

#define apply(f, x) f(x)

apply(partialconcat(he),llo) //should produce hello

EDIT:

Here’s another example, given a FOR_EACH variadic macro (see an example implementation in this answer to another question).

Say I want to call a member on several objects,
probably within another macro for a greater purpose.
I would like a macro callMember that behaves like this:

FOR_EACH(callMember(someMemberFunction), a, b, c);

produces

a.someMemberFunction(); b.someMemberFunction(); c.someMemberFunction();

This needs callMember(someMember) to produce a macro that behaves like

#define callMember_someMember(o) o.someMember()
  • 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-18T11:59:46+00:00Added an answer on June 18, 2026 at 11:59 am

    The C preprocessor is ‘only’ a simple text processor. In particular, one macro cannot define another macro; you cannot create a #define out of the expansion of a macro.

    I think that means that the last two lines of your question:

    This needs callMember(someMember) to produce a macro that behaves like

    #define callMember_someMember(o) o.someMember()

    are not achievable with a single application of the C preprocessor (and, in the general case, you’d need to apply the preprocessor an arbitrary number of times, depending on how the macros are defined).

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

Sidebar

Related Questions

I will demonstrate the problem on a real example so the situation: there is
I'm using ActionBarSherlock and have a little problem. In the Fragment Tabs example, there
I've created an example of the problem here: http://jsfiddle.net/JustinN/qWeLT/1/ My actual code is hooked
Is there any easy way / library / external app to introduce Unit of
Is there any way to create a 360 degree object view from photos? I
I'm looking for the best way to implement the following. I have a MySQL
Example of the problem If I have a list of valid option strings which
i will give an example of the problem i have. My XML is like
Here's an example of my problem on jsFiddle. I have a table with striped
Here's a very quick example for my problem: http://img19.imageshack.us/img19/3575/workertool.png (I'm not allowed to post

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.