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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:23:58+00:00 2026-06-11T15:23:58+00:00

Here’s the statement. I believe this is using a cast operator, but what’s the

  • 0

Here’s the statement. I believe this is using a cast operator, but what’s the deal with the post increment?

(*C)(x_i,gi_tn,f)++;

Declaration and definition of C:

std::auto_ptr<conditional_density> C(new conditional_density());

Declaration of the conditional_density class:

class conditional_density: public datmoConditionalDensity{
public:
  static const double l_min, l_max, delta;
  static double x_scale[X_COUNT];    // input log luminance scale
  double *g_scale;    // contrast scale
  double *f_scale;    // frequency scale      
  const double g_max;    
  double total;    
  int x_count, g_count, f_count; // Number of elements    
  double *C;          // Conditional probability function    
  conditional_density( const float pix_per_deg = 30.f ) :
    g_max( 0.7f ){
    //Irrelevant to the question               
  }    

  double& operator()( int x, int g, int f )
  {
    assert( (x + g*x_count + f*x_count*g_count >= 0) && (x + g*x_count + f*x_count*g_count < x_count*g_count*f_count) );
    return C[x + g*x_count + f*x_count*g_count];
  }

};

The parent class, datmoConditionalDensity, only has a virtual destructor.

It would have been easy to answer this by debugging the code, but this code won’t build under Windows (needs a bunch of external libraries).

  • 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-11T15:24:00+00:00Added an answer on June 11, 2026 at 3:24 pm
    (*C)(x_i,gi_tn,f)++;
    

    Let’s break it down:

    (*C)
    

    This dereferences the pointer. C is a smart pointer, and thus can be dereferenced to get the actual element being pointed to. The result is a conditional_density object.

    (*C)(x_i,gi_tn,f)
    

    This calls the the overloaded () operator in the conditional_density class. It can be strange to see it the first time, but it is an operator just like everything else. Bottom line is that it calls this code:

      double& operator()( int x, int g, int f )
      {
        assert( (x + g*x_count + f*x_count*g_count >= 0) && (x + g*x_count + f*x_count*g_count < x_count*g_count*f_count) );
        return C[x + g*x_count + f*x_count*g_count];
      }
    

    which returns a reference to a double. Finally:

    (*C)(x_i,gi_tn,f)++
    

    Because the overloaded () operator returns a reference to a double, I can use ++ on it which increments the double.

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

Sidebar

Related Questions

Here is my code, i have wasted lot of time on this but still
Here is the code in a function I'm trying to revise. This example works
Here is what I am currently doing. PHP echo's out the recent post in
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is my problem : I have a post controller with the action create.
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here is the code I'm using inside my AsyncTask DefaultHttpClient httpClient = new DefaultHttpClient();

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.