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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:54:10+00:00 2026-06-10T05:54:10+00:00

Ie, is there any difference between subrange(V, 0, 3); and project(V, range(0,3)); ? I

  • 0

Ie, is there any difference between

subrange(V, 0, 3);

and

project(V, range(0,3));

?

I ask because I’m digging into some code that seems to use both forms (with no apparent rhyme/reason for one vs. the other), but I can’t see any difference between the two… just wanted to check to make sure I’m not missing something.

  • 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-10T05:54:12+00:00Added an answer on June 10, 2026 at 5:54 am

    Looked into it, and I’ve confirmed there is no difference – subrange is simply an easy wrapper for a common-case of project, and in these cases:

    subrange(V, 0, 3);
    project(V, range(0,3));
    

    …they end up identical. So using either should be fine, as long as you’re consistent!

    For the more curious… subrange does:

    template<class V>
    vector_range<V> subrange (V &data, typename V::size_type start, typename V::size_type stop) {
            typedef basic_range<typename V::size_type, typename V::difference_type> range_type;
            return vector_range<V> (data, range_type (start, stop));
        }
    

    while project does:

    template<class V>
    vector_range<V> project (V &data, typename vector_range<V>::range_type const &r) {
        return vector_range<V> (data, r);
    }
    

    ..and since vector_range::range_type is defined to be

    typedef basic_range<size_type, difference_type> range_type;
    

    …ie, exactly what is used in subrange, the two forms are identical.

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

Sidebar

Related Questions

Is there any difference between performing binding on .aspx page via <%# some code
Is there any difference between these tow pieces of code & which approach is
Is there any difference between function MyFunc() { // code... } and var MyFunc
Is there any difference between website and web application project? What if you are
Is there any difference between: __file__ and sys.argv[0] Because both seem to be doing
Is there any difference between accessing a property that has a backing field private
Is there any difference between the computation of small floats - that are close
Is there any difference between ReferencePath with condition '%(CopyLocal)'=='true' and ReferenceCopyLocalPaths ? The question
Is there any difference between: public ActionResult logOff() { FormsAuth.SignOut(); return RedirectToAction(index, Home); }
Is there any difference between '{' and '[' when formatting a JSON object?

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.