Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-1017

Example for bind1st is wrong

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.2.1
    • 4.2.2
    • Documentation
    • None
    • Incorrect Behavior

    Description

      In the description of bind1st it says the following (http://stdcxx.apache.org/doc/stdlibref/bind1st.html):

      "For example, you could use the count_if() algorithm to count all elements in a vector that are less than or equal to 7, using the following:

      vector<int> v;
      int littleNums;

      count_if(v.begin, v.end, bind1st(greater<int>(),7),
      littleNums)

      This function adds one to littleNums each time the element is greater than 7."

      The last sentence should of course read: This function adds one to littleNums each time the element is less than 7.

      Attachments

        Activity

          People

            sebor Martin Sebor
            ezander Elmar Zander
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h