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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:26:54+00:00 2026-05-23T09:26:54+00:00

I was looking at the request parser from the boost::asio example and I was

  • 0

I was looking at the request parser from the boost::asio example and I was wondering why the private member functions like is_char() are static? :

class request_parser
{
  ...
  private:
    static bool is_char(int c);
  ...
};

It is used in the function consume which is not a static function:

boost::tribool request_parser::consume(request& req, char input)
{
  switch (state_)
  {
    case method_start:
    if (!is_char(input) || is_ctl(input) || is_tspecial(input))
    {
      return false;
    }
    ...

Only member functions can call is_char() and no static member function is calling is_char(). So is there a reason why these functions are static?

  • 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-23T09:26:55+00:00Added an answer on May 23, 2026 at 9:26 am

    This function could easily have been made freestanding, since it doesn’t require an object of the class to operate within. Making a function a static member of a class rather than a free function gives two advantages:

    1. It gives the function access to private and protected members of any object of the class, if the object is static or is passed to the function;
    2. It associates the function with the class in a similar way to a namespace.

    In this case it appears only the second point applies.

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

Sidebar

Related Questions

I'm looking for an AJAX function to dynamically request an HTML page. I already
Im looking for a term here. in messaging systems you send a request, and
Possible Duplicate: Where are the request method constants in the Servlet API? I'm looking
I'm looping through a list of items, and I'd like to get a request
Looking for an example that: Launches an EXE Waits for the EXE to finish.
I'm looking for a way to monitor/observe a singleton class I'm using to pass
I'm looking for a way to return a single JSON/JSONP string from a cross-domain
Looking for a tool/library to convert XML to X12 (270 - medical eligibility request)
A peculiar request this one. I am looking to compare two times in C#.
The documentation provides a succinct example, and one that looks like it's missing a

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.