无法理解功能性短缺

时间:2018-02-20 04:11:14

标签: c++ iterator

我是C ++的新手。我正在阅读Bjarne Stroustrup撰写的C ++编程语言。

我的问题是:

  1. 以下代码片段中的operator ++和operator *是什么?
  2. 它们只是功能名称吗?
  3. 另一个问题是,为什么在以下声明中没有Node* end(lst) struct Node { Node* next; int data; }; Node* operator++(Node* p) { return p−>next; } int operator*(Node* p) { return p−>data; } Node* end(lst) { return nullptr; } void test(Node* lst) { int s = sum<int*>(lst,end(lst)); } <?php $keyword1 = $_POST["keyword1"]; // Warning! SQL Injection Security Issue! $keyword2 = $_POST["keyword2"]; // Warning! SQL Injection Security Issue! $keyword3 = $_POST["keyword3"]; // Warning! SQL Injection Security Issue! $keyword4 = $_POST["keyword4"]; // Warning! SQL Injection Security Issue! $keyword5 = $_POST["keyword5"]; // Warning! SQL Injection Security Issue! $keyword6 = $_POST["keyword6"]; // Warning! SQL Injection Security Issue! $keyword7 = $_POST["keyword7"]; // Warning! SQL Injection Security Issue! $keyword8 = $_POST["keyword8"]; // Warning! SQL Injection Security Issue! $where = NULL; if( $keyword1 != NULL ) { $where .= "and hospital='$keyword1'"; } if( $keyword2 != NULL ) { $where .= "and room='$keyword2'"; } if( $keyword3 != NULL ) { $where .= "and equipmentNAME='$keyword3'"; } if( $keyword4 != NULL ) { $where .= "and supplier='$keyword4'"; } if( $keyword5 != NULL ) { $where .= "and brand='$keyword5'"; } if( $keyword6 != NULL ) { $where .= "and quantity='$keyword6'"; } if( $keyword7 != NULL ) { $where .= "and yearpurchased='$keyword7'"; } if( $keyword8 != NULL ) { $where .= "and nxtyrPlan='$keyword8'"; } $sql =" SELECT * FROM equipmentTable WHERE 1=1 $where"; ?> 相关联:

    import boto3
    
    ecs_client = boto3.client('ecs') 
    logger = logging.getLogger()
    
    def lambda_handler(event, context):
        response = ecs_client.run_task(
            cluster='your-cluster',
            taskDefinition='your-task-name',
            count=1,
            launchType='EC2', # or fargate
        )
    
        logger.info(response)
    
        response = {
            "isBase64Encoded": "false",
            "statusCode": 200,
            "headers": { "COntent-Type": "application/json"},
            "body": "hello"     
        }
    
        return response
    

1 个答案:

答案 0 :(得分:2)

  • operator++operator*是重载运算符,它们只是特殊功能。当您实现自定义数据类型并决定支持增量(++)和取消引用(*)操作时,它们会派上用场。在发布这些微不足道的问题之前,cppreference应该是一个值得寻找的好地方。

  • 问题的第二部分 - 您发布的内容会产生编译错误,实际签名应为Node* end(Node* lst)。我不确定你从哪里得到它,也许作者不关心lst的类型(假设从上下文推断),因为列表标记的末尾由null表示(约定) )。