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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:52:48+00:00 2026-05-10T15:52:48+00:00

Say I have: void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine

  • 0

Say I have:

void Render(void(*Call)()) {     D3dDevice->BeginScene();     Call();     D3dDevice->EndScene();     D3dDevice->Present(0,0,0,0); } 

This is fine as long as the function I want to use to render is a function or a static member function:

Render(MainMenuRender); Render(MainMenu::Render); 

However, I really want to be able to use a class method as well since in most cases the rendering function will want to access member variables, and Id rather not make the class instance global, e.g.

Render(MainMenu->Render); 

However I really have no idea how to do this, and still allow functions and static member functions to be used.

  • 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. 2026-05-10T15:52:49+00:00Added an answer on May 10, 2026 at 3:52 pm

    There are a lot of ways to skin this cat, including templates. My favorite is Boost.function as I’ve found it to be the most flexible in the long run. Also read up on Boost.bind for binding to member functions as well as many other tricks.

    It would look like this:

    #include <boost/bind.hpp> #include <boost/function.hpp>  void Render(boost::function0<void> Call) {     // as before... }  Render(boost::bind(&MainMenu::Render, myMainMenuInstance)); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The easiest way to find out what you need to… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer UITableView inherits from UIScrollView, so set the bounds of the… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer I'm not familir with ASP.NET, but if it is only… May 12, 2026 at 1:19 am

Related Questions

I have an HBITMAP containing alpha channel data. I can successfully render this using
I'm working in J2ME, I have my gameloop doing the following: public void run()
I'm building a table with some text that is HTML, so I am using
I'm trying to digitally sign a PDF file using THIS project as an example.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.