For each of the following errors, write a simple test case containing the error, and try to compile it. In the error messages, look for the key words that relate to the error in the code.
Attempting aggregate initialization of an array object with more initializers than the number of elements it holds
Attempting default construction of an array object holding elements whose type does not have a default constructor
Attempting aggregate initialization with a type that cannot be converted to the type of elements the array type holds
Attempting copy construction from an array object of a different type
Attempting to call get with an index value that is out of bounds
Write a struct named elt that holds a value of type unsigned char but doesn't initialize it. Create an object of type std::tr1::array<elt, 6> with no initializer, and show the stored values. Now write a new struct, elt1, that holds a value of type unsigned char and has a default constructor that sets the stored value to 1. Create an object of type std::tr1::array <elt1, 6> with no initializer, and show the stored values.
Repeat the preceding exercise, but when you create each array object, use an aggregate initializer that initializes some but not all of the stored objects. (You'll have to add another constructor to elt1. It should take a value of type unsigned char and copy it to the stored value.)
Create an object of type array<int, 6> that initially holds all 0s. Change all its stored values to 1. Create an object of type array<int, 6> that initially holds all 1s. Change all its stored values to 0.
Create two objects of type array<int, 6>. The first one should contain the values 1 through 6 in ascending order. The second one should contain the value 1, 2, 3, 3, 9000, and 9001, in that order. Which of the two is less than the other? Write a test program to verify your answer.
Repeat Exercise 5 from Chapter 1 with array instances instead of tuple instances.