<!DOCTYPE html>
<html>
<head>
  <meta charset=UTF-8 /><meta name=viewport content="width=device-width, initial-scale=1"/><link rel=preconnent href=https://fonts%2egoogleapis%2ecom />
  <link rel=preconnent href=https://fonts%2egstatic%2ecom crossorigin/>
  <link rel=stylesheet href="https://fonts%2egoogleapis%2ecom/css2?family=Fira+Code:wght@300%2e%2e700&family=Noto+Sans:ital,wght@0,100%2e%2e900;1,100%2e%2e900&family=Noto+Serif:ital,wght@0,100%2e%2e900;1,100%2e%2e900&display=swap"/>
  <style>
html {
    --sans-serif-family: "Noto Sans", sans-serif;
    --serif-family: "Noto Serif", serif;
    --monospace-family: "Fira Code", monospace;

    --light-background-color: white;
    --light-deep-background-color: #fafafa;
    --light-text-color: black;
    --light-border-color: #aaa;
    --light-table-border-color: #777;
    --light-del-color: #be1621;
    --light-del-background-color: #fbe6e8;
    --light-ins-color: #17752d;
    --light-ins-background-color: #e4faea;
    --light-para-color: rgb(10, 73, 136);
    --light-a-color: rgb(10, 73, 136);
    --light-a-visited-color: rgb(44, 10, 136);
    --light-a-hover-color: rgb(15, 93, 170);
    --light-mark-color: black;
    --light-mark-background-color: #ffff85;
    --light-abstract-border-color: #707070;
    --light-abstract-background-color: #f0f0f0;
    --light-abstract-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23707070"><path d="M660-160h40v-160h-40v160Zm20-200q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6ZM200-800v640-640 200-200Zm80 400h147q11-23 25.5-43t32.5-37H280v80Zm0 160h123q-3-20-3-40t3-40H280v80ZM200-80q-33 0-56.5-23.5T120-160v-640q0-33 23.5-56.5T200-880h320l240 240v92q-19-6-39-9t-41-3v-40H480v-200H200v640h227q11 23 25.5 43T485-80H200Zm480-400q83 0 141.5 58.5T880-280q0 83-58.5 141.5T680-80q-83 0-141.5-58.5T480-280q0-83 58.5-141.5T680-480Z"/></svg>');
    --light-blockquote-border-color: #707070;
    --light-blockquote-background-color: #f0f0f0;
    --light-blockquote-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="%23707070"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z"/></svg>');
    --light-bug-block-border-color: #9f7b5d;
    --light-bug-block-background-color: #f0e2d9;
    --light-bug-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%239f7b5d"><path d="M480-120q-64 0-114.5-33T283-240l-95 54-40-69 103-60q-3-11-5-22.5t-4-22.5H120v-80h122q2-12 4-23.5t5-22.5l-103-60 40-69 94 55q8-14 18.5-27.5T322-612q-2-7-2-14v-14q0-24 7-46t19-41l-66-66 56-57 70 68q17-9 35.5-13.5T480-800q20 0 39 5t36 14l69-69 56 57-66 66q12 19 18.5 41t6.5 46v13.5q0 6.5-2 13.5 11 11 21.5 25t18.5 28l95-54 40 69-104 59q3 11 5.5 22.5T718-440h122v80H718q-2 12-4 23.5t-5 22.5l103 60-40 69-95-55q-32 54-82.5 87T480-120Zm-76-546q17-7 36.5-10.5T480-680q20 0 38.5 3t35.5 10q-8-23-28-38t-46-15q-26 0-47 15.5T404-666Zm76 466q73 0 116.5-61T640-400q0-70-40.5-135T480-600q-78 0-119 64.5T320-400q0 78 43.5 139T480-200Zm-40-80v-240h80v240h-80Z"/></svg>');
    --light-decision-block-border-color: #ab6fa2;
    --light-decision-block-background-color: #f4e6f4;
    --light-decision-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23ab6fa2"><path d="M160-120v-80h480v80H160Zm226-194L160-540l84-86 228 226-86 86Zm254-254L414-796l86-84 226 226-86 86Zm184 408L302-682l56-56 522 522-56 56Z"/></svg>');
    --light-del-block-border-color: #be1621;
    --light-del-block-background-color: #fbe6e8;
    --light-del-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23be1621"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>');
    --light-details-border-color: #707070;
    --light-details-background-color: #f0f0f0;
    --light-details-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23707070"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
    --light-diff-block-border-color: #707070;
    --light-diff-block-background-color: #f0f0f0;
    --light-diff-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23707070"><path d="M500-520h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80Zm-80 160h240v-80H420v80ZM320-200q-33 0-56.5-23.5T240-280v-560q0-33 23.5-56.5T320-920h280l240 240v400q0 33-23.5 56.5T760-200H320Zm0-80h440v-360L560-840H320v560ZM160-40q-33 0-56.5-23.5T80-120v-560h80v560h440v80H160Zm160-240v-560 560Z"/></svg>');
    --light-example-block-border-color: #6f8aab;
    --light-example-block-background-color: #e6e9f4;
    --light-example-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236f8aab"><path d="M300-80q-58 0-99-41t-41-99v-520q0-58 41-99t99-41h500v600q-25 0-42.5 17.5T740-220q0 25 17.5 42.5T800-160v80H300Zm-60-267q14-7 29-10t31-3h20v-440h-20q-25 0-42.5 17.5T240-740v393Zm160-13h320v-440H400v440Zm-160 13v-453 453Zm60 187h373q-6-14-9.5-28.5T660-220q0-16 3-31t10-29H300q-26 0-43 17.5T240-220q0 26 17 43t43 17Z"/></svg>');
    --light-important-block-border-color: #b05252;
    --light-important-block-background-color: #f4e6e6;
    --light-important-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23ab6f6f"><path d="M480-120q-33 0-56.5-23.5T400-200q0-33 23.5-56.5T480-280q33 0 56.5 23.5T560-200q0 33-23.5 56.5T480-120Zm-80-240v-480h160v480H400Z"/></svg>');
    --light-ins-block-border-color: #17752d;
    --light-ins-block-background-color: #e4faea;
    --light-ins-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%2317752d"><path d="M440-240h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>');
    --light-note-block-border-color: #6fab6f;
    --light-note-block-background-color: #e6f4e9;
    --light-note-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236fab6f"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
    --light-tip-block-border-color: #b0a029;
    --light-tip-block-background-color: #f4f4e6;
    --light-tip-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23b0a029"><path d="M480-80q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-200v-80h320v80H320Zm10-120q-69-41-109.5-110T180-580q0-125 87.5-212.5T480-880q125 0 212.5 87.5T780-580q0 81-40.5 150T630-320H330Zm24-80h252q45-32 69.5-79T700-580q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 54 24.5 101t69.5 79Zm126 0Z"/></svg>');
    --light-todo-block-border-color: #6faba0;
    --light-todo-block-background-color: #e6f4f3;
    --light-todo-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236faba0"><path d="M680-80q-83 0-141.5-58.5T480-280q0-83 58.5-141.5T680-480q83 0 141.5 58.5T880-280q0 83-58.5 141.5T680-80Zm67-105 28-28-75-75v-112h-40v128l87 87Zm-547 65q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v250q-18-13-38-22t-42-16v-212h-80v120H280v-120h-80v560h212q7 22 16 42t22 38H200Zm280-640q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"/></svg>');
    --light-warning-block-border-color: #af8141;
    --light-warning-block-background-color: #f4eee6;
    --light-warning-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23af8141"><path d="M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z"/></svg>');
    --light-theme-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="black"><path d="M480-360q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35Zm0 80q-83 0-141.5-58.5T280-480q0-83 58.5-141.5T480-680q83 0 141.5 58.5T680-480q0 83-58.5 141.5T480-280ZM200-440H40v-80h160v80Zm720 0H760v-80h160v80ZM440-760v-160h80v160h-80Zm0 720v-160h80v160h-80ZM256-650l-101-97 57-59 96 100-52 56Zm492 496-97-101 53-55 101 97-57 59Zm-98-550 97-101 59 57-100 96-56-52ZM154-212l101-97 55 53-97 101-59-57Zm326-268Z"/></svg>');

    --dark-background-color: #202020;
    --dark-deep-background-color: #1a1a1a;
    --dark-text-color: #f0f0f0;
    --dark-border-color: #505050;
    --dark-table-border-color: #777;
    --dark-del-background-color: #67060c;
    --dark-del-color: #ffdcd7;
    --dark-ins-background-color: #033a16;
    --dark-ins-color: #aff5b4;
    --dark-para-color: #5bc0ff;
    --dark-a-color: #5bc0ff;
    --dark-a-visited-color: #c6a8ff;
    --dark-a-hover-color: #afd7ff;
    --dark-mark-color: #ededa8;
    --dark-mark-background-color: #525230;
    --dark-abstract-border-color: #999999;
    --dark-abstract-background-color: #2c2c2c;
    --dark-abstract-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23999999"><path d="M660-160h40v-160h-40v160Zm20-200q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6ZM200-800v640-640 200-200Zm80 400h147q11-23 25.5-43t32.5-37H280v80Zm0 160h123q-3-20-3-40t3-40H280v80ZM200-80q-33 0-56.5-23.5T120-160v-640q0-33 23.5-56.5T200-880h320l240 240v92q-19-6-39-9t-41-3v-40H480v-200H200v640h227q11 23 25.5 43T485-80H200Zm480-400q83 0 141.5 58.5T880-280q0 83-58.5 141.5T680-80q-83 0-141.5-58.5T480-280q0-83 58.5-141.5T680-480Z"/></svg>');
    --dark-blockquote-border-color: #707070;
    --dark-blockquote-background-color: #2c2c2c;
    --dark-blockquote-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="%23707070"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z"/></svg>');
    --dark-bug-block-border-color: #ab866f;
    --dark-bug-block-background-color: #373028;
    --dark-bug-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23ab866f"><path d="M480-120q-64 0-114.5-33T283-240l-95 54-40-69 103-60q-3-11-5-22.5t-4-22.5H120v-80h122q2-12 4-23.5t5-22.5l-103-60 40-69 94 55q8-14 18.5-27.5T322-612q-2-7-2-14v-14q0-24 7-46t19-41l-66-66 56-57 70 68q17-9 35.5-13.5T480-800q20 0 39 5t36 14l69-69 56 57-66 66q12 19 18.5 41t6.5 46v13.5q0 6.5-2 13.5 11 11 21.5 25t18.5 28l95-54 40 69-104 59q3 11 5.5 22.5T718-440h122v80H718q-2 12-4 23.5t-5 22.5l103 60-40 69-95-55q-32 54-82.5 87T480-120Zm-76-546q17-7 36.5-10.5T480-680q20 0 38.5 3t35.5 10q-8-23-28-38t-46-15q-26 0-47 15.5T404-666Zm76 466q73 0 116.5-61T640-400q0-70-40.5-135T480-600q-78 0-119 64.5T320-400q0 78 43.5 139T480-200Zm-40-80v-240h80v240h-80Z"/></svg>');
    --dark-details-border-color: #707070;
    --dark-details-background-color: #2c2c2c;
    --dark-details-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23707070"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
    --dark-decision-block-border-color: #ab6fa2;
    --dark-decision-block-background-color: #30232d;
    --dark-decision-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23ab6fa2"><path d="M160-120v-80h480v80H160Zm226-194L160-540l84-86 228 226-86 86Zm254-254L414-796l86-84 226 226-86 86Zm184 408L302-682l56-56 522 522-56 56Z"/></svg>');
    --dark-del-block-border-color: #be5e64;
    --dark-del-block-background-color: #302323;
    --dark-del-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23be5e64"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>');
    --dark-diff-block-border-color: #707070;
    --dark-diff-block-background-color: #2c2c2c;
    --dark-diff-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23707070"><path d="M500-520h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80Zm-80 160h240v-80H420v80ZM320-200q-33 0-56.5-23.5T240-280v-560q0-33 23.5-56.5T320-920h280l240 240v400q0 33-23.5 56.5T760-200H320Zm0-80h440v-360L560-840H320v560ZM160-40q-33 0-56.5-23.5T80-120v-560h80v560h440v80H160Zm160-240v-560 560Z"/></svg>');
    --dark-example-block-border-color: #6f81ab;
    --dark-example-block-background-color: #232630;
    --dark-example-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236f81ab"><path d="M300-80q-58 0-99-41t-41-99v-520q0-58 41-99t99-41h500v600q-25 0-42.5 17.5T740-220q0 25 17.5 42.5T800-160v80H300Zm-60-267q14-7 29-10t31-3h20v-440h-20q-25 0-42.5 17.5T240-740v393Zm160-13h320v-440H400v440Zm-160 13v-453 453Zm60 187h373q-6-14-9.5-28.5T660-220q0-16 3-31t10-29H300q-26 0-43 17.5T240-220q0 26 17 43t43 17Z"/></svg>');
    --dark-important-block-border-color: #b06262;
    --dark-important-block-background-color: #302323;
    --dark-important-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23b06262"><path d="M480-120q-33 0-56.5-23.5T400-200q0-33 23.5-56.5T480-280q33 0 56.5 23.5T560-200q0 33-23.5 56.5T480-120Zm-80-240v-480h160v480H400Z"/></svg>');
    --dark-ins-block-border-color: #5bab6d;
    --dark-ins-block-background-color: #233023;
    --dark-ins-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%235bab6d"><path d="M440-240h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>');
    --dark-note-block-border-color: #6fab76;
    --dark-note-block-background-color: #233025;
    --dark-note-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236fab76"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
    --dark-tip-block-border-color: #a2ab6f;
    --dark-tip-block-background-color: #2f3023;
    --dark-tip-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23a2ab6f"><path d="M480-80q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-200v-80h320v80H320Zm10-120q-69-41-109.5-110T180-580q0-125 87.5-212.5T480-880q125 0 212.5 87.5T780-580q0 81-40.5 150T630-320H330Zm24-80h252q45-32 69.5-79T700-580q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 54 24.5 101t69.5 79Zm126 0Z"/></svg>');
    --dark-todo-block-border-color: #6fab98;
    --dark-todo-block-background-color: #23302e;
    --dark-todo-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%236fab98"><path d="M680-80q-83 0-141.5-58.5T480-280q0-83 58.5-141.5T680-480q83 0 141.5 58.5T880-280q0 83-58.5 141.5T680-80Zm67-105 28-28-75-75v-112h-40v128l87 87Zm-547 65q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v250q-18-13-38-22t-42-16v-212h-80v120H280v-120h-80v560h212q7 22 16 42t22 38H200Zm280-640q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"/></svg>');
    --dark-warning-block-border-color: #ab9c6f;
    --dark-warning-block-background-color: #302b23;
    --dark-warning-block-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23ab9c6f"><path d="M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z"/></svg>');
    --dark-theme-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="%23f0f0f0"><path d="M480-120q-150 0-255-105T120-480q0-150 105-255t255-105q14 0 27.5 1t26.5 3q-41 29-65.5 75.5T444-660q0 90 63 153t153 63q55 0 101-24.5t75-65.5q2 13 3 26.5t1 27.5q0 150-105 255T480-120Zm0-80q88 0 158-48.5T740-375q-20 5-40 8t-40 3q-123 0-209.5-86.5T364-660q0-20 3-40t8-40q-78 32-126.5 102T200-480q0 116 82 198t198 82Zm-10-270Z"/></svg>');

    --indent: 2.5em;
    --border-radius: 0.25em;
}

/* BEGIN LIGHT AND DARK THEME */

