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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:19:23+00:00 2026-05-24T09:19:23+00:00

I look at how we use Boost::Extension BOOST_EXTENSION_TYPE_MAP_FUNCTION macro. For example like this :

  • 0

I look at how we use Boost::Extension BOOST_EXTENSION_TYPE_MAP_FUNCTION macro.

For example like this:

BOOST_EXTENSION_TYPE_MAP_FUNCTION
{
    std::map<std::string, boost::extensions::factory<service> > &factories(types.get());
    factories["file_service"].set<file_service>();
}

BOOST_EXTENSION_TYPE_MAP_FUNCTION macro is defined in extension.hpp.

I wonder how this macro understands what is in Curly Brackets and how for example expand this macro to something that would cout anything like “Hello extended macro”?

  • 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-24T09:19:25+00:00Added an answer on May 24, 2026 at 9:19 am

    Let me put my comment into an answer…

    A macro is an instruction to the compiler (I use the collective term here) to substitute at that location the symbols defined as that macro, for example

    #define FOO 1
    
    int val = FOO; // at this point, FOO is replaced with 1
    

    (p.s. please don’t do this in C++)

    Now, what is happening in your case is that there is a set of symbols (the signature of a function) defined as a macro, so all that happens is the compiler will substitute the macro with the symbols, and the end result would look (roughly) like this:

    void boost_extension_exported_type_map_function(boost::extensions::type_map& types)
    {
        std::map<std::string, boost::extensions::factory<service> > &factories(types.get());
        factories["file_service"].set<file_service>();
    }
    

    Which as you can see is a simple function. You can do this too (but don’t unless you have a very good reason)

    #define BOB void foo(std::string const& bar)
    
    BOB
    {
      std::cout << "HEllo: " << bar << std::endl;
    }
    

    It simply allows a user to define their own implementation for that function… presumably somewhere else – it takes the address of that function and uses it via a pointer…

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

Sidebar

Related Questions

I use this to look for values in my DataGridView: private void fndBtn_Click(object sender,
if i use this query thath creates a table(look Table1), But VisitingGap column is
It doesn't look like basic javascript but nor can I use JQuery commands like
I would like to use javascript to style an element to look like a
See this related question on more generic use of the Boost Random library. My
Why does tuple documentation say to use, for example: #include boost/tuple/tuple.hpp and not #include
Let's say I have objects which look very roughly like this: class object {
I have a macro that might look as follows (from boost log library) #define
Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector , but this requires a
I know this sounds stupid, but look at this simple example (working dir should

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.