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

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 72', 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ả | Usage Tuples live in namespace tuples which in turn is inside namespace boost. Include boost tuple to use the library. The relational operators are defined in the header boost tuple . Input and output of tuples are defined in boost tuple . A few of the key tuple components tie and make_tuple are also available directly in namespace boost. In this section we ll cover how tuples are used in some typical scenarios and how it is possible to extend the functionality of the library to best fit our purposes. We ll start with the construction of tuples and gradually move on to topics that include the details of how tuples can be utilized. Constructing Tuples The construction of a tuple involves declaring the types and optionally providing a list of initial values of compatible types. 1 1 The constructor arguments do not have to be of the exact type specified for the elements when specializing the tuple so long as they are implicitly convertible to those types. boost tuple int double std string triple 42 My first tuple The template parameters to the class template tuple specify the element types. The preceding example shows the creation of a tuple with three types an int a double and a std string. Providing three parameters to the constructor initializes the values of all three elements. It s also possible to pass fewer arguments than there are elements which results in the remaining elements being default initialized. boost tuple short int long another In this example another has elements of types short int and long and they are all initialized to 0. 2 Regardless of the set of types for your tuples this is how they are defined and constructed. So if one of your tuple s element types is not default constructible you need to initialize it yourself. Compared to defining structs tuples are much simpler to declare define and use. There s also the convenience function make_tuple which makes creating tuples easier still. It deduces

Đã 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.