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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:33:07+00:00 2026-05-27T03:33:07+00:00

#define BOOSTPOOL boost::pool<> BOOSTPOOL GetPool() { BOOSTPOOL AppClass1Pool(sizeof(AppClass1)); return AppClass1Pool; } void* AppClass1::operator new(size_t

  • 0
#define BOOSTPOOL boost::pool<>
BOOSTPOOL GetPool()
{
    BOOSTPOOL AppClass1Pool(sizeof(AppClass1));
    return AppClass1Pool;
}

void* AppClass1::operator new(size_t sz)
{
    BOOSTPOOL temp = GetPool();
    void* p =(void*) temp.malloc();
    return p;
}

can not access to the private member(in “boost::simple_segregated_storage<SizeType>”)
I can not use pool like this?

  • 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-27T03:33:07+00:00Added an answer on May 27, 2026 at 3:33 am

    I don’t see what you are trying to do with the code shown.

    Also, chances are that the error originates in the code you don’t show, but here’s my 5p:

    Pools are non-copyable. I assume, under C++03 you get can not access to the private member because the copy constructor is private. In c++11 you can expect:

    error: use of deleted function ‘boost::pool<>::pool(const boost::pool<>&)’
    

    Here is a fixed-up version that probably does what you intended:

    // Uncomment this to stub out all MT locking
    // #define BOOST_NO_MT
    
    #include <boost/pool/pool.hpp>
    
    struct AppClass1
    {
        int data[10];
        void* operator new(size_t sz);
    };
    
    #define BOOSTPOOL boost::pool<>
    BOOSTPOOL& GetPool()
    {
        static BOOSTPOOL AppClass1Pool(sizeof(AppClass1));
        return AppClass1Pool;
    }
    
    void* AppClass1::operator new(size_t sz)
    {
        BOOSTPOOL& temp = GetPool();
        void* p =(void*) temp.malloc();
        return p;
    }
    
    int main(int argc, const char *argv[])
    {
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I define HttpClient in 2 different ways: 1. Plain vanilla: client = new DefaultHttpClient();
#define boo(fmt, ...) SomethingToDo(fmt, __VA_ARGS__) void foo(PCSTR fmt, ...) { // some other codes
#define ADD(a,b) (a)+(b) void foo1() { int a=1, b=2; int k=0; while(k++ < 10000)
I'd like to use boost.pool. It's okay if you don't know about it. Basically,
#define q(k)main(){return!puts(#k\nq(#k));} q(#define q(k)main(){return!puts(#k\nq(#k));}) This code can print itself on the screen,however,I have a
#define INIT_MACRO create(); some(); enviroment(); ... void function(){ INIT_MACRO extra_indented(); normal_indented(); } how do
#define CANCEL_COMMON_DIALOG_HOOK(name) \ void __declspec(naked) ##name##CancelCommonDialogHook(void) \ { \ __asm \ { \ add
#define STR test1 Why does this take 6 bytes? sizeof(STR) = 6
#define SWAP_PTRS(a, b) do { void *t = (a); (a) = (b); (b) =
#define rows 2 #define cols 2 #define NUM_CORNERS 4 int main(void) { int i;

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.