TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 87

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 87', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | if_then_else_return which calls the conditional operator. Let s take a closer look at the whole range of control structures starting with i f and switch. Remember that to use if-constructs boost lambda must be included. For switch boost lambda switch. hpp must be included. The following examples all assume that the declarations in the namespace boost lambda have been brought to the current scope through using declarations or a using directive. if_then _1 5 std cout constant Less than 5 make_const 3 The i f_then function starts with a condition followed by a then-part in the preceding code if the argument passed to the lambda function is less than 5 _1 5 Less than 5 is printed to std cout. You ll note that when we invoke this lambda expression with the numeric value 3 we cannot pass it directly like so. if_then _1 5 std cout constant Less than 5 3 This would result in a compiler error because 3 is an int and an rvalue of type int or any built-in type for that matter cannot be const qualified. Thus one has to use the utility make_const here which does nothing more than return a reference to const of its argument. Another option is to wrap the whole lambda expression in a call to const_parameters like so const_parameters if_then _1 5 std cout constant Less than 5 3 const_parameters is useful to avoid having to wrap each of several arguments with make_const. Note that when using this function all of the parameters to the lambda expression are considered references to const. Now look at how i f_then looks using the alternative syntax. if_ _1 5 std cout constant Less than 5 make_const 3 This notation has a greater resemblance to the C keyword but it does exactly the same thing as i f_then. The function i f_ note the trailing underscore is followed by the parenthesized condition which in turn is followed by the then- statement. Again choosing between these syntax alternatives is simply a matter of taste. Now let s take a look at the if-then-else constructs they re

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.