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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:42:51+00:00 2026-06-09T11:42:51+00:00

I have a template class where typename is a pointer to a function: CHook<NTSTATUS(__stdcall*)(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PCONTEXT,PUSER_STACK,BOOLEAN)>

  • 0

I have a template class where typename is a pointer to a function:

CHook<NTSTATUS(__stdcall*)(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PCONTEXT,PUSER_STACK,BOOLEAN)> hZwCreateThread;

Now I call them like hZwCreateThread.Call()(…params…); but I want to make it hZwCreateThread(…params…) using () operator overloading.
This code:

const FuncType operator()() { return m_OrigFunc; };

Makes it work only in such way: hZwCreateThread()(…params…). How to make it work as I wrote above?

  • 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-09T11:42:52+00:00Added an answer on June 9, 2026 at 11:42 am

    You can use a conversion operator.

    template <typename F>
    struct CHook {
        F m_OrigFunc;
        CHook (F func) : m_OrigFunc(func) {}
        operator F () const { return m_OrigFunc; }
    };
    

    This would allow code like this:

    CHook<int(*)(const char *,...)> chook(printf);
    chook("%s\n", "Hello world!");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can have a typedef function pointer in a class like this: template<typename T>
I have the following function as the constructor for a class: template<typename T> void
I have a subset of a pointer class that look like: template <typename T>
I have an auto pointer implementation: template <typename T, bool Arr = false> class
I have a class template <typename Iterator, typename Value> class Foo { public: Foo(const
I have the following class: template <typename T> class matrix { private: int _n;
I have the following class definition: template<typename QueueItemT> class QueueBC { protected: QueueBC() {}
I have the following scenario :- template <typename T> class Base { public: virtual
I have the following code: class TimeOutException {}; template <typename T> class MultiThreadedBuffer {
I have code: #include <cstdio> template<template<typename...> class> struct Foo { enum { n =

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.