Changeset 2282
- Timestamp:
- Jun 26, 2010, 3:38:17 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/iterator_test.cc
r2277 r2282 66 66 67 67 void test_data_iterator(test::Suite& suite); 68 void test_weight_iterator(test::Suite& suite); 68 69 void test_iterator_traits(test::Suite& suite); 69 70 void test_stride_iterator(test::Suite& suite); … … 87 88 test_weighted_iterator(suite); 88 89 test_data_iterator(suite); 90 test_weight_iterator(suite); 89 91 return suite.return_value(); 90 92 } … … 311 313 data_iterator(forward_it)); 312 314 313 #ifdef YAT_TICKET_633 314 input_iterator_archetype<utility::DataWeight> input_it_w; 315 boost::input_iterator_archetype_no_proxy<utility::DataWeight> input_it_w; 315 316 mutable_forward_iterator_archetype<utility::DataWeight> forward_it_w; 316 317 std::copy(data_iterator(input_it_w), 317 318 data_iterator(input_it_w), 318 319 data_iterator(forward_it_w)); 319 #endif 320 321 } 322 323 324 void test_weight_iterator(test::Suite& suite) 325 { 326 // do not run compile test 327 return; 328 329 using utility::WeightIterator; 330 using boost::input_iterator_archetype; 331 input_iterator_archetype<double> input_it; 332 using boost::mutable_forward_iterator_archetype; 333 334 // we are using weighted here because unweighted WeightIterator is 335 // always const (not mutable) 336 mutable_forward_iterator_archetype<utility::DataWeight> forward_it_w; 337 338 using utility::weight_iterator; 339 std::copy(weight_iterator(input_it), 340 weight_iterator(input_it), 341 weight_iterator(forward_it_w)); 342 343 boost::input_iterator_archetype_no_proxy<utility::DataWeight> input_it_w; 344 std::copy(weight_iterator(input_it_w), 345 weight_iterator(input_it_w), 346 weight_iterator(forward_it_w)); 320 347 } 321 348 … … 347 374 w = traits2.weight(&dwp); 348 375 delete trivial_iter; 376 377 // do not run compile test 378 return; 379 using utility::DataWeight; 380 using utility::iterator_traits; 381 // iterator_traits does not work with a proxy that lacks member 382 // function data() so we test with no_proxy archetype instead. 383 typedef boost::input_iterator_archetype_no_proxy<DataWeight> input; 384 utility::iterator_traits<input> traits3; 385 w = traits3.weight(input()); 386 typedef boost::output_iterator_archetype<DataWeight> output; 387 utility::iterator_traits<output> traits4; 388 w = traits4.weight(boost::detail::dummy_constructor()); 349 389 } 350 390 -
trunk/yat/utility/DataIterator.h
r2202 r2282 26 26 #include "iterator_traits.h" 27 27 28 #include <boost/concept_check.hpp> 28 29 #include <boost/iterator/iterator_adaptor.hpp> 29 30 #include <boost/type_traits/remove_reference.hpp> … … 54 55 55 56 \endcode 57 58 Type Requirement: \c BASE must be an \input_iterator 56 59 */ 57 60 template<typename Base> … … 71 74 */ 72 75 explicit DataIterator(Base b) 73 : DataIterator::iterator_adaptor_(b) {} 76 : DataIterator::iterator_adaptor_(b) 77 { 78 BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>)); 79 } 74 80 75 81 /** … … 79 85 */ 80 86 DataIterator(void) 81 : DataIterator::iterator_adaptor_() {} 87 : DataIterator::iterator_adaptor_() 88 { 89 BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>)); 90 } 82 91 83 92 /** -
trunk/yat/utility/WeightIterator.h
r2202 r2282 24 24 */ 25 25 26 #include "iterator_traits.h" 27 28 #include <boost/concept_check.hpp> 26 29 #include <boost/iterator/iterator_adaptor.hpp> 27 30 #include <boost/type_traits/remove_reference.hpp> … … 52 55 53 56 \endcode 57 58 Type Requirement: \c BASE must be an \input_iterator 54 59 */ 55 60 template<typename Base> … … 71 76 */ 72 77 WeightIterator(void) 73 : WeightIterator::iterator_adaptor_() {} 78 : WeightIterator::iterator_adaptor_() 79 { 80 BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>)); 81 } 74 82 75 83 /** … … 77 85 */ 78 86 explicit WeightIterator(Base b) 79 : WeightIterator::iterator_adaptor_(b) {} 87 : WeightIterator::iterator_adaptor_(b) 88 { 89 BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>)); 90 } 80 91 81 92 /**
Note: See TracChangeset
for help on using the changeset viewer.