@media (prefers-color-scheme: light) {
    html {
        --background-color: var(--light-background-color);
        --deep-background-color: var(--light-deep-background-color);
        --text-color: var(--light-text-color);
        --border-color: var(--light-border-color);
        --table-border-color: var(--light-table-border-color);
        --del-color: var(--light-del-color);
        --del-background-color: var(--light-del-background-color);
        --ins-color: var(--light-ins-color);
        --ins-background-color: var(--light-ins-background-color);
        --para-color: var(--light-para-color);
        --a-color: var(--light-a-color);
        --a-visited-color: var(--light-a-visited-color);
        --a-hover-color: var(--light-a-hover-color);
        --mark-color: var(--light-mark-color);
        --mark-background-color: var(--light-mark-background-color);
        --abstract-border-color: var(--light-abstract-border-color);
        --abstract-background-color: var(--light-abstract-background-color);
        --abstract-image: var(--light-abstract-image);
        --blockquote-border-color: var(--light-blockquote-border-color);
        --blockquote-background-color: var(--light-blockquote-background-color);
        --blockquote-image: var(--light-blockquote-image);
        --bug-block-border-color: var(--light-bug-block-border-color);
        --bug-block-background-color: var(--light-bug-block-background-color);
        --bug-block-image: var(--light-bug-block-image);
        --decision-block-border-color: var(--light-decision-block-border-color);
        --decision-block-background-color: var(--light-decision-block-background-color);
        --decision-block-image: var(--light-decision-block-image);
        --del-block-border-color: var(--light-del-block-border-color);
        --del-block-background-color: var(--light-del-block-background-color);
        --del-block-image: var(--light-del-block-image);
        --details-border-color: var(--light-details-border-color);
        --details-background-color: var(--light-details-background-color);
        --details-image: var(--light-details-image);
        --diff-block-border-color: var(--light-diff-block-border-color);
        --diff-block-background-color: var(--light-diff-block-background-color);
        --diff-block-image: var(--light-diff-block-image);
        --example-block-border-color: var(--light-example-block-border-color);
        --example-block-background-color: var(--light-example-block-background-color);
        --example-block-image: var(--light-example-block-image);
        --important-block-border-color: var(--light-important-block-border-color);
        --important-block-background-color: var(--light-important-block-background-color);
        --important-block-image: var(--light-important-block-image);
        --ins-block-border-color: var(--light-ins-block-border-color);
        --ins-block-background-color: var(--light-ins-block-background-color);
        --ins-block-image: var(--light-ins-block-image);
        --note-block-border-color: var(--light-note-block-border-color);
        --note-block-background-color: var(--light-note-block-background-color);
        --note-block-image: var(--light-note-block-image);
        --tip-block-border-color: var(--light-tip-block-border-color);
        --tip-block-background-color: var(--light-tip-block-background-color);
        --tip-block-image: var(--light-tip-block-image);
        --todo-block-border-color: var(--light-todo-block-border-color);
        --todo-block-background-color: var(--light-todo-block-background-color);
        --todo-block-image: var(--light-todo-block-image);
        --warning-block-border-color: var(--light-warning-block-border-color);
        --warning-block-background-color: var(--light-warning-block-background-color);
        --warning-block-image: var(--light-warning-block-image);
        --theme-icon: var(--light-theme-icon);
    }
}

@media (prefers-color-scheme: dark) {
    html {
        --background-color: var(--dark-background-color);
        --deep-background-color: var(--dark-deep-background-color);
        --text-color: var(--dark-text-color);
        --border-color: var(--dark-border-color);
        --table-border-color: var(--dark-table-border-color);
        --del-color: var(--dark-del-color);
        --del-background-color: var(--dark-del-background-color);
        --ins-color: var(--dark-ins-color);
        --ins-background-color: var(--dark-ins-background-color);
        --para-color: var(--dark-para-color);
        --a-color: var(--dark-a-color);
        --a-visited-color: var(--dark-a-visited-color);
        --a-hover-color: var(--dark-a-hover-color);
        --mark-color: var(--dark-mark-color);
        --mark-background-color: var(--dark-mark-background-color);
        --abstract-border-color: var(--dark-abstract-border-color);
        --abstract-background-color: var(--dark-abstract-background-color);
        --abstract-image: var(--dark-abstract-image);
        --blockquote-border-color: var(--dark-blockquote-border-color);
        --blockquote-background-color: var(--dark-blockquote-background-color);
        --blockquote-image: var(--dark-blockquote-image);
        --bug-block-border-color: var(--dark-bug-block-border-color);
        --bug-block-background-color: var(--dark-bug-block-background-color);
        --bug-block-image: var(--dark-bug-block-image);
        --decision-block-border-color: var(--dark-decision-block-border-color);
        --decision-block-background-color: var(--dark-decision-block-background-color);
        --decision-block-image: var(--dark-decision-block-image);
        --del-block-border-color: var(--dark-del-block-border-color);
        --del-block-background-color: var(--dark-del-block-background-color);
        --del-block-image: var(--dark-del-block-image);
        --details-border-color: var(--dark-details-border-color);
        --details-background-color: var(--dark-details-background-color);
        --details-image: var(--dark-details-image);
        --diff-block-border-color: var(--dark-diff-block-border-color);
        --diff-block-background-color: var(--dark-diff-block-background-color);
        --diff-block-image: var(--dark-diff-block-image);
        --example-block-border-color: var(--dark-example-block-border-color);
        --example-block-background-color: var(--dark-example-block-background-color);
        --example-block-image: var(--dark-example-block-image);
        --important-block-border-color: var(--dark-important-block-border-color);
        --important-block-background-color: var(--dark-important-block-background-color);
        --important-block-image: var(--dark-important-block-image);
        --ins-block-border-color: var(--dark-ins-block-border-color);
        --ins-block-background-color: var(--dark-ins-block-background-color);
        --ins-block-image: var(--dark-ins-block-image);
        --note-block-border-color: var(--dark-note-block-border-color);
        --note-block-background-color: var(--dark-note-block-background-color);
        --note-block-image: var(--dark-note-block-image);
        --tip-block-border-color: var(--dark-tip-block-border-color);
        --tip-block-background-color: var(--dark-tip-block-background-color);
        --tip-block-image: var(--dark-tip-block-image);
        --todo-block-border-color: var(--dark-todo-block-border-color);
        --todo-block-background-color: var(--dark-todo-block-background-color);
        --todo-block-image: var(--dark-todo-block-image);
        --warning-block-border-color: var(--dark-warning-block-border-color);
        --warning-block-background-color: var(--dark-warning-block-background-color);
        --warning-block-image: var(--dark-warning-block-image);
        --theme-icon: var(--dark-theme-icon);
    }
}

html.light {
    --background-color: var(--light-background-color);
    --deep-background-color: var(--light-deep-background-color);
    --text-color: var(--light-text-color);
    --border-color: var(--light-border-color);
    --table-border-color: var(--light-table-border-color);
    --del-color: var(--light-del-color);
    --del-background-color: var(--light-del-background-color);
    --ins-color: var(--light-ins-color);
    --ins-background-color: var(--light-ins-background-color);
    --para-color: var(--light-para-color);
    --a-color: var(--light-a-color);
    --a-visited-color: var(--light-a-visited-color);
    --a-hover-color: var(--light-a-hover-color);
    --mark-color: var(--light-mark-color);
    --mark-background-color: var(--light-mark-background-color);
    --abstract-border-color: var(--light-abstract-border-color);
    --abstract-background-color: var(--light-abstract-background-color);
    --abstract-image: var(--light-abstract-image);
    --blockquote-border-color: var(--light-blockquote-border-color);
    --blockquote-background-color: var(--light-blockquote-background-color);
    --blockquote-image: var(--light-blockquote-image);
    --bug-block-border-color: var(--light-bug-block-border-color);
    --bug-block-background-color: var(--light-bug-block-background-color);
    --bug-block-image: var(--light-bug-block-image);
    --decision-block-border-color: var(--light-decision-block-border-color);
    --decision-block-background-color: var(--light-decision-block-background-color);
    --decision-block-image: var(--light-decision-block-image);
    --del-block-border-color: var(--light-del-block-border-color);
    --del-block-background-color: var(--light-del-block-background-color);
    --del-block-image: var(--light-del-block-image);
    --details-border-color: var(--light-details-border-color);
    --details-background-color: var(--light-details-background-color);
    --details-image: var(--light-details-image);
    --diff-block-border-color: var(--light-diff-block-border-color);
    --diff-block-background-color: var(--light-diff-block-background-color);
    --diff-block-image: var(--light-diff-block-image);
    --example-block-border-color: var(--light-example-block-border-color);
    --example-block-background-color: var(--light-example-block-background-color);
    --example-block-image: var(--light-example-block-image);
    --important-block-border-color: var(--light-important-block-border-color);
    --important-block-background-color: var(--light-important-block-background-color);
    --important-block-image: var(--light-important-block-image);
    --ins-block-border-color: var(--light-ins-block-border-color);
    --ins-block-background-color: var(--light-ins-block-background-color);
    --ins-block-image: var(--light-ins-block-image);
    --note-block-border-color: var(--light-note-block-border-color);
    --note-block-background-color: var(--light-note-block-background-color);
    --note-block-image: var(--light-note-block-image);
    --tip-block-border-color: var(--light-tip-block-border-color);
    --tip-block-background-color: var(--light-tip-block-background-color);
    --tip-block-image: var(--light-tip-block-image);
    --todo-block-border-color: var(--light-todo-block-border-color);
    --todo-block-background-color: var(--light-todo-block-background-color);
    --todo-block-image: var(--light-todo-block-image);
    --warning-block-border-color: var(--light-warning-block-border-color);
    --warning-block-background-color: var(--light-warning-block-background-color);
    --warning-block-image: var(--light-warning-block-image);
    --theme-icon: var(--light-theme-icon);
}

html.dark {
    --background-color: var(--dark-background-color);
    --deep-background-color: var(--dark-deep-background-color);
    --text-color: var(--dark-text-color);
    --border-color: var(--dark-border-color);
    --table-border-color: var(--dark-table-border-color);
    --del-color: var(--dark-del-color);
    --del-background-color: var(--dark-del-background-color);
    --ins-color: var(--dark-ins-color);
    --ins-background-color: var(--dark-ins-background-color);
    --para-color: var(--dark-para-color);
    --a-color: var(--dark-a-color);
    --a-visited-color: var(--dark-a-visited-color);
    --a-hover-color: var(--dark-a-hover-color);
    --mark-color: var(--dark-mark-color);
    --mark-background-color: var(--dark-mark-background-color);
    --abstract-border-color: var(--dark-abstract-border-color);
    --abstract-background-color: var(--dark-abstract-background-color);
    --abstract-image: var(--dark-abstract-image);
    --blockquote-border-color: var(--dark-blockquote-border-color);
    --blockquote-background-color: var(--dark-blockquote-background-color);
    --blockquote-image: var(--dark-blockquote-image);
    --bug-block-border-color: var(--dark-bug-block-border-color);
    --bug-block-background-color: var(--dark-bug-block-background-color);
    --bug-block-image: var(--dark-bug-block-image);
    --decision-block-border-color: var(--dark-decision-block-border-color);
    --decision-block-background-color: var(--dark-decision-block-background-color);
    --decision-block-image: var(--dark-decision-block-image);
    --del-block-border-color: var(--dark-del-block-border-color);
    --del-block-background-color: var(--dark-del-block-background-color);
    --del-block-image: var(--dark-del-block-image);
    --details-border-color: var(--dark-details-border-color);
    --details-background-color: var(--dark-details-background-color);
    --details-image: var(--dark-details-image);
    --diff-block-border-color: var(--dark-diff-block-border-color);
    --diff-block-background-color: var(--dark-diff-block-background-color);
    --diff-block-image: var(--dark-diff-block-image);
    --example-block-border-color: var(--dark-example-block-border-color);
    --example-block-background-color: var(--dark-example-block-background-color);
    --example-block-image: var(--dark-example-block-image);
    --important-block-border-color: var(--dark-important-block-border-color);
    --important-block-background-color: var(--dark-important-block-background-color);
    --important-block-image: var(--dark-important-block-image);
    --ins-block-border-color: var(--dark-ins-block-border-color);
    --ins-block-background-color: var(--dark-ins-block-background-color);
    --ins-block-image: var(--dark-ins-block-image);
    --note-block-border-color: var(--dark-note-block-border-color);
    --note-block-background-color: var(--dark-note-block-background-color);
    --note-block-image: var(--dark-note-block-image);
    --tip-block-border-color: var(--dark-tip-block-border-color);
    --tip-block-background-color: var(--dark-tip-block-background-color);
    --tip-block-image: var(--dark-tip-block-image);
    --todo-block-border-color: var(--dark-todo-block-border-color);
    --todo-block-background-color: var(--dark-todo-block-background-color);
    --todo-block-image: var(--dark-todo-block-image);
    --warning-block-border-color: var(--dark-warning-block-border-color);
    --warning-block-background-color: var(--dark-warning-block-background-color);
    --warning-block-image: var(--dark-warning-block-image);
    --theme-icon: var(--dark-theme-icon);
}

/* END LIGHT AND DARK THEME */

html {
    margin: 0;
    width: 100%;
    font-family: var(--serif-family);
    font-size: 11pt;

    border-left: var(--border-thickness) solid var(--border-color);
    color: var(--text-color);
    background-color: var(--background-color);
}

body {
    --vertical-margin: 2rem;
    --margin-left: 3rem;
    --margin-right: 2rem;

    margin: var(--vertical-margin) var(--margin-right) var(--vertical-margin) var(--margin-left);
    width: calc(100% - var(--margin-left) - var(--margin-right));
    box-sizing: border-box;
}

main {
    max-width: 60rem;
    margin-left: auto;
    margin-right: auto;
}

p {
    text-align: justify;
}

abstract-block,
blockquote,
bug-block,
code-block,
decision-block,
del-block,
details,
dl,
diff-block,
example-block,
hr,
ol,
important-block,
ins-block,
math[display=block],
note-block,
p,
pre,
tip-block,
todo-block,
ul,
warning-block,
.indent {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
}

a {
    color: var(--a-color);
    text-decoration: unset;
}

a:visited {
    color: var(--a-visited-color);
}

a:hover,
a:focus {
    color: var(--a-hover-color);
}

a:hover {
    text-decoration: underline;
}

ol,
ul {
    padding-left: var(--indent);
}

li {
    margin: 0.5em 0;
}

dt {
    margin-top: 0.25em;
    font-style: italic;
    font-weight: bold;
}

dd {
    margin-bottom: 0.25em;
    margin-left: var(--indent);
}

abstract-block,
blockquote,
bug-block,
del-block,
details,
decision-block,
diff-block,
example-block,
important-block,
ins-block,
note-block,
tip-block,
todo-block,
warning-block {
    --border-thickness: 0.25em;
    --padding: 0.5em;

    position: relative;
    width: calc(100% - var(--indent));
    box-sizing: border-box;
    padding: var(--padding);
    margin-left: var(--indent);

    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

abstract-block>:first-child,
blockquote>:first-child,
bug-block>:first-child,
del-block>:first-child,
details>:first-child,
decision-block>:first-child,
diff-block>:first-child,
example-block>:first-child,
important-block>:first-child,
ins-block>:first-child,
note-block>:first-child,
tip-block>:first-child,
todo-block>:first-child,
warning-block>:first-child {
    margin-top: 0;
}

abstract-block>:last-child,
blockquote>:last-child,
bug-block>:last-child,
del-block>:last-child,
details>:last-child,
decision-block>:last-child,
diff-block>:last-child,
example-block>:last-child,
important-block>:last-child,
ins-block>:last-child,
note-block>:last-child,
todo-block>:last-child,
tip-block>:last-child,
warning-block>:last-child {
    margin-bottom: 0;
}

abstract-block::before,
blockquote::before,
bug-block::before,
del-block::before,
details::before,
decision-block::before,
diff-block::before,
example-block::before,
important-block::before,
ins-block::before,
note-block::before,
todo-block::before,
tip-block::before,
warning-block::before {
    position: absolute;
    left: -2.5em;
    top: 0.25em;
    width: 2em;
    height: 2em;

    content: "";
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;

}

code,
code-block,
pre,
samp,
tt,
tt-,
.mono {
    font-family: var(--monospace-family);
    font-style: normal;
    font-variant-ligatures: none;
}

code-block:not(.borderless),
pre {
    padding: 0.5em;
    border-radius: var(--border-radius);
    box-sizing: border-box;

    background-color: var(--deep-background-color);
    border: 1px solid var(--border-color);
}

code-block,
pre {
    font-size: 95%;
    width: 100%;
}

code-block,
pre {
    white-space: pre;
    overflow-x: auto;
}

/* INSERTIONS AND DELETIONS */

ins,
ins-lines {
    text-decoration: underline;
    font-weight: 600;
    color: var(--ins-color);
    background-color: var(--ins-background-color);
}

code-block ins,
code-block ins-lines {
    text-decoration: inherit;
}

del {
    text-decoration: line-through;
}

del,
del-lines {
    color: var(--del-color);
    background-color: var(--del-background-color);
}

ins-lines,
del-lines {
    display: inline-block;
    width: 100%;
}

ins h-,
ins-lines h-,
del h-,
del-lines h- {
    color: inherit !important;
    background-color: inherit !important;
}

kbd {
    font-family: var(--sans-serif-family);

    display: inline-block;
    padding: 0 0.25em 0.15em 0.25em;
    border-radius: 0.25em;
    white-space: nowrap;

    background-color: var(--deep-background-color);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 -0.1em 0 var(--border-color);
}

mark {
    color: var(--mark-color);
    background-color: var(--mark-background-color);
}

math:not([display=block]) {
    font-size: 120%;
}

math[display=block] {
    width: fit-content;
    margin-left: var(--indent);

    font-size: 110%;
}

g-term,
f-sans,
f-serif,
wg21-block {
    display: inline;
}

f-sans,
.sans {
    font-family: var(--sans-serif-family);
}

f-serif,
.serif {
    font-family: var(--serif-family);
}

.grammar dd,
g-term {
    font-family: var(--sans-serif-family);
    font-style: oblique;
}

.grammar {
    margin-left: var(--indent);
}

.grammar dt {
    font-weight: normal;
    font-style: normal;
}

.oblique {
    font-style: oblique;
}

.word {
    white-space: nowrap;
}

.wg21-head {
    margin-bottom: 4em;
}

.wg21-head dl {
    font-family: var(--sans-serif-family);
}

.wg21-head dt {
    font-style: normal;
}

/* HEADINGS */

h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin: 1rem 0;
}

