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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:48:26+00:00 2026-05-21T13:48:26+00:00

so i use BOOST.EXTENTION to load modules. I have a special file that describes

  • 0

so i use BOOST.EXTENTION to load modules. I have a special file that describes each module. I read variables from that file.

so such example:

shared_library m("my_module_name");
// Call a function that returns an int and takes a float parameter.
int result = m.get<int, float>("function_name")(5.0f);
m.close();

for me would turn into:

shared_library m("my_module_name");
// Call a function that returns an int and takes a float parameter.
int result = m.get<myMap["TYPE_1_IN_STRING_FORM"], myMap["TYPE_2_IN_STRING_FORM"]>("function_name")(5.0f);
m.close();

How to create such map that would map standard and costume types?

Update:

may be with variant:

  shared_library m("my_module_name");
  int result = m.get<boost::variant< int, float, ... other types we want to support >, boost::variant< int, float, ... other types we want to support > >("function_name")(5.0f);
    m.close();

can halp? so we would not care as long as all types we want are declared in it?

  • 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-21T13:48:27+00:00Added an answer on May 21, 2026 at 1:48 pm

    For that, you would need a heterogeneous map – that is, its elements can be of different types. Furthermore you would need the ability to return types from functions, not just variables.


    Now, a heterogeneous map would be possible with Boost.Variant or a simple union, but that binds it to compile time: we need to know every type that is possible to create that variant/union.
    Of course a Boost.Any would be possible to store everything and its dog, but the problem strikes again: you need to extract the real type out of that Boost.Any again. The problem repeats itself. And if you know the real type, you can aswell just make a variant/union and save yourself the any_cast trouble.


    Now, for another troublesome thing:

    m.get<myMap["TYPE_1_IN_STRING_FORM"], myMap["TYPE_2_IN_STRING_FORM"]>
    

    To make the above line work, you’d need two features that C++ doesn’t have: the ability to return types and runtime templates. Lets ignore the first point for a moment.
    Templates are compile-time, and the get function is such a template. Now, to use that template, your myMap would need to be able to return types at compile-time, while getting populated at runtime. See the contradiction? That’s why runtime templates would be needed.


    Sadly, exactly those three things are not possible (or extremely hard and very very limited) in C++ at runtime: heterogeneous data types (without constant size), returning types and templates.
    Everything that involves types needs to be done at compile-time. This blogpost by @Gman somewhat correlates with that problem. It’s definitly worth a read if you want to know what C++ just can’t do.


    So, to conclude: You’ll need to rethink and refactor your problem and solution. 😐

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

Sidebar

Related Questions

Is there a way to use boost::filesystem::path with unicode file paths? In particular I'd
Is it possible to use boost::fusion::invoke function to call a function that has default
I have found that boost::signals2 uses sort of a lazy deletion of connected slots,
I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a
I thought I'd use Boost.Interprocess's Message Queue in place of sockets for communication within
I wanted to use boost::thread in my program, but get the following compiler error
I use the Boost Test framework for my C++ code but there are two
I use the Boost Test framework to unit test my C++ code and wondered
I am making extensive use of boost:shared_ptr in my code. In fact, most of
I am trying to use the boost generic image library to convert CYMK images

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.