test_bimap_lambda.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Boost.Bimap
  2. //
  3. // Copyright (c) 2006-2007 Matias Capeletto
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. // VC++ 8.0 warns on usage of certain Standard Library and API functions that
  9. // can be cause buffer overruns or other possible security issues if misused.
  10. // See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
  11. // But the wording of the warning is misleading and unsettling, there are no
  12. // portable alternative functions, and VC++ 8.0's own libraries use the
  13. // functions in question. So turn off the warnings.
  14. #define _CRT_SECURE_NO_DEPRECATE
  15. #define _SCL_SECURE_NO_DEPRECATE
  16. #include <boost/config.hpp>
  17. // Boost.Test
  18. #include <boost/test/minimal.hpp>
  19. // Boost.Bimap
  20. #include <boost/bimap/support/lambda.hpp>
  21. #include <boost/bimap/bimap.hpp>
  22. void test_bimap_lambda()
  23. {
  24. using namespace boost::bimaps;
  25. typedef bimap<int,double> bm;
  26. bm b;
  27. b.insert( bm::value_type(1,0.1) );
  28. BOOST_CHECK( b.size() == 1 );
  29. BOOST_CHECK( b.left.modify_key ( b.left.begin(), _key = 2 ) );
  30. BOOST_CHECK( b.left.modify_data( b.left.begin(), _data = 0.2 ) );
  31. BOOST_CHECK( b.left.range( _key >= 1, _key < 3 ).first == b.left.begin() );
  32. }
  33. int test_main( int, char* [] )
  34. {
  35. test_bimap_lambda();
  36. return 0;
  37. }