h1 {
    margin: 2rem 0 1.5rem 0;
    font-size: 250%;
}

h2 {
    margin: 2.5rem 0 1.5rem 0;
    font-size: 166%;
}

h3 {
    margin: 2rem 0 1rem 0;
    font-size: 133%;
}

h4 {
    margin: 1.5rem 0 0.5rem 0;
    font-size: 100%;
}

h5 {
    margin: 1rem 0 0.5rem 0;
    font-size: 100%;
    font-weight: normal;
}

h6 {
    margin: 1rem 0 0.5rem 0;
    font-size: 90%;
    font-weight: normal;
}

table {
    --border: 1px solid var(--table-border-color);

    margin-top: 1em;
    margin-bottom: 1em;
    border-collapse: collapse;
}

table,
tbody,
thead,
th {
    border: var(--border);
}

td {
    border-left: var(--border);
    border-right: var(--border);
}

td,
th {
    padding: 0.1em 0.5em;
}

.para {
    cursor: pointer;
    font-weight: normal;
    font-family: var(--monospace-family);
    text-decoration: none;
    opacity: 0.25;

    position: absolute;
    top: 0.05em;
    left: calc(-1rem - 0.5ch);
}

.para,
.para::before {
    color: var(--para-color);
}

.para:hover,
.para:focus,
:target .para {
    opacity: 1;
}

.para::before {
    content: "§";
}

/* TABLE OF CONTENTS */

.toc {
    --h-indent: 0.75em;

    display: grid;
    grid-template-columns: min-content auto;
}

.toc-num {
    display: inline-block;
    align-self: end;
    padding-right: 3em;

    letter-spacing: 0em;
}

.toc h1,
.toc h2,
.toc h3,
.toc h4,
.toc h5,
.toc h6 {
    display: inline-block;

    font-weight: 500;
    font-size: 12pt;

    margin-top: 0;
    margin-bottom: 0;
}

.toc a,
.toc-num {
    border-bottom: 1px solid rgba(0, 0, 0, 0);
    color: var(--text-color);
}

.toc h1,
.toc-num[data-level="1"] {
    font-size: 125%;
    font-weight: 900;
}

.toc h2,
.toc-num[data-level="2"] {
    font-weight: 700;
}

.toc h3,
.toc-num[data-level="3"] {
    font-weight: 500;
}

.toc h4,
.toc-num[data-level="4"] {
    font-size: 95%;
    font-weight: 400;
}

.toc h5,
.toc-num[data-level="5"] {
    font-size: 90%;
    font-weight: 300;
}

.toc h6,
.toc-num[data-level="6"] {
    font-size: 90%;
    font-weight: 100;
}

.toc a:hover {
    display: inline-block;
    width: 100%;

    color: var(--a-hover-color);
    border-bottom: 1px dashed var(--a-hover-color);
}

.toc h1:not(:nth-child(2)>h1) {
    margin-top: 1.5em;
}

.toc h2:not(:nth-child(2)>h2) {
    margin-top: 0.75em;
}

/** BIBLIOGRAPHY */

.bib {
    display: block;
    margin: 1em 0;
}

.bib-item {
    display: inline-block;
    width: 100%;
    margin: 0.25em 0;
}

.bib-item>* {
    padding: 0 0.125em;
}

.bib-author {
    font-style: italic;
}

.bib-title {
    font-weight: 500;
}

.bib-date {
    font-family: var(--monospace-family);
}

.bib-date::before {
    font-family: var(--serif-family);
    content: "(";
}

.bib-date::after {
    font-family: var(--serif-family);
    content: ")";
}

.bib-link {
    display: block;
    margin-left: var(--indent);

    font-family: var(--sans-serif-family);
    font-style: normal;
}

/* SPECIAL BLOCKS */

intro- {
    display: inline-block;

    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--sans-serif-family);
}

abstract-block {
    background-color: var(--abstract-background-color);
    border-left: var(--border-thickness) solid var(--abstract-border-color);
}

abstract-block::before {
    background-image: var(--abstract-image);
}

abstract-block intro-::before {
    content: "Abstract:";
    color: var(--abstract-border-color);
}

blockquote {
    background-color: var(--blockquote-background-color);
    border-left: var(--border-thickness) solid var(--blockquote-border-color);
}

blockquote::before {
    background-image: var(--blockquote-image);
    top: -0.25em;
}

blockquote intro-::before {
    content: "Quote:";
    color: var(--blockquote-border-color);
}

bug-block {
    background-color: var(--bug-block-background-color);
    border-left: var(--border-thickness) solid var(--bug-block-border-color);
}

bug-block::before {
    background-image: var(--bug-block-image);
}

bug-block intro-::before {
    content: "Bug:";
    color: var(--bug-block-border-color);
}

del-block {
    background-color: var(--del-block-background-color);
    border-left: var(--border-thickness) solid var(--del-block-border-color);
    color: var(--del-color);
}

del-block::before {
    background-image: var(--del-block-image);
}

del-block intro-::before {
    content: "Deleted:";
    color: var(--del-block-border-color);
}

del-block code,
del-block code-block {
    color: var(--text-color);
}

details {
    background-color: var(--details-background-color);
    border-left: var(--border-thickness) solid var(--details-border-color);
}

details::before {
    background-image: var(--details-image);
}

summary {
    font-family: var(--sans-serif-family);
    color: var(--details-border-color);
    user-select: none;
    cursor: pointer;
}

details[open]>summary {
    margin-bottom: 0.5em;
}

decision-block {
    background-color: var(--decision-block-background-color);
    border-left: var(--border-thickness) solid var(--decision-block-border-color);
}

decision-block::before {
    background-image: var(--decision-block-image);
}

decision-block intro-::before {
    content: "Decision:";
    color: var(--decision-block-border-color);
}

diff-block {
    background-color: var(--diff-block-background-color);
    border-left: var(--border-thickness) solid var(--diff-block-border-color);
}

diff-block::before {
    background-image: var(--diff-block-image);
}

diff-block intro-::before {
    content: "Difference:";
    color: var(--diff-block-border-color);
}

example-block {
    background-color: var(--example-block-background-color);
    border-left: var(--border-thickness) solid var(--example-block-border-color);
}

example-block::before {
    background-image: var(--example-block-image);
}

example-block intro-::before {
    content: "Example:";
    color: var(--example-block-border-color);
}

important-block {
    background-color: var(--important-block-background-color);
    border-left: var(--border-thickness) solid var(--important-block-border-color);
}

important-block::before {
    background-image: var(--important-block-image);
}

important-block intro-::before {
    content: "Important:";
    color: var(--important-block-border-color);
}

ins-block {
    background-color: var(--ins-block-background-color);
    border-left: var(--border-thickness) solid var(--ins-block-border-color);
    color: var(--ins-color);
}

ins-block code,
ins-block code-block {
    color: var(--text-color);
}

ins-block::before {
    background-image: var(--ins-block-image);
}

ins-block intro-::before {
    content: "Inserted:";
    color: var(--ins-block-border-color);
}

note-block {
    background-color: var(--note-block-background-color);
    border-left: var(--border-thickness) solid var(--note-block-border-color);
}

note-block::before {
    background-image: var(--note-block-image);
}

note-block intro-::before {
    content: "Note:";
    color: var(--note-block-border-color);
}

tip-block {
    background-color: var(--tip-block-background-color);
    border-left: var(--border-thickness) solid var(--tip-block-border-color);
}

tip-block::before {
    background-image: var(--tip-block-image);
}

tip-block intro-::before {
    content: "Tip:";
    color: var(--tip-block-border-color);
}

todo-block {
    background-color: var(--todo-block-background-color);
    border-left: var(--border-thickness) solid var(--todo-block-border-color);
}

todo-block::before {
    background-image: var(--todo-block-image);
}

todo-block intro-::before {
    content: "Todo:";
    color: var(--todo-block-border-color);
}

warning-block {
    background-color: var(--warning-block-background-color);
    border-left: var(--border-thickness) solid var(--warning-block-border-color);
}

warning-block::before {
    background-image: var(--warning-block-image);
}

warning-block intro-::before {
    content: "Warning:";
    color: var(--warning-block-border-color);
}

.indent {
    margin-left: var(--indent);
}

/* SETTINGS MENU */

#settings:not(.js) {
    display: none;
}

#settings {
    z-index: 999;
    position: fixed;
    display: inline-block;
    top: 1em;
    right: 1em;
}

#theme-icon {
    display: block;
    width: 2.5em;
    height: 2.5em;
    cursor: pointer;
    background-image: var(--theme-icon);
    background-size: contain;
    opacity: 0.25;
}

#theme-icon:hover,
#theme-icon:focus {
    opacity: 1;
}
  </style>
  <style>
