169 static int const values[] = {1, 2, 3, 4};
170 std::vector<int> v(values, values + (
sizeof(values) /
sizeof(*values)));
172 std::vector<int>::iterator
const it = container_find(v, 2);
174 std::vector<int>
const& v_ref = v;
175 std::vector<int>::const_iterator
const it_const = container_find(v_ref, 2);
176 printf(
"it %s it_const\n", (*it == *it_const) ?
"==" :
"!=");
Solution to Exercise 4-0.
Solution to Exercise 4-1.
Solution to Exercise 4-2.
Solution to Exercise 4-3.
Solution to Exercise 4-4.
Solution to Exercise 4-5.
static void test_exercise_4_5()
Tests for Exercise 4-5.
Encapsulate solution for Exercise 4-1.
Encapsulate solution for Exercise 4-2.
Encapsulate solution for Exercise 4-3.
Encapsulate solution for Exercise 4-4.
Encapsulate solution for Exercise 4-5.
Tests functionality from Exercise 4-1.
BOOST_STATIC_ASSERT((logical_or< undefined_false< true >, undefined_false< false > >::value))
Tests functionality from Exercise 4-2.
BOOST_STATIC_ASSERT((logical_or5< undefined_false< true >, undefined_false< false > >::value))
Tests functionality from Exercise 4-3.
formula< mpl::int_< 9 >, mpl::int_< 2 > > shouldBe7
formula< mpl::int_< 3 >, mpl::int_< 4 > > shouldBe3
next_if< mpl::int_< 1 >, mpl::greater< mpl::int_< 3 >, _1 > > shouldBe2
BOOST_STATIC_ASSERT((shouldBe1::value==1))
next_if< mpl::int_< 1 >, mpl::greater< mpl::int_< 0 >, _1 > > shouldBe1
formula< mpl::int_< 2 >, mpl::int_< 2 > > shouldBe6
Tests functionality from Exercise 4-4.
BOOST_STATIC_ASSERT((is_data_member_pointer< int *(test_class::*)>::value))
If the template parameter is false, template instantiation is an error.
If the template parameter is true, template instantiation is an error.
Short-circuit logical OR evaluation of two boolean values.
Short-circuit logical OR evaluation of two boolean values.
Short-circuit logical OR evaluation for up to five boolean values.
Fix algorithm 1 in Exercise 4-3:
Returns true if T is a pointer, but not a member function pointer.
Returns true if T is a pointer to a (non-member) function type.
Returns true if T is a reference to a pointer to a (non-member) function!
Returns true if T is a reference type to a constant type.