@media (prefers-color-scheme: light) {
h-[data-h^=err] { color:#ff0000; }
h-[data-h^=cmt] { color:green; font-style:italic; }
h-[data-h^=cmt_dlim] { font-style:normal; }
h-[data-h^=val] { color:#9f6807; }
h-[data-h^=num] { color:#9f6807; }
h-[data-h^=str] { color:#9f6807; }
h-[data-h^=esc] { color:#9f6807; }
h-[data-h^=null] { color:#00607c; }
h-[data-h^=bool] { color:#9f6807; }
h-[data-h^=this] { color:#00607c; }
h-[data-h^=mac] { color:#6f4e37; }
h-[data-h^=id] { color:#000000; }
h-[data-h^=id_labl] { color:#517a0b; }
h-[data-h^=kw] { color:#00607c; }
h-[data-h^=sym] { color:#570057; }
h-[data-h^=sym_punc] { color:#000000; }
h-[data-h^=sym_par] { color:#af1915; }
h-[data-h^=sym_sqr] { color:#af1915; }
h-[data-h^=sym_brac] { color:#af1915; }
h-[data-h^=diff_head] { color:#777777; }
h-[data-h^=diff_head_hunk] { color:#5c477e; }
h-[data-h^=diff_eq] { color:#000000; }
h-[data-h^=diff_del] { color:#b31d28; background-color:#ffeef0; }
h-[data-h^=diff_ins] { color:#22863a; background-color:#f0fff4; }
h-[data-h^=diff_mod] { color:#7a680d; background-color:#fffdee; }
h-[data-h^=mk_tag] { color:#00607c; }
h-[data-h^=mk_attr] { color:#5c477e; }
h-[data-h^=mk_del] { color:#ce9178; text-decoration:line-through; }
h-[data-h^=mk_ins] { color:#b5cea8; text-decoration:underline; }
h-[data-h^=mk_emph] { font-style:italic; }
h-[data-h^=mk_stro] { font-weight:bold; }
h-[data-h^=mk_emph_stro] { font-style:italic; font-weight:bold; }
h-[data-h^=mk_ulin] { text-decoration:underline; }
h-[data-h^=mk_emph_ulin] { font-style:italic; text-decoration:underline; }
h-[data-h^=mk_stro_ulin] { font-weight:bold; text-decoration:underline; }
h-[data-h^=mk_emph_stro_ulin] { font-weight:bold; font-style:italic; text-decoration:underline; }
h-[data-h^=mk_strk] { text-decoration:line-through; }
h-[data-h^=mk_emph_strk] { font-style:italic; text-decoration:line-through; }
h-[data-h^=mk_stro_strk] { font-weight:bold; text-decoration:line-through; }
h-[data-h^=mk_emph_stro_strk] { font-weight:bold; font-style:italic; text-decoration:line-through; }
h-[data-h^=mk_ulin_strk] { text-decoration:underline line-through; }
h-[data-h^=mk_emph_ulin_strk] { font-style:italic; text-decoration:underline line-through; }
h-[data-h^=mk_stro_ulin_strk] { font-weight:bold; text-decoration:underline line-through; }
h-[data-h^=mk_emph_stro_ulin_strk] { font-weight:bold; font-style:italic; text-decoration:underline line-through; }
h-[data-h^=sh_cmd] { color:#00607c; }
h-[data-h^=sh-opt] { color:#000000; }
h-[data-h^=asm_ins] { color:#00607c; }
h-[data-h^=asm_ins_psu] { color:#9f6807; }
}
@media (prefers-color-scheme: dark) {
h-[data-h^=err] { color:#ff0000; }
h-[data-h^=cmt] { color:#a2e08d; font-style:italic; }
h-[data-h^=cmt_dlim] { font-style:normal; }
h-[data-h^=val] { color:#f2d18d; }
h-[data-h^=num] { color:#f2d18d; }
h-[data-h^=num_dlim] { color:#e6b191; }
h-[data-h^=num_deco] { color:#e6b191; }
h-[data-h^=str] { color:#f2d18d; }
h-[data-h^=str_dlim] { color:#e6b191; }
h-[data-h^=str_deco] { color:#e6b191; }
h-[data-h^=esc] { color:#e6aee6; }
h-[data-h^=null] { color:#62ded6; }
h-[data-h^=bool] { color:#f2d18d; }
h-[data-h^=this] { color:#62ded6; }
h-[data-h^=mac] { color:#cc946e; }
h-[data-h^=id] { color:#f0f0f0; }
h-[data-h^=id_labl] { color:#d8eda6; }
h-[data-h^=kw] { color:#62ded6; }
h-[data-h^=sym] { color:#baa6b9; }
h-[data-h^=sym_punc] { color:#d0d0d0; }
h-[data-h^=sym_par] { color:#fa7878; }
h-[data-h^=sym_sqr] { color:#fa7878; }
h-[data-h^=sym_brac] { color:#fa7878; }
h-[data-h^=diff_head] { color:#777777; }
h-[data-h^=diff_head_hunk] { color:#edc385; }
h-[data-h^=diff_eq] { color:#e7e7e7; }
h-[data-h^=diff_del] { color:#ffdcd7; background-color:#67060c; }
h-[data-h^=diff_ins] { color:#aff5b4; background-color:#033a16; }
h-[data-h^=diff_mod] { color:#fff4d7; background-color:#674d06; }
h-[data-h^=mk_tag] { color:#62ded6; }
h-[data-h^=mk_attr] { color:#a4c4de; }
h-[data-h^=mk_del] { color:#ce9178; text-decoration:line-through; }
h-[data-h^=mk_ins] { color:#b5cea8; text-decoration:underline; }
h-[data-h^=mk_emph] { font-style:italic; }
h-[data-h^=mk_stro] { font-weight:bold; }
h-[data-h^=mk_emph_stro] { font-style:italic; font-weight:bold; }
h-[data-h^=mk_ulin] { text-decoration:underline; }
h-[data-h^=mk_emph_ulin] { font-style:italic; text-decoration:underline; }
h-[data-h^=mk_stro_ulin] { font-weight:bold; text-decoration:underline; }
h-[data-h^=mk_emph_stro_ulin] { font-weight:bold; font-style:italic; text-decoration:underline; }
h-[data-h^=mk_strk] { text-decoration:line-through; }
h-[data-h^=mk_emph_strk] { font-style:italic; text-decoration:line-through; }
h-[data-h^=mk_stro_strk] { font-weight:bold; text-decoration:line-through; }
h-[data-h^=mk_emph_stro_strk] { font-weight:bold; font-style:italic; text-decoration:line-through; }
h-[data-h^=mk_ulin_strk] { text-decoration:underline line-through; }
h-[data-h^=mk_emph_ulin_strk] { font-style:italic; text-decoration:underline line-through; }
h-[data-h^=mk_stro_ulin_strk] { font-weight:bold; text-decoration:underline line-through; }
h-[data-h^=mk_emph_stro_ulin_strk] { font-weight:bold; font-style:italic; text-decoration:underline line-through; }
h-[data-h^=sh_cmd] { color:#62ded6; }
h-[data-h^=sh-opt] { color:#f0f0f0; }
h-[data-h^=asm_ins] { color:#62ded6; }
h-[data-h^=asm_ins_psu] { color:#e6aee6; }
}

html.light h-[data-h^=err] { color:#ff0000; }
html.light h-[data-h^=cmt] { color:green; font-style:italic; }
html.light h-[data-h^=cmt_dlim] { font-style:normal; }
html.light h-[data-h^=val] { color:#9f6807; }
html.light h-[data-h^=num] { color:#9f6807; }
html.light h-[data-h^=str] { color:#9f6807; }
html.light h-[data-h^=esc] { color:#9f6807; }
html.light h-[data-h^=null] { color:#00607c; }
html.light h-[data-h^=bool] { color:#9f6807; }
html.light h-[data-h^=this] { color:#00607c; }
html.light h-[data-h^=mac] { color:#6f4e37; }
html.light h-[data-h^=id] { color:#000000; }
html.light h-[data-h^=id_labl] { color:#517a0b; }
html.light h-[data-h^=kw] { color:#00607c; }
html.light h-[data-h^=sym] { color:#570057; }
html.light h-[data-h^=sym_punc] { color:#000000; }
html.light h-[data-h^=sym_par] { color:#af1915; }
html.light h-[data-h^=sym_sqr] { color:#af1915; }
html.light h-[data-h^=sym_brac] { color:#af1915; }
html.light h-[data-h^=diff_head] { color:#777777; }
html.light h-[data-h^=diff_head_hunk] { color:#5c477e; }
html.light h-[data-h^=diff_eq] { color:#000000; }
html.light h-[data-h^=diff_del] { color:#b31d28; background-color:#ffeef0; }
html.light h-[data-h^=diff_ins] { color:#22863a; background-color:#f0fff4; }
html.light h-[data-h^=diff_mod] { color:#7a680d; background-color:#fffdee; }
html.light h-[data-h^=mk_tag] { color:#00607c; }
html.light h-[data-h^=mk_attr] { color:#5c477e; }
html.light h-[data-h^=mk_del] { color:#ce9178; text-decoration:line-through; }
html.light h-[data-h^=mk_ins] { color:#b5cea8; text-decoration:underline; }
html.light h-[data-h^=mk_emph] { font-style:italic; }
html.light h-[data-h^=mk_stro] { font-weight:bold; }
html.light h-[data-h^=mk_emph_stro] { font-style:italic; font-weight:bold; }
html.light h-[data-h^=mk_ulin] { text-decoration:underline; }
html.light h-[data-h^=mk_emph_ulin] { font-style:italic; text-decoration:underline; }
html.light h-[data-h^=mk_stro_ulin] { font-weight:bold; text-decoration:underline; }
html.light h-[data-h^=mk_emph_stro_ulin] { font-weight:bold; font-style:italic; text-decoration:underline; }
html.light h-[data-h^=mk_strk] { text-decoration:line-through; }
html.light h-[data-h^=mk_emph_strk] { font-style:italic; text-decoration:line-through; }
html.light h-[data-h^=mk_stro_strk] { font-weight:bold; text-decoration:line-through; }
html.light h-[data-h^=mk_emph_stro_strk] { font-weight:bold; font-style:italic; text-decoration:line-through; }
html.light h-[data-h^=mk_ulin_strk] { text-decoration:underline line-through; }
html.light h-[data-h^=mk_emph_ulin_strk] { font-style:italic; text-decoration:underline line-through; }
html.light h-[data-h^=mk_stro_ulin_strk] { font-weight:bold; text-decoration:underline line-through; }
html.light h-[data-h^=mk_emph_stro_ulin_strk] { font-weight:bold; font-style:italic; text-decoration:underline line-through; }
html.light h-[data-h^=sh_cmd] { color:#00607c; }
html.light h-[data-h^=sh-opt] { color:#000000; }
html.light h-[data-h^=asm_ins] { color:#00607c; }
html.light h-[data-h^=asm_ins_psu] { color:#9f6807; }

html.dark h-[data-h^=err] { color:#ff0000; }
html.dark h-[data-h^=cmt] { color:#a2e08d; font-style:italic; }
html.dark h-[data-h^=cmt_dlim] { font-style:normal; }
html.dark h-[data-h^=val] { color:#f2d18d; }
html.dark h-[data-h^=num] { color:#f2d18d; }
html.dark h-[data-h^=num_dlim] { color:#e6b191; }
html.dark h-[data-h^=num_deco] { color:#e6b191; }
html.dark h-[data-h^=str] { color:#f2d18d; }
html.dark h-[data-h^=str_dlim] { color:#e6b191; }
html.dark h-[data-h^=str_deco] { color:#e6b191; }
html.dark h-[data-h^=esc] { color:#e6aee6; }
html.dark h-[data-h^=null] { color:#62ded6; }
html.dark h-[data-h^=bool] { color:#f2d18d; }
html.dark h-[data-h^=this] { color:#62ded6; }
html.dark h-[data-h^=mac] { color:#cc946e; }
html.dark h-[data-h^=id] { color:#f0f0f0; }
html.dark h-[data-h^=id_labl] { color:#d8eda6; }
html.dark h-[data-h^=kw] { color:#62ded6; }
html.dark h-[data-h^=sym] { color:#baa6b9; }
html.dark h-[data-h^=sym_punc] { color:#d0d0d0; }
html.dark h-[data-h^=sym_par] { color:#fa7878; }
html.dark h-[data-h^=sym_sqr] { color:#fa7878; }
html.dark h-[data-h^=sym_brac] { color:#fa7878; }
html.dark h-[data-h^=diff_head] { color:#777777; }
html.dark h-[data-h^=diff_head_hunk] { color:#edc385; }
html.dark h-[data-h^=diff_eq] { color:#e7e7e7; }
html.dark h-[data-h^=diff_del] { color:#ffdcd7; background-color:#67060c; }
html.dark h-[data-h^=diff_ins] { color:#aff5b4; background-color:#033a16; }
html.dark h-[data-h^=diff_mod] { color:#fff4d7; background-color:#674d06; }
html.dark h-[data-h^=mk_tag] { color:#62ded6; }
html.dark h-[data-h^=mk_attr] { color:#a4c4de; }
html.dark h-[data-h^=mk_del] { color:#ce9178; text-decoration:line-through; }
html.dark h-[data-h^=mk_ins] { color:#b5cea8; text-decoration:underline; }
html.dark h-[data-h^=mk_emph] { font-style:italic; }
html.dark h-[data-h^=mk_stro] { font-weight:bold; }
html.dark h-[data-h^=mk_emph_stro] { font-style:italic; font-weight:bold; }
html.dark h-[data-h^=mk_ulin] { text-decoration:underline; }
html.dark h-[data-h^=mk_emph_ulin] { font-style:italic; text-decoration:underline; }
html.dark h-[data-h^=mk_stro_ulin] { font-weight:bold; text-decoration:underline; }
html.dark h-[data-h^=mk_emph_stro_ulin] { font-weight:bold; font-style:italic; text-decoration:underline; }
html.dark h-[data-h^=mk_strk] { text-decoration:line-through; }
html.dark h-[data-h^=mk_emph_strk] { font-style:italic; text-decoration:line-through; }
html.dark h-[data-h^=mk_stro_strk] { font-weight:bold; text-decoration:line-through; }
html.dark h-[data-h^=mk_emph_stro_strk] { font-weight:bold; font-style:italic; text-decoration:line-through; }
html.dark h-[data-h^=mk_ulin_strk] { text-decoration:underline line-through; }
html.dark h-[data-h^=mk_emph_ulin_strk] { font-style:italic; text-decoration:underline line-through; }
html.dark h-[data-h^=mk_stro_ulin_strk] { font-weight:bold; text-decoration:underline line-through; }
html.dark h-[data-h^=mk_emph_stro_ulin_strk] { font-weight:bold; font-style:italic; text-decoration:underline line-through; }
html.dark h-[data-h^=sh_cmd] { color:#62ded6; }
html.dark h-[data-h^=sh-opt] { color:#f0f0f0; }
html.dark h-[data-h^=asm_ins] { color:#62ded6; }
html.dark h-[data-h^=asm_ins_psu] { color:#e6aee6; }
  </style>
  <script>
const theme = localStorage.getItem("cowel-theme");
if (theme !== null) {
    document.documentElement.className = theme;
}
  </script>
<title>Not all predicates must be regular</title></head>
<body>
<div id=settings tabindex=0>
    <div id=theme-icon></div>
    <script>
        const settings = document.getElementById("settings");
        const htmlClasses = document.documentElement.classList;
        const themeIcon = document.getElementById("theme-icon");

        settings.classList.add("js");
        themeIcon.onclick = () => {
            const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
            const overrideClass = prefersDark.matches ? "light" : "dark";
            if (htmlClasses.contains("light")) {
                htmlClasses.remove("light");
                localStorage.removeItem("cowel-theme");
            } else if (htmlClasses.contains("dark")) {
                htmlClasses.remove("dark");
                localStorage.removeItem("cowel-theme");
            } else {
                htmlClasses.add(overrideClass);
                // to avoid legal issues or controversy in general,
                // we don't mess with local storage when the page is hosted in arbitrary places
                if (window.location.protocol === "file:") {
                    localStorage.setItem("cowel-theme", overrideClass);
                }
            }
        };
        settings.onkeydown = (e) => {
            if (e.key === "Enter" || e.key === " ") {
                event.preventDefault();
                themeIcon.onclick();
            }
        };
    </script>
</div>
<main>













































<style>
ins-block .para::before {
    display: none;
}

.stable-ref {
    float: right;
}
</style>





<p><div class=wg21-head><h1>Not all predicates must be regular</h1>

<dl>
    <dt>Document number:</dt> <dd><a href=https://wg21%2elink/P3734R0>P3734R0</a></dd>
    <dt>Date:</dt>            <dd><tt->2025-06-14</tt-></dd>
    <dt>Audience:</dt>        <dd>SG9</dd>
    <dt>Project:</dt>         <dd>ISO/IEC 14882 Programming Languages — C++, ISO/IEC JTC1/SC22/WG21</dd>
    <dt>Reply-to:</dt>        <dd>Jan Schultke &lt;<a href=mailto:janschultke@gmail%2ecom class=sans>janschultke@gmail.com</a>&gt;</dd>
    <dt>GitHub Issue:</dt>    <dd><a href=https://wg21%2elink/P3734/github class=sans>wg21.link/P3734/github</a></dd>
    <dt>Source:</dt>          <dd><a href=https://github%2ecom/Eisenwave/cpp-proposals/blob/master/src/irregular-pred%2ecow class=sans>github.com/Eisenwave/cpp-proposals/blob/master/src/irregular-pred.cow</a></dd>
</dl>
<hr/>
</div></p>

<abstract-block><p><intro-></intro-> 
Some algorithms, such as <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-></code> and <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>copy_if</h-></code> are over-constrained
by requiring the predicate to be regular,
despite the predicate visiting elements exactly once,
making the requirement meaningless.
These constraints should be relaxed.
</p></abstract-block>

<h2 id=contents><a class=para href=#contents></a>Contents</h2>

<div class=toc><div class=toc-num data-level=2>1</div>
<a href=#introduction><h2>Introduction</h2></a>
<div class=toc-num data-level=3>1.1</div>
<a href=#why-these-functions-are-over-constrained><h3>Why these functions are over-constrained</h3></a>
<div class=toc-num data-level=3>1.2</div>
<a href=#possible-implementation><h3>Possible implementation</h3></a>
<div class=toc-num data-level=2>2</div>
<a href=#motivation><h2>Motivation</h2></a>
<div class=toc-num data-level=2>3</div>
<a href=#design-discussion><h2>Design discussion</h2></a>
<div class=toc-num data-level=3>3.1</div>
<a href=#but-its-bad-practice-to-modify-the-range-in-><h3>But it's bad practice to modify the range in <code><h- data-h=id>find_if</h-></code>!</h3></a>
<div class=toc-num data-level=3>3.2</div>
<a href=#but-algorithms-are-too-under-specified-to-permit-modification><h3>But algorithms are too under-specified to permit modification!</h3></a>
<div class=toc-num data-level=3>3.3</div>
<a href=#but-this-makes-algorithms-harder-to-reason-about><h3>But this makes algorithms harder to reason about!</h3></a>
<div class=toc-num data-level=2>4</div>
<a href=#impact-on-implementations><h2>Impact on implementations</h2></a>
<div class=toc-num data-level=2>5</div>
<a href=#impact-on-existing-code><h2>Impact on existing code</h2></a>
<div class=toc-num data-level=2>6</div>
<a href=#impact-on-the-standard><h2>Impact on the standard</h2></a>
<div class=toc-num data-level=2>7</div>
<a href=#wording><h2>Wording</h2></a>
<div class=toc-num data-level=3>7.1</div>
<a href=#algorithms%2erequirements><h3>[algorithms.requirements]</h3></a>
<div class=toc-num data-level=3>7.2</div>
<a href=#indirectcallable%2eindirectinvocable><h3>[indirectcallable.indirectinvocable]</h3></a>
<div class=toc-num data-level=3>7.3</div>
<a href=#alg%2eeq%2eind%2ecmp><h3>[alg.eq.ind.cmp]</h3></a>
<div class=toc-num data-level=3>7.4</div>
<a href=#alg%2eall%2eof><h3>[alg.all.of]</h3></a>
<div class=toc-num data-level=3>7.5</div>
<a href=#alg%2eany%2eof><h3>[alg.any.of]</h3></a>
<div class=toc-num data-level=3>7.6</div>
<a href=#alg%2enone%2eof><h3>[alg.none.of]</h3></a>
<div class=toc-num data-level=3>7.7</div>
<a href=#alg%2efind><h3>[alg.find]</h3></a>
<div class=toc-num data-level=3>7.8</div>
<a href=#alg%2efind%2elast><h3>[alg.find.last]</h3></a>
<div class=toc-num data-level=3>7.9</div>
<a href=#alg%2ecount><h3>[alg.count]</h3></a>
<div class=toc-num data-level=3>7.10</div>
<a href=#alg%2emismatch><h3>[alg.mismatch]</h3></a>
<div class=toc-num data-level=3>7.11</div>
<a href=#alg%2eequal><h3>[alg.equal]</h3></a>
<div class=toc-num data-level=3>7.12</div>
<a href=#alg%2estarts%2ewith><h3>[alg.starts.with]</h3></a>
<div class=toc-num data-level=3>7.13</div>
<a href=#alg%2eends%2ewith><h3>[alg.ends.with]</h3></a>
<div class=toc-num data-level=3>7.14</div>
<a href=#alg%2ecopy><h3>[alg.copy]</h3></a>
<div class=toc-num data-level=3>7.15</div>
<a href=#alg%2ereplace><h3>[alg.replace]</h3></a>
<div class=toc-num data-level=3>7.16</div>
<a href=#alg%2eremove><h3>[alg.remove]</h3></a>
<div class=toc-num data-level=3>7.17</div>
<a href=#alg%2epartitions><h3>[alg.partitions]</h3></a>
<div class=toc-num data-level=2>8</div>
<a href=#references><h2>References</h2></a>
</div>

<h2 id=introduction><a class=para href=#introduction></a>1. Introduction</h2>

<p>Consider the following function,
which transform a string such as <code><h- data-h=str_dlim>"</h-><h- data-h=str>abc //def</h-><h- data-h=str_dlim>"</h-></code> into <code><h- data-h=str_dlim>"</h-><h- data-h=str>abc-def</h-><h- data-h=str_dlim>"</h-></code>:
</p>
<example-block><p><intro-></intro-> 
</p><code-block><h- data-h=kw_type>bool</h-> <h- data-h=id>allowed_in_id</h-><h- data-h=sym_par>(</h-><h- data-h=kw_type>char</h-> <h- data-h=id>c</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
    <h- data-h=kw_ctrl>return</h-> <h- data-h=id>c</h-> <h- data-h=sym_op>&gt;=</h-> <h- data-h=str_dlim>'</h-><h- data-h=str>a</h-><h- data-h=str_dlim>'</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>c</h-> <h- data-h=sym_op>&lt;=</h-> <h- data-h=str_dlim>'</h-><h- data-h=str>z</h-><h- data-h=str_dlim>'</h-><h- data-h=sym_punc>;</h->
<h- data-h=sym_brac>}</h->

<h- data-h=kw_type>void</h-> <h- data-h=id>sanitize_id</h-><h- data-h=sym_par>(</h-><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>string</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>id</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
    <h- data-h=kw>auto</h-> <h- data-h=id>removed_range</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>id</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_sqr>[</h-><h- data-h=sym_sqr>]</h-><h- data-h=sym_par>(</h-><h- data-h=kw_type>char</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>c</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
        <h- data-h=kw_ctrl>if</h-> <h- data-h=sym_par>(</h-><h- data-h=id>c</h-> <h- data-h=sym_op>==</h-> <h- data-h=str_dlim>'</h-><h- data-h=str> </h-><h- data-h=str_dlim>'</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
            <h- data-h=id>c</h-> <h- data-h=sym_op>=</h-> <h- data-h=str_dlim>'</h-><h- data-h=str>-</h-><h- data-h=str_dlim>'</h-><h- data-h=sym_punc>;</h->
            <h- data-h=kw_ctrl>return</h-> <h- data-h=bool>false</h-><h- data-h=sym_punc>;</h->
        <h- data-h=sym_brac>}</h->
        <h- data-h=kw_ctrl>return</h-> <h- data-h=kw>not</h-> <h- data-h=id>allowed_in_id</h-><h- data-h=sym_par>(</h-><h- data-h=id>c</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
    <h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
    <h- data-h=id>id</h-><h- data-h=sym_op>.</h-><h- data-h=id>erase</h-><h- data-h=sym_par>(</h-><h- data-h=id>removed_range</h-><h- data-h=sym_op>.</h-><h- data-h=id>begin</h-><h- data-h=sym_par>(</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>removed_range</h-><h- data-h=sym_op>.</h-><h- data-h=id>end</h-><h- data-h=sym_par>(</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=sym_brac>}</h-></code-block>
</example-block>

<p>Such code is perfectly reasonable; it allows us to transform a range and remove some of its
elements in a single pass,
which may be substantially faster than two separate passes.
</p>
<p>While this code works as expected in practice,
it <em>technically</em> has undefined behavior
due to the fact that the predicate passed to <code><h- data-h=id>erase_if</h-></code>
violates semantic requirements for the predicate,
specified in <a href=https://eel%2eis/c++draft/concept%2eregularinvocable>[concept.regularinvocable]</a>:
</p>
<blockquote>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-><h- data-h=sym_op>...</h-> <h- data-h=id>Args</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>concept</h-> <h- data-h=id>regular_invocable</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>invocable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Args</h-><h- data-h=sym_op>...</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>The <code><h- data-h=id>invoke</h-></code> function call expression shall be
equality-preserving (<a href=https://eel%2eis/c++draft/concepts%2eequality>[concepts.equality]</a>)
and shall not modify the function object or the arguments.
</p></div>
</blockquote>

<p>For example, when visiting <code><h- data-h=str_dlim>'</h-><h- data-h=str> </h-><h- data-h=str_dlim>'</h-></code> in the string the first time,
it is replaced with <code><h- data-h=str_dlim>'</h-><h- data-h=str>-</h-><h- data-h=str_dlim>'</h-></code>, and <code><h- data-h=bool>false</h-></code> is returned,
but no action is taken the second time, and <code><h- data-h=bool>true</h-></code> is returned.
Thus, both semantic requirements of <code><h- data-h=id>regular_invocable</h-></code> are violated.
</p>
<note-block><p><intro-></intro-> 
I deliberately did not use <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>erase_if</h-></code> because the code would be well-defined
based on the technicality that the predicate does not apply any non-constant functions
through its arguments (<a href=https://eel%2eis/c++draft/algorithms%2erequirements#15>[algorithms.requirements] paragraph 15</a>).
These semantic requirements are relevant to
<code><h- data-h=id>remove_if</h-></code> rather than <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-></code>,
and the former is used by <code><h- data-h=id>erase_if</h-></code> at the time of writing.
</p></note-block>

<h3 id=why-these-functions-are-over-constrained><a class=para href=#why-these-functions-are-over-constrained></a>1.1. Why these functions are over-constrained</h3>

<p>There is no motivation for the behavior being undefined in this case.
Algorithms such as <code><h- data-h=id>remove_if</h-></code> have a specification as follows (<a href=https://eel%2eis/c++draft/alg%2eremove>[alg.remove]</a>):
</p>
<blockquote>
<p><i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of the corresponding predicate and any projection.
</p></blockquote>

<p>This means that <code><h- data-h=id>remove_if</h-></code> can only visit each element a single time anyway.
If the element is modified by the predicate or if the result of the predicate changes,
that is of no consequence
because no element is visited twice.
</p>
<p>It is also worth pointing out that while <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-></code> is is restricted,
<code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove</h-></code> is not.
It would be possible to provide a type
for which the expression <code><h- data-h=id>x</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>y</h-></code> modifies <code><h- data-h=id>x</h-></code> or <code><h- data-h=id>y</h-></code>.
To be fair, <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-></code> makes use of the <code><h- data-h=id>indirect_binary_predicate</h-></code>
concept and is therefore stricter than its non-ranges counterpart.
</p>
<h3 id=possible-implementation><a class=para href=#possible-implementation></a>1.2. Possible implementation</h3>

<p>For illustration purposes,
here is a reference implementation of <code><h- data-h=id>remove_if</h-></code> taken from
<a href=https://en%2ecppreference%2ecom/w/cpp/algorithm/remove%2ehtml>cppreference</a>:
</p>
<code-block><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIt</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>UnaryPred</h-><h- data-h=sym_op>&gt;</h->
<h- data-h=id>ForwardIt</h-> <h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIt</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIt</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>UnaryPred</h-> <h- data-h=id>p</h-><h- data-h=sym_par>)</h->
<h- data-h=sym_brac>{</h->
    <h- data-h=id>first</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>p</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
    <h- data-h=kw_ctrl>if</h-> <h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>last</h-><h- data-h=sym_par>)</h->
        <h- data-h=kw_ctrl>for</h-> <h- data-h=sym_par>(</h-><h- data-h=id>ForwardIt</h-> <h- data-h=id>i</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>;</h-> <h- data-h=sym_op>++</h-><h- data-h=id>i</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>;</h-><h- data-h=sym_par>)</h->
            <h- data-h=kw_ctrl>if</h-> <h- data-h=sym_par>(</h-><h- data-h=sym_op>!</h-><h- data-h=id>p</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h->
                <h- data-h=sym_op>*</h-><h- data-h=id>first</h-><h- data-h=sym_op>++</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>move</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
    <h- data-h=kw_ctrl>return</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>;</h->
<h- data-h=sym_brac>}</h-></code-block>

<p>As can be seen,
the whole algorithm is a simple linear pass from <code><h- data-h=id>first</h-></code> to <code><h- data-h=id>last</h-></code>.
No element is visited twice,
so who cares if <code><h- data-h=id>p</h-></code> modifies an element?
</p>
<h2 id=motivation><a class=para href=#motivation></a>2. Motivation</h2>

<p>We should relax these requirements because they are of no benefit to the implementation,
and they render the behavior of useful code undefined by technicality.
A useful example for the modifying algorithms has already been presented in <a href=#introduction>§1. Introduction</a>.
</p>
<p>Even in the case of non-modifying algorithms,
modification is useful.
</p>
<example-block><p><intro-></intro-> 
The following code has undefined behavior, even in a single-threaded environment:
</p><code-block><h- data-h=kw>struct</h-> <h- data-h=id>Resource</h-> <h- data-h=sym_brac>{</h->
    <h- data-h=kw_type>int</h-> <h- data-h=id>data</h-><h- data-h=sym_punc>;</h->
    <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>mutex</h-> <h- data-h=id>m</h-><h- data-h=sym_punc>;</h->

    <h- data-h=kw_type>int</h-> <h- data-h=id>get</h-><h- data-h=sym_par>(</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
        <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>scoped_lock</h-> <h- data-h=id>lock</h-><h- data-h=sym_brac>{</h-><h- data-h=id>m</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>;</h->
        <h- data-h=kw_ctrl>return</h-> <h- data-h=id>data</h-><h- data-h=sym_punc>;</h->
    <h- data-h=sym_brac>}</h->
<h- data-h=sym_brac>}</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw_type>bool</h-> <h- data-h=id>contains_nonzero</h-><h- data-h=sym_par>(</h-><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>span</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>Resource</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>resources</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
    <h- data-h=kw_ctrl>return</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>any_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>resources</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_sqr>[</h-><h- data-h=sym_sqr>]</h-><h- data-h=sym_par>(</h-><h- data-h=id>Resource</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h->
        <h- data-h=kw_ctrl>return</h-> <h- data-h=id>r</h-><h- data-h=sym_op>.</h-><h- data-h=id>get</h-><h- data-h=sym_par>(</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>!=</h-> <h- data-h=num>0</h-><h- data-h=sym_punc>;</h->
    <h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=sym_brac>}</h-></code-block>
<p>This use of <code><h- data-h=id>any_of</h-></code> may seem innocuous,
but it would violate the semantic requirements of <a href=https://eel%2eis/c++draft/concept%2epredicate>[concept.predicate]</a>
if the arguments to the function object are modified,
and locking a mutex may be a modification.
</p></example-block>

<p>We can imagine similar examples with result of computations
being cached inside <code><h- data-h=id>Resource</h-></code>, etc.
Any reasonable user should expect this code to work,
rather than having undefined behavior based on some gotcha.
With the current restrictions,
we make many algorithms useless for a wide variety of use cases.
This is antithetical to the purpose of any standard library.
</p>
<h2 id=design-discussion><a class=para href=#design-discussion></a>3. Design discussion</h2>

<p>While the proposal does no more than getting rid of an unnecessary technicality
by which some algorithm uses are undefined behavior,
it is still a fairly significant change.
Notably, it would even allow the range to be modified within non-modifying
algorithms like <code><h- data-h=id>find_if</h-></code>, and it's not obvious whether that would be okay or desirable.
The following subsections address these concerns.
</p>
<h3 id=but-its-bad-practice-to-modify-the-range-in-><a class=para href=#but-its-bad-practice-to-modify-the-range-in-></a>3.1. But it's bad practice to modify the range in <code><h- data-h=id>find_if</h-></code>!</h3>

<p>It could be argued that modifying elements within the predicate is bad practice,
at least for algorithms that are non-modifying.
I actually agree with this,
and don't feel like there is much motivation to allow this.
However, there is quite a bit of motivation for allowing modification in algorithms
that are already modifying, like <code><h- data-h=id>remove_if</h-></code>.
</p>
<p>Also, it is not the job of WG21 to police what is "good practice"
and "bad practice" by making things undefined behavior.
CppCoreGuidelines and other style guides can police things just fine.
Even if the predicate modifies the elements it's called with,
that is of no consequence to how <code><h- data-h=id>find_if</h-></code> operates,
and by that logic, it shouldn't be undefined.
</p>
<p>We should also be cautious of status-quo bias.
If <code><h- data-h=id>find_if</h-></code> was well-defined for modifying predicates since C++98,
and someone proposed to make it undefined <em>now</em> for stylistic or philosophical reasons,
they would be laughed out of the room.
</p>
<h3 id=but-algorithms-are-too-under-specified-to-permit-modification><a class=para href=#but-algorithms-are-too-under-specified-to-permit-modification></a>3.2. But algorithms are too under-specified to permit modification!</h3>

<p>Consider the following example:
</p>
<code-block><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>vector</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw_type>int</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>v</h-><h- data-h=sym_par>(</h-><h- data-h=num>42</h-><h- data-h=sym_punc>,</h-> <h- data-h=num>0</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>v</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_sqr>[</h-><h- data-h=sym_sqr>]</h-><h- data-h=sym_par>(</h-><h- data-h=kw_type>int</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_brac>{</h-> <h- data-h=id>i</h-> <h- data-h=sym_op>=</h-> <h- data-h=num>1</h-><h- data-h=sym_punc>;</h-> <h- data-h=kw_ctrl>return</h-> <h- data-h=bool>true</h-><h- data-h=sym_punc>;</h-> <h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>

<p><code><h- data-h=id>find_if</h-></code> is simply stated to return the first iterator
for which the predicate returns <code><h- data-h=bool>true</h-></code>.
It does not specify that the algorithm is "lazy" and immediately returns
upon a <code><h- data-h=bool>true</h-></code> result,
and it does not specify in which order the elements are traversed.
Therefore, it is unspecified how many <code><h- data-h=num>0</h-></code> elements have been turned into <code><h- data-h=num>1</h-></code>,
and in what order.
However, this is not a problem for this proposal for the following reasons:
</p>
<ul>
  <li>
    The issue of algorithms being a bit under-specified is entirely pre-existing.
    If you captured <code><h- data-h=sym_op>&amp;</h-><h- data-h=id>i</h-></code> in a <code><h- data-h=id>vector</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw_type>int</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h-></code> within the predicate,
    you would also not know how large the <code><h- data-h=id>vector</h-></code> is after running <code><h- data-h=id>find_if</h-></code>,
    and would not know what the size of that <code><h- data-h=id>vector</h-></code> is.
  </li>
  <li>
    This under-specification still does not justify undefined behavior.
    Each element that the predicate was invoked with is modified,
    exactly as the user wrote.
    It is strictly better to reason that <em>some</em> elements are modified (but we don't know which)
    than for the behavior to be entirely undefined for no technical benefit.
  </li>
  <li>
    To a large extent, this is a pre-existing quality-of-implementation issue.
    It would be extremely surprising to the user
    if the code above modified more than one <code><h- data-h=kw_type>int</h-></code>, but
    it would also be extremely surprising if the predicate was invoked more than once,
    with or without that modification.
    Considering the vast amount of existing C++ code,
    some of it probably assumes that e.g. <code><h- data-h=id>find_if</h-></code> is lazy already.
  </li>
</ul>

<h3 id=but-this-makes-algorithms-harder-to-reason-about><a class=para href=#but-this-makes-algorithms-harder-to-reason-about></a>3.3. But this makes algorithms harder to reason about!</h3>

<p>Currently, we have the "guarantee" that <code><h- data-h=id>find_if</h-></code> does not modify the range
because the algorithm itself doesn't do that,
and it would result in undefined behavior if the predicate did that.
For instance, this would let you reason that <code><h- data-h=id>find_if</h-></code> is <em>idempotent</em>;
that is, you can call it multiple times in a row on the same range and obtain the same iterator.
</p>
<p>However, the flaw in that reasoning lies in that undefined behavior.
It is neither statically nor dynamically ensured by any implementation that predicates
do not modify the elements passed into them,
so at best, we can hope that users avoid modifying the range because they have read
<a href=https://eel%2eis/c++draft/algorithms%2erequirements#6>[algorithms.requirements] paragraph 6</a>.
In reality, there is no strict guarantee at all,
only hopes and recommendations.
</p>
<p>Furthermore, we do not lose any of these guarantees as long as the predicate does not modify the range.
If so, <code><h- data-h=id>find_if</h-></code> remains idempotent, as it has been.
We are merely widening the contract of <code><h- data-h=id>find_if</h-></code> at no cost to implementations.
</p>
<h2 id=impact-on-implementations><a class=para href=#impact-on-implementations></a>4. Impact on implementations</h2>

<p>The only change is that in some places,
standard concepts are swapped out for exposition-only concepts which only differ
in semantic requirements, or vice-versa.
For example,
<code><h- data-h=id>predicate</h-></code> is replaced with <code><i><h- data-h=id>boolean-test</h-></i></code> in some places,
and both these concepts ultimately expand to <code><i><h- data-h=id>boolean-testable</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>invoke_result_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Args</h-><h- data-h=sym_op>&gt;&gt;</h-></code>.
</p>
<p>Therefore, some minor tweaks to implementation-specific concepts may have to be made
for internal documentation purposes,
but any existing implementation already complies because
semantic requirements of concepts are not checked.
</p>
<h2 id=impact-on-existing-code><a class=para href=#impact-on-existing-code></a>5. Impact on existing code</h2>

<p>Code with undefined behavior may become well-defined. 😃</p>

<h2 id=impact-on-the-standard><a class=para href=#impact-on-the-standard></a>6. Impact on the standard</h2>

<p>Only algorithms that apply predicates exactly once per element are affected.
This includes both modifying algorithms like <code><h- data-h=id>remove_if</h-></code>
and non-modifying algorithms like <code><h- data-h=id>find</h-></code>.
For such algorithms, modification of the element cannot possibly alter the course of the algorithm.
</p>
<p>There are certain edge cases like <code><h- data-h=id>adjacent_find_if</h-></code> and <code><h- data-h=id>unique</h-></code>.
While these don't apply predicates multiple times,
they do apply projections more than once,
and elements are revisited,
so it's possible that a modification performed by the predicate is unsafe.
</p>
<p>Another edge case is <code><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition_point</h-></code>.
Although the predicate is not even applied once per element,
if the predicate modifies the range,
this could retroactively violate the <i>Preconditions</i> that the input range is partitioned.
</p>
<h2 id=wording><a class=para href=#wording></a>7. Wording</h2>

<p>All changes are relative to <a href="https://wg21%2elink/n5008">[N5008]</a>.
</p>


<h3 id=algorithms.requirements><a class=para href=#algorithms%2erequirements></a>[algorithms.requirements]</h3>


<p>Chang <a href=https://eel%2eis/c++draft/algorithms%2erequirements#7>[algorithms.requirements] paragraph 7</a> as follows:
</p>
<diff-block>
<p>When not otherwise constrained, the <code><h- data-h=id>Predicate</h-></code>
<ins>or <code><h- data-h=id>UnaryTest</h-></code></ins>
parameter is used
whenever an algorithm expects a function object (<a href=https://eel%2eis/c++draft/function%2eobjects>[function.objects]</a>) that,
when applied to the result of dereferencing the corresponding iterator,
returns a value testable as <code><h- data-h=bool>true</h-></code>.
If an algorithm takes <code><h- data-h=id>Predicate</h-> <h- data-h=id>pred</h-></code>
<ins>or <code><h- data-h=id>UnaryTest</h-> <h- data-h=id>pred</h-></code></ins>
as its argument and
<code><h- data-h=id>first</h-></code> as its iterator argument with value type <code><h- data-h=id>T</h-></code>,
the expression <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code> shall be well-formed and
the type <code><h- data-h=kw>decltype</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> shall model
<code><i><h- data-h=id>boolean-testable</h-></i></code> (<a href=https://eel%2eis/c++draft/concept%2ebooleantestable>[concept.booleantestable]</a>).
<del>The</del> <ins>If specified with type <code><h- data-h=id>Predicate</h-></code>, the</ins>
function object <code><h- data-h=id>pred</h-></code>
shall not apply any non-constant function
through its argument<del>. Given</del><ins>, and given</ins>
a glvalue <code><h- data-h=id>u</h-></code> of type (possibly const) <code><h- data-h=id>T</h-></code>
that designates the same object as <code><h- data-h=sym_op>*</h-><h- data-h=id>first</h-></code>,
<code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=id>u</h-><h- data-h=sym_par>)</h-></code> shall be a valid expression
that is equal to <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>.
</p></diff-block>

<p>Change <a href=https://eel%2eis/c++draft/algorithms%2erequirements#8>[algorithms.requirements] paragraph 8</a> as follows:
</p>
<diff-block>
<p>When not otherwise constrained, the <code><h- data-h=id>BinaryPredicate</h-></code>
<ins>or <code><h- data-h=id>BinaryTest</h-></code></ins> parameter is used
whenever an algorithm expects a function object that, when applied
to the result of dereferencing two corresponding iterators or
to dereferencing an iterator and type <code><h- data-h=id>T</h-></code>
when <code><h- data-h=id>T</h-></code> is part of the signature,
returns a value testable as <code><h- data-h=bool>true</h-></code>.
If an algorithm takes <code><h- data-h=id>BinaryPredicate</h-> <h- data-h=id>binary_pred</h-></code>
<ins>or <code><h- data-h=id>BinaryTest</h-></code> binary_pred</ins>
as its argument and
<code><h- data-h=id>first1</h-></code> and <code><h- data-h=id>first2</h-></code> as its iterator arguments
with respective value types <code><h- data-h=id>T1</h-></code> and <code><h- data-h=id>T2</h-></code>,
the expression <code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-></code> shall be well-formed and
the type <code><h- data-h=kw>decltype</h-><h- data-h=sym_par>(</h-><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> shall model
<code><i><h- data-h=id>boolean-testable</h-></i></code>.
Unless otherwise specified,
<code><h- data-h=id>BinaryPredicate</h-></code> always takes the first iterator's <code><h- data-h=id>value_type</h-></code>
as its first argument, that is, in those cases when <code><h- data-h=id>T</h-> <h- data-h=id>value</h-></code>
is part of the signature,
the expression <code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> shall be well-formed and
the type <code><h- data-h=kw>decltype</h-><h- data-h=sym_par>(</h-><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> shall model
<code><i><h- data-h=id>boolean-testable</h-></i></code>.
<ins>If specified with type <code><h- data-h=id>BinaryPredicate</h-></code>, </ins>
<code><h- data-h=id>binary_pred</h-></code> shall not apply any non-constant function
through any of its arguments<del>. Given</del><ins>, and given</ins>
a glvalue <code><h- data-h=id>u</h-></code> of type (possibly const) <code><h- data-h=id>T1</h-></code>
that designates the same object as <code><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-></code>, and
a glvalue <code><h- data-h=id>v</h-></code> of type (possibly const) <code><h- data-h=id>T2</h-></code>
that designates the same object as <code><h- data-h=sym_op>*</h-><h- data-h=id>first2</h-></code>,
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=id>u</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-></code>,
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>v</h-><h- data-h=sym_par>)</h-></code>, and
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=id>u</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>v</h-><h- data-h=sym_par>)</h-></code>
shall each be a valid expression that is equal to
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-></code>, and
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=id>u</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code>
shall be a valid expression that is equal to
<code><h- data-h=id>binary_pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code>.
</p></diff-block>

<h3 id=indirectcallable.indirectinvocable><a class=para href=#indirectcallable%2eindirectinvocable></a>[indirectcallable.indirectinvocable]</h3>


<p>Change <a href=https://eel%2eis/c++draft/indirectcallable%2eindirectinvocable#1>[indirectcallable.indirectinvocable] paragraph 1</a> as follows:
</p>
<diff-block>
<p>The indirect callable concepts are used to constrain those algorithms
that accept callable objects (<a href=https://eel%2eis/c++draft/func%2edef>[func.def]</a>) as arguments.
</p><code-block class=borderless><h- data-h=kw>namespace</h-> <h- data-h=id>std</h-> <h- data-h=sym_brac>{</h->
  […]

  <h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=kw>concept</h-> <h- data-h=id>indirect_unary_predicate</h-> <h- data-h=sym_op>=</h->
      <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>copy_constructible</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h->

<ins>  <h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Args</h-><h- data-h=sym_op>...</h-><h- data-h=sym_op>&gt;</h->            <h- data-h=cmt_dlim>//</h-><h- data-h=cmt> </h-><f-serif><h- data-h=cmt>exposition only</h-></f-serif>
    <h- data-h=kw>concept</h-> <i><h- data-h=id>boolean-test</h-></i> <h- data-h=sym_op>=</h-> <i><h- data-h=id>boolean-testable</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>invoke_result_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Args</h-><h- data-h=sym_op>...</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h-></ins>

<ins>  <h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h->                  <h- data-h=cmt_dlim>//</h-><h- data-h=cmt> </h-><f-serif><h- data-h=cmt>exposition only</h-></f-serif>
    <h- data-h=kw>concept</h-> <i><h- data-h=id>indirect-unary-test</h-></i> <h- data-h=sym_op>=</h->
      <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>copy_constructible</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h-></ins>

  <h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=kw>concept</h-> <h- data-h=id>indirect_binary_predicate</h-> <h- data-h=sym_op>=</h->
      <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>copy_constructible</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h->

<ins>  <h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>F</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h->        <h- data-h=cmt_dlim>//</h-><h- data-h=cmt> </h-><f-serif><h- data-h=cmt>exposition only</h-></f-serif>
    <h- data-h=kw>concept</h-> <i><h- data-h=id>indirect-binary-test</h-></i> <h- data-h=sym_op>=</h->
      <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>indirectly_readable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <h- data-h=id>copy_constructible</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <i><h- data-h=id>indirect-value-t</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
      <i><h- data-h=id>boolean-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>F</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iter_reference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h-></ins>

  […]
<h- data-h=sym_brac>}</h-></code-block>
<p><ins><wg21-block>[<i>Note</i>: 
<code><i><h- data-h=id>boolean-test</h-></i></code> and <code><h- data-h=id>predicate</h-></code>
are satisfied (but not modeled) by the same types. — <i>end note</i>]</wg21-block>
</ins>
</p></diff-block>

<h3 id=alg.eq.ind.cmp><a class=para href=#alg%2eeq%2eind%2ecmp></a>[alg.eq.ind.cmp]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2ereq%2eind%2ecmp#1>[alg.req.ind.cmp] paragraph 1</a> as follows:
</p>
<diff-block>
<p>The <code><h- data-h=id>indirectly_comparable</h-></code> concept specifies the common requirements
of algorithms that compare values from two different sequences.
</p><code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>P1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>P2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>concept</h-> <h- data-h=id>indirectly_comparable</h-> <h- data-h=sym_op>=</h->
    <h- data-h=id>indirect_binary_predicate</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>P1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>P2</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h->

<ins><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>P1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->   <h- data-h=cmt_dlim>//</h-><h- data-h=cmt> exposition only</h->
         <h- data-h=kw>class</h-> <h- data-h=id>P2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>concept</h-> <i><h- data-h=id>indirectly-binary-testable</h-></i> <h- data-h=sym_op>=</h->
    <i><h- data-h=id>indirect-binary-test</h-></i><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>P1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>P2</h-><h- data-h=sym_op>&gt;&gt;</h-><h- data-h=sym_punc>;</h-></ins></code-block>
<p><ins><wg21-block>[<i>Note</i>: 
<code><i><h- data-h=id>indirectly-binary-testable</h-></i></code> and <code><h- data-h=id>indirectly_comparable</h-></code>
are satisfied (but not modeled) by the same types. — <i>end note</i>]</wg21-block>
</ins>
</p></diff-block>

<h3 id=alg.all.of><a class=para href=#alg%2eall%2eof></a>[alg.all.of]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2eall%2eof>[alg.all.of]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>all_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>all_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
              <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>all_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>all_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-></code> for the overloads in namespace <code><h- data-h=id>std</h-></code>;</li>
<li>
  <code><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>2
<i>Returns</i>:
<code><h- data-h=bool>false</h-></code> if <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>false</h-></code>
for some iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>), and
<code><h- data-h=bool>true</h-></code> otherwise.
</p>
<p>3
<i>Complexity</i>:
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of the predicate and any projection.
</p></div>
</diff-block>

<h3 id=alg.any.of><a class=para href=#alg%2eany%2eof></a>[alg.any.of]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2eany%2eof>[alg.any.of]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>any_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>any_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
              <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>any_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>any_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-></code> for the overloads in namespace <code><h- data-h=id>std</h-></code>;</li>
<li>
  <code><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>2
<i>Returns</i>:
<code><h- data-h=bool>true</h-></code> if <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>
for some iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>), and
<code><h- data-h=bool>false</h-></code> otherwise.
</p>
<p>3
<i>Complexity</i>:
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of the predicate and any projection.
</p></div>
</diff-block>

<h3 id=alg.none.of><a class=para href=#alg%2enone%2eof></a>[alg.none.of]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2enone%2eof>[alg.none.of]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>none_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>none_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
              <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>none_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>none_of</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-></code> for the overloads in namespace <code><h- data-h=id>std</h-></code>;</li>
<li>
  <code><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>2
<i>Returns</i>:
<code><h- data-h=bool>false</h-></code> if <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>
for some iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>), and
<code><h- data-h=bool>true</h-></code> otherwise.
</p>
<p>3
<i>Complexity</i>:
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of the predicate and any projection.
</p></div>
</diff-block>

<h3 id=alg.find><a class=para href=#alg%2efind></a>[alg.find]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2efind>[alg.find]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>find</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                               <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>find</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                       <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                  <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Predicate</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                          <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>find_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                      <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>find_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                              <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                              <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>I</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>I</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>I</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li><code><h- data-h=sym_op>*</h-><h- data-h=id>i</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-></code> for <code><h- data-h=id>find</h-></code>;</li>
<li><code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>!=</h-> <h- data-h=bool>false</h-></code> for <code><h- data-h=id>find_if</h-></code>;</li>
<li><code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=bool>false</h-></code> for <code><h- data-h=id>find_if_not</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>!</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_if_not</h-></code>.</li>
</ul>

<p>2
<i>Returns</i>:
The first iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>.
Returns <code><h- data-h=id>last</h-></code> if no such iterator is found.
</p>
<p>3
<i>Complexity</i>:
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p></div>
</diff-block>

<h3 id=alg.find.last><a class=para href=#alg%2efind%2elast></a>[alg.find.last]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2efind%2elast>[alg.find.last]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if_not</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
<code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last</h-></code>;</li>
<li>
<code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if</h-></code>;</li>
<li>
<code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>!</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>find_last_if_not</h-></code>.</li>
</ul>

<p>2
<i>Returns</i>:
Let <code><h- data-h=id>i</h-></code> be the last iterator in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>.
Returns <code><h- data-h=sym_brac>{</h-><h- data-h=id>i</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last</h-><h- data-h=sym_brac>}</h-></code>, or
<code><h- data-h=sym_brac>{</h-><h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last</h-><h- data-h=sym_brac>}</h-></code> if no such iterator is found.
</p>
<p>3
<i>Complexity</i>:
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of
the corresponding predicate and projection.
</p></div>
</diff-block>



<h3 id=alg.count><a class=para href=#alg%2ecount></a>[alg.count]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2ecount>[alg.count]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw>typename</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>difference_type</h->
    <h- data-h=id>count</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>typename</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>difference_type</h->
    <h- data-h=id>count</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
          <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw>typename</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>difference_type</h->
    <h- data-h=id>count_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>typename</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>difference_type</h->
    <h- data-h=id>count_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>iter_difference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>count</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>range_difference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>count</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>iter_difference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>count_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>range_difference_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>count_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=sym_op>*</h-><h- data-h=id>i</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-></code> for the overloads
  with no parameter <code><h- data-h=id>pred</h-></code> or <code><h- data-h=id>proj</h-></code>;</li>
<li>
  <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>!=</h-> <h- data-h=bool>false</h-></code> for the overloads
  with a parameter <code><h- data-h=id>pred</h-></code> but no parameter <code><h- data-h=id>proj</h-></code>;</li>
<li>
  <code><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-></code> for the overloads
  with a parameter <code><h- data-h=id>proj</h-></code> but no parameter <code><h- data-h=id>pred</h-></code>;</li>
<li>
  <code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for the overloads
  with both parameters <code><h- data-h=id>proj</h-></code> and <code><h- data-h=id>pred</h-></code>.</li>
</ul>

<p>2
<i>Effects</i>:
Returns the number of iterators <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which <math display=inline><mi>E</mi></math> holds.
</p>
<p>3
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p></div>
</diff-block>

<h3 id=alg.mismatch><a class=para href=#alg%2emismatch></a>[alg.mismatch]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2emismatch>[alg.mismatch]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
             <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
             <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_iterator</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>mismatch_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>I1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                     <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_range</h-> <h- data-h=id>R2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>mismatch_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>R2</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                     <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <code><h- data-h=id>last2</h-></code> be <code><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-><h- data-h=sym_par>)</h-></code>
for the overloads with no parameter <code><h- data-h=id>last2</h-></code> or <code><h- data-h=id>r2</h-></code>.
</p>
<p>2
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=sym_op>!</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first1</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads with no parameter <code><h- data-h=id>pred</h-></code>;</li>
<li>
  <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first1</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=bool>false</h-></code>
  for the overloads with a parameter <code><h- data-h=id>pred</h-></code> and
  no parameter <code><h- data-h=id>proj1</h-></code>;</li>
<li>
  <code><h- data-h=sym_op>!</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first1</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj2</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads with both parameters <code><h- data-h=id>pred</h-></code> and <code><h- data-h=id>proj1</h-></code>.</li>
</ul>

<p>3
Let <math display=inline><mi>N</mi></math> be min(<code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-></code>, <code><h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>).
</p>
<p>4
<i>Returns</i>:
<code><h- data-h=sym_brac>{</h-> <h- data-h=id>first1</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=id>n</h-> <h- data-h=sym_brac>}</h-></code>,
where <code><h- data-h=id>n</h-></code> is the smallest integer in [<code><h- data-h=num>0</h-></code>, <code><math display=inline><mi>N</mi></math></code>) such that <math display=inline><mi>E</mi></math> holds,
or <math display=inline><mi>N</mi></math> if no such integer exists.
</p>
<p>5
<i>Complexity</i>:
At most <math display=inline><mi>N</mi></math> applications of the corresponding predicate and any projections.
</p></div>
</diff-block>

<h3 id=alg.equal><a class=para href=#alg%2eequal></a>[alg.equal]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2eequal>[alg.equal]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
                       <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
                       <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>BinaryPredicate</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>BinaryPredicate</h-> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
                       <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>InputIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
                       <h- data-h=id>InputIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
                       <del><h- data-h=id>BinaryPredicate</h-></del> <ins><h- data-h=id>BinaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>BinaryPredicate</h-> <h- data-h=id>BinaryTest</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
             <h- data-h=id>BinaryPredicate</h-> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_iterator</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del> <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>I1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
                               <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                               <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_range</h-> <h- data-h=id>R2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>R2</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                               <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let:
</p><ul>
<li>
  <code><h- data-h=id>last2</h-></code> be <code><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-><h- data-h=sym_par>)</h-></code>
  for the overloads with no parameter <code><h- data-h=id>last2</h-></code> or <code><h- data-h=id>r2</h-></code>;</li>
<li>
  <code><h- data-h=id>pred</h-></code> be <code><h- data-h=id>equal_to</h-><h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-></code>
  for the overloads with no parameter <code><h- data-h=id>pred</h-></code>;</li>
<li>
  <math display=inline><mi>E</mi></math> be:
  <ul>
  <li>
    <code><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
    for the overloads with no parameter <code><h- data-h=id>proj1</h-></code>;</li>
  <li>
    <code><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj2</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
    for the overloads with parameter <code><h- data-h=id>proj1</h-></code>.</li>
  </ul></li>
</ul>

<p>2
<i>Returns</i>:
If <code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>, return <code><h- data-h=bool>false</h-></code>.
Otherwise return <code><h- data-h=bool>true</h-></code>
if <math display=inline><mi>E</mi></math> holds for every iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first1</h-></code><code><h- data-h=id>last1</h-></code>).
Otherwise, returns <code><h- data-h=bool>false</h-></code>.
</p>
<p>3
<i>Complexity</i>:
If
</p><ul>
<li>
  the types of <code><h- data-h=id>first1</h-></code>, <code><h- data-h=id>last1</h-></code>, <code><h- data-h=id>first2</h-></code>, and <code><h- data-h=id>last2</h-></code>
  meet the
  <i>Cpp17RandomAccessIterator</i> requirements (<a href=https://eel%2eis/c++draft/random%2eaccess%2eiterators>[random.access.iterators]</a>)
  and <code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>
  for the overloads in namespace <code><h- data-h=id>std</h-></code>;</li>
<li>
 the types of <code><h- data-h=id>first1</h-></code>, <code><h- data-h=id>last1</h-></code>, <code><h- data-h=id>first2</h-></code>, and <code><h- data-h=id>last2</h-></code>
 pairwise model <code><h- data-h=id>sized_sentinel_for</h-></code> (<a href=https://eel%2eis/c++draft/iterator%2econcept%2esizedsentinel>[iterator.concept.sizedsentinel]</a>)
  and <code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>
  for the first overload in namespace <code><h- data-h=id>ranges</h-></code>,</li>
<li>
   <code><h- data-h=id>R1</h-></code> and <code><h- data-h=id>R2</h-></code> each model <code><h- data-h=id>sized_range</h-></code> and
   <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>distance</h-><h- data-h=sym_par>(</h-><h- data-h=id>r1</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>!=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>distance</h-><h- data-h=sym_par>(</h-><h- data-h=id>r2</h-><h- data-h=sym_par>)</h-></code>
   for the second overload in namespace <code><h- data-h=id>ranges</h-></code>,</li>
</ul>
<p>then no applications of the corresponding predicate and each projection;
otherwise,
</p><ul>
<li>
  For the overloads with no <code><h- data-h=id>ExecutionPolicy</h-></code>,
  at most min(<code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-></code>, <code><h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>)
  applications of the corresponding predicate and any projections.</li>
<li>
  For the overloads with an <code><h- data-h=id>ExecutionPolicy</h-></code>,
  𝒪(min(<code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-></code>, <code><h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>))
  applications of the corresponding predicate.</li>
</ul>
</div>
</diff-block>

<h3 id=alg.starts.with><a class=para href=#alg%2estarts%2ewith></a>[alg.starts.with]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2estarts%2ewith>[alg.starts.with]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_iterator</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>starts_with</h-><h- data-h=sym_par>(</h-><h- data-h=id>I1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                                     <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_range</h-> <h- data-h=id>R2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>starts_with</h-><h- data-h=sym_par>(</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>R2</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                                     <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
<i>Returns</i>:
</p><code-block class=borderless><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>mismatch</h-><h- data-h=sym_par>(</h-><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>move</h-><h- data-h=sym_par>(</h-><h- data-h=id>first1</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>move</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_op>.</h-><h- data-h=id>in2</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>last2</h-></code-block>
</div>
</diff-block>

<h3 id=alg.ends.with><a class=para href=#alg%2eends%2ewith></a>[alg.ends.with]</h3>


<p>Change <a href=https://eel%2eis/c++draft/alg%2eends%2ewith>[alg.ends.with]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_iterator</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=sym_par>(</h-><h- data-h=id>forward_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>||</h-> <h- data-h=id>sized_sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>S1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <h- data-h=sym_par>(</h-><h- data-h=id>forward_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>||</h-> <h- data-h=id>sized_sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>S2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>I1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>ends_with</h-><h- data-h=sym_par>(</h-><h- data-h=id>I1</h-> <h- data-h=id>first1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S1</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>I2</h-> <h- data-h=id>first2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S2</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                                   <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <code><h- data-h=id>N1</h-></code> be <code><h- data-h=id>last1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first1</h-></code> and
<code><h- data-h=id>N2</h-></code> be <code><h- data-h=id>last2</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first2</h-></code>.
</p>
<p>2
<i>Returns</i>:
<code><h- data-h=bool>false</h-></code> if <code><h- data-h=id>N1</h-></code> &lt; <code><h- data-h=id>N2</h-></code>, otherwise
</p><code-block class=borderless><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>move</h-><h- data-h=sym_par>(</h-><h- data-h=id>first1</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>N1</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>N2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>std</h-><h- data-h=sym_op>::</h-><h- data-h=id>move</h-><h- data-h=sym_par>(</h-><h- data-h=id>first2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last2</h-><h- data-h=sym_punc>,</h->
              <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj2</h-><h- data-h=sym_par>)</h-></code-block>
</div>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>input_range</h-> <h- data-h=id>R2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=sym_par>(</h-><h- data-h=id>forward_range</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>||</h-> <h- data-h=id>sized_range</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <h- data-h=sym_par>(</h-><h- data-h=id>forward_range</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>||</h-> <h- data-h=id>sized_range</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirectly_comparable</h-></del>
           <ins><i><h- data-h=id>indirectly-binary-testable</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R2</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>ends_with</h-><h- data-h=sym_par>(</h-><h- data-h=id>R1</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>R2</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h->
                                   <h- data-h=id>Proj1</h-> <h- data-h=id>proj1</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj2</h-> <h- data-h=id>proj2</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>3
Let <code><h- data-h=id>N1</h-></code> be <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>distance</h-><h- data-h=sym_par>(</h-><h- data-h=id>r1</h-><h- data-h=sym_par>)</h-></code> and
<code><h- data-h=id>N2</h-></code> be <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>distance</h-><h- data-h=sym_par>(</h-><h- data-h=id>r2</h-><h- data-h=sym_par>)</h-></code>.
</p>
<p>4
<i>Returns</i>:
<code><h- data-h=bool>false</h-></code> if <code><h- data-h=id>N1</h-></code> &lt; <code><h- data-h=id>N2</h-></code>, otherwise
</p><code-block class=borderless><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal</h-><h- data-h=sym_par>(</h-><h- data-h=id>views</h-><h- data-h=sym_op>::</h-><h- data-h=id>drop</h-><h- data-h=sym_par>(</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>ref_view</h-><h- data-h=sym_par>(</h-><h- data-h=id>r1</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>N1</h-> <h- data-h=sym_op>-</h-> <h- data-h=kw>static_cast</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>decltype</h-><h- data-h=sym_par>(</h-><h- data-h=id>N1</h-><h- data-h=sym_par>)</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_par>(</h-><h- data-h=id>N2</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>,</h->
              <h- data-h=id>r2</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>proj2</h-><h- data-h=sym_par>)</h-></code-block>
</div>
</diff-block>

<h3 id=alg.copy><a class=para href=#alg%2ecopy></a>[alg.copy]</h3>

<p>Change <a href=https://eel%2eis/c++draft/alg%2ecopy>[alg.copy]</a> as follows:
</p>


<diff-block>
<p>[…]</p>

<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>OutputIterator</h-> <h- data-h=id>copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                   <h- data-h=id>OutputIterator</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                           <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                           <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>

<div class=indent>
<p>15
Let <math display=inline><mi>E</mi></math> be:
</p><ul>
<li>
  <code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>std</h-></code>;</li>
<li>
  <code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>,</li>
</ul>
<p>and <math display=inline><mi>N</mi></math> be the number of iterators <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which the condition <math display=inline><mi>E</mi></math> holds.
</p>
<p>16
<i>Preconditions</i>:
The ranges [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) and [<code><h- data-h=id>result</h-></code>, <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>)
do not overlap.
<br/><wg21-block>[<i>Note</i>: 
For the overload with an <code><h- data-h=id>ExecutionPolicy</h-></code>,
there might be a performance cost
if <code><h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-></code>
is not <i>Cpp17MoveConstructible</i> (<a href=https://eel%2eis/c++draft/cpp17%2emoveconstructible>[cpp17.moveconstructible]</a>).
 — <i>end note</i>]</wg21-block></p>

<p>17
<i>Effects</i>:
Copies all of the elements referred to
by the iterator <code><h- data-h=id>i</h-></code> in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>.
</p>
<p>18
<i>Returns</i>:
</p><ul>
<li>
  <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <math display=inline><mi>N</mi></math></code>
  for the overloads in namespace <code><h- data-h=id>std</h-></code>.</li>
<li>
  <code><h- data-h=sym_brac>{</h-><h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <math display=inline><mi>N</mi></math><h- data-h=sym_brac>}</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>19
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p>
<p>20
<i>Remarks</i>:
Stable (<a href=https://eel%2eis/c++draft/algorithm%2estable>[algorithm.stable]</a>).
</p></div>

<p>[…]
</p></diff-block>

<h3 id=alg.replace><a class=para href=#alg%2ereplace></a>[alg.replace]</h3>

<p>Change <a href=https://eel%2eis/c++draft/alg%2ereplace>[alg.replace]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>void</h-> <h- data-h=id>replace</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                         <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>void</h-> <h- data-h=id>replace</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
               <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
               <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>void</h-> <h- data-h=id>replace_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                            <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>void</h-> <h- data-h=id>replace_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                  <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_writable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>I</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_writable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_writable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>I</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_writable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>

<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be
</p><ul>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>old_value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>replace</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>replace_if</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>old_value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_if</h-></code>.</li>
</ul>


<p>2
<i>Mandates</i>:
<code><h- data-h=id>new_value</h-></code> is writable (<a href=https://eel%2eis/c++draft/iterator%2erequirements%2egeneral>[iterator.requirements.general]</a>) to <code><h- data-h=id>first</h-></code>.
</p>
<p>3
<i>Effects</i>:
Substitutes elements referred by the iterator <code><h- data-h=id>i</h-></code>
in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) with <code><h- data-h=id>new_value</h-></code>,
when <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code>.
</p>
<p>4
<i>Returns</i>:
<code><h- data-h=id>last</h-></code> for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.
</p>
<p>5
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p></div>

<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>OutputIterator</h->
    <h- data-h=id>replace_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=id>OutputIterator</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator2</h->
    <h- data-h=id>replace_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h->
                 <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>OutputIterator</h->
    <h- data-h=id>replace_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                    <h- data-h=id>OutputIterator</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h->
                    <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator2</h->
    <h- data-h=id>replace_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                    <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                    <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h->
                    <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>iter_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <h- data-h=id>output_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h->
                         <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T1</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T2</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>iter_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
           <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>output_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T1</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>old_value</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T2</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h->
                         <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-><h- data-h=kw>class</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>iter_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>output_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h->
                            <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>iter_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>output_iterator</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>new_value</h-><h- data-h=sym_punc>,</h->
                            <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>

<div class=indent>
<p>6
Let <math display=inline><mi>E</mi></math> be
</p><ul>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>result</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>old_value</h-><h- data-h=sym_par>)</h-></code>
  for <code><h- data-h=id>replace_copy</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>result</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for <code><h- data-h=id>replace_copy_if</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>result</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>old_value</h-><h- data-h=sym_par>)</h-></code>
  for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>result</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>
  for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>replace_copy_if</h-></code>.</li>
</ul>

<p>7
<i>Mandates</i>:
The results of the expressions <code><h- data-h=sym_op>*</h-><h- data-h=id>first</h-></code> and <code><h- data-h=id>new_value</h-></code>
are writable (<a href=https://eel%2eis/c++draft/iterator%2erequirements%2egeneral>[iterator.requirements.general]</a>) to <code><h- data-h=id>result</h-></code>.
</p>
<p>8
<i>Preconditions</i>:
The ranges [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) and [<code><h- data-h=id>result</h-></code>, <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>)
do not overlap.
</p>
<p>9
<i>Effects</i>:
Assigns through every iterator <code><h- data-h=id>i</h-></code>
in the range [<code><h- data-h=id>result</h-></code>, <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>)
a new corresponding value
</p><ul>
<li><code><h- data-h=id>new_value</h-></code> if <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>true</h-></code> or</li>
<li><code><h- data-h=sym_op>*</h-><h- data-h=sym_par>(</h-><h- data-h=id>first</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>i</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>result</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> otherwise.</li>
</ul>

<p>10
<i>Returns</i>:
</p><ul>
<li>
  <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>
  for the overloads in namespace <code><h- data-h=id>std</h-></code>.</li>
<li>
  <code><h- data-h=sym_brac>{</h-><h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-><h- data-h=sym_brac>}</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>11
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p></div>
</diff-block>

<note-block><p><intro-></intro-> 
It is strange that <code><h- data-h=id>replace</h-></code> is not a stable algorithm,
unlike <code><h- data-h=id>remove</h-></code> and <code><h- data-h=id>copy</h-></code>,
but that's probably best solved in a different issue/paper.
</p></note-block>

<h3 id=alg.remove><a class=para href=#alg%2eremove></a>[alg.remove]</h3>

<p>Change <a href=https://eel%2eis/c++draft/alg%2eremove>[alg.remove]</a> as follows:
</p>
<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>remove</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                   <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>remove</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                         <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                         <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                      <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h-> <h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                            <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                            <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>permutable</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>permutable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>permutable</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del>
         <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del>
         <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>permutable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>



<div class=indent>
<p>1
Let <math display=inline><mi>E</mi></math> be
</p><ul>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>remove</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>remove_if</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_if</h-></code>.</li>
</ul>

<p>2
<i>Preconditions</i>:
For the algorithms in namespace <code><h- data-h=id>std</h-></code>,
the type of <code><h- data-h=sym_op>*</h-><h- data-h=id>first</h-></code>
meets the <i>Cpp17MoveAssignable</i> requirements (<a href=https://eel%2eis/c++draft/cpp17%2emoveassignable>[cpp17.moveassignable]</a>).
</p>
<p>3
<i>Effects</i>:
Eliminates all the elements referred to by iterator <code><h- data-h=id>i</h-></code>
in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) for which <math display=inline><mi>E</mi></math> holds.
</p>
<p>4
<i>Returns</i>:
Let <math display=inline><mi>j</mi></math> be the end of the resulting range. Returns:
</p><ul>
<li><math display=inline><mi>j</mi></math> for the overloads in namespace <code><h- data-h=id>std</h-></code>.</li>
<li><code><h- data-h=sym_brac>{</h-><math display=inline><mi>j</mi></math><h- data-h=sym_punc>,</h-> <h- data-h=id>last</h-><h- data-h=sym_brac>}</h-></code> for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>5
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p>
<p>6
<i>Remarks</i>:
Stable (<a href=https://eel%2eis/c++draft/algorithm%2estable>[algorithm.stable]</a>).
</p>
<p>7
<wg21-block>[<i>Note</i>: 
Each element in the range [<code><h- data-h=id>ret</h-></code>, <code><h- data-h=id>last</h-></code>),
where <code><h- data-h=id>ret</h-></code> is the returned value,
has a valid but unspecified state,
because the algorithms can eliminate elements
by moving from elements that were originally in that range.
 — <i>end note</i>]</wg21-block>
</p></div>

<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>InputIterator</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>OutputIterator</h->
    <h- data-h=id>remove_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                <h- data-h=id>OutputIterator</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator2</h->
    <h- data-h=id>remove_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>OutputIterator</h->
    <h- data-h=id>remove_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>OutputIterator</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator2</h->
    <h- data-h=id>remove_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>T</h-> <h- data-h=sym_op>=</h-> <h- data-h=id_type>projected_value_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <del><h- data-h=id>indirect_binary_predicate</h-></del>
           <ins><i><h- data-h=id>indirect-binary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>equal_to</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>*</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>const</h-> <h- data-h=id>T</h-><h- data-h=sym_op>&amp;</h-> <h- data-h=id>value</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>indirect_unary_predicate</h-></del>
                                <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del>
         <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_if_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_if</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O</h-> <h- data-h=id>result</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>

<div class=indent>
<p>8
Let <math display=inline><mi>E</mi></math> be
</p><ul>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>remove_copy</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_par>(</h-><h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>remove_copy_if</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-> <h- data-h=sym_op>==</h-> <h- data-h=id>value</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy</h-></code>;</li>
<li><code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=sym_op>*</h-><h- data-h=id>i</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code> for <code><h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>remove_copy_if</h-></code>.</li>
</ul>

<p>9
Let <math display=inline><mi>N</mi></math> be the number of elements in [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
for which <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>false</h-></code>.
</p>
<p>10
<i>Mandates</i>:
<code><h- data-h=sym_op>*</h-><h- data-h=id>first</h-></code> is writable (<a href=https://eel%2eis/c++draft/iterator%2erequirements%2egeneral>[iterator.requirements.general]</a>) to <code><h- data-h=id>result</h-></code>.
</p>
<p>11
<i>Preconditions</i>:
The ranges [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) and [<code><h- data-h=id>result</h-></code>, <code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <h- data-h=sym_par>(</h-><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-><h- data-h=sym_par>)</h-></code>)
do not overlap.
<br/><wg21-block>[<i>Note</i>: 
For the overloads with an <code><h- data-h=id>ExecutionPolicy</h-></code>,
there might be a performance cost
if <code><h- data-h=id>iterator_traits</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_op>::</h-><h- data-h=id>value_type</h-></code> does not meet
the <i>Cpp17MoveConstructible</i> (<a href=https://eel%2eis/c++draft/cpp17%2emoveconstructible>[cpp17.moveconstructible]</a>) requirements.
 — <i>end note</i>]</wg21-block></p>

<p>12
<i>Effects</i>:
Copies all the elements referred to by the iterator <code><h- data-h=id>i</h-></code>
in the range [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>) for which <math display=inline><mi>E</mi></math> is <code><h- data-h=bool>false</h-></code>.
</p>
<p>13
<i>Returns</i>:
</p><ul>
<li><code><h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <math display=inline><mi>N</mi></math></code>, for the algorithms in namespace <code><h- data-h=id>std</h-></code>.</li>
<li><code><h- data-h=sym_brac>{</h-><h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>result</h-> <h- data-h=sym_op>+</h-> <math display=inline><mi>N</mi></math><h- data-h=sym_brac>}</h-></code>, for the algorithms in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>14
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications
of the corresponding predicate and any projection.
</p>
<p>15
<i>Remarks</i>:
Stable (<a href=https://eel%2eis/c++draft/algorithm%2estable>[algorithm.stable]</a>).
</p></div>
</diff-block>


<h3 id=alg.partitions><a class=para href=#alg%2epartitions></a>[alg.partitions]</h3>

<p>Change <a href=https://eel%2eis/c++draft/alg%2epartitions>[alg.partitions]</a> as follows:
</p>


<diff-block>
<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Predicate</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>is_partitioned</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                                <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Predicate</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw_type>bool</h-> <h- data-h=id>is_partitioned</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                      <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>is_partitioned</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=kw_type>bool</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>is_partitioned</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>1
Let <code><h- data-h=id>proj</h-></code> be <code><h- data-h=id>identity</h-><h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-></code>
for the overloads with no parameter named <code><h- data-h=id>proj</h-></code>.
</p>
<p>2
<i>Returns</i>:
<code><h- data-h=bool>true</h-></code> if and only if the elements <code><h- data-h=id>e</h-></code> of [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
are partitioned with respect to the expression
<code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>e</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>.
</p>
<p>3
<i>Complexity</i>:
Linear.
At most <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of <code><h- data-h=id>pred</h-></code> and <code><h- data-h=id>proj</h-></code>.
</p></div>

<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ForwardIterator</h->
    <h- data-h=id>partition</h-><h- data-h=sym_par>(</h-><h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Predicate</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>ForwardIterator</h->
    <h- data-h=id>partition</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
              <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Predicate</h-> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>permutable</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>subrange</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>forward_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>permutable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id_type>borrowed_subrange_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>4
Let <code><h- data-h=id>proj</h-></code> be <code><h- data-h=id>identity</h-><h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-></code>
for the overloads with no parameter named <code><h- data-h=id>proj</h-></code>
and let <math display=inline><mi>E</mi></math>(<math display=inline><mi>x</mi></math>) be <code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <math display=inline><mi>x</mi></math><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>.
</p>
<p>5
<i>Preconditions</i>:
For the overloads in namespace <code><h- data-h=id>std</h-></code>,
<code><h- data-h=id>ForwardIterator</h-></code> meets
the <i>Cpp17ValueSwappable</i> requirements (<a href=https://eel%2eis/c++draft/swappable%2erequirements>[swappable.requirements]</a>).
</p>
<p>6
<i>Effects</i>:
Places all the elements <code><h- data-h=id>e</h-></code> in [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>)
that satisfy <math display=inline><mi>E</mi></math>(<code><h- data-h=id>e</h-></code>) before all the elements that do not.
</p>
<p>7
<i>Returns</i>:
Let <code><h- data-h=id>i</h-></code> be an iterator such that <math display=inline><mi>E</mi></math>(<code><h- data-h=sym_op>*</h-><h- data-h=id>j</h-></code>) is
<code><h- data-h=bool>true</h-></code> for every iterator <code><h- data-h=id>j</h-></code> in [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>i</h-></code>) and
<code><h- data-h=bool>false</h-></code> for every iterator <code><h- data-h=id>j</h-></code> in [<code><h- data-h=id>i</h-></code>, <code><h- data-h=id>last</h-></code>).
Returns:
</p><ul>
<li><code><h- data-h=id>i</h-></code> for the overloads in namespace <code><h- data-h=id>std</h-></code>.</li>
<li><code><h- data-h=sym_brac>{</h-><h- data-h=id>i</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>last</h-><h- data-h=sym_brac>}</h-></code> for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>8
<i>Complexity</i>:
Let <math display=inline><mi>N</mi></math> = <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code>:
</p><ul>
<li>
  For the overload with no <code><h- data-h=id>ExecutionPolicy</h-></code>,
  exactly <math display=inline><mi>N</mi></math> applications of the predicate and projection.
  At most <math display=inline><mrow><mi>N</mi><mo>/</mo><mn>2</mn></mrow></math> swaps if the type of <code><h- data-h=id>first</h-></code> meets
  the <i>Cpp17BidirectionalIterator</i> requirements
  for the overloads in namespace <code><h- data-h=id>std</h-></code> or
  models <code><h- data-h=id>bidirectional_iterator</h-></code>
  for the overloads in namespace <code><h- data-h=id>ranges</h-></code>,
  and at most <math display=inline><mi>N</mi></math> swaps otherwise.</li>
<li>
  For the overload with an <code><h- data-h=id>ExecutionPolicy</h-></code>,
  𝒪(<math display=inline><mrow><mi>N</mi><mo>log</mo><mi>N</mi></mrow></math>) swaps and 𝒪(<math display=inline><mi>N</mi></math>) applications of the predicate.</li>
</ul>
</div>

<p>[…]
</p>

<code-block class=borderless><h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>InputIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>OutputIterator2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>OutputIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>OutputIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>partition_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>InputIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>InputIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>OutputIterator1</h-> <h- data-h=id>out_true</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>OutputIterator2</h-> <h- data-h=id>out_false</h-><h- data-h=sym_punc>,</h->
                   <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=kw>class</h-> <h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_punc>,</h-> <h- data-h=kw>class</h-> <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins><h- data-h=sym_op>&gt;</h->
  <h- data-h=id>pair</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>ForwardIterator1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>partition_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>ExecutionPolicy</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>exec</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>ForwardIterator</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h->
                   <h- data-h=id>ForwardIterator1</h-> <h- data-h=id>out_true</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>ForwardIterator2</h-> <h- data-h=id>out_false</h-><h- data-h=sym_punc>,</h->
                   <del><h- data-h=id>Predicate</h-></del> <ins><h- data-h=id>UnaryTest</h-></ins> <h- data-h=id>pred</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->

<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_iterator</h-> <h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>sentinel_for</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=id>S</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>I</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>I</h-> <h- data-h=id>first</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>S</h-> <h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-> <h- data-h=id>out_true</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-> <h- data-h=id>out_false</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h->
                           <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h->
<h- data-h=kw>template</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>input_range</h-> <h- data-h=id>R</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>weakly_incrementable</h-> <h- data-h=id>O2</h-><h- data-h=sym_punc>,</h->
         <h- data-h=kw>class</h-> <h- data-h=id>Proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=id>identity</h-><h- data-h=sym_punc>,</h->
         <del><h- data-h=id>indirect_unary_predicate</h-></del> <ins><i><h- data-h=id>indirect-unary-test</h-></i></ins><h- data-h=sym_op>&lt;</h-><h- data-h=id>projected</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-><h- data-h=sym_op>&gt;&gt;</h-> <h- data-h=id>Pred</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>requires</h-> <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-><h- data-h=sym_op>&gt;</h-> <h- data-h=sym_op>&amp;&amp;</h->
           <h- data-h=id>indirectly_copyable</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-><h- data-h=sym_op>&gt;</h->
  <h- data-h=kw>constexpr</h-> <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition_copy_result</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id_type>borrowed_iterator_t</h-><h- data-h=sym_op>&lt;</h-><h- data-h=id>R</h-><h- data-h=sym_op>&gt;</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-><h- data-h=sym_op>&gt;</h->
    <h- data-h=id>ranges</h-><h- data-h=sym_op>::</h-><h- data-h=id>partition_copy</h-><h- data-h=sym_par>(</h-><h- data-h=id>R</h-><h- data-h=sym_op>&amp;&amp;</h-> <h- data-h=id>r</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O1</h-> <h- data-h=id>out_true</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>O2</h-> <h- data-h=id>out_false</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Pred</h-> <h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>Proj</h-> <h- data-h=id>proj</h-> <h- data-h=sym_op>=</h-> <h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-><h- data-h=sym_par>)</h-><h- data-h=sym_punc>;</h-></code-block>
<div class=indent>
<p>14
Let <code><h- data-h=id>proj</h-></code> be <code><h- data-h=id>identity</h-><h- data-h=sym_brac>{</h-><h- data-h=sym_brac>}</h-></code>
for the overloads with no parameter named <code><h- data-h=id>proj</h-></code> and
let <math display=inline><mi>E</mi></math>(<math display=inline><mi>x</mi></math>) be <code><h- data-h=kw_type>bool</h-><h- data-h=sym_par>(</h-><h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>pred</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>invoke</h-><h- data-h=sym_par>(</h-><h- data-h=id>proj</h-><h- data-h=sym_punc>,</h-> <math display=inline><mi>x</mi></math><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-><h- data-h=sym_par>)</h-></code>.
</p>
<p>15
<i>Mandates</i>:
For the overloads in namespace <code><h- data-h=id>std</h-></code>,
the expression <code><h- data-h=sym_op>*</h-><h- data-h=id>first</h-></code>
is writable (<a href=https://eel%2eis/c++draft/iterator%2erequirements%2egeneral>[iterator.requirements.general]</a>)
to <code><h- data-h=id>out_true</h-></code> and <code><h- data-h=id>out_false</h-></code>.
</p>
<p>16
<i>Preconditions</i>:
The input range and output ranges do not overlap.
<br/><wg21-block>[<i>Note</i>: 
For the overload with an <code><h- data-h=id>ExecutionPolicy</h-></code>,
there might be a performance cost if <code><h- data-h=id>first</h-></code>'s value type
does not meet the <i>Cpp17CopyConstructible</i> requirements.
 — <i>end note</i>]</wg21-block></p>

<p>17
<i>Effects</i>:
For each iterator <code><h- data-h=id>i</h-></code> in [<code><h- data-h=id>first</h-></code>, <code><h- data-h=id>last</h-></code>),
copies <code><h- data-h=sym_op>*</h-><h- data-h=id>i</h-></code> to the output range beginning with <code><h- data-h=id>out_true</h-></code>
if <math display=inline><mi>E</mi></math>(<code><h- data-h=sym_op>*</h-><h- data-h=id>i</h-></code>) is <code><h- data-h=bool>true</h-></code>, or
to the output range beginning with <code><h- data-h=id>out_false</h-></code> otherwise.
</p>
<p>18
<i>Returns</i>:
Let <code><h- data-h=id>o1</h-></code> be the end of the output range beginning at <code><h- data-h=id>out_true</h-></code>,
and <code><h- data-h=id>o2</h-></code> the end of the output range beginning at <code><h- data-h=id>out_false</h-></code>.
Returns
</p><ul>
<li><code><h- data-h=sym_brac>{</h-><h- data-h=id>o1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>o2</h-><h- data-h=sym_brac>}</h-></code> for the overloads in namespace <code><h- data-h=id>std</h-></code>.</li>
<li><code><h- data-h=sym_brac>{</h-><h- data-h=id>last</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>o1</h-><h- data-h=sym_punc>,</h-> <h- data-h=id>o2</h-><h- data-h=sym_brac>}</h-></code> for the overloads in namespace <code><h- data-h=id>ranges</h-></code>.</li>
</ul>

<p>19
<i>Complexity</i>:
Exactly <code><h- data-h=id>last</h-> <h- data-h=sym_op>-</h-> <h- data-h=id>first</h-></code> applications of <code><h- data-h=id>pred</h-></code> and <code><h- data-h=id>proj</h-></code>.
</p></div>
</diff-block>

<h2 id=references><a class=para href=#references></a>8. References</h2>



<div class=bib><div id=bib-item-N5008 class=bib-item>
<a href="https://wg21%2elink/n5008">[N5008]</a>
<span class=bib-author>Thomas Köppe.</span>
<span class=bib-title>Working Draft, Programming Languages — C++</span>
<span class=bib-date>2025-03-15</span>
<a href="https://www%2eopen-std%2eorg/jtc1/sc22/wg21/docs/papers/2025/n5008%2epdf" class=bib-link>https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/n5008.pdf</a></div></div>
</main></body>
</html>
